Attitude Angle

The X Sense HAT calculates the attitude angle of the current position so that we can know whether the X Sense HAT horizontal or not.

TIPS

You can read the attitude angle of X Sense HAT through this block, modify the drop-down menu options, and then choose to read roll angle or pitch angle.

_images/tip48.png

EXAMPLE

_images/example10.png

Using help

This is the coordinate system of the attitude angle.

_images/tip56.jpg

Note

Note the positive direction on each axis.

The unit symbol of the attitude angle also follows the right-hand spiral rule.

Hold the x-axis with your right hand and the thumb points in the direction of the positive semi-axis. At this time, the direction pointed by the four fingers is the positive direction of the roll angle.

In the same way, hold the y-axis with your right hand and the thumb points in the direction of the positive semi-axis. At this time, the direction pointed by the four fingers is the positive direction of the pitch angle.

_images/tip57.jpg

After the code runs, and then place the X Sense HAT horizontally, 0 will be printed on the Debug Monitor.

If you rotate the X Sense HAT 30 degrees clockwise around the x-axis, 30 will be printed on the Debug Monitor.

_images/tip70.jpg

Now change the drop-down menu to pitch, and then re-run the code.

_images/tip74.png

Rotate the X Sense HAT 30 degrees counterclockwise around the y-axis, -30 will be printed on the Debug Monitor.

_images/tip69.jpg