PyNAO is the main Python extension module of PyRIDE on Aldebaran NAO robot. More...
Public Member Functions | |
| moveHeadTo (head_yaw, head_pitch, relative, frac_speed) | |
| Move the NAO head to a specific yaw and pitch position. This new position could be either absolute head position or a relative position w.r.t the current head position. More... | |
| sit (is_relax) | |
| Move the robot into a sitting pose. More... | |
| stand (is_init) | |
| Move the robot into a standing pose. More... | |
| lyingDown (is_bellyup) | |
| Move the robot into a lying down pose. More... | |
| crouch () | |
| Move the robot into a crouch pose. More... | |
| getHeadPos () | |
| Get the current robot head yaw and pitch in radian. More... | |
| setHeadStiffness (stiffness) | |
| Set the stiffness of the NAO head. More... | |
| setBodyStiffness (stiffness) | |
| Set the stiffness of the NAO body. More... | |
| setArmStiffness (left_arm, stiffness) | |
| Set the stiffness of a NAO' arm. More... | |
| setLegStiffness (left_leg, stiffness) | |
| Set the stiffness of a NAO' leg. More... | |
| moveArmWithJointTrajectory (joint_trajectory, is_blocking) | |
| Move a NAO arm to a sequence of joint positions, i.e. trajectory. More... | |
| moveArmWithJointPos (joint_position, frac_max_speed, is_blocking) | |
| Move a NAO's arm to the specified joint position with a certain speed. More... | |
| moveLegWithJointPos (joint_position, frac_max_speed) | |
| Move a NAO's leg to the specified joint position with a certain speed. More... | |
| moveBodyWithJointPos (joint_position, frac_max_speed) | |
| Move the NAO body joints to the specified joint position within a time frame. More... | |
| moveBodyWithRawTrajectoryData (joint_trajectory_data) | |
| Move the NAO body joints in specified trajectories. More... | |
| getArmJointPositions (left_arm) | |
| Get the current joint positions of one of the NAO arm. More... | |
| getLegJointPositions (left_leg) | |
| Get the current joint positions of one of the NAO left. More... | |
| getBodyJointPositions (use_sensor_data) | |
| Get the current joint positions of NAO body joints. More... | |
| moveBodyTo (x, y, theta, cancel_previous_move, is_blocking) | |
| Move the NAO body to a pose at (x,y,theta). More... | |
| openHand (which_hand, keep_stiffness) | |
| Opens one or both NAO hands. More... | |
| closeHand (which_hand, keep_stiffness) | |
| Closes one or both NAO hands. More... | |
| setHandPosition (which_hand, hand_joint_ratio, keep_stiffness) | |
| open one of NAO hands to the specified ratio [0..1.0]. More... | |
| setTeamMemberID (member_id, team_id) | |
| Sets the ID number of the robot. More... | |
| say (text) | |
| Use Text-to-Speech system to say the input text. More... | |
| sendTeamMessage (message) | |
| Broadcast a message to other robots in the same team (colour). More... | |
Remote Client Access Functions | |
| onRemoteCommand (cmd_id, cmd_text) | |
| Callback function when a custom command is received from a remote client. More... | |
| onUserLogOn (user_name) | |
| Callback function when a user logs in through a remote client. More... | |
| onUserLogOff (user_name) | |
| Callback function when a remote user logs off. More... | |
| disconnect (username) | |
| Disconnect all remote clients. More... | |
| blockRemoteExclusiveControl (toblock) | |
| Block or unblock exclusive control of connected remote clients. More... | |
| updateOperationalStatus (op_state, op_text) | |
| Send robot operational status notification to all connected remote clients. More... | |
Timer Management Functions | |
| onTimer (timer_id) | |
| Callback function when a timer object (created by PyNAO.addTimer) is fired. More... | |
| onTimerLapsed (timer_id) | |
| Callback function when a timer object (created by PyNAO.addTimer) is fired for the last time. More... | |
| addTimer (init_start, repeats, interval) | |
| Add a timer object. More... | |
| removeTimer (timer_id) | |
| Remove a timer object. More... | |
| isTimerRunning (timer_id) | |
| Check whether a timer object is still alive. More... | |
| removeAllTimers () | |
| Remove all timer objects in the system. More... | |
Miscellaneous Functions | |
| onPeerMessage (sender_id, message) | |
| Callback function when a team message is received from a team member (calling PyNAO.sendTeamMessage). More... | |
| setChestLED (colour) | |
| Set NAO's chest LED to a colour. More... | |
| pulseChestLED (colour_one, colour_two, period) | |
| Periodically switch NAO's chest LED between the two input colours. More... | |
| getBatteryStatus () | |
| Return the current robot battery status. More... | |
| takeCameraSnapshot (all_camera) | |
| Take a snapshot for the robot camera(s) More... | |
| getMyIPAddress () | |
| Get the IP address of the robot. More... | |
| onSnapshotImage (image_name) | |
| Callback function when PyNAO.takeCameraSnapshot is called. More... | |
Event Callback Functions | |
| onBumperPressed (side) | |
| Callback function when one of NAO's bumpers is pressed. More... | |
| onHeadTactileTouched (side) | |
| Callback function when one of NAO's head tactile sensor is touched. More... | |
| onRightHandTouched (side, status) | |
| Callback function when one of NAO's right hand tactile sensor is touched. More... | |
| onLeftHandTouched (side, status) | |
| Callback function when one of NAO's left hand tactile sensor is touched. More... | |
| onChestButtonPressed (presses) | |
| Callback function when the chest button is pressed. More... | |
| onPowerPluggedChange (is_plugged) | |
| Callback function when NAO change between battery power or main power. More... | |
| onBatteryChargeChange (bat_percent, is_discharging) | |
| Callback function when the NAO battery status has changed. More... | |
| onSystemShutdown () | |
| Callback function when the NAO is shutting down. More... | |
Audio Management Functions | |
| loadAudioFile (file_name) | |
| Load an audio file into the robot system. More... | |
| unloadAudioFile (audio_id) | |
| Unload an audio from the robot system (free memory). More... | |
| unloadAllAudioFile () | |
| Unload all audio from the robot system. More... | |
| playAudioID (audio_id) | |
| Play a loaded audio file. More... | |
| getAudioVolume () | |
| Get the current master audio volume. More... | |
| setAudioVolume (volume) | |
| Set the master audio volume. More... | |
| pauseAudioID (audio_id) | |
| Pause a playing audio. More... | |
| stopAllAudio () | |
| Stop playing all audio files. More... | |
Remote Client User Management Functions | |
| listCurrentUsers () | |
| Return a list of users who are currently logged in through remote clients. More... | |
| listAllUsers () | |
| Return a list of users who can log in remotely. More... | |
| saveConfiguration () | |
| Save the current user access configuration. More... | |
| addUser (user_name, user_password) | |
| Add a new remote user into the system. More... | |
| removeUser (user_name) | |
| Remove an existing remote user from the system. More... | |
| changeUserPassword (user_name, old_password, new_password) | |
| Change an existing remote user's password. More... | |
PyNAO is the main Python extension module of PyRIDE on Aldebaran NAO robot.
PyNAO module consists of a set of callable Python methods specifically related to NAO low level functionalities and a set of callback functions that should be implemented by NAO programmers.
| addTimer | ( | init_start | , |
| repeats | , | ||
| interval | |||
| ) |
Add a timer object.
| float | init_start. Initial start time (in seconds, precision to 10th of a second) after the method is called. |
| long | repeats. A number of times the timer shall be called. -1 means infinite. |
| float | interval. Time interval (in seconds, precision to 10th of a second) between timer callbacks. |
| addUser | ( | user_name | , |
| user_password | |||
| ) |
Add a new remote user into the system.
| str | user_name. |
| str | user_password. |
| blockRemoteExclusiveControl | ( | toblock | ) |
Block or unblock exclusive control of connected remote clients.
Allow or block the exclusive control right of remote clients. If a client has already taken the exclusive control, the control right will be revoked when the input is set to True.
| bool | toblock. True for block; False for unblock. |
| changeUserPassword | ( | user_name | , |
| old_password | , | ||
| new_password | |||
| ) |
Change an existing remote user's password.
| str | user_name name. |
| str | old_password. |
| str | new_password. |
| closeHand | ( | which_hand | , |
| keep_stiffness | |||
| ) |
Closes one or both NAO hands.
| int | which_hand. 1 = left hand, 2 = right hand and 3 = both hands. |
| bool | keep_stiffness. Optional, keep stiffness on after closing the hand (default False). |
| crouch | ( | ) |
Move the robot into a crouch pose.
| disconnect | ( | username | ) |
Disconnect all remote clients.
| str | username. Optional name of an online user to be disconnected. If no username is provided. All connected clients will be disconnected. |
| getArmJointPositions | ( | left_arm | ) |
Get the current joint positions of one of the NAO arm.
| bool | left_arm. True for left arm; False for right arm. |
| getAudioVolume | ( | ) |
Get the current master audio volume.
| getBatteryStatus | ( | ) |
Return the current robot battery status.
| getBodyJointPositions | ( | use_sensor_data | ) |
Get the current joint positions of NAO body joints.
| bool | use_sensor_data. True = using sensor reading; False = not using sensor. |
| getHeadPos | ( | ) |
Get the current robot head yaw and pitch in radian.
| getLegJointPositions | ( | left_leg | ) |
Get the current joint positions of one of the NAO left.
| bool | left_leg. True for left leg; False for right leg. |
| getMyIPAddress | ( | ) |
Get the IP address of the robot.
| isTimerRunning | ( | timer_id | ) |
Check whether a timer object is still alive.
| long | timer_id. ID of the timer object. |
| listAllUsers | ( | ) |
Return a list of users who can log in remotely.
| listCurrentUsers | ( | ) |
Return a list of users who are currently logged in through remote clients.
| loadAudioFile | ( | file_name | ) |
Load an audio file into the robot system.
| str | file_name. Audio file path. Must be a full path. |
| lyingDown | ( | is_bellyup | ) |
Move the robot into a lying down pose.
| bool | is_bellyup. Optional. True = belly up; False = belly down. |
| moveArmWithJointPos | ( | joint_position | , |
| frac_max_speed | , | ||
| is_blocking | |||
| ) |
Move a NAO's arm to the specified joint position with a certain speed.
| dict | joint_position. A dictionary of arm joint positions in radian. The dictionary must the same structure as the return of PyNAO.getArmJointPositions. |
| float | frac_max_speed. Fraction of the maximum motor speed. |
| bool | is_blocking. Optional. True = blocking call; False = unblocking call (Default False). |
| moveArmWithJointTrajectory | ( | joint_trajectory | , |
| is_blocking | |||
| ) |
Move a NAO arm to a sequence of joint positions, i.e. trajectory.
| list | joint_trajectory. A list of joint position dictionaries with the same structure of the PyNAO.moveArmWithJointPos. |
| bool | is_blocking. Optional. True = blocking call; False = unblocking call (Default False). |
| moveBodyTo | ( | x | , |
| y | , | ||
| theta | , | ||
| cancel_previous_move | , | ||
| is_blocking | |||
| ) |
Move the NAO body to a pose at (x,y,theta).
| float | x. X coordinate w.r.t. the current pose. |
| float | y. Y coordinate w.r.t. the current pose. |
| float | theta. Angular position w.r.t. the current pose. |
| bool | cancel_previous_move. Optional cancel previous move command if it is still executing (default False). |
| bool | is_blocking. Optional. True = blocking call; False = unblocking call (Default False). |
| moveBodyWithJointPos | ( | joint_position | , |
| frac_max_speed | |||
| ) |
Move the NAO body joints to the specified joint position within a time frame.
| dict | joint_position. A dictionary of body joint positions in radian. The dictionary must the same structure as the return of PyNAO.getBodyJointPositions. |
| float | frac_max_speed. Fraction of the maximum motor speed. |
| moveBodyWithRawTrajectoryData | ( | joint_trajectory_data | ) |
Move the NAO body joints in specified trajectories.
| dict | joint_trajectory_data. A dictionary of {joints, keyframes, timestamps, is_blocking} where joints is a list of joint names that are factory defined, keyframes is a list of corresponding joint values (trajectory) for each joint specified in joints; timestamps is a list of corresponding time to reach values for the keyframes for each joint specified in joints; is_blocking is a boolean for whether the call is blocking. |
| moveHeadTo | ( | head_yaw | , |
| head_pitch | , | ||
| relative | , | ||
| frac_speed | |||
| ) |
Move the NAO head to a specific yaw and pitch position. This new position could be either absolute head position or a relative position w.r.t the current head position.
| float | head_yaw. Must be in radian. |
| float | head_pitch. Must be in radian. |
| bool | relative. True == relative angle values; False == absolute angle values. Optional, default is False. |
| float | frac_speed. Fraction of the maximum speed, i.e. within (0..1] Optional, default = 0.05. |
| moveLegWithJointPos | ( | joint_position | , |
| frac_max_speed | |||
| ) |
Move a NAO's leg to the specified joint position with a certain speed.
| dict | joint_position. A dictionary of leg joint positions in radian. The dictionary must the same structure as the return of PyNAO.getLegJointPositions. |
| float | frac_max_speed. Fraction of the maximum motor speed. |
| onBatteryChargeChange | ( | bat_percent | , |
| is_discharging | |||
| ) |
Callback function when the NAO battery status has changed.
| int | bat_percent. The remaining battery percentage within [0..100]. |
| bool | is_discharging. True == the battery is discharging, False == the batter is charging. |
| onBumperPressed | ( | side | ) |
Callback function when one of NAO's bumpers is pressed.
| str | side: side = "right" for the right bumper or "left" for the left bumper. |
| onChestButtonPressed | ( | presses | ) |
Callback function when the chest button is pressed.
| int | presses. Number of presses occurred. |
| onHeadTactileTouched | ( | side | ) |
Callback function when one of NAO's head tactile sensor is touched.
| str | side: side = "front" for the front tactile, "middle" for the middle tactile and "rear" from the back tactile. |
| onLeftHandTouched | ( | side | , |
| status | |||
| ) |
Callback function when one of NAO's left hand tactile sensor is touched.
| str | side. side = "back" for the back tactile, "right" for the right tactile and "left" from the left tactile. |
| str | status. status = "on" for touch on or "off" for touch off. |
| onPeerMessage | ( | sender_id | , |
| message | |||
| ) |
Callback function when a team message is received from a team member (calling PyNAO.sendTeamMessage).
| int | sender_id. The ID of the team member who sends the message. |
| str | message. Text of the message. |
| onPowerPluggedChange | ( | is_plugged | ) |
Callback function when NAO change between battery power or main power.
| bool | is_plugged. True == plugged into main, False == on battery power. |
| onRemoteCommand | ( | cmd_id | , |
| cmd_text | |||
| ) |
Callback function when a custom command is received from a remote client.
| int | cmd_id. Custom command ID. |
| str | cmd_text. Custom command text string. |
| onRightHandTouched | ( | side | , |
| status | |||
| ) |
Callback function when one of NAO's right hand tactile sensor is touched.
| str | side. side = "back" for the back tactile, "right" for the right tactile and "left" from the left tactile. |
| bool | status. True == touch on, False == touch off. |
| onSnapshotImage | ( | image_name | ) |
Callback function when PyNAO.takeCameraSnapshot is called.
| str | image_name. Path for the saved image. |
| onSystemShutdown | ( | ) |
Callback function when the NAO is shutting down.
| onTimer | ( | timer_id | ) |
Callback function when a timer object (created by PyNAO.addTimer) is fired.
| int | timer_id. ID of the timer object. |
| onTimerLapsed | ( | timer_id | ) |
Callback function when a timer object (created by PyNAO.addTimer) is fired for the last time.
| int | timer_id. ID of the timer object. |
| onUserLogOff | ( | user_name | ) |
Callback function when a remote user logs off.
| str | user_name. The name of the user. |
| onUserLogOn | ( | user_name | ) |
Callback function when a user logs in through a remote client.
| str | user_name. The name of the user. |
| openHand | ( | which_hand | , |
| keep_stiffness | |||
| ) |
Opens one or both NAO hands.
| int | which_hand. 1 = left hand, 2 = right hand and 3 = both hand. |
| bool | keep_stiffness. Optional, keep stiffness on after opening the hand (default False). |
| pauseAudioID | ( | audio_id | ) |
Pause a playing audio.
| int | audio_id. Audo file ID. |
| playAudioID | ( | audio_id | ) |
Play a loaded audio file.
| int | audio_id. Loaded audio file ID. |
| pulseChestLED | ( | colour_one | , |
| colour_two | , | ||
| period | |||
| ) |
Periodically switch NAO's chest LED between the two input colours.
| str | colour_one. Colour label one. |
| str | colour_one. Colour label two. |
| int | period. Time (in seconds) before switching LED colour. |
| removeAllTimers | ( | ) |
Remove all timer objects in the system.
| removeTimer | ( | timer_id | ) |
Remove a timer object.
| long | timer_id. ID of the timer object pending for removal. |
| removeUser | ( | user_name | ) |
Remove an existing remote user from the system.
| str | user_name name. |
| saveConfiguration | ( | ) |
Save the current user access configuration.
| say | ( | text | ) |
Use Text-to-Speech system to say the input text.
| str | text. Text to be spoken by the robot. |
| sendTeamMessage | ( | message | ) |
Broadcast a message to other robots in the same team (colour).
| str | message. A text based message. |
| setArmStiffness | ( | left_arm | , |
| stiffness | |||
| ) |
Set the stiffness of a NAO' arm.
| bool | left_arm. True for left arm; False for right arm. |
| float | stiffness. Must be between [0.0,1.0]. |
| setAudioVolume | ( | volume | ) |
Set the master audio volume.
| int | volume. Must be between [0,100] |
| setBodyStiffness | ( | stiffness | ) |
Set the stiffness of the NAO body.
| float | stiffness. Must be between [0.0,1.0]. |
| setChestLED | ( | colour | ) |
Set NAO's chest LED to a colour.
| str | colour. Colour must be 'red','green', 'blue', 'white', 'blank', 'yellow' or 'pink'. |
| setHandPosition | ( | which_hand | , |
| hand_joint_ratio | , | ||
| keep_stiffness | |||
| ) |
open one of NAO hands to the specified ratio [0..1.0].
| int | which_hand. 1 = left hand, 2 = right hand and 3 = both hands. |
| float | hand_joint_ratio. Hand opening ratio [0..1.0]. |
| bool | keep_stiffness. Optional, keep stiffness on after closing the hand (default False). |
| setHeadStiffness | ( | stiffness | ) |
Set the stiffness of the NAO head.
| float | stiffness. Must be between [0.0,1.0]. |
| setLegStiffness | ( | left_leg | , |
| stiffness | |||
| ) |
Set the stiffness of a NAO' leg.
| bool | left_leg. True for left leg; False for right leg. |
| float | stiffness. Must be between [0.0,1.0]. |
| setTeamMemberID | ( | member_id | , |
| team_id | |||
| ) |
Sets the ID number of the robot.
The robot can be assigned as a member of blue team (number 1) or pink team (number 2). This facilitates robot to robot communication.
| int | member_id. Must be a non-negative integer. |
| int | team_id. Must be either 1 (blue team) or 2 (pink team). |
| sit | ( | is_relax | ) |
Move the robot into a sitting pose.
| bool | is_relax. Optional. True = Relaxed sitting pose (stiffness is off); False = Non-relaxed sitting pose. |
| stand | ( | is_init | ) |
Move the robot into a standing pose.
| bool | is_init. Optional. True = A standing pose ready for walk; False = Default standing pose. |
| stopAllAudio | ( | ) |
Stop playing all audio files.
| takeCameraSnapshot | ( | all_camera | ) |
Take a snapshot for the robot camera(s)
| bool | all_camera. Take a snapshot from all available cameras. |
| unloadAllAudioFile | ( | ) |
Unload all audio from the robot system.
| unloadAudioFile | ( | audio_id | ) |
Unload an audio from the robot system (free memory).
| int | audio_id. Loaded audio file ID. |
| updateOperationalStatus | ( | op_state | , |
| op_text | |||
| ) |
Send robot operational status notification to all connected remote clients.
| int | op_state. Must be a positive integer representing the operational status. |
| str | op_text. Optional text for the operational status. |
1.8.6