Skip to content

[Bug] Possible sign error in beta_alt Taylor expansion for Quaternion overload of log6 #2948

Description

@BeichenZhuo

🐞 Bug

[Bug] Possible sign error in beta_alt Taylor expansion for Quaternion overload of log6

Description

I believe I have identified a potential sign error in the Taylor series expansion used for the beta coefficient in the SE(3) logarithmic map, specifically in the small-angle branch of the log6_impl::run function.

Mathematical Background

The beta coefficient in the SE(3) inverse left Jacobian is defined as:

$$ \beta(\theta) = \frac{1}{\theta^2} - \frac{1}{2\theta}\cot\left(\frac{\theta}{2}\right) $$

Its Taylor expansion around (\theta = 0) is:

$$ \beta(\theta) = \frac{1}{12} + \frac{\theta^2}{720} + \frac{\theta^4}{30240} + \mathcal{O}(\theta^6) $$

Suspected Issue Location

In the run function (file: include/pinocchio/src/spatial/log.hxx ) , the small-angle approximation is computed as:

    const Scalar th_2_squared = t2 / Scalar(4); // (theta / 2) squared
    const Scalar beta_alt = (Scalar(1) / Scalar(3) - th_2_squared / Scalar(45)) / Scalar(4);

Since t2 = θ², we have th_2_squared = θ²/4. Substituting:

$$ \beta_{\text{alt}} = \frac{1}{4}\left(\frac{1}{3} - \frac{\theta^2/4}{45}\right) = \frac{1}{12} - \frac{\theta^2}{720} $$

This yields:

$$ \beta_{\text{alt}} = \frac{1}{12} - \frac{\theta^2}{720} $$

However, the correct mathematical expansion is:

$$ \beta(\theta) = \frac{1}{12} + \frac{\theta^2}{720} + \cdots $$

The sign of the (\theta^2) term appears to be inverted (negative instead of positive).

Suggested Fix

If confirmed, the fix would be to change the sign in beta_alt:

// Current (suspect):
const Scalar beta_alt = (Scalar(1) / Scalar(3) - th_2_squared / Scalar(45)) / Scalar(4);

// Proposed:
const Scalar beta_alt = (Scalar(1) / Scalar(3) + th_2_squared / Scalar(45)) / Scalar(4);

This would yield:

$$ \beta_{\text{alt}} = \frac{1}{12} + \frac{\theta^2}{720} $$

which matches the mathematical expansion.


Thank you for considering this report.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions