🐞 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.
🐞 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
betacoefficient in the SE(3) logarithmic map, specifically in the small-angle branch of thelog6_impl::runfunction.Mathematical Background
The
betacoefficient in the SE(3) inverse left Jacobian is defined as:Its Taylor expansion around (\theta = 0) is:
Suspected Issue Location
In the
runfunction (file:include/pinocchio/src/spatial/log.hxx) , the small-angle approximation is computed as:Since
t2 = θ², we haveth_2_squared = θ²/4. Substituting:This yields:
However, the correct mathematical expansion is:
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:This would yield:
which matches the mathematical expansion.
Thank you for considering this report.