The robot has a built-in IMU, which continuously outputs its own posture to the host PC via the cradle at a constant cycle (approx. 60 Hz) during operation.
The IMU is the TDK InvenSense ICM-20948, which is equipped with 9-axis inertial sensors (3-axis acceleration, 3-axis angular velocity, 3-axis magnetism) and a DMP (Digital Motion Processor) that performs attitude calculation by sensor fusion of this sensor information.
<aside> <img src="/icons/folder_gray.svg" alt="/icons/folder_gray.svg" width="40px" /> ICM-20948 Datasheet
</aside>
Fig. 6-1-1 ICM-20948
Fig. 6-1-2 Axis placement of the IMU on the robot.
Fig. 6-1-2 shows the axis arrangement of the IMU on the robot; the coordinate system of the IMU is based on the right-hand system, and the robot follows it.
The DMP outputs a quaternion $\boldsymbol{q}$, updated sequentially at each control cycle. The robot converts this quaternion $\boldsymbol{q}$ into the Euler angle $\boldsymbol{\theta} (\theta_x,\theta_y,\theta_z)$ by the built-in MCU and sends it to the host PC.
The conversion process to Euler angles is calculated in rotation order: X(Roll)→Y(Pitch)→Z(Yaw)
. If $\boldsymbol{q}=q_w+q_xi+q_yj+q_zk$ is the output quaternion of DMP, the calculation is as follows. (Note that $\theta_y \neq \frac{\pi}{2},\frac{3\pi}{2}$, i.e. $\cos\theta_y=0$, is assumed not to be taken, and the conversion calculation process is omitted in case separation)
$$ \theta_x\ = \arctan(-\cfrac{2q_yq_z-2q_xq_w}{2q_w^2+2q_y^2-1}) $$
$$ \theta_y\ =\arcsin(2q_xq_z+2q_yq_w) $$
$$ \theta_z\ = \arctan(-\cfrac{2q_xq_y-2q_zq_w}{2q_w^2+2q_x^2-1}) $$