Robot Dancing
Built-in Actions in OriginMan
Through the previous examples, everyone has experienced OriginMan's athletic abilities. In fact, OriginMan comes with dozens of built-in actions that everyone can quickly utilize.
Action List and Implementation Methods
Action Name | Description |
---|---|
stand | Stand at attention |
go_forward | Move forward |
back_fast | Move backward |
left_move_fast | Move left |
right_move_fast | Move right |
push_ups | Push-ups |
sit_ups | Sit-ups |
turn_left | Turn left |
turn_right | Turn right |
wave | Wave |
bow | Bow |
squat | Squat |
chest | Celebrate |
left_shot_fast | Left kick |
right_shot_fast | Right kick |
wing_chun | Wing Chun |
left_uppercut | Left uppercut |
right_uppercut | Right uppercut |
left_kick | Left side kick |
right_kick | Right side kick |
stand_up_front | Stand up from front fall |
stand_up_back | Stand up from back fall |
twist | Twist waist |
stand_slow | Stand at attention |
stepping | Stepping in place |
jugong | Bow |
weightlifting | Weightlifting |
With so many actions available, how can we make OriginMan perform them for us?
Let's run the following command for a quick demonstration:
After running this, you'll see OriginMan perform a bowing action. How is this implemented and how can we switch to other actions?
#!/usr/bin/env python3
# encoding:utf-8
import time
import hiwonder.ActionGroupControl
class RobotActionController:
def __init__(self):
pass
def run_action_group(self, action_group_name, wait_time=5):
"""
Run a specified action group
:param action_group_name: Action group file name (without .dfca extension)
:param wait_time: Wait time after executing the action group (seconds), default 5 seconds
"""
try:
hiwonder.ActionGroupControl.runActionGroup(action_group_name)
# Wait according to the expected execution time of the action group
print(f"Executing action group: {action_group_name}")
time.sleep(wait_time) # Wait for action group to complete
except Exception as e:
print(f"Error executing action group {action_group_name}: {e}")
if __name__ == "__main__":
controller = RobotActionController()
# First execute 'stand' action group
controller.run_action_group("stand")
# Then execute 'bow' action group
controller.run_action_group("bow")
As you can see from this code, you only need to call the controller.run_action_group method. By replacing the action name in the parentheses, you can experience many of OriginMan's actions!
Let's Dance with the Robot!
You might notice that these are just single actions. Is it possible to string these actions together to perform a dance?
Let's run the following command:
Now you'll see OriginMan start dancing! Come and play with OriginMan!
Attention
OriginMan's action groups are built into /userdata/dev_ws/src/originman/driver/ActionGroups, where numbers 16-24 are dance actions. Try them out!