Skip to main content

get_orientation()

Description#

Uses the acceleration values to find Zumi's orientation with respect to the strongest force being applied to Zumi (gravity).

Syntax#

get_orientation()

Parameters#

None

Returns#

Integer denoting orientation state.

Orientation state
-1 = unknown
0 = probably falling or moving between states
1 = camera straight up
2 = camera facing down
3 = on right side
4 = on left side
5 = wheels on floor
6 = wheels facing up (upside down)
7 = accelerating faster than 1g

Example Code#
Python#
#Python code
from zumi.zumi import Zumi
import time
zumi = Zumi()
#grab zumi and place it on any side
#example: upside down, on its nose etc.
for i in range(20):
orientation = zumi.get_orientation()
print(orientation)
time.sleep(0.5)
print(" done ")