pyzenbo.modules.motion module¶
- class pyzenbo.modules.motion.Motion(inter_comm)¶
Bases:
object
- move_body(relative_x=0, relative_y=0, relative_theta_degree=0, speed_level=0, sync=True, timeout=None)¶
Move body to a new location and turn head to a new angle relative to original pose with specified speed level.
- Parameters
relative_x – relative distance (in meters) in x-axis direction, positive value would go forward
relative_y – relative distance (in meters) in y-axis direction, positive value would go right
relative_theta_degree – relative rotational angle (in degree)
speed_level – speed level from 1 to 6, 1 is slowest, and 6 is fastest
sync – True if this command is blocking
timeout – maximum blocking time in second, None means infinity
- Returns
serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code
- move_head(yaw_degree=0, pitch_degree=0, speed_level=1, sync=True, timeout=None)¶
Ask robot to turn its head, use SpeedLevel.Head to control moving speed.
- Parameters
yaw_degree – the angle in degrees, the range is -45(left) to 45(right) In Zenbo junior is not effect
pitch_degree – the angle in degrees, the range is -15(down) to 55(up) In Zenbo junior the range is -10(down) to 50(up)
speed_level – speed level from 1 to 3, 1 is slowest, and 3 is fastest
sync – True if this command is blocking
timeout – maximum blocking time in second, None means infinity
- Returns
serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code
- stop_moving(sync=True, timeout=None)¶
Stop robot’s movement in motion subclass, including neck and body.
- Parameters
sync – True if this command is blocking
timeout – maximum blocking time in second, None means infinity
- Returns
serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code
- remote_control_body(direction, sync=True, timeout=None)¶
Control body to move until remoteControlBody(STOP) or stopMoving() command is received.
- Parameters
direction – STOP=0, FORWARD=1, BACKWARD=2, TURN_LEFT=3, TURN_RIGHT=4
sync – True if this command is blocking
timeout – maximum blocking time in second, None means infinity
- Returns
serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code
- remote_control_head(direction, sync=True, timeout=None)¶
Control head to move until remoteControlHead(STOP) or stopMoving() command is received. The limit of pitch is -15 ~ 55 degrees, and the limit of yaw is -45 ~ 45 degrees.
- Parameters
direction – STOP=0, UP=1, DOWN=2, LEFT=3, RIGHT=4
sync – True if this command is blocking
timeout – maximum blocking time in second, None means infinity
- Returns
serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code
- get_avoidance_status(sync=True, timeout=None)¶
Get the obstacle-avoidance status.
Result return by onResult callback, result bundle will have a String key is “RESULT”, if obstacle-avoidance is enable result string will be True.
- Parameters
sync – True if this command is blocking, defaults to True
timeout – maximum blocking time in second, None means infinity, defaults to None
- Returns
serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code
- set_avoidance_status(enable, sync=True, timeout=None)¶
Turn on/off the obstacle-avoidance.
- Parameters
enable – flag to enable/disable obstacle-avoidance
sync – True if this command is blocking
timeout – maximum blocking time in second, None means infinity
- Returns
serial number of the command, if command is blocking also return a dict, it include two key, ‘state’ indicate execute result and ‘error’ will contain error code