pyzenbo.modules.utility module

class pyzenbo.modules.utility.PlayAction

Bases: object

DEFAULT_1 = 0
DEFAULT_2 = 1
NOD_1 = 2
HEAD_UP_1 = 3
HEAD_UP_2 = 4
SHAKE_HEAD_1 = 5
HEAD_UP_3 = 6
HEAD_UP_4 = 7
HEAD_DOWN_1 = 8
HEAD_DOWN_2 = 9
HEAD_DOWN_3 = 10
SHAKE_HEAD_2 = 11
HEAD_DOWN_4 = 12
HEAD_UP_5 = 13
HEAD_DOWN_5 = 14
DANCE_B_1_LOOP = 15
HEAD_UP_7 = 16
MUSIC_1_LOOP = 17
TURN_LEFT_1 = 18
TURN_LEFT_2 = 19
SHAKE_HEAD_3 = 20
DANCE_S_1_LOOP = 21
BODY_TWIST_1 = 22
BODY_TWIST_2 = 23
DANCE_2_LOOP = 24
SHAKE_HEAD_4_LOOP = 25
HEAD_TWIST_1_LOOP = 26
DANCE_3_LOOP = 27
SHAKE_HEAD_5 = 28
SHAKE_HEAD_6 = 42
HEAD_DOWN_7 = 43
TURN_RIGHT_1 = 44
TURN_RIGHT_2 = 45
TURN_LEFT_REVERSE_1 = 46
TURN_RIGHT_REVERSE_1 = 47
TURN_LEFT_REVERSE_2 = 48
TURN_RIGHT_REVERSE_2 = 49
HEAD_UP_6 = 54
class pyzenbo.modules.utility.Utility(inter_comm)

Bases: object

play_action(number, sync=True, timeout=None)

Perform predefined actions by turning neck and wheels. Use PlayAction to set action number, naming with loop will be incessant replay. Use cancelCommandBySerial() or cancelCommandAll() to cancel action.

Parameters
  • number – number of predefined action

  • 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

play_emotional_action(face, play_action, sync=True, timeout=None)

Perform robot expression and predefined action. Use PlayAction to set action number, naming with loop will be incessant replay. Use cancelCommandBySerial() or cancelCommandAll() to cancel action.

Parameters
  • face – face expression ID

  • play_action – action ID

  • 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

look_at_user(doa, sync=True, timeout=None)

Ask robot to look at user in robot front.

Parameters
  • doa – direction of arrival

  • 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

find_person_nearby(sync=True, timeout=None)

Ask robot to find person nearby.

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

track_face(enable_preview, large_preview, sync=False, timeout=None)

Ask robot track the face. There are two “onResult” callback during trackFace processing: 1. “TRACK_FACE_START_FIND_USER” : plugin start to find user 2. “TRACK_FACE_FOUND_USER”: plugin has found user, will start to follow

Parameters
  • enable_preview – set True to enable camera preview window for debug

  • large_preview – set True to enable full screen preview, it works only when enablePreview is true

  • 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

follow_face(enable_preview, large_preview, sync=False, timeout=None)

Ask robot follow the face. There are two “onResult” callback during followFace processing: 1. “FOLLOW_FACE_START_FIND_USER”: plugin start to find user 2. “FOLLOW_FACE_FOUND_USER”: plugin has found user, will start to follow

Parameters
  • enable_preview – set True to enable camera preview window for debug

  • large_preview – set True to enable full screen preview,

  • 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

follow_object(sync=False, timeout=None)

Ask robot to follow object.

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

reset_to_default_setting(sync=True, timeout=None)

Reset to default setting, include voice trigger, touch only signal, pat on head action, daily dialogue mode, ask back action and always listen mode.

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