1

follow
🛠 Done

Alban Laflaquiere

Hi,

Unless I'm doing something wrong, it seems there's an error in the Euler angles returned by a `jacobi.Frame`

created from a quaternion.

Here is a minimal code to reproduce the error where the Euler angles are compared with the ones computed by scipy (scipy also agrees with the results of our own internal library):

```
import numpy as np
from scipy.spatial.transform import Rotation
import jacobi
for k in range(10):
q_xyzw = np.array([2 * np.random.rand() - 1, 2 * np.random.rand() - 1, 2 * np.random.rand() - 1, 2 * np.random.rand() - 1])
q_xyzw = q_xyzw / np.linalg.norm(q_xyzw)
print("")
print("jacobi euler: ", *[f"{e:+2.5f}" for e in jacobi.Frame.from_quaternion(0, 0, 0, q_xyzw[3], q_xyzw[0], q_xyzw[1], q_xyzw[2]).euler[3:]])
print(" scipy euler: ", *[f"{e:+2.5f}" for e in Rotation.from_quat(q_xyzw).as_euler("xyz")])
```

6 months ago

4 months ago

Hi Alban,

We're currently using the extrinsic Euler XYZ convention, which is available in scipy by uppercase

`as_euler("XYZ")`

.Moreover, Euler angles are not unique and we're using the solution which minimizes x with x >= 0. I'm not sure what scipy is doing exactly, but I can look into that later today to make sure that the solutions in the script are equal.

I'll add that to the docs. Do you have specific interest in using the intrinsic Euler representation?

Best,

Lars

0 6 months ago Reply

Thank you Lars, that makes sense. I hadn't noticed the difference of convention.

The intrinsic convention could indeed be useful as it is the default in ROS.

0 6 months ago Reply

Does your description also applie to Studio?

I tried entering the following end-effector orientation in Studio:

From the

`Jacobi.Frame`

it indeed looks like`x`

is minimized. But if I try to enter these values in Studio, the interface acts strangely (recomputing the angles under the hood, I'm guessing) whenever I type a digit in the`c`

input box, and the most sensible/stable values I can enter are`a=-3.1416, b=1.5705, c=0`

, where x is neither positive nor minimized (in absolute).1 6 months ago Reply

@Alban Laflaquiere: Yeah, we're going to refactor the rotation input in Studio, and also add quaternion input.

0 6 months ago Reply