├── motion_action
├── launch
│ ├── AMENT_IGNORE
│ ├── test_as_manager.launch
│ └── test_as_manager.py
├── test
│ ├── AMENT_IGNORE
│ ├── controller_test.cpp
│ └── publisher_test.cpp
├── scripts
│ ├── AMENT_IGNORE
│ ├── statistics.py
│ └── motion_demo.py
├── motion_action
│ └── __init__.py
├── preset
│ ├── elec_skin.toml
│ ├── 121.toml
│ ├── 122.toml
│ ├── 123.toml
│ ├── 140.toml
│ ├── 141.toml
│ ├── 142.toml
│ ├── 143.toml
│ ├── 144.toml
│ ├── 145.toml
│ ├── 146.toml
│ ├── 147.toml
│ ├── 148.toml
│ ├── 149.toml
│ ├── 150.toml
│ ├── 151.toml
│ ├── 152.toml
│ ├── 153.toml
│ ├── 154.toml
│ ├── 155.toml
│ ├── 156.toml
│ ├── 157.toml
│ ├── 158.toml
│ ├── 159.toml
│ ├── 160.toml
│ ├── 161.toml
│ ├── 162.toml
│ ├── 163.toml
│ ├── 164.toml
│ ├── 165.toml
│ ├── 166.toml
│ ├── 167.toml
│ ├── 168.toml
│ ├── 169.toml
│ ├── 170.toml
│ ├── 171.toml
│ ├── 172.toml
│ ├── 173.toml
│ ├── 174.toml
│ ├── 175.toml
│ ├── 176.toml
│ ├── 177.toml
│ ├── 178.toml
│ ├── 179.toml
│ ├── 180.toml
│ ├── 181.toml
│ ├── 101.toml
│ ├── 102.toml
│ ├── 111.toml
│ ├── 124.toml
│ ├── 125.toml
│ ├── 126.toml
│ ├── 127.toml
│ ├── 128.toml
│ ├── 129.toml
│ ├── 137.toml
│ ├── 201.toml
│ ├── 301.toml
│ ├── 302.toml
│ ├── 303.toml
│ ├── 305.toml
│ ├── 130.toml
│ ├── 131.toml
│ ├── 132.toml
│ ├── 133.toml
│ ├── 134.toml
│ ├── 135.toml
│ ├── 136.toml
│ ├── 138.toml
│ ├── 202.toml
│ ├── 211.toml
│ ├── 212.toml
│ ├── 0.toml
│ ├── user_gait_400.toml
│ └── 400.toml
├── package.xml
├── CMakeLists.txt
└── include
│ └── motion_action
│ ├── motion_macros.hpp
│ └── motion_action.hpp
├── motion_bridge
├── test
│ ├── AMENT_IGNORE
│ ├── as_controller_file.cpp
│ └── as_controller.cpp
├── package.xml
├── include
│ └── motion_bridge
│ │ ├── file_bridge.hpp
│ │ ├── motor_bridge.hpp
│ │ ├── imu_bridge.hpp
│ │ ├── odom_out_publisher.hpp
│ │ └── elevation_bridge.hpp
├── src
│ ├── file_bridge.cpp
│ ├── motor_bridge.cpp
│ ├── imu_bridge.cpp
│ ├── odom_out_publisher.cpp
│ └── elevation_bridge.cpp
└── CMakeLists.txt
├── motion_utils
├── scripts
│ ├── AMENT_IGNORE
│ └── servo_delay_statistics.py
├── test
│ ├── AMENT_IGNORE
│ ├── distance_test.cpp
│ ├── duration_test.cpp
│ ├── edge_perception_test.cpp
│ ├── stair_perception_test.cpp
│ ├── edge_align.cpp
│ ├── stair_perception.cpp
│ ├── edge_perception.cpp
│ └── stair_align.cpp
├── config
│ ├── edge_align.toml
│ └── stair_align.toml
├── motion_utils
│ └── __init__.py
├── package.xml
├── launch
│ ├── stair_align_launch.py
│ └── tof_node_launch.py
├── include
│ └── motion_utils
│ │ ├── edge_align.hpp
│ │ ├── stair_align.hpp
│ │ ├── stair_perception.hpp
│ │ ├── edge_perception.hpp
│ │ └── motion_utils.hpp
├── CMakeLists.txt
└── src
│ └── motion_utils.cpp
├── motion_manager
├── test
│ └── gait_factory.toml
├── config
│ └── priority.toml
├── package.xml
├── src
│ └── main.cpp
├── CMakeLists.txt
└── include
│ └── motion_manager
│ └── motion_manager.hpp
├── .github
├── ISSUE_TEMPLATE
│ ├── custom.md
│ ├── feature_request.md
│ └── bug_report.md
└── workflows
│ └── workflow.yml
├── skin_manager
├── config
│ └── elec_skin.toml
├── package.xml
├── CMakeLists.txt
├── src
│ └── skin_manager.cpp
└── include
│ └── skin_manager
│ └── skin_manager.hpp
├── .gitignore
├── README.md
└── elec_skin
├── package.xml
├── toml_config
└── elec_skin.toml
├── CMakeLists.txt
├── include
└── elec_skin
│ ├── elec_skin_base.hpp
│ └── elec_skin.hpp
└── src
└── main.cpp
/motion_action/launch/AMENT_IGNORE:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/motion_action/test/AMENT_IGNORE:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/motion_bridge/test/AMENT_IGNORE:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/motion_utils/scripts/AMENT_IGNORE:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/motion_utils/test/AMENT_IGNORE:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/motion_action/scripts/AMENT_IGNORE:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/motion_action/motion_action/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/motion_manager/test/gait_factory.toml:
--------------------------------------------------------------------------------
1 | [gait.a]
2 | motion_id = 0
3 | description = "null"
4 | [gait.a.pre]
5 |
6 |
--------------------------------------------------------------------------------
/motion_manager/config/priority.toml:
--------------------------------------------------------------------------------
1 | App = 0 # App
2 | Audio = 1 # Audio
3 | Vis = 2 # Vis
4 | BluTele = 3 # BluTele
5 | Algo = 4 # Algo
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/custom.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Custom issue template
3 | about: Describe this issue template's purpose here.
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 |
11 |
--------------------------------------------------------------------------------
/skin_manager/config/elec_skin.toml:
--------------------------------------------------------------------------------
1 | default_color = 0 # 0 white, 1 black
2 | start_direction = 0 # 0 front, 1 back
3 | gradual_duration = 50 # milsecs
4 | defaul_duration = 2000 # milsecs
5 | enable = false
6 | align_contact = true
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # cache and binary files during ros build
2 | build/
3 | log/
4 | install/
5 |
6 | # files create by macOS
7 | *.DS_Store
8 |
9 | # vs code workspace
10 | .vscode/
11 |
12 | # swp files
13 | *.swp
14 |
15 | .github
16 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # cyberdog_motion
2 |
3 | *L91主控运动管理*
4 |
5 | ### 软件架构
6 |
7 | [设计文档](blob:https://xiaomi.f.mioffice.cn/29484161-1078-4de7-9dee-0ac4db7e3b0f)
8 |
9 | - motion_manager:运动管理单元,所有L91软件调用运动能力,均由该模块负责管理;
10 | - motion_action:运动指令单元,所有对运动的调用均经过该模块转发;
11 |
--------------------------------------------------------------------------------
/motion_action/preset/elec_skin.toml:
--------------------------------------------------------------------------------
1 | default_color = 0 # 0 white, 1 black
2 | start_direction = 0 # 0 front, 1 back
3 | gradual_duration = 50 # milsecs
4 | stand_gradual_duration_ = 3500 # milsecs
5 | twink_gradual_duration_ = 3500 # milsecs
6 | random_gradual_duration_ = 3500 # milsecs
--------------------------------------------------------------------------------
/motion_action/preset/121.toml:
--------------------------------------------------------------------------------
1 | # 后空翻
2 | cmd_type = 0
3 | vel_des = [0.1, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.0, 0.0]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/122.toml:
--------------------------------------------------------------------------------
1 | # 前空翻
2 | cmd_type = 0
3 | vel_des = [0.1, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.0, 0.0]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/123.toml:
--------------------------------------------------------------------------------
1 | # 作揖
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.0, 0.0]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/140.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/141.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/142.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/143.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/144.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/145.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/146.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/147.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/148.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/149.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/150.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/151.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/152.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/153.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/154.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/155.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/156.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/157.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/158.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/159.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/160.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/161.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/162.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/163.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/164.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/165.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/166.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/167.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/168.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/169.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/170.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/171.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/172.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/173.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/174.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/175.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/176.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/177.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/178.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/179.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/180.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/181.toml:
--------------------------------------------------------------------------------
1 | #
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/101.toml:
--------------------------------------------------------------------------------
1 | # 高阻尼趴下
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.0, 0.0]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/102.toml:
--------------------------------------------------------------------------------
1 | # 高阻尼趴下
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.0, 0.0]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/111.toml:
--------------------------------------------------------------------------------
1 | # 恢复站立
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.0, 0.0]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/124.toml:
--------------------------------------------------------------------------------
1 | # 向左打滚一圈
2 | cmd_type = 0
3 | vel_des = [0.1, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.0, 0.0]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/125.toml:
--------------------------------------------------------------------------------
1 | # 遛狗
2 | cmd_type = 0
3 | vel_des = [0.1, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.2]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.05, 0.05]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/126.toml:
--------------------------------------------------------------------------------
1 | # 跳上台阶
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/127.toml:
--------------------------------------------------------------------------------
1 | # 跳上台阶
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/128.toml:
--------------------------------------------------------------------------------
1 | # 跳上台阶
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/129.toml:
--------------------------------------------------------------------------------
1 | # 跳上台阶
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/137.toml:
--------------------------------------------------------------------------------
1 | # 跳下台阶
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/201.toml:
--------------------------------------------------------------------------------
1 | # 绝对量力控姿态
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.2]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.0, 0.0]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/301.toml:
--------------------------------------------------------------------------------
1 | # 前后跳
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.2]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.05, 0.05]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/302.toml:
--------------------------------------------------------------------------------
1 | # 四足小跳
2 | cmd_type = 0
3 | vel_des = [0.1, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.2]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.05, 0.05]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/303.toml:
--------------------------------------------------------------------------------
1 | # 自变频行走
2 | cmd_type = 0
3 | vel_des = [0.1, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.05, 0.05]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/305.toml:
--------------------------------------------------------------------------------
1 | # 快跑
2 | cmd_type = 0
3 | vel_des = [0.1, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.2]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.05, 0.05]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/130.toml:
--------------------------------------------------------------------------------
1 | # 3D跳跃左转90度
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/131.toml:
--------------------------------------------------------------------------------
1 | # 3D跳跃右转90度
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/132.toml:
--------------------------------------------------------------------------------
1 | # 3D跳跃前跳60cm
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/133.toml:
--------------------------------------------------------------------------------
1 | # 3D跳跃前跳30cm
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/134.toml:
--------------------------------------------------------------------------------
1 | # 3D跳跃左跳20cm
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/135.toml:
--------------------------------------------------------------------------------
1 | # 3D跳跃右跳20cm
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/136.toml:
--------------------------------------------------------------------------------
1 | # 3D跳跃向上30cm
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/138.toml:
--------------------------------------------------------------------------------
1 | # 向右侧躺下后恢复站立
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.00, 0.00]
10 | duration = 0
--------------------------------------------------------------------------------
/motion_action/preset/202.toml:
--------------------------------------------------------------------------------
1 | # 增量力控姿态
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.0, 0.0]
10 | duration = 2000
--------------------------------------------------------------------------------
/motion_action/preset/211.toml:
--------------------------------------------------------------------------------
1 | # 绝对量位控姿态
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.2]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.0, 0.0]
10 | duration = 1000
--------------------------------------------------------------------------------
/motion_action/preset/212.toml:
--------------------------------------------------------------------------------
1 | # 相对量位控姿态站立
2 | cmd_type = 0
3 | vel_des = [0.0, 0.0, 0.0]
4 | rpy_des = [0.0, 0.0, 0.0]
5 | pos_des = [0.0, 0.0, 0.0]
6 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
7 | ctrl_point = [0.0, 0.0, 0.0]
8 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
9 | step_height = [0.0, 0.0]
10 | duration = 1000
--------------------------------------------------------------------------------
/motion_action/preset/0.toml:
--------------------------------------------------------------------------------
1 | # OFF状态,即停状态
2 | motion_id = 0
3 | cmd_type = 0
4 | vel_des = [0.0, 0.0, 0.0]
5 | rpy_des = [0.0, 0.0, 0.0]
6 | pos_des = [0.0, 0.0, 0.0]
7 | acc_des = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
8 | ctrl_point = [0.0, 0.0, 0.0]
9 | foot_pose = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
10 | step_height = [0.0, 0.0]
11 | duration = 0
--------------------------------------------------------------------------------
/motion_utils/test/distance_test.cpp:
--------------------------------------------------------------------------------
1 | #include "motion_utils/motion_utils.hpp"
2 | #include "motion_action/motion_macros.hpp"
3 |
4 | int main(int argc, char** argv)
5 | {
6 | rclcpp::init(argc, argv);
7 | cyberdog::motion::MotionUtils& mu = cyberdog::motion::MotionUtils::GetMotionUtils();
8 | // mu.ExecuteWalkDuration(10000, 0.1, 0.2, 0.3);
9 | mu.ExecuteWalkDistance(1.0, 0.1, 0.0, 0.0);
10 | }
--------------------------------------------------------------------------------
/motion_utils/test/duration_test.cpp:
--------------------------------------------------------------------------------
1 | #include "motion_utils/motion_utils.hpp"
2 | #include "motion_action/motion_macros.hpp"
3 |
4 | int main(int argc, char** argv)
5 | {
6 | rclcpp::init(argc, argv);
7 | cyberdog::motion::MotionUtils& mu = cyberdog::motion::MotionUtils::GetMotionUtils();
8 | // mu.ExecuteWalkDuration(10000, 0.1, 0.2, 0.3);
9 | mu.ExecuteWalkDuration(2000, 0.1, 0.0, 0.0);
10 | }
--------------------------------------------------------------------------------
/motion_utils/config/edge_align.toml:
--------------------------------------------------------------------------------
1 | # Align
2 | vel_x = 0.1 # 线速度
3 | vel_omega = 0.25 # 角速度
4 | jump_after_align = false # 对齐边沿后是否执行跳跃动作
5 | auto_start = false # 是否自动启动
6 |
7 | # Perception
8 | radius = 0.055 # 离散点半径
9 | min_neighbors = 5 # 近邻点最小数量
10 | orientation_dead_zone = 2 # 角度调整时的死区
11 | orientation_correction = 0 # 角度调整时对两侧tof点数量的修正
12 | orientation_filter = false # 角度调整时两侧点的数量是否采用均值滤波
13 | filter_size = 10 # 均值滤波的步长
14 | blind_forward_threshold = 95 # 停止盲向行走时点数量的阈值
15 |
16 | threshold = 40 # 停止靠近边沿时点数量的阈值
17 | max_depth = 0.43
18 |
19 |
--------------------------------------------------------------------------------
/motion_action/launch/test_as_manager.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/motion_utils/motion_utils/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2023 Xiaomi Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/motion_utils/config/stair_align.toml:
--------------------------------------------------------------------------------
1 | # Align
2 | vel_x = 0.1 # 线速度
3 | vel_omega = 0.25 # 角速度
4 | jump_after_align = false # 对齐台阶后是否执行跳跃动作
5 | auto_start = false # 是否自动启动
6 | is_stair_mode = true
7 |
8 | # Perception
9 | radius = 0.04 # 离散点半径
10 | min_neighbors = 5 # 近邻点最小数量
11 | orientation_dead_zone = 2 # 角度调整时的死区
12 | orientation_correction = 0 # 角度调整时对两侧tof点数量的修正
13 | orientation_filter = false # 角度调整时两侧点的数量是否采用均值滤波
14 | filter_size = 10 # 均值滤波的步长
15 | blind_forward_threshold = 25 # 停止盲向行走时点数量的阈值
16 |
17 | [[approach_threshold]]
18 | z_range = [0.0, 0.10]
19 | threshold = 100 # 停止靠近台阶时点数量的阈值
20 |
21 | [[approach_threshold]]
22 | z_range = [0.10, 0.13]
23 | threshold = 80 # 停止靠近台阶时点数量的阈值
24 |
25 | [[approach_threshold]]
26 | z_range = [0.13, 0.5]
27 | threshold = 60 # 停止靠近台阶时点数量的阈值
28 |
--------------------------------------------------------------------------------
/elec_skin/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | elec_skin
5 | 0.0.0
6 | TODO: Package description
7 | liukai21
8 | TODO: License declaration
9 |
10 | ament_cmake
11 | rclcpp
12 | std_msgs
13 | toml
14 | ament_index_cpp
15 | cyberdog_common
16 | cyberdog_embed_protocol
17 |
18 | ament_lint_auto
19 | ament_lint_common
20 |
21 |
22 | ament_cmake
23 |
24 |
25 |
--------------------------------------------------------------------------------
/motion_action/preset/user_gait_400.toml:
--------------------------------------------------------------------------------
1 | [[section]]
2 | contact = [1, 1, 1, 1]
3 | duration = 8
4 |
5 | [[section]]
6 | contact = [0, 0, 1, 1]
7 | duration = 6
8 |
9 | [[section]]
10 | contact = [1, 1, 1, 1]
11 | duration = 8
12 |
13 | [[section]]
14 | contact = [0, 0, 1, 1]
15 | duration = 6
16 |
17 | [[section]]
18 | contact = [1, 1, 1, 1]
19 | duration = 8
20 |
21 | [[section]]
22 | contact = [0, 0, 1, 1]
23 | duration = 6
24 |
25 | [[section]]
26 | contact = [1, 1, 1, 1]
27 | duration = 8
28 |
29 | [[section]]
30 | contact = [0, 0, 1, 1]
31 | duration = 6
32 |
33 | [[section]]
34 | contact = [1, 1, 1, 1]
35 | duration = 8
36 |
37 | [[section]]
38 | contact = [0, 0, 1, 1]
39 | duration = 6
40 |
41 | [[section]]
42 | contact = [1, 1, 1, 1]
43 | duration = 8
44 |
45 | [[section]]
46 | contact = [0, 0, 1, 1]
47 | duration = 6
48 |
49 | [[section]]
50 | contact = [1, 1, 1, 1]
51 | duration = 8
52 |
--------------------------------------------------------------------------------
/skin_manager/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | skin_manager
5 | 0.0.0
6 | the elec_skin manager for other module
7 | lijian29
8 | TODO: License declaration
9 |
10 | ament_cmake
11 | rclcpp
12 | std_msgs
13 | toml
14 | protocol
15 | ament_index_cpp
16 | cyberdog_common
17 | builtin_interfaces
18 | elec_skin
19 |
20 |
21 | ament_lint_auto
22 | ament_lint_common
23 |
24 |
25 | ament_cmake
26 |
27 |
--------------------------------------------------------------------------------
/motion_action/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | motion_action
5 | 0.0.0
6 | TODO: Package description
7 | dukun
8 | TODO: License declaration
9 |
10 | ament_cmake
11 | ament_cmake_python
12 |
13 | rclcpp
14 | rclpy
15 | cyberdog_system
16 | cyberdog_common
17 | cyberdog_debug
18 | protocol
19 | skin_manager
20 |
21 | ament_lint_auto
22 | ament_lint_common
23 |
24 |
25 | ament_cmake
26 |
27 |
28 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
--------------------------------------------------------------------------------
/motion_manager/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | motion_manager
5 | 0.0.0
6 | TODO: Package description
7 | dukun
8 | Apache License, Version 2.0
9 |
10 | ament_cmake
11 |
12 | rclcpp
13 | cyberdog_system
14 | cyberdog_common
15 | cyberdog_debug
16 | manager_base
17 | motion_action
18 | protocol
19 | cyberdog_machine
20 | bes_transmit
21 |
22 | ament_lint_auto
23 | ament_lint_common
24 |
25 |
26 | ament_cmake
27 |
28 |
29 |
--------------------------------------------------------------------------------
/motion_utils/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | motion_utils
5 | 0.0.0
6 | TODO: Package description
7 | dukun
8 | TODO: License declaration
9 |
10 | ament_cmake
11 | ament_cmake_python
12 |
13 | rclcpp
14 | rclpy
15 | cyberdog_system
16 | cyberdog_common
17 | cyberdog_debug
18 | protocol
19 | nav_msgs
20 | motion_manager
21 |
22 | ament_lint_auto
23 | ament_lint_common
24 |
25 |
26 | ament_cmake
27 |
28 |
29 |
--------------------------------------------------------------------------------
/motion_bridge/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | motion_bridge
5 | 0.0.0
6 | TODO: Package description
7 | harvey
8 | TODO: License declaration
9 |
10 | ament_cmake
11 |
12 | rclcpp
13 | lcm
14 | cyberdog_common
15 | motion_action
16 | tf2_ros
17 | grid_map
18 | grid_map_core
19 | grid_map_ros
20 | nav2_msgs
21 | sensor_msgs
22 |
23 |
24 | ament_lint_auto
25 | ament_lint_common
26 |
27 |
28 | ament_cmake
29 |
30 |
31 |
--------------------------------------------------------------------------------
/elec_skin/toml_config/elec_skin.toml:
--------------------------------------------------------------------------------
1 | # Testing normal usage STD_CAN with std_frame
2 | protocol = "can"
3 | name = "elec_skin"
4 |
5 | can_interface = "can0"
6 | extended_frame = true
7 | canfd_enable = false
8 | timeout_us = 1234567
9 |
10 |
11 | [[cmd]]
12 | description = ""
13 | cmd_name = "model_on"
14 | can_id = "0x0e802f00"
15 | ctrl_len = 0
16 |
17 | [[cmd]]
18 | description = "body middle"
19 | cmd_name = "body_middle"
20 | can_id = "0x0e802000"
21 | ctrl_len = 0
22 |
23 | [[cmd]]
24 | description = "left back leg"
25 | cmd_name = "left_back_leg"
26 | can_id = "0x0e802100"
27 | ctrl_len = 0
28 |
29 | [[cmd]]
30 | description = ""
31 | cmd_name = "body_left"
32 | can_id = "0x0e802200"
33 | ctrl_len = 0
34 |
35 | [[cmd]]
36 | description = ""
37 | cmd_name = "left_front_leg"
38 | can_id = "0x0e802300"
39 | ctrl_len = 0
40 |
41 | [[cmd]]
42 | description = ""
43 | cmd_name = "front_chest"
44 | can_id = "0x0e802400"
45 | ctrl_len = 0
46 |
47 | [[cmd]]
48 | description = ""
49 | cmd_name = "right_front_leg"
50 | can_id = "0x0e802500"
51 | ctrl_len = 0
52 |
53 | [[cmd]]
54 | description = ""
55 | cmd_name = "body_right"
56 | can_id = "0x0e802600"
57 | ctrl_len = 0
58 |
59 | [[cmd]]
60 | description = ""
61 | cmd_name = "right_back_leg"
62 | can_id = "0x0e802700"
63 | ctrl_len = 0
--------------------------------------------------------------------------------
/motion_action/scripts/statistics.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | from protocol.msg import MotionServoCmd
4 | import rclpy
5 | import datetime
6 | from rclpy.node import Node
7 | from std_msgs.msg import Float32
8 |
9 | class ServoCmdSubscriber(Node):
10 |
11 | def __init__(self):
12 | super().__init__('servo_subscriber')
13 | self.last_timestamp = datetime.datetime.now().timestamp()
14 | self.subscription = self.create_subscription(
15 | MotionServoCmd,
16 | 'motion_servo_cmd',
17 | self.topic_callback,
18 | 10)
19 | self.publisher = self.create_publisher(Float32, "interval", 1)
20 |
21 | def topic_callback(self, msg):
22 | this_timestamp = datetime.datetime.now().timestamp()
23 | interval = this_timestamp - self.last_timestamp
24 | print(interval)
25 | interval_msg = Float32()
26 | interval_msg.data = interval
27 | self.publisher.publish(interval_msg)
28 | self.last_timestamp = this_timestamp
29 |
30 | def main(args=None):
31 | rclpy.init(args=args)
32 | servo_subscriber = ServoCmdSubscriber()
33 | rclpy.spin(servo_subscriber)
34 | servo_subscriber.destroy_node()
35 | rclpy.shutdown()
36 |
37 | if __name__ == '__main__':
38 | main()
39 |
--------------------------------------------------------------------------------
/motion_utils/scripts/servo_delay_statistics.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | from protocol.msg import MotionServoCmd
4 | import rclpy
5 | import datetime
6 | from rclpy.node import Node
7 | from std_msgs.msg import Float32
8 |
9 | class ServoCmdSubscriber(Node):
10 |
11 | def __init__(self):
12 | super().__init__('servo_subscriber')
13 | self.last_timestamp = datetime.datetime.now().timestamp()
14 | self.subscription = self.create_subscription(
15 | MotionServoCmd,
16 | 'motion_servo_cmd',
17 | self.topic_callback,
18 | 10)
19 | self.publisher = self.create_publisher(Float32, "interval", 1)
20 |
21 | def topic_callback(self, msg):
22 | this_timestamp = datetime.datetime.now().timestamp()
23 | interval = this_timestamp - self.last_timestamp
24 | print(interval)
25 | interval_msg = Float32()
26 | interval_msg.data = interval
27 | self.publisher.publish(interval_msg)
28 | self.last_timestamp = this_timestamp
29 |
30 | def main(args=None):
31 | rclpy.init(args=args)
32 | servo_subscriber = ServoCmdSubscriber()
33 | rclpy.spin(servo_subscriber)
34 | servo_subscriber.destroy_node()
35 | rclpy.shutdown()
36 |
37 | if __name__ == '__main__':
38 | main()
39 |
--------------------------------------------------------------------------------
/.github/workflows/workflow.yml:
--------------------------------------------------------------------------------
1 | name: GitHub Actions CI
2 | run-name: ${{ github.actor }} is run GitHub Actions 🚀
3 | on: [push]
4 | defaults:
5 | run:
6 | shell: bash
7 | jobs:
8 | build-job:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - name: Login to Docker Hub
12 | uses: docker/login-action@v2
13 | with:
14 | registry: ghcr.io
15 | username: ${{ github.actor }}
16 | password: ${{ secrets.GIT_TOKEN }}
17 | - name: Install dependence
18 | run: |
19 | sudo apt install -y qemu-user-static binfmt-support
20 | - name: Download code
21 | uses: actions/checkout@v3
22 | - name: Build and code test
23 | run: |
24 | docker pull ghcr.io/miroboticslab/cyberdog:v1
25 | docker run -i -v $GITHUB_WORKSPACE:/home/ros2/src ghcr.io/miroboticslab/cyberdog:v1 bash -c \
26 | "cd /home/ros2 && source /opt/ros2/galactic/setup.bash \
27 | && colcon build --packages-up-to motion_manager motion_action motion_bridge motion_utils elec_skin skin_manager \
28 | && colcon test --event-handlers console_cohesion+ --return-code-on-test-failure --packages-select motion_manager motion_action motion_bridge motion_utils elec_skin skin_manager"
29 | # colcon build test
30 |
--------------------------------------------------------------------------------
/motion_action/scripts/motion_demo.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # Copyright (c) 2023 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 | import motion_units
17 | import time
18 | motion_units.standup()
19 | time.sleep(2)
20 | motion_units.yaw(-0.35, 2000)
21 | time.sleep(2)
22 | motion_units.yaw(0.7, 4000)
23 | time.sleep(4)
24 | motion_units.yaw(-0.35,2000)
25 | time.sleep(2)
26 |
27 | motion_units.pitch(0.25, 2000)
28 | time.sleep(2)
29 | motion_units.pitch(-0.5, 4000)
30 | time.sleep(4)
31 | motion_units.pitch(0.25, 2000)
32 | time.sleep(2)
33 |
34 | motion_units.roll(0.3, 2000)
35 | time.sleep(2)
36 | motion_units.roll(-0.6, 4000)
37 | time.sleep(4)
38 | motion_units.roll(0.3, 2000)
39 | time.sleep(10)
40 | motion_units.getdown()
41 |
--------------------------------------------------------------------------------
/motion_manager/src/main.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | #include
15 | #include
16 | #include "cyberdog_common/cyberdog_log.hpp"
17 | #include "cyberdog_debug/backtrace.hpp"
18 | #include "motion_manager/motion_manager.hpp"
19 |
20 |
21 | int main(int argc, char ** argv)
22 | {
23 | LOGGER_MAIN_INSTANCE("MotionManager");
24 | cyberdog::debug::register_signal();
25 | rclcpp::init(argc, argv);
26 |
27 | auto motion_manager =
28 | std::make_shared(std::string("motion_manager"));
29 |
30 | if (!motion_manager->Init()) {
31 | ERROR("Init failed!");
32 | return -1;
33 | }
34 | motion_manager->Run();
35 | return 0;
36 | }
37 |
--------------------------------------------------------------------------------
/motion_manager/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.8)
2 | project(motion_manager)
3 |
4 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
5 | add_compile_options(-Wall -Wextra -Wpedantic -g)
6 | endif()
7 |
8 | # find dependencies
9 | find_package(ament_cmake REQUIRED)
10 | find_package(manager_base REQUIRED)
11 | find_package(cyberdog_common REQUIRED)
12 | find_package(cyberdog_system REQUIRED)
13 | find_package(protocol REQUIRED)
14 | find_package(motion_action REQUIRED)
15 | find_package(cyberdog_debug REQUIRED)
16 | find_package(cyberdog_machine REQUIRED)
17 | find_package(bes_transmit REQUIRED)
18 |
19 | include_directories(include)
20 |
21 | add_executable(${PROJECT_NAME}
22 | src/motion_handler.cpp
23 | src/motion_decision.cpp
24 | src/motion_manager.cpp
25 | src/main.cpp)
26 |
27 | ament_target_dependencies(${PROJECT_NAME}
28 | rclcpp
29 | protocol
30 | manager_base
31 | cyberdog_system
32 | cyberdog_common
33 | motion_action
34 | protocol
35 | bes_transmit
36 | )
37 |
38 | install(TARGETS
39 | ${PROJECT_NAME}
40 | DESTINATION lib/${PROJECT_NAME})
41 |
42 | install(DIRECTORY
43 | config
44 | DESTINATION share/${PROJECT_NAME})
45 |
46 | if(BUILD_TESTING)
47 | find_package(ament_lint_auto REQUIRED)
48 | ament_lint_auto_find_test_dependencies()
49 | endif()
50 |
51 | ament_package()
52 |
--------------------------------------------------------------------------------
/motion_utils/test/edge_perception_test.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | #include "motion_utils/edge_perception.hpp"
15 | #include
16 | int main(int argc, char** argv)
17 | {
18 | rclcpp::init(argc, argv);
19 | rclcpp::Node::SharedPtr node(new rclcpp::Node("edge_perception_test"));
20 | std::string toml_file = ament_index_cpp::get_package_share_directory("motion_utils") + "/config/edge_align.toml";
21 | toml::value config;
22 | if(!cyberdog::common::CyberdogToml::ParseFile(toml_file, config)) {
23 | FATAL("Cannot parse %s", toml_file.c_str());
24 | exit(-1);
25 | }
26 | cyberdog::motion::EdgePerception sp(node, config);
27 | rclcpp::spin(node);
28 | return 0;
29 | }
--------------------------------------------------------------------------------
/motion_utils/test/stair_perception_test.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | #include "motion_utils/stair_perception.hpp"
15 | #include
16 | int main(int argc, char** argv)
17 | {
18 | rclcpp::init(argc, argv);
19 | rclcpp::Node::SharedPtr node(new rclcpp::Node("stair_perception_test"));
20 | std::string toml_file = ament_index_cpp::get_package_share_directory("motion_utils") + "/config/stair_align.toml";
21 | toml::value config;
22 | if(!cyberdog::common::CyberdogToml::ParseFile(toml_file, config)) {
23 | FATAL("Cannot parse %s", toml_file.c_str());
24 | exit(-1);
25 | }
26 | cyberdog::motion::StairPerception sp(node, config);
27 | rclcpp::spin(node);
28 | return 0;
29 | }
--------------------------------------------------------------------------------
/motion_utils/launch/stair_align_launch.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2023 Xiaomi Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | import os
15 |
16 | from ament_index_python.packages import get_package_share_directory
17 |
18 | from launch import LaunchDescription
19 | from launch.actions import IncludeLaunchDescription
20 | from launch.launch_description_sources import PythonLaunchDescriptionSource
21 | from launch_ros.actions import Node
22 |
23 |
24 | def generate_launch_description():
25 | return LaunchDescription([
26 | IncludeLaunchDescription(
27 | PythonLaunchDescriptionSource([
28 | os.path.join(get_package_share_directory('motion_utils'), 'launch'),
29 | '/tof_node_launch.py'])
30 | ),
31 | Node(
32 | package='motion_utils',
33 | executable='stair_align'
34 | )
35 | ])
36 |
--------------------------------------------------------------------------------
/motion_bridge/include/motion_bridge/file_bridge.hpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | #ifndef MOTION_BRIDGE__FILE_BRIDGE_HPP_
15 | #define MOTION_BRIDGE__FILE_BRIDGE_HPP_
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include "motion_action/motion_macros.hpp"
25 |
26 | namespace cyberdog
27 | {
28 | namespace motion
29 | {
30 | class FileBridge
31 | {
32 | public:
33 | explicit FileBridge(const rclcpp::Node::SharedPtr node);
34 | ~FileBridge() {}
35 | void Spin();
36 |
37 | private:
38 | void HandleFileBridgeCallback();
39 | rclcpp::Node::SharedPtr node_;
40 | std::shared_ptr lcm_;
41 | file_send_lcmt file_;
42 | }; // class FileBridge
43 | } // namespace motion
44 | } // namespace cyberdog
45 | #endif // MOTION_BRIDGE__FILE_BRIDGE_HPP_
46 |
--------------------------------------------------------------------------------
/motion_bridge/test/as_controller_file.cpp:
--------------------------------------------------------------------------------
1 | #include "protocol/lcm/file_send_lcmt.hpp"
2 | #include "lcm/lcm-cpp.hpp"
3 | #include "rclcpp/rclcpp.hpp"
4 | #include "cyberdog_common/cyberdog_log.hpp"
5 | #include "motion_bridge/file_bridge.hpp"
6 | namespace cyberdog
7 | {
8 | namespace motion
9 | {
10 | class AsController
11 | {
12 | public:
13 | AsController()
14 | {
15 | node_.reset(new rclcpp::Node("as_controller"));
16 | lcm_.reset(new lcm::LCM(kLCMBirdgeSubscribeURL));
17 | lcm_->subscribe(kLCMBridgeFileChannel, &AsController::LCMCallback, this);
18 | std::thread{[this]() {
19 | while (rclcpp::ok()) {
20 | while (0 == this->lcm_->handleTimeout(1000)) {
21 | ERROR("Cannot read LCM from bridge");
22 | }
23 | }
24 | }
25 | }.detach();
26 |
27 | }
28 | ~AsController() {file_.close();}
29 | void Spin()
30 | {
31 | rclcpp::spin(node_);
32 | rclcpp::shutdown();
33 | }
34 |
35 | private:
36 | void LCMCallback(const lcm::ReceiveBuffer *, const std::string &, const file_send_lcmt * msg)
37 | {
38 | INFO("%s", msg->data.c_str());
39 | // std::ofstream file("/home/harvey/test.toml");
40 | if(file_.is_open()) {
41 | file_ << msg->data;
42 | }
43 | // file_ << "\n";
44 | }
45 | std::shared_ptr lcm_;
46 | rclcpp::Node::SharedPtr node_;
47 | std::ofstream file_{"/home/harvey/test.toml"};
48 |
49 | };
50 | }
51 | }
52 |
53 | int main(int argc, char ** argv)
54 | {
55 | rclcpp::init(argc, argv);
56 | LOGGER_MAIN_INSTANCE("AsController");
57 | std::shared_ptr ac =
58 | std::make_shared();
59 | ac->Spin();
60 | }
61 |
--------------------------------------------------------------------------------
/motion_utils/launch/tof_node_launch.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2023 Xiaomi Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from launch import LaunchDescription
16 | from launch_ros.actions import Node
17 |
18 |
19 | def generate_launch_description():
20 | return LaunchDescription([
21 | Node(
22 | package='motion_utils',
23 | executable='head_tof_pcl_publisher.py',
24 | ),
25 | Node(
26 | package='tf2_ros',
27 | executable='static_transform_publisher',
28 | arguments=['0.259', '0.03', '0.102', '0', '-0.266', '0.296', 'robot', 'left_head']
29 | ),
30 | Node(
31 | package='tf2_ros',
32 | executable='static_transform_publisher',
33 | arguments=['0.259', '-0.03', '0.102', '0', '-0.266', '-0.296', 'robot', 'right_head']
34 | ),
35 | Node(
36 | package='tf2_ros',
37 | executable='static_transform_publisher',
38 | arguments=['-0.021', '0.042', '-0.051', '0', '0', '0.296', 'robot', 'left_rear']
39 | ),
40 | Node(
41 | package='tf2_ros',
42 | executable='static_transform_publisher',
43 | arguments=['-0.021', '-0.042', '-0.051', '0', '0', '-0.296', 'robot', 'right_rear']
44 | )
45 | ])
46 |
--------------------------------------------------------------------------------
/elec_skin/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.8)
2 | project(elec_skin)
3 |
4 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
5 | add_compile_options(-Wall -Wextra -Wpedantic)
6 | endif()
7 |
8 | if(NOT CMAKE_C_STANDARD)
9 | set(CMAKE_C_STANDARD 99)
10 | endif()
11 |
12 | if(NOT CMAKE_CXX_STANDARD)
13 | set(CMAKE_CXX_STANDARD 17)
14 | endif()
15 |
16 | find_package(ament_cmake REQUIRED)
17 | find_package(rclcpp REQUIRED)
18 | find_package(std_msgs REQUIRED)
19 | find_package(toml REQUIRED)
20 | find_package(ament_index_cpp REQUIRED)
21 | find_package(cyberdog_common REQUIRED)
22 | find_package(cyberdog_embed_protocol REQUIRED)
23 |
24 | include_directories(include)
25 |
26 | add_executable(${PROJECT_NAME} src/main.cpp)
27 |
28 | # MESSAGE('--------------${CMAKE_INSTALL_PREFIX}------------------')
29 |
30 | ament_target_dependencies( ${PROJECT_NAME}
31 | rclcpp
32 | std_msgs
33 | toml
34 | ament_index_cpp
35 | cyberdog_common
36 | cyberdog_embed_protocol )
37 |
38 | install(
39 | DIRECTORY include/
40 | DESTINATION include
41 | )
42 |
43 | install(TARGETS ${PROJECT_NAME}
44 | DESTINATION lib/${PROJECT_NAME})
45 |
46 | install(
47 | DIRECTORY include/
48 | DESTINATION include/
49 | )
50 |
51 | install(DIRECTORY toml_config/
52 | DESTINATION share/${PROJECT_NAME}/toml_config/
53 | )
54 |
55 | if(BUILD_TESTING)
56 | find_package(ament_lint_auto REQUIRED)
57 | # the following line skips the linter which checks for copyrights
58 | # uncomment the line when a copyright and license is not present in all source files
59 | #set(ament_cmake_copyright_FOUND TRUE)
60 | # the following line skips cpplint (only works in a git repo)
61 | # uncomment the line when this package is not in a git repo
62 | #set(ament_cmake_cpplint_FOUND TRUE)
63 | ament_lint_auto_find_test_dependencies()
64 | endif()
65 |
66 |
67 | ament_package()
68 |
--------------------------------------------------------------------------------
/motion_bridge/include/motion_bridge/motor_bridge.hpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | #ifndef MOTION_BRIDGE__MOTOR_BRIDGE_HPP_
15 | #define MOTION_BRIDGE__MOTOR_BRIDGE_HPP_
16 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include "motion_action/motion_macros.hpp"
23 | #include "protocol/lcm/danger_states_lcmt.hpp"
24 | #include "protocol/srv/motor_temp.hpp"
25 | namespace cyberdog
26 | {
27 | namespace motion
28 | {
29 | class MotorBridge
30 | {
31 | public:
32 | explicit MotorBridge(const rclcpp::Node::SharedPtr node);
33 | ~MotorBridge() {}
34 | void Spin();
35 |
36 | private:
37 | void ReadLcm(
38 | const lcm::ReceiveBuffer *, const std::string &,
39 | const danger_states_lcmt * msg);
40 | void HandleMotorTempCallback(
41 | const protocol::srv::MotorTemp_Request::SharedPtr req,
42 | protocol::srv::MotorTemp_Response::SharedPtr res);
43 | rclcpp::Node::SharedPtr node_;
44 | rclcpp::Service::SharedPtr motor_temp_srv_ {nullptr};
45 | std::shared_ptr lcm_subscribe_instance_;
46 | danger_states_lcmt motor_temp_;
47 | std::thread lcm_handle_thread_;
48 | }; // class MotorBridge
49 | } // namespace motion
50 | } // namespace cyberdog
51 | #endif // MOTION_BRIDGE__MOTOR_BRIDGE_HPP_
52 |
--------------------------------------------------------------------------------
/motion_bridge/src/file_bridge.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #include
16 | #include
17 | #include "motion_bridge/file_bridge.hpp"
18 |
19 | namespace cyberdog
20 | {
21 | namespace motion
22 | {
23 | FileBridge::FileBridge(const rclcpp::Node::SharedPtr node)
24 | {
25 | node_ = node;
26 | lcm_ = std::make_shared(kLCMBirdgeSubscribeURL);
27 | // std::thread{[this]() {
28 | // while (lcm_->good()) {
29 | // lcm_->publish(kLCMBridgeElevationChannel, &elevation_);
30 | // std::this_thread::sleep_for(std::chrono::milliseconds(50));
31 | // }
32 | // }
33 | // }.detach();
34 | std::ifstream file("/home/harvey/Downloads/user_gait_01.toml");
35 | std::string s;
36 | while (getline(file, s)) {
37 | INFO("%s", s.c_str());
38 | file_.data += s + "\n";
39 | }
40 | lcm_->publish(kLCMBridgeFileChannel, &file_);
41 | }
42 |
43 | void FileBridge::Spin()
44 | {
45 | }
46 |
47 |
48 | void FileBridge::HandleFileBridgeCallback()
49 | {
50 | // std::ifstream file("");
51 | // std::string s;
52 | // while(file >> s) {
53 | // INFO("%s", s.c_str());
54 | // }
55 | }
56 | } // namespace motion
57 | } // namespace cyberdog
58 |
59 | int main(int argc, char const * argv[])
60 | {
61 | rclcpp::init(argc, argv);
62 | rclcpp::Node::SharedPtr node(new rclcpp::Node("elevation_bridge"));
63 | cyberdog::motion::FileBridge fb(node);
64 | return 0;
65 | }
66 |
--------------------------------------------------------------------------------
/skin_manager/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.8)
2 | project(skin_manager)
3 |
4 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
5 | add_compile_options(-Wall -Wextra -Wpedantic)
6 | endif()
7 |
8 | if(NOT CMAKE_C_STANDARD)
9 | set(CMAKE_C_STANDARD 99)
10 | endif()
11 |
12 | if(NOT CMAKE_CXX_STANDARD)
13 | set(CMAKE_CXX_STANDARD 17)
14 | endif()
15 |
16 | find_package(ament_cmake REQUIRED)
17 | find_package(rclcpp REQUIRED)
18 | find_package(std_msgs REQUIRED)
19 | find_package(builtin_interfaces REQUIRED)
20 | find_package(toml REQUIRED)
21 | find_package(protocol REQUIRED)
22 | find_package(ament_index_cpp REQUIRED)
23 | find_package(cyberdog_common REQUIRED)
24 | find_package(elec_skin REQUIRED)
25 |
26 | include_directories(include)
27 |
28 | add_library(${PROJECT_NAME} SHARED src/skin_manager.cpp)
29 |
30 |
31 | # MESSAGE('--------------${CMAKE_INSTALL_PREFIX}------------------')
32 |
33 | ament_target_dependencies( ${PROJECT_NAME}
34 | rclcpp
35 | std_msgs
36 | toml
37 | protocol
38 | builtin_interfaces
39 | ament_index_cpp
40 | cyberdog_common
41 | elec_skin )
42 |
43 | install(
44 | DIRECTORY include/
45 | DESTINATION include
46 | )
47 |
48 | install(TARGETS ${PROJECT_NAME}
49 | LIBRARY DESTINATION lib
50 | RUNTIME DESTINATION lib/${PROJECT_NAME}
51 | )
52 |
53 | install(
54 | DIRECTORY include/
55 | DESTINATION include/
56 | )
57 |
58 | install(DIRECTORY config/
59 | DESTINATION share/${PROJECT_NAME}/config/
60 | )
61 |
62 | if(BUILD_TESTING)
63 | find_package(ament_lint_auto REQUIRED)
64 | # the following line skips the linter which checks for copyrights
65 | # uncomment the line when a copyright and license is not present in all source files
66 | #set(ament_cmake_copyright_FOUND TRUE)
67 | # the following line skips cpplint (only works in a git repo)
68 | # uncomment the line when this package is not in a git repo
69 | #set(ament_cmake_cpplint_FOUND TRUE)
70 | ament_lint_auto_find_test_dependencies()
71 | endif()
72 |
73 | ament_export_libraries(${PROJECT_NAME})
74 | ament_export_dependencies(elec_skin)
75 | ament_package()
76 |
--------------------------------------------------------------------------------
/elec_skin/include/elec_skin/elec_skin_base.hpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | #ifndef ELEC_SKIN__ELEC_SKIN_BASE_HPP_
15 | #define ELEC_SKIN__ELEC_SKIN_BASE_HPP_
16 |
17 | #include
18 |
19 | namespace cyberdog
20 | {
21 | namespace motion
22 | {
23 |
24 | enum class ModelSwitch : uint8_t
25 | {
26 | MS_FLASH = 0, // 闪烁
27 | MS_WAVEF = 1, // 动画前向后变
28 | MS_RANDOM = 2, // 随机
29 | MS_WAVEB = 3, // 动画后向前变
30 | MS_CONTROL = 4, // 上位机实时控制模式
31 | }; // enum class PositionSkin
32 |
33 | enum class PositionSkin : uint8_t
34 | {
35 | PS_BODYM = 0, // 背部
36 | PS_LBLEG = 1, // 左后腿
37 | PS_BODYL = 2, // 左侧
38 | PS_LFLEG = 3, // 左前腿
39 | PS_FRONT = 4, // 前胸
40 | PS_RFLEG = 5, // 右前腿
41 | PS_BODYR = 6, // 右侧
42 | PS_RBLEG = 7, // 右后腿
43 | }; // enum class PositionSkin
44 |
45 | enum class PositionColorChangeDirection : uint8_t
46 | {
47 | PCCD_WTOB = 1, // 白变黑
48 | PCCD_BTOW = 0, // 黑变白
49 | }; // enum class PositionColorChangeDirection
50 |
51 | enum class PositionColorStartDirection : uint8_t
52 | {
53 | PCSD_FRONT = 0, // 前方先变色
54 | PCSD_BACK = 1, // 后方先变色
55 | }; // enum class PositionColorStartDirection
56 |
57 | class ElecSkinBase
58 | {
59 | public:
60 | virtual void ModelControl(ModelSwitch ms, uint16_t milsecs) = 0;
61 | virtual void PositionContril(
62 | PositionSkin ps, PositionColorChangeDirection pccd,
63 | PositionColorStartDirection pcsd, uint16_t milsecs) = 0;
64 | };
65 |
66 | } // namespace motion
67 | } // namespace cyberdog
68 |
69 | #endif // ELEC_SKIN__ELEC_SKIN_BASE_HPP_
70 |
--------------------------------------------------------------------------------
/motion_action/launch/test_as_manager.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2023 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import os
16 |
17 | from matplotlib.pyplot import text
18 | from ament_index_python import get_package_share_directory
19 | from launch import LaunchDescription
20 | from launch.actions import DeclareLaunchArgument
21 | from launch.actions import IncludeLaunchDescription
22 | from launch.actions import GroupAction
23 | from launch.launch_description_sources import PythonLaunchDescriptionSource
24 | from launch.substitutions import LaunchConfiguration, PathJoinSubstitution, LocalSubstitution, PythonExpression
25 | from launch.substitutions import TextSubstitution
26 | from launch_ros.actions import Node
27 | from launch_ros.actions import PushRosNamespace
28 |
29 | def generate_launch_description():
30 | preset_cmd = LaunchConfiguration('cmd')
31 | sim_cmd = LaunchConfiguration('sim')
32 | declare_cmd_arg = DeclareLaunchArgument('cmd', default_value='1.toml')
33 | declare_sim_arg = DeclareLaunchArgument('sim', default_value='False')
34 | cmd_preset = PathJoinSubstitution([get_package_share_directory('motion_action'), 'preset', preset_cmd])
35 |
36 | start_test_as_manager_cmd = Node(
37 | package='motion_action',
38 | executable='test_as_manager',
39 | name='test_as_manager',
40 | output='screen',
41 | parameters=[
42 | {'publish_url' : ''},
43 | {'subscribe_url' : ''},
44 | {'cmd_preset' : cmd_preset}]
45 | )
46 | ld = LaunchDescription()
47 | ld.add_action(declare_cmd_arg)
48 | ld.add_action(declare_sim_arg)
49 | ld.add_action(start_test_as_manager_cmd)
50 | return ld
--------------------------------------------------------------------------------
/motion_bridge/include/motion_bridge/imu_bridge.hpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | #ifndef MOTION_BRIDGE__IMU_BRIDGE_HPP_
15 | #define MOTION_BRIDGE__IMU_BRIDGE_HPP_
16 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include "motion_action/motion_macros.hpp"
24 | #include "protocol/lcm/microstrain_lcmt.hpp"
25 | #include "protocol/lcm/robot_control_response_lcmt.hpp"
26 | #include "sensor_msgs/msg/imu.hpp"
27 | namespace cyberdog
28 | {
29 | namespace motion
30 | {
31 | constexpr int8_t SIZE_X = 80;
32 | constexpr int8_t SIZE_Y = 80;
33 | constexpr float RESOLUTION = 0.05;
34 | constexpr const char * LAYER_ELEVATION = "elevation";
35 | constexpr const char * LAYER_TRAVERSABILITY = " ";
36 | class ImuBridge
37 | {
38 | public:
39 | explicit ImuBridge(const rclcpp::Node::SharedPtr node);
40 | ~ImuBridge() {}
41 | void Spin();
42 |
43 | private:
44 | void ReadLcm(
45 | const lcm::ReceiveBuffer *, const std::string &,
46 | const microstrain_lcmt * msg);
47 | rclcpp::Node::SharedPtr node_;
48 | std::shared_ptr lcm_subscribe_instance_;
49 | rclcpp::Publisher::SharedPtr imu_pub_ {nullptr};
50 | sensor_msgs::msg::Imu::SharedPtr imu_ros_data_ {nullptr};
51 | microstrain_lcmt imu_lcm_data_;
52 | robot_control_response_lcmt response_lcm_data_;
53 | std::thread topic_publish_thread_, lcm_handle_thread_;
54 | std::string imu_frame_{"imu"};
55 | }; // class ImuBridge
56 | } // namespace motion
57 | } // namespace cyberdog
58 | #endif // MOTION_BRIDGE__IMU_BRIDGE_HPP_
59 |
--------------------------------------------------------------------------------
/motion_action/preset/400.toml:
--------------------------------------------------------------------------------
1 | [[step]]
2 | mode = 11
3 | gait_id = 81
4 | contact = 30
5 | life_count = 0
6 | vel_des = [ 0.0, 0.0, 0.0,]
7 | rpy_des = [ 0.0, 0.0, 0.0,]
8 | pos_des = [ 0.0, 0.0, 0.0,]
9 | acc_des = [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,]
10 | ctrl_point = [ 0.0, 0.0, 1.0,]
11 | foot_pose = [ 0.0, -0.02, 0.0, 0.02, 0.0, 0.0,]
12 | step_height = [ 35035.0, 20020.0,]
13 | value = 0
14 | duration = 420
15 |
16 | [[step]]
17 | mode = 11
18 | gait_id = 81
19 | contact = 30
20 | life_count = 0
21 | vel_des = [ 0.0, 0.0, 0.0,]
22 | rpy_des = [ 0.0, 0.0, 0.0,]
23 | pos_des = [ 0.0, 0.0, 0.0,]
24 | acc_des = [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,]
25 | ctrl_point = [ 0.0, 0.0, 1.0,]
26 | foot_pose = [ 0.0, 0.02, 0.0, -0.02, 0.0, 0.0,]
27 | step_height = [ 35035.0, 20020.0,]
28 | value = 0
29 | duration = 420
30 |
31 | [[step]]
32 | mode = 11
33 | gait_id = 81
34 | contact = 30
35 | life_count = 0
36 | vel_des = [ 0.0, 0.0, 0.0,]
37 | rpy_des = [ 0.0, 0.0, 0.0,]
38 | pos_des = [ 0.0, 0.0, 0.0,]
39 | acc_des = [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,]
40 | ctrl_point = [ 0.0, 0.0, 1.0,]
41 | foot_pose = [ 0.0, -0.02, 0.0, 0.02, 0.0, 0.0,]
42 | step_height = [ 35035.0, 20020.0,]
43 | value = 0
44 | duration = 420
45 |
46 | [[step]]
47 | mode = 11
48 | gait_id = 81
49 | contact = 30
50 | life_count = 0
51 | vel_des = [ 0.0, 0.0, 0.0,]
52 | rpy_des = [ 0.0, 0.0, 0.0,]
53 | pos_des = [ 0.0, 0.0, 0.0,]
54 | acc_des = [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,]
55 | ctrl_point = [ 0.0, 0.0, 1.0,]
56 | foot_pose = [ 0.0, 0.02, 0.0, -0.02, 0.0, 0.0,]
57 | step_height = [ 35035.0, 20020.0,]
58 | value = 0
59 | duration = 420
60 |
61 | [[step]]
62 | mode = 11
63 | gait_id = 81
64 | contact = 30
65 | life_count = 0
66 | vel_des = [ 0.0, 0.0, 0.0,]
67 | rpy_des = [ 0.0, 0.0, 0.0,]
68 | pos_des = [ 0.0, 0.0, 0.0,]
69 | acc_des = [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,]
70 | ctrl_point = [ 0.0, 0.0, 1.0,]
71 | foot_pose = [ 0.0, -0.02, 0.0, 0.02, 0.0, 0.0,]
72 | step_height = [ 35035.0, 20020.0,]
73 | value = 0
74 | duration = 420
75 |
76 | [[step]]
77 | mode = 11
78 | gait_id = 81
79 | contact = 30
80 | life_count = 0
81 | vel_des = [ 0.0, 0.0, 0.0,]
82 | rpy_des = [ 0.0, 0.0, 0.0,]
83 | pos_des = [ 0.0, 0.0, 0.0,]
84 | acc_des = [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,]
85 | ctrl_point = [ 0.0, 0.0, 1.0,]
86 | foot_pose = [ 0.06, 0.0, 0.06, 0.0, 0.0, 0.0,]
87 | step_height = [ 35035.0, 20020.0,]
88 | value = 0
89 | duration = 660
--------------------------------------------------------------------------------
/motion_utils/include/motion_utils/edge_align.hpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | #ifndef MOTION_UTILS__EDGE_ALIGN_HPP_
15 | #define MOTION_UTILS__EDGE_ALIGN_HPP_
16 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include "cyberdog_common/cyberdog_log.hpp"
22 | #include "cyberdog_common/cyberdog_toml.hpp"
23 | #include "motion_utils/edge_perception.hpp"
24 | #include "motion_action/motion_macros.hpp"
25 | #include "std_srvs/srv/trigger.hpp"
26 | #include "std_msgs/msg/bool.hpp"
27 |
28 | namespace cyberdog
29 | {
30 | namespace motion
31 | {
32 | class EdgeAlign
33 | {
34 | public:
35 | explicit EdgeAlign(rclcpp::Node::SharedPtr node);
36 | void Spin()
37 | {
38 | rclcpp::spin(node_);
39 | }
40 |
41 | private:
42 | void HandleServiceCallback(
43 | const std_srvs::srv::Trigger_Request::SharedPtr request,
44 | std_srvs::srv::Trigger_Response::SharedPtr response);
45 | void Loop();
46 |
47 | rclcpp::Node::SharedPtr node_;
48 | rclcpp::Publisher::SharedPtr servo_cmd_pub_;
49 | rclcpp::Service::SharedPtr edge_align_srv_;
50 | rclcpp::Client::SharedPtr result_cmd_client_;
51 | MotionServoCmdMsg servo_cmd_;
52 | rclcpp::Publisher::SharedPtr align_finish_pub_;
53 | std_msgs::msg::Bool align_finish_;
54 | std::shared_ptr edge_perception_;
55 | std::mutex loop_mutex_;
56 | std::condition_variable cv_;
57 | float vel_x_, vel_omega_;
58 | bool jump_after_align_, auto_start_;
59 | }; // calss EdgeAlign
60 | } // namespace motion
61 | } // namespace cyberdog
62 | #endif // MOTION_UTILS__EDGE_ALIGN_HPP_
63 |
--------------------------------------------------------------------------------
/motion_bridge/include/motion_bridge/odom_out_publisher.hpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | #ifndef MOTION_BRIDGE__ODOM_OUT_PUBLISHER_HPP_
15 | #define MOTION_BRIDGE__ODOM_OUT_PUBLISHER_HPP_
16 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include "motion_action/motion_macros.hpp"
31 |
32 | namespace cyberdog
33 | {
34 | namespace motion
35 | {
36 |
37 | class OdomOutPublisher
38 | {
39 | LOGGER_MINOR_INSTANCE("OdomOutPublisher");
40 |
41 | public:
42 | explicit OdomOutPublisher(const rclcpp::Node::SharedPtr node);
43 | ~OdomOutPublisher() {}
44 | bool Init();
45 | void Spin();
46 |
47 | private:
48 | void OdomLCMCabllback(
49 | const lcm::ReceiveBuffer *, const std::string &,
50 | const localization_lcmt * msg);
51 | std::shared_ptr tf2_broadcaster_;
52 | rclcpp::Node::SharedPtr node_;
53 | std::shared_ptr lcm_;
54 | rclcpp::Publisher::SharedPtr leg_odom_publisher_;
55 | nav_msgs::msg::Odometry odom_;
56 | geometry_msgs::msg::TransformStamped transform_stamped_;
57 | std::string map_frame_{"map"}, odom_frame_{"odom"}, base_frame_{"base_link_leg"};
58 | std::condition_variable cv_;
59 | std::mutex mutex_;
60 | bool ready_publish_;
61 | bool tf_pub_;
62 | }; // class OdomOutPublisher
63 | } // namespace motion
64 | } // namespace cyberdog
65 | #endif // MOTION_BRIDGE__ODOM_OUT_PUBLISHER_HPP_
66 |
--------------------------------------------------------------------------------
/motion_bridge/include/motion_bridge/elevation_bridge.hpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | #ifndef MOTION_BRIDGE__ELEVATION_BRIDGE_HPP_
15 | #define MOTION_BRIDGE__ELEVATION_BRIDGE_HPP_
16 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include "motion_action/motion_macros.hpp"
30 |
31 | namespace cyberdog
32 | {
33 | namespace motion
34 | {
35 | constexpr int8_t SIZE_X = 80;
36 | constexpr int8_t SIZE_Y = 80;
37 | constexpr float RESOLUTION = 0.02;
38 | constexpr const char * LAYER_ELEVATION = "elevation";
39 | constexpr const char * LAYER_TRAVERSABILITY = " ";
40 | class ElevationBridge
41 | {
42 | public:
43 | explicit ElevationBridge(const rclcpp::Node::SharedPtr node);
44 | ~ElevationBridge() {}
45 | void Spin();
46 |
47 | private:
48 | void GridMapCallback(const grid_map_msgs::msg::GridMap::SharedPtr msg);
49 | bool GetTransform(
50 | Eigen::Isometry3d & transform, const std::string & target_frame,
51 | const std::string & source_frame);
52 | std::shared_ptr tf2_listener_;
53 | std::shared_ptr tf2_buffer_;
54 | rclcpp::Node::SharedPtr node_;
55 | std::shared_ptr lcm_;
56 | rclcpp::Subscription::SharedPtr gridmap_sub_;
57 | heightmap_t elevation_;
58 | std::string map_frame_{"map"}, odom_frame_{"odom"}, base_frame_{"base_link"};
59 | }; // class ElevationBridge
60 | } // namespace motion
61 | } // namespace cyberdog
62 | #endif // MOTION_BRIDGE__ELEVATION_BRIDGE_HPP_
63 |
--------------------------------------------------------------------------------
/motion_bridge/test/as_controller.cpp:
--------------------------------------------------------------------------------
1 | #include "protocol/lcm/heightmap_t.hpp"
2 | #include "lcm/lcm-cpp.hpp"
3 | #include "rclcpp/rclcpp.hpp"
4 | #include "grid_map_core/grid_map_core.hpp"
5 | #include "grid_map_msgs/msg/grid_map.hpp"
6 | #include "grid_map_ros/grid_map_ros.hpp"
7 | #include "cyberdog_common/cyberdog_log.hpp"
8 | #include "motion_bridge/elevation_bridge.hpp"
9 | namespace cyberdog
10 | {
11 | namespace motion
12 | {
13 | class AsController
14 | {
15 | public:
16 | AsController()
17 | {
18 | node_.reset(new rclcpp::Node("as_controller"));
19 | lcm_.reset(new lcm::LCM(kLCMBirdgeSubscribeURL));
20 | pub_ = node_->create_publisher(
21 | "elevation_submap",
22 | rclcpp::SystemDefaultsQoS());
23 | lcm_->subscribe("local_heightmap", &AsController::LCMCallback, this);
24 | std::thread{[this]() {
25 | // while (0 == lcm_->handle()) {}}
26 | while (rclcpp::ok()) {
27 | while (0 == this->lcm_->handleTimeout(1000)) {
28 | ERROR("Cannot read LCM from bridge");
29 | }
30 | }
31 | }}.detach();
32 | length_x_ = SIZE_X * RESOLUTION;
33 | length_y_ = SIZE_Y * RESOLUTION;
34 | }
35 | ~AsController() {}
36 | void Spin()
37 | {
38 | rclcpp::spin(node_);
39 | rclcpp::shutdown();
40 | }
41 |
42 | private:
43 | void LCMCallback(const lcm::ReceiveBuffer *, const std::string &, const heightmap_t * msg)
44 | {
45 | grid_map::GridMap map;
46 | map.setFrameId("map");
47 | map.add(LAYER_ELEVATION);
48 | grid_map::Position center(msg->robot_loc[0], msg->robot_loc[1]);
49 | map.setGeometry(grid_map::Length(length_x_, length_y_), RESOLUTION, center);
50 | grid_map::GridMapIterator iter(map); // NOTE 迭代器从左上角开始向下遍历,不同于SubmapIterator向右开始遍历。?
51 | for (int8_t j = 0; j < SIZE_Y; ++j) {
52 | for (int8_t i = 0; i < SIZE_X; ++i) {
53 | map.at(LAYER_ELEVATION, *iter) = msg->map[i][j];
54 | ++iter;
55 | }
56 | }
57 | std::unique_ptr map_ros;
58 | map_ros = grid_map::GridMapRosConverter::toMessage(map);
59 | pub_->publish(*map_ros);
60 | }
61 | std::shared_ptr lcm_;
62 | rclcpp::Node::SharedPtr node_;
63 | rclcpp::Publisher::SharedPtr pub_;
64 | double length_x_, length_y_;
65 | };
66 | }
67 | }
68 |
69 | int main(int argc, char ** argv)
70 | {
71 | rclcpp::init(argc, argv);
72 | LOGGER_MAIN_INSTANCE("AsController");
73 | std::shared_ptr ac =
74 | std::make_shared();
75 | ac->Spin();
76 | }
77 |
--------------------------------------------------------------------------------
/motion_bridge/src/motor_bridge.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #include
16 | #include
17 | #include
18 | #include "motion_bridge/motor_bridge.hpp"
19 |
20 | namespace cyberdog
21 | {
22 | namespace motion
23 | {
24 | MotorBridge::MotorBridge(const rclcpp::Node::SharedPtr node)
25 | {
26 | node_ = node;
27 | motor_temp_srv_ = node_->create_service(
28 | "motor_temp",
29 | std::bind(
30 | &MotorBridge::HandleMotorTempCallback,
31 | this, std::placeholders::_1, std::placeholders::_2));
32 | lcm_subscribe_instance_ = std::make_shared(kLCMBirdgeSubscribeURL);
33 | lcm_subscribe_instance_->subscribe(kLCMBridgeMotorChannel, &MotorBridge::ReadLcm, this);
34 | lcm_handle_thread_ =
35 | std::thread(
36 | [this]() {
37 | while (rclcpp::ok()) {
38 | while (0 == this->lcm_subscribe_instance_->handleTimeout(5000)) {
39 | ERROR("Cannot read motor temp LCM from MR813");
40 | }
41 | }
42 | });
43 | lcm_handle_thread_.detach();
44 | }
45 |
46 | void MotorBridge::Spin()
47 | {
48 | rclcpp::spin(node_);
49 | rclcpp::shutdown();
50 | }
51 |
52 | void MotorBridge::ReadLcm(
53 | const lcm::ReceiveBuffer *, const std::string &,
54 | const danger_states_lcmt * msg)
55 | {
56 | motor_temp_ = *msg;
57 | }
58 |
59 | void MotorBridge::HandleMotorTempCallback(
60 | const protocol::srv::MotorTemp_Request::SharedPtr,
61 | protocol::srv::MotorTemp_Response::SharedPtr res)
62 | {
63 | res->result = true;
64 | res->motor_temp = std::vector(
65 | std::begin(motor_temp_.motor_temperature),
66 | std::end(motor_temp_.motor_temperature));
67 | }
68 |
69 | } // namespace motion
70 | } // namespace cyberdog
71 |
72 | int main(int argc, char const * argv[])
73 | {
74 | rclcpp::init(argc, argv);
75 | rclcpp::Node::SharedPtr node(new rclcpp::Node("motor_temp"));
76 | cyberdog::motion::MotorBridge mb(node);
77 | mb.Spin();
78 | return 0;
79 | }
80 |
--------------------------------------------------------------------------------
/motion_bridge/src/imu_bridge.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #include
16 | #include
17 | #include "motion_bridge/imu_bridge.hpp"
18 |
19 | namespace cyberdog
20 | {
21 | namespace motion
22 | {
23 | ImuBridge::ImuBridge(const rclcpp::Node::SharedPtr node)
24 | {
25 | node_ = node;
26 | imu_pub_ = node->create_publisher("imu", rclcpp::SystemDefaultsQoS());
27 | lcm_subscribe_instance_ = std::make_shared(kLCMBirdgeSubscribeURL);
28 | lcm_subscribe_instance_->subscribe(kLCMBridgeImuChannel, &ImuBridge::ReadLcm, this);
29 | imu_ros_data_.reset(new sensor_msgs::msg::Imu);
30 |
31 | lcm_handle_thread_ =
32 | std::thread(
33 | [this]() {
34 | while (rclcpp::ok()) {
35 | while (0 == this->lcm_subscribe_instance_->handleTimeout(kAcitonLcmReadTimeout)) {
36 | ERROR("Cannot read LCM from MR813");
37 | }
38 | }
39 | });
40 | lcm_handle_thread_.detach();
41 | }
42 |
43 | void ImuBridge::Spin()
44 | {
45 | rclcpp::spin(node_);
46 | rclcpp::shutdown();
47 | }
48 |
49 | void ImuBridge::ReadLcm(
50 | const lcm::ReceiveBuffer *, const std::string &,
51 | const microstrain_lcmt * msg)
52 | {
53 | imu_ros_data_->header.frame_id = imu_frame_;
54 | imu_ros_data_->header.stamp = node_->get_clock()->now();
55 | imu_ros_data_->linear_acceleration.x = msg->acc[0];
56 | imu_ros_data_->linear_acceleration.y = msg->acc[1];
57 | imu_ros_data_->linear_acceleration.z = msg->acc[2];
58 | imu_ros_data_->angular_velocity.x = msg->omega[0];
59 | imu_ros_data_->angular_velocity.y = msg->omega[1];
60 | imu_ros_data_->angular_velocity.z = msg->omega[2];
61 | imu_ros_data_->orientation.x = msg->quat[0];
62 | imu_ros_data_->orientation.y = msg->quat[1];
63 | imu_ros_data_->orientation.z = msg->quat[2];
64 | imu_ros_data_->orientation.w = msg->quat[3];
65 | imu_pub_->publish(*imu_ros_data_);
66 | }
67 | } // namespace motion
68 | } // namespace cyberdog
69 |
70 | int main(int argc, char const * argv[])
71 | {
72 | rclcpp::init(argc, argv);
73 | rclcpp::Node::SharedPtr node(new rclcpp::Node("test_imu_bridege"));
74 | cyberdog::motion::ImuBridge ib(node);
75 | ib.Spin();
76 | return 0;
77 | }
78 |
--------------------------------------------------------------------------------
/motion_utils/include/motion_utils/stair_align.hpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | #ifndef MOTION_UTILS__STAIR_ALIGN_HPP_
15 | #define MOTION_UTILS__STAIR_ALIGN_HPP_
16 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include "cyberdog_common/cyberdog_log.hpp"
22 | #include "cyberdog_common/cyberdog_toml.hpp"
23 | #include "motion_utils/stair_perception.hpp"
24 | #include "motion_utils/edge_perception.hpp"
25 | #include "motion_action/motion_macros.hpp"
26 | #include "std_srvs/srv/trigger.hpp"
27 | #include "std_msgs/msg/bool.hpp"
28 | #include "std_srvs/srv/set_bool.hpp"
29 |
30 | namespace cyberdog
31 | {
32 | namespace motion
33 | {
34 | class StairAlign
35 | {
36 | public:
37 | enum class State
38 | {
39 | IDLE,
40 | BLIND_FORWARD,
41 | TURN_LEFT,
42 | TURN_RIGHT,
43 | APPROACH,
44 | FINISH
45 | };
46 | explicit StairAlign(rclcpp::Node::SharedPtr node);
47 | void Spin()
48 | {
49 | rclcpp::spin(node_);
50 | }
51 |
52 | private:
53 | void HandleStartAlignCallback(
54 | const std_srvs::srv::SetBool_Request::SharedPtr request,
55 | std_srvs::srv::SetBool_Response::SharedPtr response);
56 | void HandleStopAlignCallback(
57 | const std_srvs::srv::Trigger::Request::SharedPtr request,
58 | std_srvs::srv::Trigger::Response::SharedPtr response);
59 | void Loop();
60 |
61 | rclcpp::Node::SharedPtr node_;
62 | rclcpp::Publisher::SharedPtr servo_cmd_pub_, align_status_pub_;
63 | rclcpp::Service::SharedPtr start_stair_align_srv_;
64 | rclcpp::Service::SharedPtr stop_stair_align_srv_;
65 | // rclcpp::Service::SharedPtr jump_srv_;
66 | rclcpp::Client::SharedPtr result_cmd_client_;
67 | MotionServoCmdMsg servo_cmd_;
68 | rclcpp::Publisher::SharedPtr align_finish_pub_;
69 | std_msgs::msg::Bool align_finish_;
70 | std::shared_ptr stair_perception_;
71 | std::shared_ptr edge_perception_;
72 | std::mutex loop_mutex_;
73 | std::condition_variable cv_;
74 | float vel_x_, vel_omega_;
75 | bool jump_after_align_, auto_start_, is_stair_mode;
76 | bool task_start_{false};
77 | }; // calss StairAlign
78 | } // namespace motion
79 | } // namespace cyberdog
80 | #endif // MOTION_UTILS__STAIR_ALIGN_HPP_
81 |
--------------------------------------------------------------------------------
/motion_action/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.8)
2 | project(motion_action)
3 |
4 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
5 | add_compile_options(-Wall -Wextra -Wpedantic -g)
6 | endif()
7 |
8 | if(NOT CMAKE_C_STANDARD)
9 | set(CMAKE_C_STANDARD 99)
10 | endif()
11 |
12 | if(NOT CMAKE_CXX_STANDARD)
13 | set(CMAKE_CXX_STANDARD 17)
14 | endif()
15 |
16 | # find dependencies
17 | find_package(ament_cmake REQUIRED)
18 | find_package(ament_cmake_python REQUIRED)
19 | find_package(rclcpp REQUIRED)
20 | find_package(rclpy REQUIRED)
21 | find_package(protocol REQUIRED)
22 | find_package(cyberdog_system REQUIRED)
23 | find_package(cyberdog_debug REQUIRED)
24 | find_package(cyberdog_common)
25 | find_package(lcm REQUIRED)
26 | find_package(skin_manager REQUIRED)
27 |
28 | include_directories(include)
29 |
30 | add_library(${PROJECT_NAME} SHARED src/motion_action.cpp)
31 | target_link_libraries(${PROJECT_NAME} lcm)
32 | ament_target_dependencies(${PROJECT_NAME}
33 | rclcpp
34 | protocol
35 | cyberdog_system
36 | cyberdog_common
37 | cyberdog_debug
38 | skin_manager
39 | )
40 |
41 | # add_executable(manager_test test/manager_test.cpp)
42 | # target_link_libraries(manager_test ${PROJECT_NAME} lcm)
43 | # ament_target_dependencies(manager_test lcm cyberdog_common cyberdog_debug)
44 |
45 | add_executable(controller_test test/controller_test.cpp)
46 | target_link_libraries(controller_test ${PROJECT_NAME} lcm)
47 | ament_target_dependencies(controller_test lcm cyberdog_common cyberdog_debug)
48 |
49 | add_executable(publisher_test test/publisher_test.cpp)
50 | target_link_libraries(publisher_test ${PROJECT_NAME} lcm)
51 | ament_target_dependencies(publisher_test lcm cyberdog_common cyberdog_debug)
52 |
53 | add_executable(client_test test/client_test.cpp)
54 | target_link_libraries(client_test ${PROJECT_NAME} lcm)
55 | ament_target_dependencies(client_test lcm cyberdog_common cyberdog_debug)
56 |
57 | install(
58 | DIRECTORY include/
59 | DESTINATION include
60 | )
61 | install(
62 | DIRECTORY launch
63 | DESTINATION share/${PROJECT_NAME}
64 | )
65 | install(
66 | DIRECTORY preset
67 | DESTINATION share/${PROJECT_NAME}
68 | )
69 | install(TARGETS
70 | ${PROJECT_NAME}
71 | # manager_test
72 | controller_test
73 | publisher_test
74 | client_test
75 | LIBRARY DESTINATION lib
76 | RUNTIME DESTINATION lib/${PROJECT_NAME}
77 | )
78 |
79 | ament_python_install_package(${PROJECT_NAME})
80 |
81 | install(PROGRAMS
82 | scripts/motion_teleop.py
83 | scripts/pose_teleop.py
84 | scripts/statistics.py
85 | scripts/motion_units.py
86 | scripts/motion_demo.py
87 | DESTINATION lib/${PROJECT_NAME}
88 | )
89 |
90 | if(BUILD_TESTING)
91 | find_package(ament_lint_auto REQUIRED)
92 | ament_lint_auto_find_test_dependencies()
93 | endif()
94 |
95 | ament_export_include_directories(
96 | include
97 | )
98 | ament_export_libraries(
99 | ${PROJECT_NAME}
100 | )
101 | ament_export_dependencies(lcm cyberdog_common cyberdog_debug skin_manager)
102 | ament_package()
103 |
--------------------------------------------------------------------------------
/motion_bridge/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.8)
2 | project(motion_bridge)
3 |
4 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
5 | add_compile_options(-Wall -Wextra -Wpedantic -g)
6 | endif()
7 |
8 | # find dependencies
9 | find_package(ament_cmake REQUIRED)
10 | find_package(tf2_ros REQUIRED)
11 | find_package(rclcpp REQUIRED)
12 | find_package(lcm REQUIRED)
13 | find_package(protocol REQUIRED)
14 | find_package(cyberdog_common REQUIRED)
15 | find_package(motion_action REQUIRED)
16 | find_package(grid_map REQUIRED)
17 | find_package(grid_map_core REQUIRED)
18 | find_package(grid_map_ros REQUIRED)
19 | find_package(grid_map_msgs REQUIRED)
20 | find_package(sensor_msgs REQUIRED)
21 | # uncomment the following section in order to fill in
22 | # further dependencies manually.
23 | # find_package( REQUIRED)
24 |
25 | set(dependencies
26 | rclcpp
27 | tf2_ros
28 | lcm
29 | protocol
30 | cyberdog_common
31 | motion_action
32 | grid_map
33 | grid_map_core
34 | grid_map_ros
35 | grid_map_msgs
36 | sensor_msgs)
37 |
38 | include_directories(include)
39 |
40 | add_executable(elevation_bridge
41 | src/elevation_bridge.cpp
42 | )
43 | target_link_libraries(elevation_bridge lcm)
44 | ament_target_dependencies(elevation_bridge ${dependencies})
45 |
46 | add_executable(imu_bridge
47 | src/imu_bridge.cpp
48 | )
49 | target_link_libraries(imu_bridge lcm)
50 | ament_target_dependencies(imu_bridge ${dependencies})
51 |
52 | add_executable(motor_bridge
53 | src/motor_bridge.cpp
54 | )
55 | target_link_libraries(motor_bridge lcm)
56 | ament_target_dependencies(motor_bridge ${dependencies})
57 |
58 | add_executable(odom_out_publisher
59 | src/odom_out_publisher.cpp
60 | )
61 | target_link_libraries(odom_out_publisher lcm)
62 | ament_target_dependencies(odom_out_publisher ${dependencies})
63 |
64 | add_executable(file_bridge
65 | src/file_bridge.cpp
66 | )
67 | target_link_libraries(file_bridge lcm)
68 | ament_target_dependencies(file_bridge ${dependencies})
69 |
70 | add_executable(as_controller
71 | test/as_controller.cpp
72 | )
73 | target_link_libraries(as_controller lcm)
74 | ament_target_dependencies(as_controller ${dependencies})
75 |
76 | add_executable(as_controller_file
77 | test/as_controller_file.cpp
78 | )
79 | target_link_libraries(as_controller_file lcm)
80 | ament_target_dependencies(as_controller_file ${dependencies})
81 |
82 | if(BUILD_TESTING)
83 | find_package(ament_lint_auto REQUIRED)
84 | # the following line skips the linter which checks for copyrights
85 | # uncomment the line when a copyright and license is not present in all source files
86 | #set(ament_cmake_copyright_FOUND TRUE)
87 | # the following line skips cpplint (only works in a git repo)
88 | # uncomment the line when this package is not in a git repo
89 | #set(ament_cmake_cpplint_FOUND TRUE)xmllint
90 | ament_lint_auto_find_test_dependencies()
91 | endif()
92 |
93 | install(TARGETS
94 | elevation_bridge
95 | imu_bridge
96 | motor_bridge
97 | odom_out_publisher
98 | file_bridge
99 | as_controller
100 | as_controller_file
101 | DESTINATION lib/${PROJECT_NAME}
102 | )
103 | ament_export_dependencies(${dependencies})
104 | ament_package()
105 |
--------------------------------------------------------------------------------
/motion_utils/include/motion_utils/stair_perception.hpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | #ifndef MOTION_UTILS__STAIR_PERCEPTION_HPP_
15 | #define MOTION_UTILS__STAIR_PERCEPTION_HPP_
16 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include "cyberdog_common/cyberdog_log.hpp"
30 | #include "cyberdog_common/cyberdog_toml.hpp"
31 | #include "motion_action/motion_macros.hpp"
32 | namespace cyberdog
33 | {
34 | namespace motion
35 | {
36 |
37 | class StairPerception
38 | {
39 | public:
40 | enum class State
41 | {
42 | IDLE,
43 | BLIND_FORWARD,
44 | TURN_LEFT,
45 | TURN_RIGHT,
46 | APPROACH,
47 | FINISH
48 | };
49 | struct ApproachThreshold
50 | {
51 | std::array range;
52 | int threshold;
53 | };
54 |
55 | public:
56 | StairPerception(const rclcpp::Node::SharedPtr node, const toml::value & config);
57 | void Launch(bool launch) {launch_ = launch;}
58 | bool CheckLaunched() {return launch_;}
59 | const State & GetStatus() const {return state_;}
60 | inline void SetStatus(const State & state) {state_ = state;}
61 | void SetTrigger() {trigger_ = true;}
62 |
63 | private:
64 | void HandlePointCloud(const sensor_msgs::msg::PointCloud2 & msg);
65 | inline int GetMeanDiff(int diff)
66 | {
67 | diffs_.emplace_back(diff);
68 | if (static_cast(diffs_.size()) > filter_size_) {
69 | diffs_.pop_front();
70 | }
71 | int sum = 0;
72 | for (auto diff : diffs_) {
73 | sum += diff;
74 | }
75 | return sum / filter_size_;
76 | }
77 |
78 | pcl::RadiusOutlierRemoval ro_filter_;
79 | pcl::PointCloud::Ptr pc_raw_;
80 | pcl::PointCloud::Ptr pc_filtered_;
81 | pcl::PointCloud::Ptr pc_ro_filtered_;
82 |
83 | sensor_msgs::msg::PointCloud2 pc_filtered_ros_;
84 | rclcpp::Publisher::SharedPtr pc_ro_filtered_pub_;
85 | rclcpp::Node::SharedPtr node_;
86 | rclcpp::Subscription::SharedPtr pcl_sub_;
87 | State state_;
88 | std::deque diffs_;
89 | std::vector approach_thresholds_;
90 | double radius_{0.05};
91 | std::string norms_frame_{"robot"}, pc_frame_{"robot"}, base_link_frame_{"robot"};
92 | int min_neighbors_{5};
93 | int filter_size_ {10};
94 | int orientation_dead_zone_{2}, orientation_correction_{0};
95 | int blind_forward_threshold_{15}, approach_threshold_{100};
96 | bool trigger_ {false}, orientation_filter_ {false};
97 | bool launch_ {false};
98 | }; // calss StairPerception
99 | } // namespace motion
100 | } // namespace cyberdog
101 | #endif // MOTION_UTILS__STAIR_PERCEPTION_HPP_
102 |
--------------------------------------------------------------------------------
/motion_action/test/controller_test.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #include
16 | #include
17 | #include
18 | #include
19 |
20 | class SimMotionController
21 | {
22 | public:
23 | SimMotionController()
24 | {
25 | lcm_sub_.reset(new lcm::LCM(cyberdog::motion::kLCMActionPublishURL));
26 | lcm_pub_.reset(new lcm::LCM(cyberdog::motion::kLCMActionSubscibeURL));
27 | lcm_recv_pub_.reset(new lcm::LCM(cyberdog::motion::kLCMActionPublishURL));
28 | lcm_sub_->subscribe("robot_control_cmd", &SimMotionController::HandleCmd, this);
29 | lcm_sub_->subscribe("user_gait_file", &SimMotionController::HandleFileCmd, this);
30 | std::thread([this]() {while (0 == this->lcm_sub_->handle()) {}}).detach();
31 | }
32 | void Run()
33 | {
34 | while (true) {
35 | // lcm_sub_->handle();
36 | lcm_pub_->publish("robot_control_response", &res_);
37 | // INFO(
38 | // "MotionController send res:\n mode: %d\n gait_id: %d\n contact: %d\n order_process_bar: %d\n switch_status: %d\n ori_error: %d\n footpos_error: %d\n motor_error: [%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d]\n", res_.mode, res_.gait_id, res_.contact, res_.order_process_bar, res_.switch_status, res_.ori_error, res_.footpos_error,
39 | // res_.motor_error[0], res_.motor_error[1], res_.motor_error[2], res_.motor_error[3],
40 | // res_.motor_error[4], res_.motor_error[5], res_.motor_error[6], res_.motor_error[7],
41 | // res_.motor_error[8], res_.motor_error[9], res_.motor_error[10], res_.motor_error[11]);
42 | std::this_thread::sleep_for(std::chrono::milliseconds(50));
43 | }
44 | }
45 |
46 | private:
47 | std::shared_ptr lcm_sub_, lcm_pub_, lcm_recv_pub_;
48 | robot_control_response_lcmt res_;
49 | file_recv_lcmt recv_result_;
50 | void HandleCmd(const lcm::ReceiveBuffer *, const std::string &,
51 | const robot_control_cmd_lcmt * msg)
52 | {
53 | INFO("MotionController get cmd mode %d, gait_id %d, life_count %d", msg->mode, msg->gait_id, msg->life_count);
54 | res_.mode = msg->mode;
55 | res_.gait_id = msg->gait_id;
56 | res_.contact = msg->contact;
57 | res_.order_process_bar = 100;
58 | res_.switch_status = 0;
59 | res_.ori_error = 0;
60 | res_.footpos_error = 0;
61 | memset(res_.motor_error, 0, sizeof(res_.motor_error));
62 | }
63 | void HandleFileCmd(const lcm::ReceiveBuffer *, const std::string &,
64 | const file_send_lcmt * msg)
65 | {
66 | INFO("MotionController get SequenceCmd data %s", msg->data.c_str());
67 | recv_result_.result = 0;
68 | lcm_recv_pub_->publish("user_gait_result", &recv_result_);
69 | INFO("publish result: %d", recv_result_.result);
70 | }
71 | LOGGER_MINOR_INSTANCE("SimMotionController")
72 | };
73 |
74 | void SimMotionControllerFunction()
75 | {
76 | SimMotionController smc;
77 | smc.Run();
78 | }
79 |
80 | int main()
81 | {
82 | LOGGER_MAIN_INSTANCE("test_as_controller")
83 | std::thread t2(SimMotionControllerFunction);
84 |
85 | if (t2.joinable()) {
86 | t2.join();
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/motion_utils/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.8)
2 | project(motion_utils)
3 |
4 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
5 | add_compile_options(-Wall -Wextra -Wpedantic -g)
6 | endif()
7 |
8 | if(NOT CMAKE_C_STANDARD)
9 | set(CMAKE_C_STANDARD 99)
10 | endif()
11 |
12 | if(NOT CMAKE_CXX_STANDARD)
13 | set(CMAKE_CXX_STANDARD 17)
14 | endif()
15 |
16 | # find dependencies
17 | find_package(ament_cmake REQUIRED)
18 | find_package(ament_cmake_python REQUIRED)
19 | find_package(rclcpp REQUIRED)
20 | find_package(rclpy REQUIRED)
21 | find_package(protocol REQUIRED)
22 | find_package(cyberdog_system REQUIRED)
23 | find_package(cyberdog_debug REQUIRED)
24 | find_package(nav_msgs REQUIRED)
25 | find_package(PCL EXACT 1.8.1 REQUIRED COMPONENTS filters)
26 | find_package(pcl_conversions REQUIRED)
27 | # find_package(visualization_msgs REQUIRED)
28 | find_package(cyberdog_common)
29 | find_package(motion_manager)
30 |
31 | include_directories(include ${PCL_INCLUDE_DIRS})
32 |
33 | add_library(${PROJECT_NAME} SHARED src/motion_utils.cpp)
34 | # target_link_libraries(${PROJECT_NAME} lcm)
35 | ament_target_dependencies(${PROJECT_NAME}
36 | rclcpp
37 | protocol
38 | cyberdog_system
39 | cyberdog_common
40 | cyberdog_debug
41 | nav_msgs
42 | )
43 |
44 | add_executable(distance_test test/distance_test.cpp)
45 | target_link_libraries(distance_test ${PROJECT_NAME})
46 | ament_target_dependencies(distance_test lcm cyberdog_common cyberdog_debug)
47 |
48 | add_executable(duration_test test/duration_test.cpp)
49 | target_link_libraries(duration_test ${PROJECT_NAME})
50 | ament_target_dependencies(duration_test lcm cyberdog_common cyberdog_debug)
51 |
52 | add_executable(stair_align test/stair_align.cpp test/stair_perception.cpp test/edge_perception.cpp)
53 | target_link_libraries(stair_align ${PROJECT_NAME} ${PCL_LIBRARIES})
54 | ament_target_dependencies(stair_align cyberdog_common cyberdog_debug pcl_conversions)
55 |
56 | add_executable(stair_perception_test test/stair_perception.cpp test/stair_perception_test.cpp)
57 | target_link_libraries(stair_perception_test ${PROJECT_NAME} ${PCL_LIBRARIES})
58 | ament_target_dependencies(stair_perception_test cyberdog_common cyberdog_debug pcl_conversions)
59 |
60 | add_executable(edge_align test/edge_align.cpp test/edge_perception.cpp)
61 | target_link_libraries(edge_align ${PROJECT_NAME} ${PCL_LIBRARIES})
62 | ament_target_dependencies(edge_align cyberdog_common cyberdog_debug pcl_conversions)
63 |
64 | add_executable(edge_perception_test test/edge_perception.cpp test/edge_perception_test.cpp)
65 | target_link_libraries(edge_perception_test ${PROJECT_NAME} ${PCL_LIBRARIES})
66 | ament_target_dependencies(edge_perception_test cyberdog_common cyberdog_debug pcl_conversions)
67 |
68 | install(
69 | DIRECTORY include/
70 | DESTINATION include
71 | )
72 |
73 | install(TARGETS
74 | ${PROJECT_NAME}
75 | distance_test
76 | duration_test
77 | stair_align
78 | edge_align
79 | stair_perception_test
80 | edge_perception_test
81 | LIBRARY DESTINATION lib
82 | RUNTIME DESTINATION lib/${PROJECT_NAME}
83 | )
84 |
85 | ament_python_install_package(${PROJECT_NAME})
86 |
87 | install(PROGRAMS
88 | scripts/servo_delay_statistics.py
89 | scripts/head_tof_pcl_publisher.py
90 | DESTINATION lib/${PROJECT_NAME}
91 | )
92 |
93 | install(
94 | DIRECTORY launch config
95 | DESTINATION share/${PROJECT_NAME}
96 | )
97 |
98 | if(BUILD_TESTING)
99 | find_package(ament_lint_auto REQUIRED)
100 | ament_lint_auto_find_test_dependencies()
101 | endif()
102 |
103 | ament_export_include_directories(
104 | include
105 | )
106 | ament_export_libraries(
107 | ${PROJECT_NAME}
108 | )
109 | ament_export_dependencies(cyberdog_common cyberdog_debug)
110 | ament_package()
111 |
--------------------------------------------------------------------------------
/motion_utils/include/motion_utils/edge_perception.hpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | #ifndef MOTION_UTILS__EDGE_PERCEPTION_HPP_
15 | #define MOTION_UTILS__EDGE_PERCEPTION_HPP_
16 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include "cyberdog_common/cyberdog_log.hpp"
30 | #include "cyberdog_common/cyberdog_toml.hpp"
31 | #include "motion_action/motion_macros.hpp"
32 | namespace cyberdog
33 | {
34 | namespace motion
35 | {
36 |
37 | class EdgePerception
38 | {
39 | public:
40 | enum class State
41 | {
42 | IDLE,
43 | BLIND_FORWARD,
44 | TURN_LEFT,
45 | TURN_RIGHT,
46 | APPROACH,
47 | FINISH
48 | };
49 | struct ApproachThreshold
50 | {
51 | std::array range;
52 | int threshold;
53 | };
54 |
55 | public:
56 | EdgePerception(const rclcpp::Node::SharedPtr node, const toml::value & config);
57 | void Launch(bool launch) {launch_ = launch;}
58 | bool CheckLaunched() {return launch_;}
59 | const State & GetStatus() const {return state_;}
60 | inline void SetStatus(const State & state) {state_ = state;}
61 | void SetTrigger() {trigger_ = true;}
62 | const bool & GetEdgeIsDeep() const {return is_edge_deep_;}
63 |
64 | private:
65 | void HandlePointCloud(const sensor_msgs::msg::PointCloud2 & msg);
66 | inline int GetMeanDiff(int diff)
67 | {
68 | diffs_.emplace_back(diff);
69 | if (static_cast(diffs_.size()) > filter_size_) {
70 | diffs_.pop_front();
71 | }
72 | int sum = 0;
73 | for (auto diff : diffs_) {
74 | sum += diff;
75 | }
76 | return sum / filter_size_;
77 | }
78 |
79 | pcl::RadiusOutlierRemoval ro_filter_;
80 | pcl::PassThrough pt_filter_;
81 | pcl::PointCloud::Ptr pc_raw_;
82 | pcl::PointCloud::Ptr pc_ptfiltered_;
83 | pcl::PointCloud::Ptr pc_rofiltered_;
84 |
85 | sensor_msgs::msg::PointCloud2 pc_filtered_ros_;
86 | rclcpp::Publisher::SharedPtr pc_ro_filtered_pub_;
87 | rclcpp::Node::SharedPtr node_;
88 | rclcpp::Subscription::SharedPtr pcl_sub_;
89 | State state_;
90 | bool is_edge_deep_{false};
91 | std::deque diffs_;
92 | // std::vector approach_thresholds_;
93 | double radius_{0.05};
94 | std::string norms_frame_{"robot"}, pc_frame_{"robot"}, base_link_frame_{"robot"};
95 | int min_neighbors_{5};
96 | int filter_size_ {10};
97 | int orientation_dead_zone_{2}, orientation_correction_{0};
98 | int blind_forward_threshold_{15}, approach_threshold_{100};
99 | bool trigger_ {false}, orientation_filter_ {false};
100 | double max_depth_{0.5};
101 | bool launch_ {false};
102 | }; // calss EdgePerception
103 | } // namespace motion
104 | } // namespace cyberdog
105 | #endif // MOTION_UTILS__EDGE_PERCEPTION_HPP_
106 |
--------------------------------------------------------------------------------
/elec_skin/include/elec_skin/elec_skin.hpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021 Beijing Xiaomi Mobile Software Co., Ltd. All rights reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | #ifndef ELEC_SKIN__ELEC_SKIN_HPP_
15 | #define ELEC_SKIN__ELEC_SKIN_HPP_
16 |
17 | #include
18 | #include
19 | #include
20 | #include