< >
Home » OpenDuckMini快速入门教程 » OpenDuckMini快速入门教程-生成参考动作

OpenDuckMini快速入门教程-生成参考动作

文章说明

  • 本教程将引导你如何使用Open_Duck_reference_motion_generator模块,为OpenDuckMini机器人生成仿真或真实部署时使用的参考动作轨迹
  • 本教程只是简单介绍下操作步骤,更多详细内容请参阅源码 | 源码地址
  • 欢迎加入我们的openduckmini交流群,微信扫描右侧二维码立即进群交流

相关设备

示例图片

操作步骤

  • 生成动作数据前,可以交互式调试单组gait参数,实时查看动作效果
$ cd ~/open_duck_mini_ws/Open_Duck_reference_motion_generator
$ uv run open_duck_reference_motion_generator/gait_playground.py --duck open_duck_mini_v2
<frozen importlib._bootstrap>:241: RuntimeWarning: to-Python converter for std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > already registered; second conversion method ignored.
<frozen importlib._bootstrap>:241: RuntimeWarning: to-Python converter for std::vector<double, std::allocator<double> > already registered; second conversion method ignored.
<frozen importlib._bootstrap>:241: RuntimeWarning: to-Python converter for std::vector<int, std::allocator<int> > already registered; second conversion method ignored.
exit
gait_parameters {'dx': 0.1, 'dy': 0.0, 'dtheta': 0.0, 'duration': 8, 'hardware': True, 'double_support_ratio': 0.18, 'startend_double_support_ratio': 1.5, 'planned_timesteps': 48, 'replan_timesteps': 10, 'walk_com_height': 0.2, 'walk_foot_height': 0.04, 'walk_trunk_pitch': -3, 'walk_foot_rise_ratio': 0.2, 'single_support_duration': 0.17, 'single_support_timesteps': 10, 'foot_length': 0.06, 'feet_spacing': 0.16, 'zmp_margin': 0.0, 'foot_zmp_target_x': 0.0, 'foot_zmp_target_y': 0.0, 'walk_max_dtheta': 1.0, 'walk_max_dy': 0.1, 'walk_max_dx_forward': 0.08, 'walk_max_dx_backward': 0.03, 'joints': ['left_hip_yaw', 'left_hip_roll', 'left_hip_pitch', 'left_knee', 'left_ankle', 'neck_pitch', 'head_pitch', 'head_yaw', 'head_roll', 'left_antenna', 'right_antenna', 'right_hip_yaw', 'right_hip_roll', 'right_hip_pitch', 'right_knee', 'right_ankle'], 'joint_angles': {'head_pitch': 0, 'head_yaw': 0, 'neck_pitch': 0, 'head_roll': 0, 'left_antenna': 0, 'right_antenna': 0}}
WARNING: Robot has the following self collisions in neutral position:
  -trunk_assembly_17 collides with neck_pitch_assembly_0
  -trunk_assembly_18 collides with neck_pitch_assembly_1
  -trunk_assembly_19 collides with hip_roll_assembly_2_1
  -trunk_assembly_21 collides with hip_roll_assembly_1
  -hip_roll_assembly_2 collides with left_roll_to_pitch_assembly_0
  -hip_roll_assembly_3 collides with left_roll_to_pitch_assembly_0
  -left_roll_to_pitch_assembly_1 collides with knee_and_ankle_assembly_3
  -knee_and_ankle_assembly_4 collides with knee_and_ankle_assembly_2_2
  -knee_and_ankle_assembly_2_3 collides with foot_assembly_3
  -neck_pitch_assembly_2 collides with head_pitch_to_yaw_0
  -head_pitch_to_yaw_0 collides with neck_yaw_assembly_1
  -neck_yaw_assembly_0 collides with head_assembly_8
  -head_assembly_5 collides with left_antenna_holder_1
  -head_assembly_6 collides with right_antenna_holder_0
  -hip_roll_assembly_2_2 collides with right_roll_to_pitch_assembly_0
  -hip_roll_assembly_2_3 collides with right_roll_to_pitch_assembly_0
  -right_roll_to_pitch_assembly_1 collides with knee_and_ankle_assembly_3_2
  -knee_and_ankle_assembly_3_4 collides with knee_and_ankle_assembly_4_2
  -knee_and_ankle_assembly_4_3 collides with foot_assembly_2_3
WARNING: Can't find head frames in the model, camera_look_at won't work
Placing the robot in the initial position...
Initial position reached
{'left_hip_yaw': 0.04438826481975585, 'left_hip_roll': 0.09264428582776495, 'left_hip_pitch': -0.5101765988264804, 'left_knee': 0.971169258545654, 'left_ankle': -0.5143389426027873, 'neck_pitch': -2.2832492531393943e-05, 'head_pitch': -2.280251868308536e-05, 'head_yaw': 2.6727562906831063e-06, 'head_roll': 1.588982082649495e-06, 'left_antenna': 9.1816532704823e-08, 'right_antenna': -9.552319091751995e-08, 'right_hip_yaw': 0.03828704993079768, 'right_hip_roll': -0.021364386361746028, 'right_hip_pitch': 0.5903735221870561, 'right_knee': 1.1765627083998766, 'right_ankle': -0.6393166196320932}
## period: 0.40800000000000003
You can open the visualizer by visiting the following URL:
http://127.0.0.1:7000/static/
Viewer URL: http://127.0.0.1:7000/static/
gait generator waiting
 * Serving Flask app 'gait_playground'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
Press CTRL+C to quit
127.0.0.1 - - [21/Jun/2025 11:20:06] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [21/Jun/2025 11:20:07] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [21/Jun/2025 11:20:08] "GET /get HTTP/1.1" 200 -

请输入图片描述

更多其他参数配置,请参阅源码

  • 调整各项参数,就能直观观察单个参数对步态的影响
  • 通过gait_playground.py脚本反复调好的参数(如 dx、dtheta、walk_foot_height 等),可以拿来用于批量动作生成的脚本
  • 对应配置文件如下
$ ls ~/open_duck_mini_ws/Open_Duck_reference_motion_generator/open_duck_reference_motion_generator/robots/open_duck_mini_v2
assets          open_duck_mini_v2.urdf  placo_presets
auto_gait.json  placo_defaults.json
  • 批量生成动作轨迹
$ uv run scripts/auto_waddle.py -j8 --duck open_duck_mini_v2 --sweep --output_dir recordings/
============================
=== GENERATING 240 MOVES ===
============================
  • 参数说明
    • j? number of jobs. If j is not specified, will run sequentially. If j is specified without a number, your computer will crash :) (runs with all available cores). Use j4 for example
    • --duck selects the duck type
    • --sweep generates all combinations of motion within the ranges specified in Open_Duck_reference_motion_generator/open_duck_reference_motion_generator/robots//auto_gait.json
    • --num generates random motions
    • --output_dir self explanatory
  • 通常会在recordings/目录下生成多个.json文件,例如:recordings/2_0.0_-0.111_-1.111.json
  • 回放一个已经生成的动作序列
$ uv run scripts/replay_motion.py -f recordings/2_0.0_-0.111_-1.111.json

请输入图片描述

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: none