Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +511 -0
- GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/bindings/py_bindings.cpp +546 -0
- GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/examples/example.py +47 -0
- GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/examples/example_body_tracking.py +86 -0
- GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/examples/example_motion_tracker.py +17 -0
- GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/examples/run_binding_continuous.py +111 -0
- GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/examples/send_json_example.py +29 -0
- GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/examples/test_hand_isactive.py +63 -0
- GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/include/PXREARobotSDK.h +120 -0
- GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/include/aarch64/PXREARobotSDK.h +120 -0
- GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/include/aarch64/nlohmann/json.hpp +0 -0
- GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/include/aarch64/nlohmann/json_fwd.hpp +176 -0
- GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/include/nlohmann/json.hpp +0 -0
- GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/include/nlohmann/json_fwd.hpp +176 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2/camera/camera_opencv.py +51 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2/camera/capture_image.py +51 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2/high_level/b2_sport_client.py +105 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2/low_level/b2_stand_example.py +175 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2/low_level/unitree_legged_const.py +20 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2w/camera/camera_opencv.py +51 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2w/camera/capture_image.py +51 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2w/high_level/b2w_sport_client.py +101 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2w/low_level/b2w_stand_example.py +196 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2w/low_level/unitree_legged_const.py +24 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/g1/audio/g1_audio_client_example.py +44 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/g1/high_level/g1_arm5_sdk_dds_example.py +192 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/g1/high_level/g1_arm7_sdk_dds_example.py +194 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/g1/high_level/g1_loco_client_example.py +117 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/g1/low_level/g1_low_level_example.py +205 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/g1/low_level/g1_move_hands_example.py +225 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/g1/readme.md +5 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/go2/front_camera/camera_opencv.py +41 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/go2/front_camera/capture_image.py +30 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/go2/high_level/go2_sport_client.py +170 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/go2/high_level/go2_utlidar_switch.py +39 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/go2/low_level/go2_stand_example.py +176 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/go2/low_level/unitree_legged_const.py +20 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/go2w/high_level/go2w_sport_client.py +99 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/go2w/low_level/go2w_stand_example.py +196 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/go2w/low_level/unitree_legged_const.py +24 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/h1/high_level/h1_loco_client_example.py +96 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/h1/low_level/h1_low_level_example.py +167 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/h1/low_level/unitree_legged_const.py +5 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/h1_2/low_level/h1_2_low_level_example.py +201 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/helloworld/publisher.py +28 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/helloworld/subscriber.py +20 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/helloworld/user_data.py +9 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/motionSwitcher/motion_switcher_example.py +36 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/obstacles_avoid/obstacles_avoid_move.py +35 -0
- GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/obstacles_avoid/obstacles_avoid_switch.py +94 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,514 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
GR00T-WholeBodyControl/media/groot_wbc.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
GR00T-WholeBodyControl/media/screws.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
GR00T-WholeBodyControl/media/teleop_jumping.gif filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
GR00T-WholeBodyControl/media/ssd.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
GR00T-WholeBodyControl/media/teleop_running.gif filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
GR00T-WholeBodyControl/media/teleop_bimanual.gif filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
GR00T-WholeBodyControl/media/flashing.png filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
GR00T-WholeBodyControl/media/teleop_kneeling.gif filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
GR00T-WholeBodyControl/media/gear_sonic_teleop.gif filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
GR00T-WholeBodyControl/media/teleop_sideways.gif filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
GR00T-WholeBodyControl/media/teleop_getup.gif filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
GR00T-WholeBodyControl/media/teleop_switch_hands.gif filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_shoulder_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_wrist_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/torso_link_rev_1_0.STL filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_wrist_roll_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_hip_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_hand_palm_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/torso_constraint_L_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_hand_thumb_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 57 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_hip_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 58 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_knee_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 59 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_elbow_link_merge.STL filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/waist_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_ankle_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_wrist_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_hand_thumb_2_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_wrist_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 65 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_hand_index_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_hand_palm_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 67 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_hip_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 68 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_hand_index_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 69 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_elbow_link_merge.STL filter=lfs diff=lfs merge=lfs -text
|
| 70 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_hand_middle_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 71 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_hand_index_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 72 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/waist_constraint_L.STL filter=lfs diff=lfs merge=lfs -text
|
| 73 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_wrist_roll_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 74 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/waist_support_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 75 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_hand_middle_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 76 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/waist_constraint_R.STL filter=lfs diff=lfs merge=lfs -text
|
| 77 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_hand_thumb_2_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 78 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_hand_middle_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 79 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_shoulder_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 80 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/head_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 81 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/torso_constraint_R_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 82 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_hand_index_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 83 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_hip_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 84 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_hip_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 85 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 86 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/pelvis.STL filter=lfs diff=lfs merge=lfs -text
|
| 87 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_shoulder_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 88 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_ankle_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 89 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_hip_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 90 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_knee_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 91 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/torso_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 92 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_shoulder_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 93 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_shoulder_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 94 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/logo_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 95 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_shoulder_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 96 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_hand_thumb_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 97 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/waist_yaw_link_rev_1_0.STL filter=lfs diff=lfs merge=lfs -text
|
| 98 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/left_wrist_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 99 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/right_hand_middle_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 100 |
+
GR00T-WholeBodyControl/media/teleop_walking.gif filter=lfs diff=lfs merge=lfs -text
|
| 101 |
+
GR00T-WholeBodyControl/gear_sonic/utils/motion_lib/__pycache__/motion_lib_base.cpython-311.pyc filter=lfs diff=lfs merge=lfs -text
|
| 102 |
+
GR00T-WholeBodyControl/gear_sonic/utils/motion_lib/__pycache__/motion_lib_base.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 103 |
+
GR00T-WholeBodyControl/gear_sonic/data/robot_model/model_data/g1/meshes/pelvis_contour_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 104 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_29dof_leggedlab_allinone.usd filter=lfs diff=lfs merge=lfs -text
|
| 105 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_29dof_anneal_23dof.usd filter=lfs diff=lfs merge=lfs -text
|
| 106 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_27dof_right_hook.usd filter=lfs diff=lfs merge=lfs -text
|
| 107 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_43dof.usd filter=lfs diff=lfs merge=lfs -text
|
| 108 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_29dof.usd filter=lfs diff=lfs merge=lfs -text
|
| 109 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_12dof.usd filter=lfs diff=lfs merge=lfs -text
|
| 110 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_29dof_with_hand_rev_1_0_homie.usd filter=lfs diff=lfs merge=lfs -text
|
| 111 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_23dof.usd filter=lfs diff=lfs merge=lfs -text
|
| 112 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_fix_lower.usd filter=lfs diff=lfs merge=lfs -text
|
| 113 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_27dof_fakehand.usd filter=lfs diff=lfs merge=lfs -text
|
| 114 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_29dof_fakehand.usd filter=lfs diff=lfs merge=lfs -text
|
| 115 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_14dof.usd filter=lfs diff=lfs merge=lfs -text
|
| 116 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_fix_lower_right_hand.usd filter=lfs diff=lfs merge=lfs -text
|
| 117 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_27dof_eef_pad.usd filter=lfs diff=lfs merge=lfs -text
|
| 118 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_27dof_nohand.usd filter=lfs diff=lfs merge=lfs -text
|
| 119 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 120 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_wrist_roll_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 121 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_wrist_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 122 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_shoulder_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 123 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_29dof_with_hand_rev_1_0.usd filter=lfs diff=lfs merge=lfs -text
|
| 124 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_hand_palm_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 125 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/g1_29dof_anneal_23dof.usd filter=lfs diff=lfs merge=lfs -text
|
| 126 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_hip_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 127 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/torso_constraint_L_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 128 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_hand_thumb_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 129 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_knee_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 130 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_hip_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 131 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_elbow_link_merge.STL filter=lfs diff=lfs merge=lfs -text
|
| 132 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_ankle_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 133 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/waist_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 134 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_wrist_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 135 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_hand_thumb_2_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 136 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/cup.stl filter=lfs diff=lfs merge=lfs -text
|
| 137 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/torso_link_23dof_rev_1_0.STL filter=lfs diff=lfs merge=lfs -text
|
| 138 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_little_force_sensor_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 139 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_thumb_force_sensor_3.STL filter=lfs diff=lfs merge=lfs -text
|
| 140 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_hand_index_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 141 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_index_force_sensor_1.STL filter=lfs diff=lfs merge=lfs -text
|
| 142 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link21_R.STL filter=lfs diff=lfs merge=lfs -text
|
| 143 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/d455_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 144 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_hip_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 145 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_wrist_roll_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 146 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_hand_middle_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 147 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_ring_1.STL filter=lfs diff=lfs merge=lfs -text
|
| 148 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_middle_force_sensor_1.STL filter=lfs diff=lfs merge=lfs -text
|
| 149 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link16_R.STL filter=lfs diff=lfs merge=lfs -text
|
| 150 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_hand_index_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 151 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link15_R.STL filter=lfs diff=lfs merge=lfs -text
|
| 152 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_thumb_4.STL filter=lfs diff=lfs merge=lfs -text
|
| 153 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_hand_index_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 154 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_ring_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 155 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link20_L.STL filter=lfs diff=lfs merge=lfs -text
|
| 156 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link15_L.STL filter=lfs diff=lfs merge=lfs -text
|
| 157 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/waist_constraint_L.STL filter=lfs diff=lfs merge=lfs -text
|
| 158 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/waist_support_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 159 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link13_R.STL filter=lfs diff=lfs merge=lfs -text
|
| 160 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_hand_thumb_2_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 161 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_hand_middle_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 162 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_thumb_force_sensor_3.STL filter=lfs diff=lfs merge=lfs -text
|
| 163 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_thumb_force_sensor_1.STL filter=lfs diff=lfs merge=lfs -text
|
| 164 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_hand_middle_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 165 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/waist_constraint_R.STL filter=lfs diff=lfs merge=lfs -text
|
| 166 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link22_L.STL filter=lfs diff=lfs merge=lfs -text
|
| 167 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_shoulder_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 168 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_little_force_sensor_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 169 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/head_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 170 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_little_1.STL filter=lfs diff=lfs merge=lfs -text
|
| 171 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/xl330_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 172 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/torso_constraint_R_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 173 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_palm_force_sensor.STL filter=lfs diff=lfs merge=lfs -text
|
| 174 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_hand_index_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 175 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_index_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 176 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link14_R.STL filter=lfs diff=lfs merge=lfs -text
|
| 177 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_hip_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 178 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_little_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 179 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_hip_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 180 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link12_R.STL filter=lfs diff=lfs merge=lfs -text
|
| 181 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_index_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 182 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_middle_force_sensor_1.STL filter=lfs diff=lfs merge=lfs -text
|
| 183 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_little_force_sensor_1.STL filter=lfs diff=lfs merge=lfs -text
|
| 184 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_little_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 185 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 186 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/pelvis.STL filter=lfs diff=lfs merge=lfs -text
|
| 187 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link18_L.STL filter=lfs diff=lfs merge=lfs -text
|
| 188 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/torso_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 189 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/L_hand_base_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 190 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link19_L.STL filter=lfs diff=lfs merge=lfs -text
|
| 191 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link16_L.STL filter=lfs diff=lfs merge=lfs -text
|
| 192 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_ankle_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 193 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_ring_1.STL filter=lfs diff=lfs merge=lfs -text
|
| 194 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_shoulder_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 195 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_knee_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 196 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_ring_force_sensor_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 197 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link22_R.STL filter=lfs diff=lfs merge=lfs -text
|
| 198 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/head_servo_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 199 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_thumb_3.STL filter=lfs diff=lfs merge=lfs -text
|
| 200 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_middle_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 201 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link12_L.STL filter=lfs diff=lfs merge=lfs -text
|
| 202 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_thumb_force_sensor_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 203 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_hip_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 204 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link19_R.STL filter=lfs diff=lfs merge=lfs -text
|
| 205 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link13_L.STL filter=lfs diff=lfs merge=lfs -text
|
| 206 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_shoulder_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 207 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_thumb_3.STL filter=lfs diff=lfs merge=lfs -text
|
| 208 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_shoulder_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 209 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_ring_force_sensor_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 210 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_middle_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 211 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_ring_force_sensor_1.STL filter=lfs diff=lfs merge=lfs -text
|
| 212 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_index_force_sensor_1.STL filter=lfs diff=lfs merge=lfs -text
|
| 213 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/logo_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 214 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_shoulder_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 215 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/waist_yaw_link_rev_1_0.STL filter=lfs diff=lfs merge=lfs -text
|
| 216 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_wrist_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 217 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_hand_palm_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 218 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_hand_index_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 219 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_elbow_link_merge.STL filter=lfs diff=lfs merge=lfs -text
|
| 220 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_hip_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 221 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_hand_index_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 222 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_hand_middle_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 223 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_wrist_roll_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 224 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/waist_constraint_L.STL filter=lfs diff=lfs merge=lfs -text
|
| 225 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_hand_thumb_2_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 226 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_hand_index_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 227 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/waist_support_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 228 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_hand_middle_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 229 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/waist_constraint_R.STL filter=lfs diff=lfs merge=lfs -text
|
| 230 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_hand_middle_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 231 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_shoulder_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 232 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/head_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 233 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/torso_constraint_R_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 234 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_hip_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 235 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_hand_index_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 236 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_hip_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 237 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/pelvis.STL filter=lfs diff=lfs merge=lfs -text
|
| 238 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 239 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/torso_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 240 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_shoulder_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 241 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_ankle_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 242 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_knee_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 243 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_hip_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 244 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_shoulder_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 245 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_shoulder_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 246 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/logo_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 247 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_shoulder_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 248 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_hand_thumb_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 249 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/pelvis_contour_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 250 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/left_wrist_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 251 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1_old/meshes/right_hand_middle_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 252 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/images/g1_23dof.png filter=lfs diff=lfs merge=lfs -text
|
| 253 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/images/g1_29dof_with_hand.png filter=lfs diff=lfs merge=lfs -text
|
| 254 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/images/g1_29dof.png filter=lfs diff=lfs merge=lfs -text
|
| 255 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/images/g1_dual_arm.png filter=lfs diff=lfs merge=lfs -text
|
| 256 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_little_force_sensor_1.STL filter=lfs diff=lfs merge=lfs -text
|
| 257 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_wrist_roll_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 258 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/torso_link_rev_1_0.STL filter=lfs diff=lfs merge=lfs -text
|
| 259 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_ring_force_sensor_1.STL filter=lfs diff=lfs merge=lfs -text
|
| 260 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link18_R.STL filter=lfs diff=lfs merge=lfs -text
|
| 261 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_middle_force_sensor_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 262 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_shoulder_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 263 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 264 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_wrist_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 265 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link21_L.STL filter=lfs diff=lfs merge=lfs -text
|
| 266 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_G1_EE_pad.STL filter=lfs diff=lfs merge=lfs -text
|
| 267 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_hand_palm_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 268 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_thumb_force_sensor_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 269 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link17_R.STL filter=lfs diff=lfs merge=lfs -text
|
| 270 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_middle_1.STL filter=lfs diff=lfs merge=lfs -text
|
| 271 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_hip_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 272 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/torso_constraint_L_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 273 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_palm_force_sensor.STL filter=lfs diff=lfs merge=lfs -text
|
| 274 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_hand_thumb_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 275 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_knee_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 276 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_base_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 277 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_hip_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 278 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link14_L.STL filter=lfs diff=lfs merge=lfs -text
|
| 279 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_43dof_s3.usda filter=lfs diff=lfs merge=lfs -text
|
| 280 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_ankle_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 281 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/tote_no_bar.STL filter=lfs diff=lfs merge=lfs -text
|
| 282 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_index_force_sensor_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 283 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/waist_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 284 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_thumb_force_sensor_1.STL filter=lfs diff=lfs merge=lfs -text
|
| 285 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_hand_thumb_2_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 286 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/R_hand_base_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 287 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_wrist_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 288 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_thumb_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 289 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_middle_force_sensor_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 290 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_ring_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 291 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_little_1.STL filter=lfs diff=lfs merge=lfs -text
|
| 292 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_G1_EE_pad.STL filter=lfs diff=lfs merge=lfs -text
|
| 293 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_hand_palm_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 294 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_wrist_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 295 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_index_1.STL filter=lfs diff=lfs merge=lfs -text
|
| 296 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link20_R.STL filter=lfs diff=lfs merge=lfs -text
|
| 297 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_thumb_4.STL filter=lfs diff=lfs merge=lfs -text
|
| 298 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_hand_thumb_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 299 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_base_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 300 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_wrist_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 301 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/pelvis_contour_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 302 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_index_force_sensor_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 303 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_thumb_2.STL filter=lfs diff=lfs merge=lfs -text
|
| 304 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_index_1.STL filter=lfs diff=lfs merge=lfs -text
|
| 305 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/Link17_L.STL filter=lfs diff=lfs merge=lfs -text
|
| 306 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/right_hand_middle_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 307 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/left_middle_1.STL filter=lfs diff=lfs merge=lfs -text
|
| 308 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/right_palm_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 309 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/right_shoulder_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 310 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/right_three_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 311 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/right_hip_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 312 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/left_elbow_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 313 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/right_knee_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 314 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/left_hip_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 315 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/right_two_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 316 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/left_ankle_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 317 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/right_elbow_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 318 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/left_six_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 319 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/left_palm_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 320 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/left_hip_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 321 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/right_five_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 322 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/left_shoulder_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 323 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/right_four_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 324 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/head_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 325 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/left_five_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 326 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/right_six_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 327 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/right_hip_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 328 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/right_hip_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 329 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/right_elbow_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 330 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/left_four_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 331 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/pelvis.STL filter=lfs diff=lfs merge=lfs -text
|
| 332 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/left_one_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 333 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/torso_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 334 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/left_shoulder_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 335 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/right_ankle_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 336 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/left_knee_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 337 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/left_hip_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 338 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/right_shoulder_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 339 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/right_shoulder_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 340 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/logo_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 341 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/left_shoulder_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 342 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/pelvis_contour_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 343 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/right_one_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 344 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/left_three_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 345 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/left_two_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 346 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1/left_elbow_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 347 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 348 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_wrist_roll_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 349 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_shoulder_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 350 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_wrist_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 351 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_hand_palm_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 352 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_hip_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 353 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/torso_constraint_L_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 354 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_hand_thumb_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 355 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_knee_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 356 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_hip_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 357 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_ankle_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 358 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/waist_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 359 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_wrist_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 360 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_hand_thumb_2_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 361 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_wrist_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 362 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_hand_palm_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 363 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_hand_index_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 364 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_hip_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 365 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_hand_index_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 366 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_wrist_roll_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 367 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_hand_middle_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 368 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/waist_constraint_L.STL filter=lfs diff=lfs merge=lfs -text
|
| 369 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_hand_index_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 370 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/waist_support_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 371 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_hand_thumb_2_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 372 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_hand_middle_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 373 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/waist_constraint_R.STL filter=lfs diff=lfs merge=lfs -text
|
| 374 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_hand_middle_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 375 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_shoulder_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 376 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/head_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 377 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/torso_constraint_R_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 378 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_hand_index_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 379 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_hip_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 380 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_hip_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 381 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/pelvis.STL filter=lfs diff=lfs merge=lfs -text
|
| 382 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 383 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/torso_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 384 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_ankle_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 385 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_shoulder_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 386 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_knee_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 387 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_hip_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 388 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_shoulder_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 389 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_shoulder_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 390 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/logo_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 391 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_shoulder_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 392 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_hand_thumb_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 393 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/left_wrist_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 394 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/pelvis_contour_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 395 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/old/mesh/G1_23DoF/right_hand_middle_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 396 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/images/g1_23dof.png filter=lfs diff=lfs merge=lfs -text
|
| 397 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/images/g1_29dof.png filter=lfs diff=lfs merge=lfs -text
|
| 398 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/images/g1_29dof_with_hand.png filter=lfs diff=lfs merge=lfs -text
|
| 399 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/images/g1_dual_arm.png filter=lfs diff=lfs merge=lfs -text
|
| 400 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/right_palm_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 401 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_29dof_cylinder/configuration/main_nodex_base.usd filter=lfs diff=lfs merge=lfs -text
|
| 402 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/right_shoulder_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 403 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/right_three_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 404 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/right_hip_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 405 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/left_elbow_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 406 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/left_hip_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 407 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/right_knee_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 408 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/right_two_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 409 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/right_elbow_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 410 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/left_ankle_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 411 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/left_six_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 412 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/left_palm_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 413 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/left_hip_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 414 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/right_five_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 415 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/left_shoulder_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 416 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/head_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 417 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/right_four_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 418 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/left_five_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 419 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/right_six_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 420 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/right_hip_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 421 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/right_hip_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 422 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/right_elbow_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 423 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/left_four_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 424 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/pelvis.STL filter=lfs diff=lfs merge=lfs -text
|
| 425 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/left_one_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 426 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/torso_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 427 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/right_ankle_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 428 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/left_shoulder_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 429 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/left_knee_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 430 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/right_shoulder_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 431 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/left_hip_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 432 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/right_shoulder_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 433 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/left_shoulder_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 434 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/logo_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 435 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/pelvis_contour_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 436 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/right_one_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 437 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/left_three_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 438 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/left_two_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 439 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1/left_elbow_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 440 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_shoulder_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 441 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 442 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_wrist_roll_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 443 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_wrist_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 444 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_hand_palm_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 445 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/torso_constraint_L_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 446 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_hip_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 447 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_hand_thumb_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 448 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_hip_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 449 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_knee_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 450 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_ankle_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 451 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_hand_thumb_2_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 452 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/waist_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 453 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_wrist_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 454 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_wrist_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 455 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_hand_palm_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 456 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_hand_index_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 457 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_wrist_roll_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 458 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_hip_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 459 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_hand_index_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 460 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_hand_middle_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 461 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/waist_constraint_L.STL filter=lfs diff=lfs merge=lfs -text
|
| 462 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_hand_index_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 463 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/waist_support_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 464 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_hand_thumb_2_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 465 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_hand_middle_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 466 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_hand_middle_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 467 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/waist_constraint_R.STL filter=lfs diff=lfs merge=lfs -text
|
| 468 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_shoulder_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 469 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/head_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 470 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/torso_constraint_R_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 471 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_hand_index_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 472 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_hip_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 473 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_hip_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 474 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/pelvis.STL filter=lfs diff=lfs merge=lfs -text
|
| 475 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 476 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/torso_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 477 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_ankle_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 478 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_shoulder_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 479 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_knee_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 480 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_hip_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 481 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_shoulder_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 482 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_shoulder_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 483 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/logo_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 484 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_shoulder_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 485 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_hand_thumb_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 486 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/left_wrist_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 487 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/pelvis_contour_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 488 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/meshes/old/mesh/G1_23DoF/right_hand_middle_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 489 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_29dof_rev_1_0/configuration/g1_29dof_rev_1_0_base.usd filter=lfs diff=lfs merge=lfs -text
|
| 490 |
+
GR00T-WholeBodyControl/gear_sonic/data/robots/g1/g1_sonic_usd/configuration/g1_43dof_main_base.usd filter=lfs diff=lfs merge=lfs -text
|
| 491 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_wrist_roll_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 492 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/torso_link_rev_1_0.STL filter=lfs diff=lfs merge=lfs -text
|
| 493 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/backpack.STL filter=lfs diff=lfs merge=lfs -text
|
| 494 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 495 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_shoulder_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 496 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_wrist_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 497 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_hand_palm_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 498 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_hip_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 499 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/torso_constraint_L_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 500 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_hand_thumb_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 501 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_knee_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 502 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/yam_gripper_base.STL filter=lfs diff=lfs merge=lfs -text
|
| 503 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_hip_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 504 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_ankle_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 505 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/waist_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 506 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_hand_thumb_2_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 507 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_wrist_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 508 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_wrist_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 509 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_hand_palm_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 510 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_hand_index_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 511 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_hip_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 512 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/torso_link_23dof_rev_1_0.STL filter=lfs diff=lfs merge=lfs -text
|
| 513 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_wrist_roll_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 514 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_hand_index_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 515 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_hand_middle_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 516 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/waist_constraint_L.STL filter=lfs diff=lfs merge=lfs -text
|
| 517 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_hand_index_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 518 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/waist_support_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 519 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_hand_thumb_2_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 520 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_hand_middle_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 521 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/waist_constraint_R.STL filter=lfs diff=lfs merge=lfs -text
|
| 522 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_hand_middle_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 523 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_shoulder_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 524 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/head_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 525 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/torso_constraint_R_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 526 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_hand_index_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 527 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_hip_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 528 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_hip_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 529 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/yam_gripper_finger.STL filter=lfs diff=lfs merge=lfs -text
|
| 530 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_rubber_hand.STL filter=lfs diff=lfs merge=lfs -text
|
| 531 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/pelvis.STL filter=lfs diff=lfs merge=lfs -text
|
| 532 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/torso_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 533 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_ankle_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 534 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_shoulder_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 535 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_knee_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 536 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_hip_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 537 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_shoulder_pitch_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 538 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_shoulder_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 539 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/logo_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 540 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_shoulder_yaw_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 541 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/waist_yaw_link_rev_1_0.STL filter=lfs diff=lfs merge=lfs -text
|
| 542 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_hand_thumb_1_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 543 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/left_wrist_roll_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 544 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/pelvis_contour_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 545 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/right_hand_middle_0_link.STL filter=lfs diff=lfs merge=lfs -text
|
| 546 |
+
GR00T-WholeBodyControl/gear_sonic/data/assets/robot_description/meshes/g1/NVBP.STL filter=lfs diff=lfs merge=lfs -text
|
GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/bindings/py_bindings.cpp
ADDED
|
@@ -0,0 +1,546 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#include <pybind11/pybind11.h>
|
| 2 |
+
#include <pybind11/chrono.h>
|
| 3 |
+
#include <pybind11/stl.h>
|
| 4 |
+
#include <thread>
|
| 5 |
+
#include <iostream>
|
| 6 |
+
#include <mutex>
|
| 7 |
+
#include <sstream>
|
| 8 |
+
#include <array>
|
| 9 |
+
#include <nlohmann/json.hpp>
|
| 10 |
+
#include "PXREARobotSDK.h"
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
using json = nlohmann::json;
|
| 14 |
+
|
| 15 |
+
std::array<double, 7> LeftControllerPose;
|
| 16 |
+
std::array<double, 7> RightControllerPose;
|
| 17 |
+
std::array<double, 7> HeadsetPose;
|
| 18 |
+
|
| 19 |
+
std::array<std::array<double, 7>, 26> LeftHandTrackingState;
|
| 20 |
+
double LeftHandScale = 1.0;
|
| 21 |
+
int LeftHandIsActive = 0;
|
| 22 |
+
std::array<std::array<double, 7>, 26> RightHandTrackingState;
|
| 23 |
+
double RightHandScale = 1.0;
|
| 24 |
+
int RightHandIsActive = 0;
|
| 25 |
+
|
| 26 |
+
// Whole body motion data - 24 joints for body tracking
|
| 27 |
+
std::array<std::array<double, 7>, 24> BodyJointsPose; // Position and rotation for each joint
|
| 28 |
+
std::array<std::array<double, 6>, 24> BodyJointsVelocity; // Velocity and angular velocity for each joint
|
| 29 |
+
std::array<std::array<double, 6>, 24> BodyJointsAcceleration; // Acceleration and angular acceleration for each joint
|
| 30 |
+
std::array<int64_t, 24> BodyJointsTimestamp; // IMU timestamp for each joint
|
| 31 |
+
int64_t BodyTimeStampNs = 0; // Body data timestamp
|
| 32 |
+
bool BodyDataAvailable = false; // Flag to indicate if body data is available
|
| 33 |
+
|
| 34 |
+
std::array<std::array<double, 7>, 3> MotionTrackerPose; // Position and rotation for each joint
|
| 35 |
+
std::array<std::array<double, 6>, 3> MotionTrackerVelocity; // Velocity and angular velocity for each joint
|
| 36 |
+
std::array<std::array<double, 6>, 3> MotionTrackerAcceleration; // Acceleration and angular acceleration for each joint
|
| 37 |
+
std::array<std::string, 3> MotionTrackerSerialNumbers; // Serial numbers of the motion trackers
|
| 38 |
+
int64_t MotionTimeStampNs = 0; // Motion data timestamp
|
| 39 |
+
int NumMotionDataAvailable = 0; // number of motion trackers
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
bool LeftMenuButton;
|
| 43 |
+
double LeftTrigger;
|
| 44 |
+
double LeftGrip;
|
| 45 |
+
std::array<double, 2> LeftAxis{0.0, 0.0};
|
| 46 |
+
bool LeftAxisClick;
|
| 47 |
+
bool LeftPrimaryButton;
|
| 48 |
+
bool LeftSecondaryButton;
|
| 49 |
+
|
| 50 |
+
bool RightMenuButton;
|
| 51 |
+
double RightTrigger;
|
| 52 |
+
double RightGrip;
|
| 53 |
+
std::array<double, 2> RightAxis{0.0, 0.0};
|
| 54 |
+
bool RightAxisClick;
|
| 55 |
+
bool RightPrimaryButton;
|
| 56 |
+
bool RightSecondaryButton;
|
| 57 |
+
|
| 58 |
+
int64_t TimeStampNs;
|
| 59 |
+
|
| 60 |
+
std::mutex leftMutex;
|
| 61 |
+
std::mutex rightMutex;
|
| 62 |
+
std::mutex headsetPoseMutex;
|
| 63 |
+
std::mutex timestampMutex;
|
| 64 |
+
std::mutex leftHandMutex;
|
| 65 |
+
std::mutex rightHandMutex;
|
| 66 |
+
std::mutex bodyMutex; // Mutex for body tracking data
|
| 67 |
+
std::mutex motionMutex;
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
std::array<double, 7> stringToPoseArray(const std::string& poseStr) {
|
| 72 |
+
std::array<double, 7> result{0};
|
| 73 |
+
std::stringstream ss(poseStr);
|
| 74 |
+
std::string value;
|
| 75 |
+
int i = 0;
|
| 76 |
+
while (std::getline(ss, value, ',') && i < 7) {
|
| 77 |
+
result[i++] = std::stod(value);
|
| 78 |
+
}
|
| 79 |
+
return result;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
std::array<double, 6> stringToVelocityArray(const std::string& velocityStr) {
|
| 83 |
+
std::array<double, 6> result{0};
|
| 84 |
+
std::stringstream ss(velocityStr);
|
| 85 |
+
std::string value;
|
| 86 |
+
int i = 0;
|
| 87 |
+
while (std::getline(ss, value, ',') && i < 6) {
|
| 88 |
+
result[i++] = std::stod(value);
|
| 89 |
+
}
|
| 90 |
+
return result;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
void OnPXREAClientCallback(void* context, PXREAClientCallbackType type, int status, void* userData)
|
| 94 |
+
{
|
| 95 |
+
switch (type)
|
| 96 |
+
{
|
| 97 |
+
case PXREAServerConnect:
|
| 98 |
+
std::cout << "server connect\n" << std::endl;
|
| 99 |
+
break;
|
| 100 |
+
case PXREAServerDisconnect:
|
| 101 |
+
std::cout << "server disconnect\n" << std::endl;
|
| 102 |
+
break;
|
| 103 |
+
case PXREADeviceFind:
|
| 104 |
+
std::cout << "device found\n" << (const char*)userData << std::endl;
|
| 105 |
+
break;
|
| 106 |
+
case PXREADeviceMissing:
|
| 107 |
+
std::cout << "device missing\n" << (const char*)userData << std::endl;
|
| 108 |
+
break;
|
| 109 |
+
case PXREADeviceConnect:
|
| 110 |
+
std::cout << "device connect\n" << (const char*)userData << status << std::endl;
|
| 111 |
+
break;
|
| 112 |
+
case PXREADeviceStateJson:
|
| 113 |
+
auto& dsj = *((PXREADevStateJson*)userData);
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
try {
|
| 117 |
+
json data = json::parse(dsj.stateJson);
|
| 118 |
+
if (data.contains("value")) {
|
| 119 |
+
auto value = json::parse(data["value"].get<std::string>());
|
| 120 |
+
if (value["Controller"].contains("left")) {
|
| 121 |
+
auto& left = value["Controller"]["left"];
|
| 122 |
+
{
|
| 123 |
+
std::lock_guard<std::mutex> lock(leftMutex);
|
| 124 |
+
LeftControllerPose = stringToPoseArray(left["pose"].get<std::string>());
|
| 125 |
+
LeftTrigger = left["trigger"].get<double>();
|
| 126 |
+
LeftGrip = left["grip"].get<double>();
|
| 127 |
+
LeftMenuButton = left["menuButton"].get<bool>();
|
| 128 |
+
LeftAxis[0] = left["axisX"].get<double>();
|
| 129 |
+
LeftAxis[1] = left["axisY"].get<double>();
|
| 130 |
+
LeftAxisClick = left["axisClick"].get<bool>();
|
| 131 |
+
LeftPrimaryButton = left["primaryButton"].get<bool>();
|
| 132 |
+
LeftSecondaryButton = left["secondaryButton"].get<bool>();
|
| 133 |
+
}
|
| 134 |
+
}
|
| 135 |
+
if (value["Controller"].contains("right")) {
|
| 136 |
+
auto& right = value["Controller"]["right"];
|
| 137 |
+
{
|
| 138 |
+
std::lock_guard<std::mutex> lock(rightMutex);
|
| 139 |
+
RightControllerPose = stringToPoseArray(right["pose"].get<std::string>());
|
| 140 |
+
RightTrigger = right["trigger"].get<double>();
|
| 141 |
+
RightGrip = right["grip"].get<double>();
|
| 142 |
+
RightMenuButton = right["menuButton"].get<bool>();
|
| 143 |
+
RightAxis[0] = right["axisX"].get<double>();
|
| 144 |
+
RightAxis[1] = right["axisY"].get<double>();
|
| 145 |
+
RightAxisClick = right["axisClick"].get<bool>();
|
| 146 |
+
RightPrimaryButton = right["primaryButton"].get<bool>();
|
| 147 |
+
RightSecondaryButton = right["secondaryButton"].get<bool>();
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
if (value.contains("Head")) {
|
| 151 |
+
auto& headset = value["Head"];
|
| 152 |
+
{
|
| 153 |
+
std::lock_guard<std::mutex> lock(headsetPoseMutex);
|
| 154 |
+
HeadsetPose = stringToPoseArray(headset["pose"].get<std::string>());
|
| 155 |
+
}
|
| 156 |
+
}
|
| 157 |
+
if (value.contains("timeStampNs")) {
|
| 158 |
+
std::lock_guard<std::mutex> lock(timestampMutex);
|
| 159 |
+
TimeStampNs = value["timeStampNs"].get<int64_t>();
|
| 160 |
+
}
|
| 161 |
+
if (value["Hand"].contains("leftHand")) {
|
| 162 |
+
auto& leftHand = value["Hand"]["leftHand"];
|
| 163 |
+
{
|
| 164 |
+
std::lock_guard<std::mutex> lock(leftHandMutex);
|
| 165 |
+
|
| 166 |
+
LeftHandScale = leftHand["scale"].get<double>();
|
| 167 |
+
LeftHandIsActive = leftHand["isActive"].get<int>();
|
| 168 |
+
for (int i = 0; i < 26; i++) {
|
| 169 |
+
LeftHandTrackingState[i] = stringToPoseArray(leftHand["HandJointLocations"][i]["p"].get<std::string>());
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
+
if (value["Hand"].contains("rightHand")) {
|
| 174 |
+
auto& rightHand = value["Hand"]["rightHand"];
|
| 175 |
+
{
|
| 176 |
+
std::lock_guard<std::mutex> lock(rightHandMutex);
|
| 177 |
+
RightHandScale = rightHand["scale"].get<double>();
|
| 178 |
+
RightHandIsActive = rightHand["isActive"].get<int>();
|
| 179 |
+
for (int i = 0; i < 26; i++) {
|
| 180 |
+
RightHandTrackingState[i] = stringToPoseArray(rightHand["HandJointLocations"][i]["p"].get<std::string>());
|
| 181 |
+
}
|
| 182 |
+
}
|
| 183 |
+
}
|
| 184 |
+
// Parse Body data for whole body motion capture
|
| 185 |
+
if (value.contains("Body")) {
|
| 186 |
+
auto& body = value["Body"];
|
| 187 |
+
{
|
| 188 |
+
std::lock_guard<std::mutex> lock(bodyMutex);
|
| 189 |
+
|
| 190 |
+
if (body.contains("timeStampNs")) {
|
| 191 |
+
BodyTimeStampNs = body["timeStampNs"].get<int64_t>();
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
if (body.contains("joints") && body["joints"].is_array()) {
|
| 195 |
+
auto joints = body["joints"];
|
| 196 |
+
int jointCount = std::min(static_cast<int>(joints.size()), 24);
|
| 197 |
+
|
| 198 |
+
for (int i = 0; i < jointCount; i++) {
|
| 199 |
+
auto& joint = joints[i];
|
| 200 |
+
|
| 201 |
+
// Parse pose (position and rotation)
|
| 202 |
+
if (joint.contains("p")) {
|
| 203 |
+
BodyJointsPose[i] = stringToPoseArray(joint["p"].get<std::string>());
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
// Parse velocity and angular velocity
|
| 207 |
+
if (joint.contains("va")) {
|
| 208 |
+
BodyJointsVelocity[i] = stringToVelocityArray(joint["va"].get<std::string>());
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
// Parse acceleration and angular acceleration
|
| 212 |
+
if (joint.contains("wva")) {
|
| 213 |
+
BodyJointsAcceleration[i] = stringToVelocityArray(joint["wva"].get<std::string>());
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
// Parse IMU timestamp
|
| 217 |
+
if (joint.contains("t")) {
|
| 218 |
+
BodyJointsTimestamp[i] = joint["t"].get<int64_t>();
|
| 219 |
+
}
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
BodyDataAvailable = true;
|
| 223 |
+
}
|
| 224 |
+
}
|
| 225 |
+
}
|
| 226 |
+
//parse individual tracker data
|
| 227 |
+
if (value.contains("Motion")) {
|
| 228 |
+
auto& motion = value["Motion"];
|
| 229 |
+
{
|
| 230 |
+
std::lock_guard<std::mutex> lock(motionMutex);
|
| 231 |
+
if (motion.contains("timeStampNs")) {
|
| 232 |
+
MotionTimeStampNs = motion["timeStampNs"].get<int64_t>();
|
| 233 |
+
}
|
| 234 |
+
if (motion.contains("joints") && motion["joints"].is_array()) {
|
| 235 |
+
auto joints = motion["joints"];
|
| 236 |
+
NumMotionDataAvailable = std::min(static_cast<int>(joints.size()), 3);
|
| 237 |
+
|
| 238 |
+
for (int i = 0; i < NumMotionDataAvailable; i++) {
|
| 239 |
+
auto& joint = joints[i];
|
| 240 |
+
|
| 241 |
+
// Parse pose (position and rotation)
|
| 242 |
+
if (joint.contains("p")) {
|
| 243 |
+
MotionTrackerPose[i] = stringToPoseArray(joint["p"].get<std::string>());
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
// Parse velocity and angular velocity
|
| 247 |
+
if (joint.contains("va")) {
|
| 248 |
+
MotionTrackerVelocity[i] = stringToVelocityArray(joint["va"].get<std::string>());
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
// Parse acceleration and angular acceleration
|
| 252 |
+
if (joint.contains("wva")) {
|
| 253 |
+
MotionTrackerAcceleration[i] = stringToVelocityArray(joint["wva"].get<std::string>());
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
if (joint.contains("sn")) {
|
| 257 |
+
MotionTrackerSerialNumbers[i] = joint["sn"].get<std::string>();
|
| 258 |
+
}
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
}
|
| 262 |
+
}
|
| 263 |
+
}
|
| 264 |
+
}
|
| 265 |
+
} catch (const json::exception& e) {
|
| 266 |
+
std::cerr << "JSON parsing error: " << e.what() << std::endl;
|
| 267 |
+
}
|
| 268 |
+
break;
|
| 269 |
+
}
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
void init() {
|
| 273 |
+
if (PXREAInit(NULL, OnPXREAClientCallback, PXREAFullMask) != 0) {
|
| 274 |
+
throw std::runtime_error("PXREAInit failed");
|
| 275 |
+
}
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
void deinit() {
|
| 279 |
+
PXREADeinit();
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
std::array<double, 7> getLeftControllerPose() {
|
| 283 |
+
std::lock_guard<std::mutex> lock(leftMutex);
|
| 284 |
+
return LeftControllerPose;
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
std::array<double, 7> getRightControllerPose() {
|
| 288 |
+
std::lock_guard<std::mutex> lock(rightMutex);
|
| 289 |
+
return RightControllerPose;
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
std::array<double, 7> getHeadsetPose() {
|
| 293 |
+
std::lock_guard<std::mutex> lock(headsetPoseMutex);
|
| 294 |
+
return HeadsetPose;
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
double getLeftTrigger() {
|
| 298 |
+
std::lock_guard<std::mutex> lock(leftMutex);
|
| 299 |
+
return LeftTrigger;
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
double getLeftGrip() {
|
| 303 |
+
std::lock_guard<std::mutex> lock(leftMutex);
|
| 304 |
+
return LeftGrip;
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
double getRightTrigger() {
|
| 308 |
+
std::lock_guard<std::mutex> lock(rightMutex);
|
| 309 |
+
return RightTrigger;
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
double getRightGrip() {
|
| 313 |
+
std::lock_guard<std::mutex> lock(rightMutex);
|
| 314 |
+
return RightGrip;
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
bool getLeftMenuButton() {
|
| 318 |
+
std::lock_guard<std::mutex> lock(leftMutex);
|
| 319 |
+
return LeftMenuButton;
|
| 320 |
+
}
|
| 321 |
+
|
| 322 |
+
bool getRightMenuButton() {
|
| 323 |
+
std::lock_guard<std::mutex> lock(rightMutex);
|
| 324 |
+
return RightMenuButton;
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
bool getLeftAxisClick() {
|
| 328 |
+
std::lock_guard<std::mutex> lock(leftMutex);
|
| 329 |
+
return LeftAxisClick;
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
bool getRightAxisClick() {
|
| 333 |
+
std::lock_guard<std::mutex> lock(rightMutex);
|
| 334 |
+
return RightAxisClick;
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
std::array<double, 2> getLeftAxis() {
|
| 338 |
+
std::lock_guard<std::mutex> lock(leftMutex);
|
| 339 |
+
return LeftAxis;
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
|
| 343 |
+
std::array<double, 2> getRightAxis() {
|
| 344 |
+
std::lock_guard<std::mutex> lock(rightMutex);
|
| 345 |
+
return RightAxis;
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
bool getLeftPrimaryButton() {
|
| 349 |
+
std::lock_guard<std::mutex> lock(leftMutex);
|
| 350 |
+
return LeftPrimaryButton;
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
bool getRightPrimaryButton() {
|
| 354 |
+
std::lock_guard<std::mutex> lock(rightMutex);
|
| 355 |
+
return RightPrimaryButton;
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
bool getLeftSecondaryButton() {
|
| 359 |
+
std::lock_guard<std::mutex> lock(leftMutex);
|
| 360 |
+
return LeftSecondaryButton;
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
bool getRightSecondaryButton() {
|
| 364 |
+
std::lock_guard<std::mutex> lock(rightMutex);
|
| 365 |
+
return RightSecondaryButton;
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
int64_t getTimeStampNs() {
|
| 369 |
+
std::lock_guard<std::mutex> lock(timestampMutex);
|
| 370 |
+
return TimeStampNs;
|
| 371 |
+
}
|
| 372 |
+
|
| 373 |
+
std::array<std::array<double, 7>, 26> getLeftHandTrackingState() {
|
| 374 |
+
std::lock_guard<std::mutex> lock(leftHandMutex);
|
| 375 |
+
return LeftHandTrackingState;
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
int getLeftHandScale() {
|
| 379 |
+
std::lock_guard<std::mutex> lock(leftHandMutex);
|
| 380 |
+
return LeftHandScale;
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
int getLeftHandIsActive() {
|
| 384 |
+
std::lock_guard<std::mutex> lock(leftHandMutex);
|
| 385 |
+
return LeftHandIsActive;
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
std::array<std::array<double, 7>, 26> getRightHandTrackingState() {
|
| 389 |
+
std::lock_guard<std::mutex> lock(rightHandMutex);
|
| 390 |
+
return RightHandTrackingState;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
int getRightHandScale() {
|
| 394 |
+
std::lock_guard<std::mutex> lock(rightHandMutex);
|
| 395 |
+
return RightHandScale;
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
int getRightHandIsActive() {
|
| 399 |
+
std::lock_guard<std::mutex> lock(rightHandMutex);
|
| 400 |
+
return RightHandIsActive;
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
// Body tracking functions
|
| 404 |
+
bool isBodyDataAvailable() {
|
| 405 |
+
std::lock_guard<std::mutex> lock(bodyMutex);
|
| 406 |
+
return BodyDataAvailable;
|
| 407 |
+
}
|
| 408 |
+
|
| 409 |
+
std::array<std::array<double, 7>, 24> getBodyJointsPose() {
|
| 410 |
+
std::lock_guard<std::mutex> lock(bodyMutex);
|
| 411 |
+
return BodyJointsPose;
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
std::array<std::array<double, 6>, 24> getBodyJointsVelocity() {
|
| 415 |
+
std::lock_guard<std::mutex> lock(bodyMutex);
|
| 416 |
+
return BodyJointsVelocity;
|
| 417 |
+
}
|
| 418 |
+
|
| 419 |
+
std::array<std::array<double, 6>, 24> getBodyJointsAcceleration() {
|
| 420 |
+
std::lock_guard<std::mutex> lock(bodyMutex);
|
| 421 |
+
return BodyJointsAcceleration;
|
| 422 |
+
}
|
| 423 |
+
|
| 424 |
+
std::array<int64_t, 24> getBodyJointsTimestamp() {
|
| 425 |
+
std::lock_guard<std::mutex> lock(bodyMutex);
|
| 426 |
+
return BodyJointsTimestamp;
|
| 427 |
+
}
|
| 428 |
+
|
| 429 |
+
int64_t getBodyTimeStampNs() {
|
| 430 |
+
std::lock_guard<std::mutex> lock(bodyMutex);
|
| 431 |
+
return BodyTimeStampNs;
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
int numMotionDataAvailable() {
|
| 435 |
+
std::lock_guard<std::mutex> lock(motionMutex);
|
| 436 |
+
return NumMotionDataAvailable;
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
std::vector<std::array<double, 7>> getMotionTrackerPose() {
|
| 440 |
+
std::lock_guard<std::mutex> lock(motionMutex);
|
| 441 |
+
std::vector<std::array<double, 7>> result;
|
| 442 |
+
for (int i = 0; i < NumMotionDataAvailable; i++) {
|
| 443 |
+
result.push_back(MotionTrackerPose[i]);
|
| 444 |
+
}
|
| 445 |
+
return result;
|
| 446 |
+
}
|
| 447 |
+
|
| 448 |
+
std::vector<std::array<double, 6>> getMotionTrackerVelocity() {
|
| 449 |
+
std::lock_guard<std::mutex> lock(motionMutex);
|
| 450 |
+
std::vector<std::array<double, 6>> result;
|
| 451 |
+
for (int i = 0; i < NumMotionDataAvailable; i++) {
|
| 452 |
+
result.push_back(MotionTrackerVelocity[i]);
|
| 453 |
+
}
|
| 454 |
+
return result;
|
| 455 |
+
}
|
| 456 |
+
|
| 457 |
+
std::vector<std::array<double, 6>> getMotionTrackerAcceleration() {
|
| 458 |
+
std::lock_guard<std::mutex> lock(motionMutex);
|
| 459 |
+
std::vector<std::array<double, 6>> result;
|
| 460 |
+
for (int i = 0; i < NumMotionDataAvailable; i++) {
|
| 461 |
+
result.push_back(MotionTrackerAcceleration[i]);
|
| 462 |
+
}
|
| 463 |
+
return result;
|
| 464 |
+
}
|
| 465 |
+
|
| 466 |
+
std::vector<std::string> getMotionTrackerSerialNumbers() {
|
| 467 |
+
std::lock_guard<std::mutex> lock(motionMutex);
|
| 468 |
+
std::vector<std::string> result;
|
| 469 |
+
for (int i = 0; i < NumMotionDataAvailable; i++) {
|
| 470 |
+
result.push_back(MotionTrackerSerialNumbers[i]);
|
| 471 |
+
}
|
| 472 |
+
return result;
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
int64_t getMotionTimeStampNs() {
|
| 476 |
+
std::lock_guard<std::mutex> lock(motionMutex);
|
| 477 |
+
return MotionTimeStampNs;
|
| 478 |
+
}
|
| 479 |
+
|
| 480 |
+
int DeviceControlJsonWrapper(const std::string& dev_id, const std::string& json_str) {
|
| 481 |
+
const int rc = PXREADeviceControlJson(dev_id.c_str(), json_str.c_str());
|
| 482 |
+
if (rc != 0) {
|
| 483 |
+
throw std::runtime_error("device_control_json failed");
|
| 484 |
+
}
|
| 485 |
+
return rc; // 0
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
int SendBytesToDeviceWrapper(const std::string& dev_id, pybind11::bytes blob) {
|
| 489 |
+
std::string s = blob; // copy Python bytes to std::string
|
| 490 |
+
const int rc = PXREASendBytesToDevice(dev_id.c_str(), s.data(), static_cast<unsigned>(s.size()));
|
| 491 |
+
if (rc != 0) {
|
| 492 |
+
throw std::runtime_error("send_bytes_to_device failed");
|
| 493 |
+
}
|
| 494 |
+
return rc; // 0
|
| 495 |
+
}
|
| 496 |
+
|
| 497 |
+
|
| 498 |
+
PYBIND11_MODULE(xrobotoolkit_sdk, m) {
|
| 499 |
+
m.def("init", &init, "Initialize the PXREARobot SDK.");
|
| 500 |
+
m.def("close", &deinit, "Deinitialize the PXREARobot SDK.");
|
| 501 |
+
m.def("get_left_controller_pose", &getLeftControllerPose, "Get the left controller pose.");
|
| 502 |
+
m.def("get_right_controller_pose", &getRightControllerPose, "Get the right controller pose.");
|
| 503 |
+
m.def("get_headset_pose", &getHeadsetPose, "Get the headset pose.");
|
| 504 |
+
m.def("get_left_trigger", &getLeftTrigger, "Get the left trigger value.");
|
| 505 |
+
m.def("get_left_grip", &getLeftGrip, "Get the left grip value.");
|
| 506 |
+
m.def("get_right_trigger", &getRightTrigger, "Get the right trigger value.");
|
| 507 |
+
m.def("get_right_grip", &getRightGrip, "Get the right grip value.");
|
| 508 |
+
m.def("get_left_menu_button", &getLeftMenuButton, "Get the left menu button state.");
|
| 509 |
+
m.def("get_right_menu_button", &getRightMenuButton, "Get the right menu button state.");
|
| 510 |
+
m.def("get_left_axis_click", &getLeftAxisClick, "Get the left axis click state.");
|
| 511 |
+
m.def("get_right_axis_click", &getRightAxisClick, "Get the right axis click state.");
|
| 512 |
+
m.def("get_left_axis", &getLeftAxis, "Get the left axis values (x, y).");
|
| 513 |
+
m.def("get_right_axis", &getRightAxis, "Get the right axis values (x, y).");
|
| 514 |
+
m.def("get_X_button", &getLeftPrimaryButton, "Get the left primary button state.");
|
| 515 |
+
m.def("get_A_button", &getRightPrimaryButton, "Get the right primary button state.");
|
| 516 |
+
m.def("get_Y_button", &getLeftSecondaryButton, "Get the left secondary button state.");
|
| 517 |
+
m.def("get_B_button", &getRightSecondaryButton, "Get the right secondary button state.");
|
| 518 |
+
m.def("get_time_stamp_ns", &getTimeStampNs, "Get the timestamp in nanoseconds.");
|
| 519 |
+
m.def("get_left_hand_tracking_state", &getLeftHandTrackingState, "Get the left hand state.");
|
| 520 |
+
m.def("get_right_hand_tracking_state", &getRightHandTrackingState, "Get the right hand state.");
|
| 521 |
+
m.def("get_left_hand_is_active", &getLeftHandIsActive, "Get the left hand tracking quality (0 = low, 1 = high).");
|
| 522 |
+
m.def("get_right_hand_is_active", &getRightHandIsActive, "Get the right hand tracking quality (0 = low, 1 = high).");
|
| 523 |
+
|
| 524 |
+
// Body tracking functions
|
| 525 |
+
m.def("is_body_data_available", &isBodyDataAvailable, "Check if body tracking data is available.");
|
| 526 |
+
m.def("get_body_joints_pose", &getBodyJointsPose, "Get the body joints pose data (24 joints, 7 values each: x,y,z,qx,qy,qz,qw).");
|
| 527 |
+
m.def("get_body_joints_velocity", &getBodyJointsVelocity, "Get the body joints velocity data (24 joints, 6 values each: vx,vy,vz,wx,wy,wz).");
|
| 528 |
+
m.def("get_body_joints_acceleration", &getBodyJointsAcceleration, "Get the body joints acceleration data (24 joints, 6 values each: ax,ay,az,wax,way,waz).");
|
| 529 |
+
m.def("get_body_joints_timestamp", &getBodyJointsTimestamp, "Get the body joints IMU timestamp data (24 joints).");
|
| 530 |
+
m.def("get_body_timestamp_ns", &getBodyTimeStampNs, "Get the body data timestamp in nanoseconds.");
|
| 531 |
+
|
| 532 |
+
// Motion tracker functions
|
| 533 |
+
m.def("num_motion_data_available", &numMotionDataAvailable, "Check if motion tracker data is available.");
|
| 534 |
+
m.def("get_motion_tracker_pose", &getMotionTrackerPose, "Get the motion tracker pose data (3 trackers, 7 values each: x,y,z,qx,qy,qz,qw).");
|
| 535 |
+
m.def("get_motion_tracker_velocity", &getMotionTrackerVelocity, "Get the motion tracker velocity data (3 trackers, 6 values each: vx,vy,vz,wx,wy,wz).");
|
| 536 |
+
m.def("get_motion_tracker_acceleration", &getMotionTrackerAcceleration, "Get the motion tracker acceleration data (3 trackers, 6 values each: ax,ay,az,wax,way,waz).");
|
| 537 |
+
m.def("get_motion_tracker_serial_numbers", &getMotionTrackerSerialNumbers, "Get the serial numbers of the motion trackers.");
|
| 538 |
+
m.def("get_motion_timestamp_ns", &getMotionTimeStampNs, "Get the motion data timestamp in nanoseconds.");
|
| 539 |
+
|
| 540 |
+
|
| 541 |
+
// send json bytes functions
|
| 542 |
+
m.def("device_control_json", &DeviceControlJsonWrapper, "Send a JSON control command to a device");
|
| 543 |
+
m.def("send_bytes_to_device", &SendBytesToDeviceWrapper, "Send raw bytes to a device");
|
| 544 |
+
|
| 545 |
+
m.doc() = "Python bindings for PXREARobot SDK using pybind11.";
|
| 546 |
+
}
|
GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/examples/example.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 1. Get Controller and Headset Poses
|
| 2 |
+
|
| 3 |
+
import xrobotoolkit_sdk as xrt
|
| 4 |
+
|
| 5 |
+
xrt.init()
|
| 6 |
+
|
| 7 |
+
left_pose = xrt.get_left_controller_pose()
|
| 8 |
+
right_pose = xrt.get_right_controller_pose()
|
| 9 |
+
headset_pose = xrt.get_headset_pose()
|
| 10 |
+
|
| 11 |
+
print(f"Left Controller Pose: {left_pose}")
|
| 12 |
+
print(f"Right Controller Pose: {right_pose}")
|
| 13 |
+
print(f"Headset Pose: {headset_pose}")
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# 2. Get Controller Inputs (Triggers, Grips, Buttons, Axes)**
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
# Triggers and Grips
|
| 21 |
+
left_trigger = xrt.get_left_trigger()
|
| 22 |
+
right_grip = xrt.get_right_grip()
|
| 23 |
+
print(f"Left Trigger: {left_trigger}, Right Grip: {right_grip}")
|
| 24 |
+
|
| 25 |
+
# Buttons
|
| 26 |
+
a_button_pressed = xrt.get_A_button()
|
| 27 |
+
x_button_pressed = xrt.get_X_button()
|
| 28 |
+
print(f"A Button Pressed: {a_button_pressed}, X Button Pressed: {x_button_pressed}")
|
| 29 |
+
|
| 30 |
+
# Axes
|
| 31 |
+
left_axis = xrt.get_left_axis()
|
| 32 |
+
right_axis_click = xrt.get_right_axis_click()
|
| 33 |
+
print(f"Left Axis: {left_axis}, Right Axis Clicked: {right_axis_click}")
|
| 34 |
+
|
| 35 |
+
# Timestamp
|
| 36 |
+
timestamp = xrt.get_time_stamp_ns()
|
| 37 |
+
print(f"Current Timestamp (ns): {timestamp}")
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
# 3. Get hand tracking state
|
| 41 |
+
|
| 42 |
+
# Left Hand State
|
| 43 |
+
left_hand_tracking_state = xrt.get_left_hand_tracking_state()
|
| 44 |
+
print(f"Left Hand State: {left_hand_tracking_state}")
|
| 45 |
+
# Right Hand State
|
| 46 |
+
right_hand_tracking_state = xrt.get_right_hand_tracking_state()
|
| 47 |
+
print(f"Right Hand State: {right_hand_tracking_state}")
|
GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/examples/example_body_tracking.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Example script demonstrating whole body motion tracking with XRoboToolkit SDK.
|
| 4 |
+
|
| 5 |
+
This script shows how to:
|
| 6 |
+
1. Check if body tracking data is available
|
| 7 |
+
2. Get body joint poses (position and rotation)
|
| 8 |
+
3. Get body joint velocities and accelerations
|
| 9 |
+
4. Get IMU timestamps for each joint
|
| 10 |
+
5. Get body data timestamp
|
| 11 |
+
6. Save data to structured format (pickle/json)
|
| 12 |
+
|
| 13 |
+
Body Joint Indices (24 joints total):
|
| 14 |
+
0: Pelvis, 1: Left Hip, 2: Right Hip, 3: Spine1, 4: Left Knee, 5: Right Knee,
|
| 15 |
+
6: Spine2, 7: Left Ankle, 8: Right Ankle, 9: Spine3, 10: Left Foot, 11: Right Foot,
|
| 16 |
+
12: Neck, 13: Left Collar, 14: Right Collar, 15: Head, 16: Left Shoulder, 17: Right Shoulder,
|
| 17 |
+
18: Left Elbow, 19: Right Elbow, 20: Left Wrist, 21: Right Wrist, 22: Left Hand, 23: Right Hand
|
| 18 |
+
"""
|
| 19 |
+
|
| 20 |
+
import xrobotoolkit_sdk as xrt
|
| 21 |
+
import time
|
| 22 |
+
import argparse
|
| 23 |
+
import csv
|
| 24 |
+
import os
|
| 25 |
+
import json
|
| 26 |
+
import pickle
|
| 27 |
+
from datetime import datetime
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def main():
|
| 31 |
+
|
| 32 |
+
xrt.init()
|
| 33 |
+
|
| 34 |
+
while not xrt.is_body_data_available():
|
| 35 |
+
time.sleep(0.01)
|
| 36 |
+
|
| 37 |
+
if xrt.is_body_data_available():
|
| 38 |
+
print("Body tracking data is available!")
|
| 39 |
+
|
| 40 |
+
# Joint names for reference
|
| 41 |
+
joint_names = [
|
| 42 |
+
"Pelvis", "Left_Hip", "Right_Hip", "Spine1", "Left_Knee", "Right_Knee",
|
| 43 |
+
"Spine2", "Left_Ankle", "Right_Ankle", "Spine3", "Left_Foot", "Right_Foot",
|
| 44 |
+
"Neck", "Left_Collar", "Right_Collar", "Head", "Left_Shoulder", "Right_Shoulder",
|
| 45 |
+
"Left_Elbow", "Right_Elbow", "Left_Wrist", "Right_Wrist", "Left_Hand", "Right_Hand"
|
| 46 |
+
]
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
body_poses = xrt.get_body_joints_pose() # list of [x, y, z, qx, qy, qz, qw]
|
| 50 |
+
body_velocities = xrt.get_body_joints_velocity() # vx, vy, vz, wx, wy, wz
|
| 51 |
+
body_accelerations = xrt.get_body_joints_acceleration() # ax, ay, az, wax, way, waz
|
| 52 |
+
imu_timestamps = xrt.get_body_joints_timestamp() # list of [timestamp]
|
| 53 |
+
body_timestamp = xrt.get_body_timestamp_ns() # timestamp in ns
|
| 54 |
+
|
| 55 |
+
saved_data = []
|
| 56 |
+
length = 500
|
| 57 |
+
step_idx = 0
|
| 58 |
+
while len(saved_data) < length:
|
| 59 |
+
|
| 60 |
+
# Sample data at specified rate
|
| 61 |
+
if xrt.is_body_data_available():
|
| 62 |
+
# Get all body tracking data
|
| 63 |
+
body_poses = xrt.get_body_joints_pose()
|
| 64 |
+
body_velocities = xrt.get_body_joints_velocity()
|
| 65 |
+
body_accelerations = xrt.get_body_joints_acceleration()
|
| 66 |
+
imu_timestamps = xrt.get_body_joints_timestamp()
|
| 67 |
+
body_timestamp = xrt.get_body_timestamp_ns()
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
body_pose_dict = {}
|
| 71 |
+
for i, joint_name in enumerate(joint_names):
|
| 72 |
+
pos = [body_poses[i][0], body_poses[i][1], body_poses[i][2]]
|
| 73 |
+
rot = [body_poses[i][6], body_poses[i][3], body_poses[i][4], body_poses[i][5]] # scalar first
|
| 74 |
+
body_pose_dict[joint_name] = [pos, rot]
|
| 75 |
+
|
| 76 |
+
saved_data.append(body_pose_dict)
|
| 77 |
+
step_idx += 1
|
| 78 |
+
time.sleep(1/50)
|
| 79 |
+
print(f"Step {step_idx} of {length}")
|
| 80 |
+
|
| 81 |
+
with open('body_tracking_data.pkl', 'wb') as f:
|
| 82 |
+
pickle.dump(saved_data, f)
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
if __name__ == "__main__":
|
| 86 |
+
main()
|
GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/examples/example_motion_tracker.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import xrobotoolkit_sdk as xrt
|
| 2 |
+
|
| 3 |
+
xrt.init()
|
| 4 |
+
num_motion_data = xrt.num_motion_data_available()
|
| 5 |
+
print(f"Number of Motion Trackers: {num_motion_data}")
|
| 6 |
+
if num_motion_data > 0:
|
| 7 |
+
motion_tracker_pose = xrt.get_motion_tracker_pose()
|
| 8 |
+
motion_tracker_velocity = xrt.get_motion_tracker_velocity()
|
| 9 |
+
motion_tracker_acceleration = xrt.get_motion_tracker_acceleration()
|
| 10 |
+
motion_tracker_serial_numbers = xrt.get_motion_tracker_serial_numbers()
|
| 11 |
+
motion_timestamp_ns = xrt.get_motion_timestamp_ns()
|
| 12 |
+
|
| 13 |
+
print(f"Motion Tracker Pose: {motion_tracker_pose}")
|
| 14 |
+
print(f"Motion Tracker Velocity: {motion_tracker_velocity}")
|
| 15 |
+
print(f"Motion Tracker Acceleration: {motion_tracker_acceleration}")
|
| 16 |
+
print(f"Motion Tracker Serial Numbers: {motion_tracker_serial_numbers}")
|
| 17 |
+
print(f"Motion Timestamp (ns): {motion_timestamp_ns}")
|
GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/examples/run_binding_continuous.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
import time
|
| 3 |
+
|
| 4 |
+
import xrobotoolkit_sdk as xrt
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def run_tests():
|
| 8 |
+
print("Starting Python binding test...")
|
| 9 |
+
|
| 10 |
+
try:
|
| 11 |
+
print("Initializing SDK...")
|
| 12 |
+
xrt.init()
|
| 13 |
+
print("SDK Initialized successfully.")
|
| 14 |
+
|
| 15 |
+
print("\n--- Testing all functions for 10 iterations ---")
|
| 16 |
+
for i in range(100):
|
| 17 |
+
print(f"\n--- Iteration {i+1} ---")
|
| 18 |
+
|
| 19 |
+
# Poses
|
| 20 |
+
left_pose = xrt.get_left_controller_pose()
|
| 21 |
+
right_pose = xrt.get_right_controller_pose()
|
| 22 |
+
headset_pose = xrt.get_headset_pose()
|
| 23 |
+
print(f"Left Controller Pose: {left_pose}")
|
| 24 |
+
print(f"Right Controller Pose: {right_pose}")
|
| 25 |
+
print(f"Headset Pose: {headset_pose}")
|
| 26 |
+
|
| 27 |
+
# Triggers
|
| 28 |
+
left_trigger = xrt.get_left_trigger()
|
| 29 |
+
right_trigger = xrt.get_right_trigger()
|
| 30 |
+
print(f"Left Trigger: {left_trigger}")
|
| 31 |
+
print(f"Right Trigger: {right_trigger}")
|
| 32 |
+
|
| 33 |
+
# Grips
|
| 34 |
+
left_grip = xrt.get_left_grip()
|
| 35 |
+
right_grip = xrt.get_right_grip()
|
| 36 |
+
print(f"Left Grip: {left_grip}")
|
| 37 |
+
print(f"Right Grip: {right_grip}")
|
| 38 |
+
|
| 39 |
+
# Menu Buttons
|
| 40 |
+
left_menu = xrt.get_left_menu_button()
|
| 41 |
+
right_menu = xrt.get_right_menu_button()
|
| 42 |
+
print(f"Left Menu Button: {left_menu}")
|
| 43 |
+
print(f"Right Menu Button: {right_menu}")
|
| 44 |
+
|
| 45 |
+
# Axis Clicks
|
| 46 |
+
left_axis_click = xrt.get_left_axis_click()
|
| 47 |
+
right_axis_click = xrt.get_right_axis_click()
|
| 48 |
+
print(f"Left Axis Click: {left_axis_click}")
|
| 49 |
+
print(f"Right Axis Click: {right_axis_click}")
|
| 50 |
+
|
| 51 |
+
# Axes
|
| 52 |
+
left_axis = xrt.get_left_axis()
|
| 53 |
+
right_axis = xrt.get_right_axis()
|
| 54 |
+
print(f"Left Axis (X, Y): {left_axis}")
|
| 55 |
+
print(f"Right Axis (X, Y): {right_axis}")
|
| 56 |
+
|
| 57 |
+
# Primary Buttons (X, A)
|
| 58 |
+
x_button = xrt.get_X_button() # Left Primary
|
| 59 |
+
a_button = xrt.get_A_button() # Right Primary
|
| 60 |
+
print(f"X Button (Left Primary): {x_button}")
|
| 61 |
+
print(f"A Button (Right Primary): {a_button}")
|
| 62 |
+
|
| 63 |
+
# Secondary Buttons (Y, B)
|
| 64 |
+
y_button = xrt.get_Y_button() # Left Secondary
|
| 65 |
+
b_button = xrt.get_B_button() # Right Secondary
|
| 66 |
+
print(f"Y Button (Left Secondary): {y_button}")
|
| 67 |
+
print(f"B Button (Right Secondary): {b_button}")
|
| 68 |
+
|
| 69 |
+
# Left Hand State
|
| 70 |
+
left_hand_state = xrt.get_left_hand_tracking_state()
|
| 71 |
+
print(f"Left Hand State: {left_hand_state}")
|
| 72 |
+
# Right Hand State
|
| 73 |
+
right_hand_state = xrt.get_right_hand_tracking_state()
|
| 74 |
+
print(f"Right Hand State: {right_hand_state}")
|
| 75 |
+
|
| 76 |
+
# Timestamp
|
| 77 |
+
timestamp = xrt.get_time_stamp_ns()
|
| 78 |
+
print(f"Timestamp (ns): {timestamp}")
|
| 79 |
+
|
| 80 |
+
num_motion_data = xrt.num_motion_data_available()
|
| 81 |
+
print(f"Number of Motion Trackers: {num_motion_data}")
|
| 82 |
+
if num_motion_data > 0:
|
| 83 |
+
motion_tracker_pose = xrt.get_motion_tracker_pose()
|
| 84 |
+
motion_tracker_velocity = xrt.get_motion_tracker_velocity()
|
| 85 |
+
motion_tracker_acceleration = xrt.get_motion_tracker_acceleration()
|
| 86 |
+
motion_tracker_serial_numbers = xrt.get_motion_tracker_serial_numbers()
|
| 87 |
+
motion_timestamp_ns = xrt.get_motion_timestamp_ns()
|
| 88 |
+
|
| 89 |
+
print(f"Motion Tracker Pose: {motion_tracker_pose}")
|
| 90 |
+
print(f"Motion Tracker Velocity: {motion_tracker_velocity}")
|
| 91 |
+
print(f"Motion Tracker Acceleration: {motion_tracker_acceleration}")
|
| 92 |
+
print(f"Motion Tracker Serial Numbers: {motion_tracker_serial_numbers}")
|
| 93 |
+
print(f"Motion Timestamp (ns): {motion_timestamp_ns}")
|
| 94 |
+
|
| 95 |
+
time.sleep(0.5) # Wait for 0.5 seconds before the next iteration
|
| 96 |
+
|
| 97 |
+
print("\nAll iterations complete.")
|
| 98 |
+
|
| 99 |
+
except RuntimeError as e:
|
| 100 |
+
print(f"Runtime Error: {e}", file=sys.stderr)
|
| 101 |
+
except Exception as e:
|
| 102 |
+
print(f"An unexpected error occurred: {e}", file=sys.stderr)
|
| 103 |
+
finally:
|
| 104 |
+
print("\nClosing SDK...")
|
| 105 |
+
xrt.close()
|
| 106 |
+
print("SDK closed.")
|
| 107 |
+
print("Test finished.")
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
if __name__ == "__main__":
|
| 111 |
+
run_tests()
|
GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/examples/send_json_example.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json, time
|
| 2 |
+
import xrobotoolkit_sdk as xrt
|
| 3 |
+
from datetime import datetime
|
| 4 |
+
|
| 5 |
+
xrt.init() # 建链、启动心跳与服务端反馈流
|
| 6 |
+
|
| 7 |
+
dev_id = "TestDevice" # your device ID in unity app
|
| 8 |
+
|
| 9 |
+
# send JSON
|
| 10 |
+
|
| 11 |
+
for i in range(3):
|
| 12 |
+
print("start sending")
|
| 13 |
+
start = int(time.time() * 1e3)
|
| 14 |
+
cmd = {"functionName": "set_robot", "value": {"mode": "teach"}, "timestamp_ns": start}
|
| 15 |
+
jsonfile= json.dumps(cmd)
|
| 16 |
+
jsontime = int(time.time()*1e3)
|
| 17 |
+
xrt.device_control_json(dev_id,jsonfile)
|
| 18 |
+
end = int(time.time()*1e3)
|
| 19 |
+
|
| 20 |
+
print("json process time", jsontime - start)
|
| 21 |
+
|
| 22 |
+
print("current time difference ", end-start)
|
| 23 |
+
# send bytes
|
| 24 |
+
print("send_bytes_to_device rc =", xrt.send_bytes_to_device(dev_id, b"\xAA\x55\x10\x00"))
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
|
GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/examples/test_hand_isactive.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Test script for hand tracking isActive functionality.
|
| 4 |
+
|
| 5 |
+
This script demonstrates how to use the new isActive functions to check
|
| 6 |
+
hand tracking quality for both left and right hands.
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
import xrobotoolkit_sdk as xrt
|
| 10 |
+
import time
|
| 11 |
+
|
| 12 |
+
def main():
|
| 13 |
+
try:
|
| 14 |
+
# Initialize the SDK
|
| 15 |
+
print("Initializing XRoboToolkit SDK...")
|
| 16 |
+
xrt.init()
|
| 17 |
+
|
| 18 |
+
print("Testing hand tracking isActive functionality...")
|
| 19 |
+
print("isActive values: 0 = low quality, 1 = high quality")
|
| 20 |
+
print("Press Ctrl+C to stop\n")
|
| 21 |
+
|
| 22 |
+
while True:
|
| 23 |
+
# Get hand tracking states
|
| 24 |
+
left_hand_state = xrt.get_left_hand_tracking_state()
|
| 25 |
+
right_hand_state = xrt.get_right_hand_tracking_state()
|
| 26 |
+
|
| 27 |
+
# Get hand tracking quality (isActive)
|
| 28 |
+
left_hand_active = xrt.get_left_hand_is_active()
|
| 29 |
+
right_hand_active = xrt.get_right_hand_is_active()
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
print(f"Left Hand: isActive={left_hand_active}")
|
| 33 |
+
print(f"Right Hand: isActive={right_hand_active}")
|
| 34 |
+
|
| 35 |
+
# Show hand tracking quality status
|
| 36 |
+
left_quality = "HIGH" if left_hand_active == 1 else "LOW"
|
| 37 |
+
right_quality = "HIGH" if right_hand_active == 1 else "LOW"
|
| 38 |
+
|
| 39 |
+
print(f"Left Hand Quality: {left_quality}")
|
| 40 |
+
print(f"Right Hand Quality: {right_quality}")
|
| 41 |
+
|
| 42 |
+
# Example of first joint position for reference
|
| 43 |
+
if len(left_hand_state) > 0:
|
| 44 |
+
left_wrist_pos = left_hand_state[0][:3] # x, y, z
|
| 45 |
+
print(f"Left Wrist Position: ({left_wrist_pos[0]:.3f}, {left_wrist_pos[1]:.3f}, {left_wrist_pos[2]:.3f})")
|
| 46 |
+
|
| 47 |
+
if len(right_hand_state) > 0:
|
| 48 |
+
right_wrist_pos = right_hand_state[0][:3] # x, y, z
|
| 49 |
+
print(f"Right Wrist Position: ({right_wrist_pos[0]:.3f}, {right_wrist_pos[1]:.3f}, {right_wrist_pos[2]:.3f})")
|
| 50 |
+
|
| 51 |
+
print("-" * 50)
|
| 52 |
+
time.sleep(1)
|
| 53 |
+
|
| 54 |
+
except KeyboardInterrupt:
|
| 55 |
+
print("\nStopping hand tracking test...")
|
| 56 |
+
except Exception as e:
|
| 57 |
+
print(f"Error: {e}")
|
| 58 |
+
finally:
|
| 59 |
+
print("Closing SDK...")
|
| 60 |
+
xrt.close()
|
| 61 |
+
|
| 62 |
+
if __name__ == "__main__":
|
| 63 |
+
main()
|
GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/include/PXREARobotSDK.h
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @file PXREARobotSDK.h
|
| 3 |
+
* @brief Robot SDK header file for client-side communication
|
| 4 |
+
*/
|
| 5 |
+
#ifndef PXREACLIENTSDK_H
|
| 6 |
+
#define PXREACLIENTSDK_H
|
| 7 |
+
#ifdef _WIN32
|
| 8 |
+
#if defined(PXREACLIENTSDK_LIBRARY)
|
| 9 |
+
# define PXREACLIENTSDK_EXPORT __declspec(dllexport)
|
| 10 |
+
#else
|
| 11 |
+
# define PXREACLIENTSDK_EXPORT __declspec(dllimport)
|
| 12 |
+
#endif
|
| 13 |
+
#endif
|
| 14 |
+
|
| 15 |
+
#ifdef __linux__
|
| 16 |
+
#if defined(PXREACLIENTSDK_LIBRARY)
|
| 17 |
+
# define PXREACLIENTSDK_EXPORT __attribute__((visibility("default")))
|
| 18 |
+
#else
|
| 19 |
+
# define PXREACLIENTSDK_EXPORT __attribute__((visibility("default")))
|
| 20 |
+
#endif
|
| 21 |
+
#endif
|
| 22 |
+
|
| 23 |
+
#ifdef __cplusplus
|
| 24 |
+
extern "C" {
|
| 25 |
+
#endif
|
| 26 |
+
|
| 27 |
+
enum PXREAClientCallbackType
|
| 28 |
+
{
|
| 29 |
+
/// @brief Server connected
|
| 30 |
+
PXREAServerConnect = 1<<2,
|
| 31 |
+
/// @brief Server disconnected
|
| 32 |
+
PXREAServerDisconnect = 1<<3,
|
| 33 |
+
/// @brief Device online
|
| 34 |
+
PXREADeviceFind = 1<<4,
|
| 35 |
+
/// @brief Device offline
|
| 36 |
+
PXREADeviceMissing = 1<<5,
|
| 37 |
+
/// @brief Device connected
|
| 38 |
+
PXREADeviceConnect = 1<<9,
|
| 39 |
+
/// @brief Device state in JSON format
|
| 40 |
+
PXREADeviceStateJson = 1<<25,
|
| 41 |
+
/// @brief Custom message
|
| 42 |
+
PXREADeviceCustomMessage = 1<<26,
|
| 43 |
+
/// @brief Mask for enabling all callbacks
|
| 44 |
+
PXREAFullMask = 0xffffffff
|
| 45 |
+
};
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
/// @brief Device state in JSON format
|
| 55 |
+
typedef struct {
|
| 56 |
+
/// @brief Device serial number
|
| 57 |
+
char devID[32];
|
| 58 |
+
/// @brief JSON string containing device state information
|
| 59 |
+
char stateJson[16352];
|
| 60 |
+
}PXREADevStateJson;
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
typedef struct {
|
| 64 |
+
/// @brief Device serial number
|
| 65 |
+
char devID[32];
|
| 66 |
+
/// @brief Data size
|
| 67 |
+
uint64_t dataSize;
|
| 68 |
+
/// @brief Data pointer, valid within callback
|
| 69 |
+
const char* dataPtr;
|
| 70 |
+
}PXREADevCustomMessage;
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
/**
|
| 76 |
+
* @brief Client callback for receiving server messages
|
| 77 |
+
* @param context Callback context, passed from #Init parameter 1 context
|
| 78 |
+
* @param type Callback type
|
| 79 |
+
* @param status Callback status code
|
| 80 |
+
* @param userData Callback data pointer, determined by parameter 2 type
|
| 81 |
+
*/
|
| 82 |
+
typedef void(*pfPXREAClientCallback)(void* context,PXREAClientCallbackType type,int status,void* userData);
|
| 83 |
+
|
| 84 |
+
/**
|
| 85 |
+
* @brief SDK initialization interface
|
| 86 |
+
* @details Connect to service and register callback
|
| 87 |
+
* @param context Callback context for passing user-defined data to callback function
|
| 88 |
+
* @param cliCallback Callback function pointer for listening to server messages
|
| 89 |
+
* @param mask Callback mask for filtering certain server messages
|
| 90 |
+
*/
|
| 91 |
+
PXREACLIENTSDK_EXPORT int PXREAInit(void* context,pfPXREAClientCallback cliCallback,unsigned mask);
|
| 92 |
+
/**
|
| 93 |
+
* @brief Termination interface
|
| 94 |
+
* @details Disconnect from service
|
| 95 |
+
*/
|
| 96 |
+
PXREACLIENTSDK_EXPORT int PXREADeinit();
|
| 97 |
+
|
| 98 |
+
/**
|
| 99 |
+
* @brief Send JSON format command to device
|
| 100 |
+
* @param devID Device serial number
|
| 101 |
+
* @param parameterJson Function and parameters in JSON format, refer to robot SDK documentation for specific usage
|
| 102 |
+
* @return 0 Success
|
| 103 |
+
* @return -1 Failure
|
| 104 |
+
*/
|
| 105 |
+
PXREACLIENTSDK_EXPORT int PXREADeviceControlJson(const char *devID,const char *parameterJson);
|
| 106 |
+
/**
|
| 107 |
+
* @brief Send byte stream to specified device
|
| 108 |
+
* @note This command is suitable for SDK caller's custom messages
|
| 109 |
+
* @param devID Device serial number
|
| 110 |
+
* @param data Starting address of byte stream
|
| 111 |
+
* @param len Length of byte stream
|
| 112 |
+
* @return 0 Success
|
| 113 |
+
* @return -1 Failure
|
| 114 |
+
*/
|
| 115 |
+
PXREACLIENTSDK_EXPORT int PXREASendBytesToDevice(const char* devID,const char* data,unsigned len);
|
| 116 |
+
#ifdef __cplusplus
|
| 117 |
+
}
|
| 118 |
+
#endif
|
| 119 |
+
|
| 120 |
+
#endif // PXREACLIENTSDK_H
|
GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/include/aarch64/PXREARobotSDK.h
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @file PXREARobotSDK.h
|
| 3 |
+
* @brief Robot SDK header file for client-side communication
|
| 4 |
+
*/
|
| 5 |
+
#ifndef PXREACLIENTSDK_H
|
| 6 |
+
#define PXREACLIENTSDK_H
|
| 7 |
+
#ifdef _WIN32
|
| 8 |
+
#if defined(PXREACLIENTSDK_LIBRARY)
|
| 9 |
+
# define PXREACLIENTSDK_EXPORT __declspec(dllexport)
|
| 10 |
+
#else
|
| 11 |
+
# define PXREACLIENTSDK_EXPORT __declspec(dllimport)
|
| 12 |
+
#endif
|
| 13 |
+
#endif
|
| 14 |
+
|
| 15 |
+
#ifdef __linux__
|
| 16 |
+
#if defined(PXREACLIENTSDK_LIBRARY)
|
| 17 |
+
# define PXREACLIENTSDK_EXPORT __attribute__((visibility("default")))
|
| 18 |
+
#else
|
| 19 |
+
# define PXREACLIENTSDK_EXPORT __attribute__((visibility("default")))
|
| 20 |
+
#endif
|
| 21 |
+
#endif
|
| 22 |
+
|
| 23 |
+
#ifdef __cplusplus
|
| 24 |
+
extern "C" {
|
| 25 |
+
#endif
|
| 26 |
+
|
| 27 |
+
enum PXREAClientCallbackType
|
| 28 |
+
{
|
| 29 |
+
/// @brief Server connected
|
| 30 |
+
PXREAServerConnect = 1<<2,
|
| 31 |
+
/// @brief Server disconnected
|
| 32 |
+
PXREAServerDisconnect = 1<<3,
|
| 33 |
+
/// @brief Device online
|
| 34 |
+
PXREADeviceFind = 1<<4,
|
| 35 |
+
/// @brief Device offline
|
| 36 |
+
PXREADeviceMissing = 1<<5,
|
| 37 |
+
/// @brief Device connected
|
| 38 |
+
PXREADeviceConnect = 1<<9,
|
| 39 |
+
/// @brief Device state in JSON format
|
| 40 |
+
PXREADeviceStateJson = 1<<25,
|
| 41 |
+
/// @brief Custom message
|
| 42 |
+
PXREADeviceCustomMessage = 1<<26,
|
| 43 |
+
/// @brief Mask for enabling all callbacks
|
| 44 |
+
PXREAFullMask = 0xffffffff
|
| 45 |
+
};
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
/// @brief Device state in JSON format
|
| 55 |
+
typedef struct {
|
| 56 |
+
/// @brief Device serial number
|
| 57 |
+
char devID[32];
|
| 58 |
+
/// @brief JSON string containing device state information
|
| 59 |
+
char stateJson[16352];
|
| 60 |
+
}PXREADevStateJson;
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
typedef struct {
|
| 64 |
+
/// @brief Device serial number
|
| 65 |
+
char devID[32];
|
| 66 |
+
/// @brief Data size
|
| 67 |
+
uint64_t dataSize;
|
| 68 |
+
/// @brief Data pointer, valid within callback
|
| 69 |
+
const char* dataPtr;
|
| 70 |
+
}PXREADevCustomMessage;
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
/**
|
| 76 |
+
* @brief Client callback for receiving server messages
|
| 77 |
+
* @param context Callback context, passed from #Init parameter 1 context
|
| 78 |
+
* @param type Callback type
|
| 79 |
+
* @param status Callback status code
|
| 80 |
+
* @param userData Callback data pointer, determined by parameter 2 type
|
| 81 |
+
*/
|
| 82 |
+
typedef void(*pfPXREAClientCallback)(void* context,PXREAClientCallbackType type,int status,void* userData);
|
| 83 |
+
|
| 84 |
+
/**
|
| 85 |
+
* @brief SDK initialization interface
|
| 86 |
+
* @details Connect to service and register callback
|
| 87 |
+
* @param context Callback context for passing user-defined data to callback function
|
| 88 |
+
* @param cliCallback Callback function pointer for listening to server messages
|
| 89 |
+
* @param mask Callback mask for filtering certain server messages
|
| 90 |
+
*/
|
| 91 |
+
PXREACLIENTSDK_EXPORT int PXREAInit(void* context,pfPXREAClientCallback cliCallback,unsigned mask);
|
| 92 |
+
/**
|
| 93 |
+
* @brief Termination interface
|
| 94 |
+
* @details Disconnect from service
|
| 95 |
+
*/
|
| 96 |
+
PXREACLIENTSDK_EXPORT int PXREADeinit();
|
| 97 |
+
|
| 98 |
+
/**
|
| 99 |
+
* @brief Send JSON format command to device
|
| 100 |
+
* @param devID Device serial number
|
| 101 |
+
* @param parameterJson Function and parameters in JSON format, refer to robot SDK documentation for specific usage
|
| 102 |
+
* @return 0 Success
|
| 103 |
+
* @return -1 Failure
|
| 104 |
+
*/
|
| 105 |
+
PXREACLIENTSDK_EXPORT int PXREADeviceControlJson(const char *devID,const char *parameterJson);
|
| 106 |
+
/**
|
| 107 |
+
* @brief Send byte stream to specified device
|
| 108 |
+
* @note This command is suitable for SDK caller's custom messages
|
| 109 |
+
* @param devID Device serial number
|
| 110 |
+
* @param data Starting address of byte stream
|
| 111 |
+
* @param len Length of byte stream
|
| 112 |
+
* @return 0 Success
|
| 113 |
+
* @return -1 Failure
|
| 114 |
+
*/
|
| 115 |
+
PXREACLIENTSDK_EXPORT int PXREASendBytesToDevice(const char* devID,const char* data,unsigned len);
|
| 116 |
+
#ifdef __cplusplus
|
| 117 |
+
}
|
| 118 |
+
#endif
|
| 119 |
+
|
| 120 |
+
#endif // PXREACLIENTSDK_H
|
GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/include/aarch64/nlohmann/json.hpp
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/include/aarch64/nlohmann/json_fwd.hpp
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// __ _____ _____ _____
|
| 2 |
+
// __| | __| | | | JSON for Modern C++
|
| 3 |
+
// | | |__ | | | | | | version 3.11.3
|
| 4 |
+
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
|
| 5 |
+
//
|
| 6 |
+
// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>
|
| 7 |
+
// SPDX-License-Identifier: MIT
|
| 8 |
+
|
| 9 |
+
#ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_
|
| 10 |
+
#define INCLUDE_NLOHMANN_JSON_FWD_HPP_
|
| 11 |
+
|
| 12 |
+
#include <cstdint> // int64_t, uint64_t
|
| 13 |
+
#include <map> // map
|
| 14 |
+
#include <memory> // allocator
|
| 15 |
+
#include <string> // string
|
| 16 |
+
#include <vector> // vector
|
| 17 |
+
|
| 18 |
+
// #include <nlohmann/detail/abi_macros.hpp>
|
| 19 |
+
// __ _____ _____ _____
|
| 20 |
+
// __| | __| | | | JSON for Modern C++
|
| 21 |
+
// | | |__ | | | | | | version 3.11.3
|
| 22 |
+
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
|
| 23 |
+
//
|
| 24 |
+
// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>
|
| 25 |
+
// SPDX-License-Identifier: MIT
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
// This file contains all macro definitions affecting or depending on the ABI
|
| 30 |
+
|
| 31 |
+
#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK
|
| 32 |
+
#if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH)
|
| 33 |
+
#if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 3
|
| 34 |
+
#warning "Already included a different version of the library!"
|
| 35 |
+
#endif
|
| 36 |
+
#endif
|
| 37 |
+
#endif
|
| 38 |
+
|
| 39 |
+
#define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum)
|
| 40 |
+
#define NLOHMANN_JSON_VERSION_MINOR 11 // NOLINT(modernize-macro-to-enum)
|
| 41 |
+
#define NLOHMANN_JSON_VERSION_PATCH 3 // NOLINT(modernize-macro-to-enum)
|
| 42 |
+
|
| 43 |
+
#ifndef JSON_DIAGNOSTICS
|
| 44 |
+
#define JSON_DIAGNOSTICS 0
|
| 45 |
+
#endif
|
| 46 |
+
|
| 47 |
+
#ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON
|
| 48 |
+
#define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0
|
| 49 |
+
#endif
|
| 50 |
+
|
| 51 |
+
#if JSON_DIAGNOSTICS
|
| 52 |
+
#define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag
|
| 53 |
+
#else
|
| 54 |
+
#define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS
|
| 55 |
+
#endif
|
| 56 |
+
|
| 57 |
+
#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON
|
| 58 |
+
#define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp
|
| 59 |
+
#else
|
| 60 |
+
#define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON
|
| 61 |
+
#endif
|
| 62 |
+
|
| 63 |
+
#ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION
|
| 64 |
+
#define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0
|
| 65 |
+
#endif
|
| 66 |
+
|
| 67 |
+
// Construct the namespace ABI tags component
|
| 68 |
+
#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b
|
| 69 |
+
#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \
|
| 70 |
+
NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b)
|
| 71 |
+
|
| 72 |
+
#define NLOHMANN_JSON_ABI_TAGS \
|
| 73 |
+
NLOHMANN_JSON_ABI_TAGS_CONCAT( \
|
| 74 |
+
NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \
|
| 75 |
+
NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON)
|
| 76 |
+
|
| 77 |
+
// Construct the namespace version component
|
| 78 |
+
#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \
|
| 79 |
+
_v ## major ## _ ## minor ## _ ## patch
|
| 80 |
+
#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \
|
| 81 |
+
NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch)
|
| 82 |
+
|
| 83 |
+
#if NLOHMANN_JSON_NAMESPACE_NO_VERSION
|
| 84 |
+
#define NLOHMANN_JSON_NAMESPACE_VERSION
|
| 85 |
+
#else
|
| 86 |
+
#define NLOHMANN_JSON_NAMESPACE_VERSION \
|
| 87 |
+
NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \
|
| 88 |
+
NLOHMANN_JSON_VERSION_MINOR, \
|
| 89 |
+
NLOHMANN_JSON_VERSION_PATCH)
|
| 90 |
+
#endif
|
| 91 |
+
|
| 92 |
+
// Combine namespace components
|
| 93 |
+
#define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b
|
| 94 |
+
#define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \
|
| 95 |
+
NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b)
|
| 96 |
+
|
| 97 |
+
#ifndef NLOHMANN_JSON_NAMESPACE
|
| 98 |
+
#define NLOHMANN_JSON_NAMESPACE \
|
| 99 |
+
nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \
|
| 100 |
+
NLOHMANN_JSON_ABI_TAGS, \
|
| 101 |
+
NLOHMANN_JSON_NAMESPACE_VERSION)
|
| 102 |
+
#endif
|
| 103 |
+
|
| 104 |
+
#ifndef NLOHMANN_JSON_NAMESPACE_BEGIN
|
| 105 |
+
#define NLOHMANN_JSON_NAMESPACE_BEGIN \
|
| 106 |
+
namespace nlohmann \
|
| 107 |
+
{ \
|
| 108 |
+
inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \
|
| 109 |
+
NLOHMANN_JSON_ABI_TAGS, \
|
| 110 |
+
NLOHMANN_JSON_NAMESPACE_VERSION) \
|
| 111 |
+
{
|
| 112 |
+
#endif
|
| 113 |
+
|
| 114 |
+
#ifndef NLOHMANN_JSON_NAMESPACE_END
|
| 115 |
+
#define NLOHMANN_JSON_NAMESPACE_END \
|
| 116 |
+
} /* namespace (inline namespace) NOLINT(readability/namespace) */ \
|
| 117 |
+
} // namespace nlohmann
|
| 118 |
+
#endif
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
/*!
|
| 122 |
+
@brief namespace for Niels Lohmann
|
| 123 |
+
@see https://github.com/nlohmann
|
| 124 |
+
@since version 1.0.0
|
| 125 |
+
*/
|
| 126 |
+
NLOHMANN_JSON_NAMESPACE_BEGIN
|
| 127 |
+
|
| 128 |
+
/*!
|
| 129 |
+
@brief default JSONSerializer template argument
|
| 130 |
+
|
| 131 |
+
This serializer ignores the template arguments and uses ADL
|
| 132 |
+
([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl))
|
| 133 |
+
for serialization.
|
| 134 |
+
*/
|
| 135 |
+
template<typename T = void, typename SFINAE = void>
|
| 136 |
+
struct adl_serializer;
|
| 137 |
+
|
| 138 |
+
/// a class to store JSON values
|
| 139 |
+
/// @sa https://json.nlohmann.me/api/basic_json/
|
| 140 |
+
template<template<typename U, typename V, typename... Args> class ObjectType =
|
| 141 |
+
std::map,
|
| 142 |
+
template<typename U, typename... Args> class ArrayType = std::vector,
|
| 143 |
+
class StringType = std::string, class BooleanType = bool,
|
| 144 |
+
class NumberIntegerType = std::int64_t,
|
| 145 |
+
class NumberUnsignedType = std::uint64_t,
|
| 146 |
+
class NumberFloatType = double,
|
| 147 |
+
template<typename U> class AllocatorType = std::allocator,
|
| 148 |
+
template<typename T, typename SFINAE = void> class JSONSerializer =
|
| 149 |
+
adl_serializer,
|
| 150 |
+
class BinaryType = std::vector<std::uint8_t>, // cppcheck-suppress syntaxError
|
| 151 |
+
class CustomBaseClass = void>
|
| 152 |
+
class basic_json;
|
| 153 |
+
|
| 154 |
+
/// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document
|
| 155 |
+
/// @sa https://json.nlohmann.me/api/json_pointer/
|
| 156 |
+
template<typename RefStringType>
|
| 157 |
+
class json_pointer;
|
| 158 |
+
|
| 159 |
+
/*!
|
| 160 |
+
@brief default specialization
|
| 161 |
+
@sa https://json.nlohmann.me/api/json/
|
| 162 |
+
*/
|
| 163 |
+
using json = basic_json<>;
|
| 164 |
+
|
| 165 |
+
/// @brief a minimal map-like container that preserves insertion order
|
| 166 |
+
/// @sa https://json.nlohmann.me/api/ordered_map/
|
| 167 |
+
template<class Key, class T, class IgnoredLess, class Allocator>
|
| 168 |
+
struct ordered_map;
|
| 169 |
+
|
| 170 |
+
/// @brief specialization that maintains the insertion order of object keys
|
| 171 |
+
/// @sa https://json.nlohmann.me/api/ordered_json/
|
| 172 |
+
using ordered_json = basic_json<nlohmann::ordered_map>;
|
| 173 |
+
|
| 174 |
+
NLOHMANN_JSON_NAMESPACE_END
|
| 175 |
+
|
| 176 |
+
#endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_
|
GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/include/nlohmann/json.hpp
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
GR00T-WholeBodyControl/external_dependencies/XRoboToolkit-PC-Service-Pybind_X86_and_ARM64/include/nlohmann/json_fwd.hpp
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// __ _____ _____ _____
|
| 2 |
+
// __| | __| | | | JSON for Modern C++
|
| 3 |
+
// | | |__ | | | | | | version 3.11.3
|
| 4 |
+
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
|
| 5 |
+
//
|
| 6 |
+
// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>
|
| 7 |
+
// SPDX-License-Identifier: MIT
|
| 8 |
+
|
| 9 |
+
#ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_
|
| 10 |
+
#define INCLUDE_NLOHMANN_JSON_FWD_HPP_
|
| 11 |
+
|
| 12 |
+
#include <cstdint> // int64_t, uint64_t
|
| 13 |
+
#include <map> // map
|
| 14 |
+
#include <memory> // allocator
|
| 15 |
+
#include <string> // string
|
| 16 |
+
#include <vector> // vector
|
| 17 |
+
|
| 18 |
+
// #include <nlohmann/detail/abi_macros.hpp>
|
| 19 |
+
// __ _____ _____ _____
|
| 20 |
+
// __| | __| | | | JSON for Modern C++
|
| 21 |
+
// | | |__ | | | | | | version 3.11.3
|
| 22 |
+
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
|
| 23 |
+
//
|
| 24 |
+
// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>
|
| 25 |
+
// SPDX-License-Identifier: MIT
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
// This file contains all macro definitions affecting or depending on the ABI
|
| 30 |
+
|
| 31 |
+
#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK
|
| 32 |
+
#if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH)
|
| 33 |
+
#if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 3
|
| 34 |
+
#warning "Already included a different version of the library!"
|
| 35 |
+
#endif
|
| 36 |
+
#endif
|
| 37 |
+
#endif
|
| 38 |
+
|
| 39 |
+
#define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum)
|
| 40 |
+
#define NLOHMANN_JSON_VERSION_MINOR 11 // NOLINT(modernize-macro-to-enum)
|
| 41 |
+
#define NLOHMANN_JSON_VERSION_PATCH 3 // NOLINT(modernize-macro-to-enum)
|
| 42 |
+
|
| 43 |
+
#ifndef JSON_DIAGNOSTICS
|
| 44 |
+
#define JSON_DIAGNOSTICS 0
|
| 45 |
+
#endif
|
| 46 |
+
|
| 47 |
+
#ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON
|
| 48 |
+
#define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0
|
| 49 |
+
#endif
|
| 50 |
+
|
| 51 |
+
#if JSON_DIAGNOSTICS
|
| 52 |
+
#define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag
|
| 53 |
+
#else
|
| 54 |
+
#define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS
|
| 55 |
+
#endif
|
| 56 |
+
|
| 57 |
+
#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON
|
| 58 |
+
#define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp
|
| 59 |
+
#else
|
| 60 |
+
#define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON
|
| 61 |
+
#endif
|
| 62 |
+
|
| 63 |
+
#ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION
|
| 64 |
+
#define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0
|
| 65 |
+
#endif
|
| 66 |
+
|
| 67 |
+
// Construct the namespace ABI tags component
|
| 68 |
+
#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b
|
| 69 |
+
#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \
|
| 70 |
+
NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b)
|
| 71 |
+
|
| 72 |
+
#define NLOHMANN_JSON_ABI_TAGS \
|
| 73 |
+
NLOHMANN_JSON_ABI_TAGS_CONCAT( \
|
| 74 |
+
NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \
|
| 75 |
+
NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON)
|
| 76 |
+
|
| 77 |
+
// Construct the namespace version component
|
| 78 |
+
#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \
|
| 79 |
+
_v ## major ## _ ## minor ## _ ## patch
|
| 80 |
+
#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \
|
| 81 |
+
NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch)
|
| 82 |
+
|
| 83 |
+
#if NLOHMANN_JSON_NAMESPACE_NO_VERSION
|
| 84 |
+
#define NLOHMANN_JSON_NAMESPACE_VERSION
|
| 85 |
+
#else
|
| 86 |
+
#define NLOHMANN_JSON_NAMESPACE_VERSION \
|
| 87 |
+
NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \
|
| 88 |
+
NLOHMANN_JSON_VERSION_MINOR, \
|
| 89 |
+
NLOHMANN_JSON_VERSION_PATCH)
|
| 90 |
+
#endif
|
| 91 |
+
|
| 92 |
+
// Combine namespace components
|
| 93 |
+
#define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b
|
| 94 |
+
#define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \
|
| 95 |
+
NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b)
|
| 96 |
+
|
| 97 |
+
#ifndef NLOHMANN_JSON_NAMESPACE
|
| 98 |
+
#define NLOHMANN_JSON_NAMESPACE \
|
| 99 |
+
nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \
|
| 100 |
+
NLOHMANN_JSON_ABI_TAGS, \
|
| 101 |
+
NLOHMANN_JSON_NAMESPACE_VERSION)
|
| 102 |
+
#endif
|
| 103 |
+
|
| 104 |
+
#ifndef NLOHMANN_JSON_NAMESPACE_BEGIN
|
| 105 |
+
#define NLOHMANN_JSON_NAMESPACE_BEGIN \
|
| 106 |
+
namespace nlohmann \
|
| 107 |
+
{ \
|
| 108 |
+
inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \
|
| 109 |
+
NLOHMANN_JSON_ABI_TAGS, \
|
| 110 |
+
NLOHMANN_JSON_NAMESPACE_VERSION) \
|
| 111 |
+
{
|
| 112 |
+
#endif
|
| 113 |
+
|
| 114 |
+
#ifndef NLOHMANN_JSON_NAMESPACE_END
|
| 115 |
+
#define NLOHMANN_JSON_NAMESPACE_END \
|
| 116 |
+
} /* namespace (inline namespace) NOLINT(readability/namespace) */ \
|
| 117 |
+
} // namespace nlohmann
|
| 118 |
+
#endif
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
/*!
|
| 122 |
+
@brief namespace for Niels Lohmann
|
| 123 |
+
@see https://github.com/nlohmann
|
| 124 |
+
@since version 1.0.0
|
| 125 |
+
*/
|
| 126 |
+
NLOHMANN_JSON_NAMESPACE_BEGIN
|
| 127 |
+
|
| 128 |
+
/*!
|
| 129 |
+
@brief default JSONSerializer template argument
|
| 130 |
+
|
| 131 |
+
This serializer ignores the template arguments and uses ADL
|
| 132 |
+
([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl))
|
| 133 |
+
for serialization.
|
| 134 |
+
*/
|
| 135 |
+
template<typename T = void, typename SFINAE = void>
|
| 136 |
+
struct adl_serializer;
|
| 137 |
+
|
| 138 |
+
/// a class to store JSON values
|
| 139 |
+
/// @sa https://json.nlohmann.me/api/basic_json/
|
| 140 |
+
template<template<typename U, typename V, typename... Args> class ObjectType =
|
| 141 |
+
std::map,
|
| 142 |
+
template<typename U, typename... Args> class ArrayType = std::vector,
|
| 143 |
+
class StringType = std::string, class BooleanType = bool,
|
| 144 |
+
class NumberIntegerType = std::int64_t,
|
| 145 |
+
class NumberUnsignedType = std::uint64_t,
|
| 146 |
+
class NumberFloatType = double,
|
| 147 |
+
template<typename U> class AllocatorType = std::allocator,
|
| 148 |
+
template<typename T, typename SFINAE = void> class JSONSerializer =
|
| 149 |
+
adl_serializer,
|
| 150 |
+
class BinaryType = std::vector<std::uint8_t>, // cppcheck-suppress syntaxError
|
| 151 |
+
class CustomBaseClass = void>
|
| 152 |
+
class basic_json;
|
| 153 |
+
|
| 154 |
+
/// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document
|
| 155 |
+
/// @sa https://json.nlohmann.me/api/json_pointer/
|
| 156 |
+
template<typename RefStringType>
|
| 157 |
+
class json_pointer;
|
| 158 |
+
|
| 159 |
+
/*!
|
| 160 |
+
@brief default specialization
|
| 161 |
+
@sa https://json.nlohmann.me/api/json/
|
| 162 |
+
*/
|
| 163 |
+
using json = basic_json<>;
|
| 164 |
+
|
| 165 |
+
/// @brief a minimal map-like container that preserves insertion order
|
| 166 |
+
/// @sa https://json.nlohmann.me/api/ordered_map/
|
| 167 |
+
template<class Key, class T, class IgnoredLess, class Allocator>
|
| 168 |
+
struct ordered_map;
|
| 169 |
+
|
| 170 |
+
/// @brief specialization that maintains the insertion order of object keys
|
| 171 |
+
/// @sa https://json.nlohmann.me/api/ordered_json/
|
| 172 |
+
using ordered_json = basic_json<nlohmann::ordered_map>;
|
| 173 |
+
|
| 174 |
+
NLOHMANN_JSON_NAMESPACE_END
|
| 175 |
+
|
| 176 |
+
#endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2/camera/camera_opencv.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from unitree_sdk2py.core.channel import ChannelFactoryInitialize
|
| 2 |
+
from unitree_sdk2py.b2.front_video.front_video_client import FrontVideoClient
|
| 3 |
+
from unitree_sdk2py.b2.back_video.back_video_client import BackVideoClient
|
| 4 |
+
import cv2
|
| 5 |
+
import numpy as np
|
| 6 |
+
import sys
|
| 7 |
+
|
| 8 |
+
def display_image(window_name, data):
|
| 9 |
+
# If data is a list, we need to convert it to a bytes object
|
| 10 |
+
if isinstance(data, list):
|
| 11 |
+
data = bytes(data)
|
| 12 |
+
|
| 13 |
+
# Now convert to numpy image
|
| 14 |
+
image_data = np.frombuffer(data, dtype=np.uint8)
|
| 15 |
+
image = cv2.imdecode(image_data, cv2.IMREAD_COLOR)
|
| 16 |
+
if image is not None:
|
| 17 |
+
cv2.imshow(window_name, image)
|
| 18 |
+
|
| 19 |
+
if __name__ == "__main__":
|
| 20 |
+
if len(sys.argv) > 1:
|
| 21 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 22 |
+
else:
|
| 23 |
+
ChannelFactoryInitialize(0)
|
| 24 |
+
|
| 25 |
+
frontCameraClient = FrontVideoClient() # Create a front camera video client
|
| 26 |
+
frontCameraClient.SetTimeout(3.0)
|
| 27 |
+
frontCameraClient.Init()
|
| 28 |
+
|
| 29 |
+
backCameraClient = BackVideoClient() # Create a back camera video client
|
| 30 |
+
backCameraClient.SetTimeout(3.0)
|
| 31 |
+
backCameraClient.Init()
|
| 32 |
+
|
| 33 |
+
# Loop to continuously fetch images
|
| 34 |
+
while True:
|
| 35 |
+
# Get front camera image
|
| 36 |
+
front_code, front_data = frontCameraClient.GetImageSample()
|
| 37 |
+
if front_code == 0:
|
| 38 |
+
display_image("Front Camera", front_data)
|
| 39 |
+
|
| 40 |
+
# Get back camera image
|
| 41 |
+
back_code, back_data = backCameraClient.GetImageSample()
|
| 42 |
+
if back_code == 0:
|
| 43 |
+
display_image("Back Camera", back_data)
|
| 44 |
+
|
| 45 |
+
# Press ESC to stop
|
| 46 |
+
if cv2.waitKey(20) == 27:
|
| 47 |
+
break
|
| 48 |
+
|
| 49 |
+
# Clean up windows
|
| 50 |
+
cv2.destroyAllWindows()
|
| 51 |
+
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2/camera/capture_image.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import os
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
from unitree_sdk2py.core.channel import ChannelFactoryInitialize
|
| 6 |
+
from unitree_sdk2py.b2.front_video.front_video_client import FrontVideoClient
|
| 7 |
+
from unitree_sdk2py.b2.back_video.back_video_client import BackVideoClient
|
| 8 |
+
|
| 9 |
+
if __name__ == "__main__":
|
| 10 |
+
if len(sys.argv) > 1:
|
| 11 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 12 |
+
else:
|
| 13 |
+
ChannelFactoryInitialize(0)
|
| 14 |
+
|
| 15 |
+
# 创建前置相机客户端
|
| 16 |
+
front_client = FrontVideoClient()
|
| 17 |
+
front_client.SetTimeout(3.0)
|
| 18 |
+
front_client.Init()
|
| 19 |
+
|
| 20 |
+
# 创建后置相机客户端
|
| 21 |
+
back_client = BackVideoClient()
|
| 22 |
+
back_client.SetTimeout(3.0)
|
| 23 |
+
back_client.Init()
|
| 24 |
+
|
| 25 |
+
print("##################Get Front Camera Image###################")
|
| 26 |
+
# 获取前置相机图像
|
| 27 |
+
front_code, front_data = front_client.GetImageSample()
|
| 28 |
+
|
| 29 |
+
if front_code != 0:
|
| 30 |
+
print("Get front camera image error. Code:", front_code)
|
| 31 |
+
else:
|
| 32 |
+
front_image_name = "./front_img.jpg"
|
| 33 |
+
print("Front Image Saved as:", front_image_name)
|
| 34 |
+
|
| 35 |
+
with open(front_image_name, "+wb") as f:
|
| 36 |
+
f.write(bytes(front_data))
|
| 37 |
+
|
| 38 |
+
print("##################Get Back Camera Image###################")
|
| 39 |
+
# 获取后置相机图像
|
| 40 |
+
back_code, back_data = back_client.GetImageSample()
|
| 41 |
+
|
| 42 |
+
if back_code != 0:
|
| 43 |
+
print("Get back camera image error. Code:", back_code)
|
| 44 |
+
else:
|
| 45 |
+
back_image_name = "./back_img.jpg"
|
| 46 |
+
print("Back Image Saved as:", back_image_name)
|
| 47 |
+
|
| 48 |
+
with open(back_image_name, "+wb") as f:
|
| 49 |
+
f.write(bytes(back_data))
|
| 50 |
+
|
| 51 |
+
time.sleep(1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2/high_level/b2_sport_client.py
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
| 4 |
+
from unitree_sdk2py.b2.sport.sport_client import SportClient
|
| 5 |
+
import math
|
| 6 |
+
from dataclasses import dataclass
|
| 7 |
+
|
| 8 |
+
@dataclass
|
| 9 |
+
class TestOption:
|
| 10 |
+
name: str
|
| 11 |
+
id: int
|
| 12 |
+
|
| 13 |
+
option_list = [
|
| 14 |
+
TestOption(name="damp", id=0),
|
| 15 |
+
TestOption(name="stand_up", id=1),
|
| 16 |
+
TestOption(name="stand_down", id=2),
|
| 17 |
+
TestOption(name="move forward", id=3),
|
| 18 |
+
TestOption(name="move lateral", id=4),
|
| 19 |
+
TestOption(name="move rotate", id=5),
|
| 20 |
+
TestOption(name="stop_move", id=6),
|
| 21 |
+
TestOption(name="switch_gait", id=7),
|
| 22 |
+
TestOption(name="switch_gait", id=8),
|
| 23 |
+
TestOption(name="recovery", id=9),
|
| 24 |
+
TestOption(name="balanced stand", id=10)
|
| 25 |
+
]
|
| 26 |
+
|
| 27 |
+
class UserInterface:
|
| 28 |
+
def __init__(self):
|
| 29 |
+
self.test_option_ = None
|
| 30 |
+
|
| 31 |
+
def convert_to_int(self, input_str):
|
| 32 |
+
try:
|
| 33 |
+
return int(input_str)
|
| 34 |
+
except ValueError:
|
| 35 |
+
return None
|
| 36 |
+
|
| 37 |
+
def terminal_handle(self):
|
| 38 |
+
input_str = input("Enter id or name: \n")
|
| 39 |
+
|
| 40 |
+
if input_str == "list":
|
| 41 |
+
self.test_option_.name = None
|
| 42 |
+
self.test_option_.id = None
|
| 43 |
+
for option in option_list:
|
| 44 |
+
print(f"{option.name}, id: {option.id}")
|
| 45 |
+
return
|
| 46 |
+
|
| 47 |
+
for option in option_list:
|
| 48 |
+
if input_str == option.name or self.convert_to_int(input_str) == option.id:
|
| 49 |
+
self.test_option_.name = option.name
|
| 50 |
+
self.test_option_.id = option.id
|
| 51 |
+
print(f"Test: {self.test_option_.name}, test_id: {self.test_option_.id}")
|
| 52 |
+
return
|
| 53 |
+
|
| 54 |
+
print("No matching test option found.")
|
| 55 |
+
|
| 56 |
+
if __name__ == "__main__":
|
| 57 |
+
|
| 58 |
+
if len(sys.argv) < 2:
|
| 59 |
+
print(f"Usage: python3 {sys.argv[0]} networkInterface")
|
| 60 |
+
sys.exit(-1)
|
| 61 |
+
|
| 62 |
+
print("WARNING: Please ensure there are no obstacles around the robot while running this example.")
|
| 63 |
+
input("Press Enter to continue...")
|
| 64 |
+
|
| 65 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 66 |
+
|
| 67 |
+
test_option = TestOption(name=None, id=None)
|
| 68 |
+
user_interface = UserInterface()
|
| 69 |
+
user_interface.test_option_ = test_option
|
| 70 |
+
|
| 71 |
+
sport_client = SportClient()
|
| 72 |
+
sport_client.SetTimeout(10.0)
|
| 73 |
+
sport_client.Init()
|
| 74 |
+
|
| 75 |
+
print("Input \"list\" to list all test option ...")
|
| 76 |
+
|
| 77 |
+
while True:
|
| 78 |
+
user_interface.terminal_handle()
|
| 79 |
+
|
| 80 |
+
print(f"Updated Test Option: Name = {test_option.name}, ID = {test_option.id}")
|
| 81 |
+
|
| 82 |
+
if test_option.id == 0:
|
| 83 |
+
sport_client.Damp()
|
| 84 |
+
elif test_option.id == 1:
|
| 85 |
+
sport_client.StandUp()
|
| 86 |
+
elif test_option.id == 2:
|
| 87 |
+
sport_client.StandDown()
|
| 88 |
+
elif test_option.id == 3:
|
| 89 |
+
sport_client.Move(0.3,0,0)
|
| 90 |
+
elif test_option.id == 4:
|
| 91 |
+
sport_client.Move(0,0.3,0)
|
| 92 |
+
elif test_option.id == 5:
|
| 93 |
+
sport_client.Move(0,0,0.5)
|
| 94 |
+
elif test_option.id == 6:
|
| 95 |
+
sport_client.StopMove()
|
| 96 |
+
elif test_option.id == 7:
|
| 97 |
+
sport_client.SwitchGait(0)
|
| 98 |
+
elif test_option.id == 8:
|
| 99 |
+
sport_client.SwitchGait(1)
|
| 100 |
+
elif test_option.id == 9:
|
| 101 |
+
sport_client.RecoveryStand()
|
| 102 |
+
elif test_option.id == 10:
|
| 103 |
+
sport_client.BalanceStand()
|
| 104 |
+
|
| 105 |
+
time.sleep(1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2/low_level/b2_stand_example.py
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactoryInitialize
|
| 5 |
+
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
| 6 |
+
from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowCmd_
|
| 7 |
+
from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowState_
|
| 8 |
+
from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowCmd_
|
| 9 |
+
from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowState_
|
| 10 |
+
from unitree_sdk2py.utils.thread import RecurrentThread
|
| 11 |
+
import unitree_legged_const as b2
|
| 12 |
+
from unitree_sdk2py.comm.motion_switcher.motion_switcher_client import MotionSwitcherClient
|
| 13 |
+
from unitree_sdk2py.b2.sport.sport_client import SportClient
|
| 14 |
+
|
| 15 |
+
from unitree_sdk2py.utils.crc import CRC
|
| 16 |
+
|
| 17 |
+
class Custom:
|
| 18 |
+
def __init__(self):
|
| 19 |
+
self.Kp = 1000.0
|
| 20 |
+
self.Kd = 10.0
|
| 21 |
+
self.time_consume = 0
|
| 22 |
+
self.rate_count = 0
|
| 23 |
+
self.sin_count = 0
|
| 24 |
+
self.motiontime = 0
|
| 25 |
+
self.dt = 0.002
|
| 26 |
+
|
| 27 |
+
self.low_cmd = unitree_go_msg_dds__LowCmd_()
|
| 28 |
+
self.low_state = None
|
| 29 |
+
|
| 30 |
+
self.targetPos_1 = [0.0, 1.36, -2.65, 0.0, 1.36, -2.65,
|
| 31 |
+
-0.2, 1.36, -2.65, 0.2, 1.36, -2.65]
|
| 32 |
+
|
| 33 |
+
self.targetPos_2 = [0.0, 0.67, -1.3, 0.0, 0.67, -1.3,
|
| 34 |
+
0.0, 0.67, -1.3, 0.0, 0.67, -1.3]
|
| 35 |
+
|
| 36 |
+
self.targetPos_3 = [-0.5, 1.36, -2.65, 0.5, 1.36, -2.65,
|
| 37 |
+
-0.5, 1.36, -2.65, 0.5, 1.36, -2.65]
|
| 38 |
+
|
| 39 |
+
self.startPos = [0.0] * 12
|
| 40 |
+
self.duration_1 = 500
|
| 41 |
+
self.duration_2 = 900
|
| 42 |
+
self.duration_3 = 1000
|
| 43 |
+
self.duration_4 = 900
|
| 44 |
+
self.percent_1 = 0
|
| 45 |
+
self.percent_2 = 0
|
| 46 |
+
self.percent_3 = 0
|
| 47 |
+
self.percent_4 = 0
|
| 48 |
+
|
| 49 |
+
self.firstRun = True
|
| 50 |
+
self.done = False
|
| 51 |
+
|
| 52 |
+
# thread handling
|
| 53 |
+
self.lowCmdWriteThreadPtr = None
|
| 54 |
+
|
| 55 |
+
self.crc = CRC()
|
| 56 |
+
|
| 57 |
+
def Init(self):
|
| 58 |
+
self.InitLowCmd()
|
| 59 |
+
|
| 60 |
+
# create publisher #
|
| 61 |
+
self.lowcmd_publisher = ChannelPublisher("rt/lowcmd", LowCmd_)
|
| 62 |
+
self.lowcmd_publisher.Init()
|
| 63 |
+
|
| 64 |
+
# create subscriber #
|
| 65 |
+
self.lowstate_subscriber = ChannelSubscriber("rt/lowstate", LowState_)
|
| 66 |
+
self.lowstate_subscriber.Init(self.LowStateMessageHandler, 10)
|
| 67 |
+
|
| 68 |
+
self.sc = SportClient()
|
| 69 |
+
self.sc.SetTimeout(5.0)
|
| 70 |
+
self.sc.Init()
|
| 71 |
+
|
| 72 |
+
self.msc = MotionSwitcherClient()
|
| 73 |
+
self.msc.SetTimeout(5.0)
|
| 74 |
+
self.msc.Init()
|
| 75 |
+
|
| 76 |
+
status, result = self.msc.CheckMode()
|
| 77 |
+
while result['name']:
|
| 78 |
+
self.sc.StandDown()
|
| 79 |
+
self.msc.ReleaseMode()
|
| 80 |
+
status, result = self.msc.CheckMode()
|
| 81 |
+
time.sleep(1)
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def Start(self):
|
| 85 |
+
self.lowCmdWriteThreadPtr = RecurrentThread(
|
| 86 |
+
interval=0.002, target=self.LowCmdWrite, name="writebasiccmd"
|
| 87 |
+
)
|
| 88 |
+
self.lowCmdWriteThreadPtr.Start()
|
| 89 |
+
|
| 90 |
+
def InitLowCmd(self):
|
| 91 |
+
self.low_cmd.head[0] = 0xFE
|
| 92 |
+
self.low_cmd.head[1] = 0xEF
|
| 93 |
+
self.low_cmd.level_flag = 0xFF
|
| 94 |
+
self.low_cmd.gpio = 0
|
| 95 |
+
for i in range(20):
|
| 96 |
+
self.low_cmd.motor_cmd[i].mode = 0x01
|
| 97 |
+
self.low_cmd.motor_cmd[i].q= b2.PosStopF
|
| 98 |
+
self.low_cmd.motor_cmd[i].kp = 0
|
| 99 |
+
self.low_cmd.motor_cmd[i].dq = b2.VelStopF
|
| 100 |
+
self.low_cmd.motor_cmd[i].kd = 0
|
| 101 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 102 |
+
|
| 103 |
+
def LowStateMessageHandler(self, msg: LowState_):
|
| 104 |
+
self.low_state = msg
|
| 105 |
+
|
| 106 |
+
def LowCmdWrite(self):
|
| 107 |
+
|
| 108 |
+
if self.firstRun:
|
| 109 |
+
for i in range(12):
|
| 110 |
+
self.startPos[i] = self.low_state.motor_state[i].q
|
| 111 |
+
self.firstRun = False
|
| 112 |
+
|
| 113 |
+
self.percent_1 += 1.0 / self.duration_1
|
| 114 |
+
self.percent_1 = min(self.percent_1, 1)
|
| 115 |
+
if self.percent_1 < 1:
|
| 116 |
+
for i in range(12):
|
| 117 |
+
self.low_cmd.motor_cmd[i].q = (1 - self.percent_1) * self.startPos[i] + self.percent_1 * self.targetPos_1[i]
|
| 118 |
+
self.low_cmd.motor_cmd[i].dq = 0
|
| 119 |
+
self.low_cmd.motor_cmd[i].kp = self.Kp
|
| 120 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 121 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 122 |
+
|
| 123 |
+
if (self.percent_1 == 1) and (self.percent_2 <= 1):
|
| 124 |
+
self.percent_2 += 1.0 / self.duration_2
|
| 125 |
+
self.percent_2 = min(self.percent_2, 1)
|
| 126 |
+
for i in range(12):
|
| 127 |
+
self.low_cmd.motor_cmd[i].q = (1 - self.percent_2) * self.targetPos_1[i] + self.percent_2 * self.targetPos_2[i]
|
| 128 |
+
self.low_cmd.motor_cmd[i].dq = 0
|
| 129 |
+
self.low_cmd.motor_cmd[i].kp = self.Kp
|
| 130 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 131 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 132 |
+
|
| 133 |
+
if (self.percent_1 == 1) and (self.percent_2 == 1) and (self.percent_3 < 1):
|
| 134 |
+
self.percent_3 += 1.0 / self.duration_3
|
| 135 |
+
self.percent_3 = min(self.percent_3, 1)
|
| 136 |
+
for i in range(12):
|
| 137 |
+
self.low_cmd.motor_cmd[i].q = self.targetPos_2[i]
|
| 138 |
+
self.low_cmd.motor_cmd[i].dq = 0
|
| 139 |
+
self.low_cmd.motor_cmd[i].kp = self.Kp
|
| 140 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 141 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 142 |
+
|
| 143 |
+
if (self.percent_1 == 1) and (self.percent_2 == 1) and (self.percent_3 == 1) and (self.percent_4 <= 1):
|
| 144 |
+
self.percent_4 += 1.0 / self.duration_4
|
| 145 |
+
self.percent_4 = min(self.percent_4, 1)
|
| 146 |
+
for i in range(12):
|
| 147 |
+
self.low_cmd.motor_cmd[i].q = (1 - self.percent_4) * self.targetPos_2[i] + self.percent_4 * self.targetPos_3[i]
|
| 148 |
+
self.low_cmd.motor_cmd[i].dq = 0
|
| 149 |
+
self.low_cmd.motor_cmd[i].kp = self.Kp
|
| 150 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 151 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 152 |
+
|
| 153 |
+
self.low_cmd.crc = self.crc.Crc(self.low_cmd)
|
| 154 |
+
self.lowcmd_publisher.Write(self.low_cmd)
|
| 155 |
+
|
| 156 |
+
if __name__ == '__main__':
|
| 157 |
+
|
| 158 |
+
print("WARNING: Please ensure there are no obstacles around the robot while running this example.")
|
| 159 |
+
input("Press Enter to continue...")
|
| 160 |
+
|
| 161 |
+
if len(sys.argv)>1:
|
| 162 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 163 |
+
else:
|
| 164 |
+
ChannelFactoryInitialize(0)
|
| 165 |
+
|
| 166 |
+
custom = Custom()
|
| 167 |
+
custom.Init()
|
| 168 |
+
custom.Start()
|
| 169 |
+
|
| 170 |
+
while True:
|
| 171 |
+
if custom.percent_4 == 1.0:
|
| 172 |
+
time.sleep(1)
|
| 173 |
+
print("Done!")
|
| 174 |
+
sys.exit(-1)
|
| 175 |
+
time.sleep(1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2/low_level/unitree_legged_const.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
LegID = {
|
| 2 |
+
"FR_0": 0, # Front right hip
|
| 3 |
+
"FR_1": 1, # Front right thigh
|
| 4 |
+
"FR_2": 2, # Front right calf
|
| 5 |
+
"FL_0": 3,
|
| 6 |
+
"FL_1": 4,
|
| 7 |
+
"FL_2": 5,
|
| 8 |
+
"RR_0": 6,
|
| 9 |
+
"RR_1": 7,
|
| 10 |
+
"RR_2": 8,
|
| 11 |
+
"RL_0": 9,
|
| 12 |
+
"RL_1": 10,
|
| 13 |
+
"RL_2": 11,
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
HIGHLEVEL = 0xEE
|
| 17 |
+
LOWLEVEL = 0xFF
|
| 18 |
+
TRIGERLEVEL = 0xF0
|
| 19 |
+
PosStopF = 2.146e9
|
| 20 |
+
VelStopF = 16000.0
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2w/camera/camera_opencv.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from unitree_sdk2py.core.channel import ChannelFactoryInitialize
|
| 2 |
+
from unitree_sdk2py.b2.front_video.front_video_client import FrontVideoClient
|
| 3 |
+
from unitree_sdk2py.b2.back_video.back_video_client import BackVideoClient
|
| 4 |
+
import cv2
|
| 5 |
+
import numpy as np
|
| 6 |
+
import sys
|
| 7 |
+
|
| 8 |
+
def display_image(window_name, data):
|
| 9 |
+
# If data is a list, we need to convert it to a bytes object
|
| 10 |
+
if isinstance(data, list):
|
| 11 |
+
data = bytes(data)
|
| 12 |
+
|
| 13 |
+
# Now convert to numpy image
|
| 14 |
+
image_data = np.frombuffer(data, dtype=np.uint8)
|
| 15 |
+
image = cv2.imdecode(image_data, cv2.IMREAD_COLOR)
|
| 16 |
+
if image is not None:
|
| 17 |
+
cv2.imshow(window_name, image)
|
| 18 |
+
|
| 19 |
+
if __name__ == "__main__":
|
| 20 |
+
if len(sys.argv) > 1:
|
| 21 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 22 |
+
else:
|
| 23 |
+
ChannelFactoryInitialize(0)
|
| 24 |
+
|
| 25 |
+
frontCameraClient = FrontVideoClient() # Create a front camera video client
|
| 26 |
+
frontCameraClient.SetTimeout(3.0)
|
| 27 |
+
frontCameraClient.Init()
|
| 28 |
+
|
| 29 |
+
backCameraClient = BackVideoClient() # Create a back camera video client
|
| 30 |
+
backCameraClient.SetTimeout(3.0)
|
| 31 |
+
backCameraClient.Init()
|
| 32 |
+
|
| 33 |
+
# Loop to continuously fetch images
|
| 34 |
+
while True:
|
| 35 |
+
# Get front camera image
|
| 36 |
+
front_code, front_data = frontCameraClient.GetImageSample()
|
| 37 |
+
if front_code == 0:
|
| 38 |
+
display_image("Front Camera", front_data)
|
| 39 |
+
|
| 40 |
+
# Get back camera image
|
| 41 |
+
back_code, back_data = backCameraClient.GetImageSample()
|
| 42 |
+
if back_code == 0:
|
| 43 |
+
display_image("Back Camera", back_data)
|
| 44 |
+
|
| 45 |
+
# Press ESC to stop
|
| 46 |
+
if cv2.waitKey(20) == 27:
|
| 47 |
+
break
|
| 48 |
+
|
| 49 |
+
# Clean up windows
|
| 50 |
+
cv2.destroyAllWindows()
|
| 51 |
+
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2w/camera/capture_image.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import os
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
from unitree_sdk2py.core.channel import ChannelFactoryInitialize
|
| 6 |
+
from unitree_sdk2py.b2.front_video.front_video_client import FrontVideoClient
|
| 7 |
+
from unitree_sdk2py.b2.back_video.back_video_client import BackVideoClient
|
| 8 |
+
|
| 9 |
+
if __name__ == "__main__":
|
| 10 |
+
if len(sys.argv) > 1:
|
| 11 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 12 |
+
else:
|
| 13 |
+
ChannelFactoryInitialize(0)
|
| 14 |
+
|
| 15 |
+
# 创建前置相机客户端
|
| 16 |
+
front_client = FrontVideoClient()
|
| 17 |
+
front_client.SetTimeout(3.0)
|
| 18 |
+
front_client.Init()
|
| 19 |
+
|
| 20 |
+
# 创建后置相机客户端
|
| 21 |
+
back_client = BackVideoClient()
|
| 22 |
+
back_client.SetTimeout(3.0)
|
| 23 |
+
back_client.Init()
|
| 24 |
+
|
| 25 |
+
print("##################Get Front Camera Image###################")
|
| 26 |
+
# 获取前置相机图像
|
| 27 |
+
front_code, front_data = front_client.GetImageSample()
|
| 28 |
+
|
| 29 |
+
if front_code != 0:
|
| 30 |
+
print("Get front camera image error. Code:", front_code)
|
| 31 |
+
else:
|
| 32 |
+
front_image_name = "./front_img.jpg"
|
| 33 |
+
print("Front Image Saved as:", front_image_name)
|
| 34 |
+
|
| 35 |
+
with open(front_image_name, "+wb") as f:
|
| 36 |
+
f.write(bytes(front_data))
|
| 37 |
+
|
| 38 |
+
print("##################Get Back Camera Image###################")
|
| 39 |
+
# 获取后置相机图像
|
| 40 |
+
back_code, back_data = back_client.GetImageSample()
|
| 41 |
+
|
| 42 |
+
if back_code != 0:
|
| 43 |
+
print("Get back camera image error. Code:", back_code)
|
| 44 |
+
else:
|
| 45 |
+
back_image_name = "./back_img.jpg"
|
| 46 |
+
print("Back Image Saved as:", back_image_name)
|
| 47 |
+
|
| 48 |
+
with open(back_image_name, "+wb") as f:
|
| 49 |
+
f.write(bytes(back_data))
|
| 50 |
+
|
| 51 |
+
time.sleep(1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2w/high_level/b2w_sport_client.py
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
| 4 |
+
from unitree_sdk2py.b2.sport.sport_client import SportClient
|
| 5 |
+
import math
|
| 6 |
+
from dataclasses import dataclass
|
| 7 |
+
|
| 8 |
+
@dataclass
|
| 9 |
+
class TestOption:
|
| 10 |
+
name: str
|
| 11 |
+
id: int
|
| 12 |
+
|
| 13 |
+
option_list = [
|
| 14 |
+
TestOption(name="damp", id=0),
|
| 15 |
+
TestOption(name="stand_up", id=1),
|
| 16 |
+
TestOption(name="stand_down", id=2),
|
| 17 |
+
TestOption(name="move forward", id=3),
|
| 18 |
+
TestOption(name="move lateral", id=4),
|
| 19 |
+
TestOption(name="move rotate", id=5),
|
| 20 |
+
TestOption(name="stop_move", id=6),
|
| 21 |
+
TestOption(name="switch_gait", id=7),
|
| 22 |
+
TestOption(name="switch_gait", id=8),
|
| 23 |
+
TestOption(name="recovery", id=9)
|
| 24 |
+
]
|
| 25 |
+
|
| 26 |
+
class UserInterface:
|
| 27 |
+
def __init__(self):
|
| 28 |
+
self.test_option_ = None
|
| 29 |
+
|
| 30 |
+
def convert_to_int(self, input_str):
|
| 31 |
+
try:
|
| 32 |
+
return int(input_str)
|
| 33 |
+
except ValueError:
|
| 34 |
+
return None
|
| 35 |
+
|
| 36 |
+
def terminal_handle(self):
|
| 37 |
+
input_str = input("Enter id or name: \n")
|
| 38 |
+
|
| 39 |
+
if input_str == "list":
|
| 40 |
+
self.test_option_.name = None
|
| 41 |
+
self.test_option_.id = None
|
| 42 |
+
for option in option_list:
|
| 43 |
+
print(f"name: {option.name}, id: {option.id}")
|
| 44 |
+
return
|
| 45 |
+
|
| 46 |
+
for option in option_list:
|
| 47 |
+
if input_str == option.name or self.convert_to_int(input_str) == option.id:
|
| 48 |
+
self.test_option_.name = option.name
|
| 49 |
+
self.test_option_.id = option.id
|
| 50 |
+
print(f"Test: {self.test_option_.name}, test_id: {self.test_option_.id}")
|
| 51 |
+
return
|
| 52 |
+
|
| 53 |
+
print("No matching test option found.")
|
| 54 |
+
|
| 55 |
+
if __name__ == "__main__":
|
| 56 |
+
if len(sys.argv) < 2:
|
| 57 |
+
print(f"Usage: python3 {sys.argv[0]} networkInterface")
|
| 58 |
+
sys.exit(-1)
|
| 59 |
+
|
| 60 |
+
print("WARNING: Please ensure there are no obstacles around the robot while running this example.")
|
| 61 |
+
input("Press Enter to continue...")
|
| 62 |
+
|
| 63 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 64 |
+
|
| 65 |
+
test_option = TestOption(name=None, id=None)
|
| 66 |
+
user_interface = UserInterface()
|
| 67 |
+
user_interface.test_option_ = test_option
|
| 68 |
+
|
| 69 |
+
sport_client = SportClient()
|
| 70 |
+
sport_client.SetTimeout(10.0)
|
| 71 |
+
sport_client.Init()
|
| 72 |
+
|
| 73 |
+
print("Input \"list\" to list all test option ...")
|
| 74 |
+
|
| 75 |
+
while True:
|
| 76 |
+
user_interface.terminal_handle()
|
| 77 |
+
|
| 78 |
+
print(f"Updated Test Option: Name = {test_option.name}, ID = {test_option.id}\n")
|
| 79 |
+
|
| 80 |
+
if test_option.id == 0:
|
| 81 |
+
sport_client.Damp()
|
| 82 |
+
elif test_option.id == 1:
|
| 83 |
+
sport_client.StandUp()
|
| 84 |
+
elif test_option.id == 2:
|
| 85 |
+
sport_client.StandDown()
|
| 86 |
+
elif test_option.id == 3:
|
| 87 |
+
sport_client.Move(0.3,0,0)
|
| 88 |
+
elif test_option.id == 4:
|
| 89 |
+
sport_client.Move(0,0.3,0)
|
| 90 |
+
elif test_option.id == 5:
|
| 91 |
+
sport_client.Move(0,0,0.5)
|
| 92 |
+
elif test_option.id == 6:
|
| 93 |
+
sport_client.StopMove()
|
| 94 |
+
elif test_option.id == 7:
|
| 95 |
+
sport_client.SwitchGait(0)
|
| 96 |
+
elif test_option.id == 8:
|
| 97 |
+
sport_client.SwitchGait(1)
|
| 98 |
+
elif test_option.id == 9:
|
| 99 |
+
sport_client.RecoveryStand()
|
| 100 |
+
|
| 101 |
+
time.sleep(1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2w/low_level/b2w_stand_example.py
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactoryInitialize
|
| 5 |
+
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
| 6 |
+
from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowCmd_
|
| 7 |
+
from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowState_
|
| 8 |
+
from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowCmd_
|
| 9 |
+
from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowState_
|
| 10 |
+
from unitree_sdk2py.utils.crc import CRC
|
| 11 |
+
from unitree_sdk2py.utils.thread import RecurrentThread
|
| 12 |
+
import unitree_legged_const as b2w
|
| 13 |
+
from unitree_sdk2py.comm.motion_switcher.motion_switcher_client import MotionSwitcherClient
|
| 14 |
+
from unitree_sdk2py.b2.sport.sport_client import SportClient
|
| 15 |
+
|
| 16 |
+
class Custom:
|
| 17 |
+
def __init__(self):
|
| 18 |
+
self.Kp = 1000.0
|
| 19 |
+
self.Kd = 10.0
|
| 20 |
+
self.time_consume = 0
|
| 21 |
+
self.rate_count = 0
|
| 22 |
+
self.sin_count = 0
|
| 23 |
+
self.motiontime = 0
|
| 24 |
+
self.dt = 0.002
|
| 25 |
+
|
| 26 |
+
self.low_cmd = unitree_go_msg_dds__LowCmd_()
|
| 27 |
+
self.low_state = None
|
| 28 |
+
|
| 29 |
+
self.targetPos_1 = [0.0, 1.36, -2.65, 0.0, 1.36, -2.65,
|
| 30 |
+
-0.2, 1.36, -2.65, 0.2, 1.36, -2.65]
|
| 31 |
+
|
| 32 |
+
self.targetPos_2 = [0.0, 0.67, -1.3, 0.0, 0.67, -1.3,
|
| 33 |
+
0.0, 0.67, -1.3, 0.0, 0.67, -1.3]
|
| 34 |
+
|
| 35 |
+
self.targetPos_3 = [-0.65, 1.36, -2.65, 0.65, 1.36, -2.65,
|
| 36 |
+
-0.65, 1.36, -2.65, 0.65, 1.36, -2.65]
|
| 37 |
+
|
| 38 |
+
self.startPos = [0.0] * 12
|
| 39 |
+
self.duration_1 = 800
|
| 40 |
+
self.duration_2 = 800
|
| 41 |
+
self.duration_3 = 2000
|
| 42 |
+
self.duration_4 = 1500
|
| 43 |
+
self.percent_1 = 0
|
| 44 |
+
self.percent_2 = 0
|
| 45 |
+
self.percent_3 = 0
|
| 46 |
+
self.percent_4 = 0
|
| 47 |
+
|
| 48 |
+
self.firstRun = True
|
| 49 |
+
self.done = False
|
| 50 |
+
|
| 51 |
+
# thread handling
|
| 52 |
+
self.lowCmdWriteThreadPtr = None
|
| 53 |
+
|
| 54 |
+
self.crc = CRC()
|
| 55 |
+
|
| 56 |
+
def Init(self):
|
| 57 |
+
self.InitLowCmd()
|
| 58 |
+
|
| 59 |
+
# create publisher #
|
| 60 |
+
self.lowcmd_publisher = ChannelPublisher("rt/lowcmd", LowCmd_)
|
| 61 |
+
self.lowcmd_publisher.Init()
|
| 62 |
+
|
| 63 |
+
# create subscriber #
|
| 64 |
+
self.lowstate_subscriber = ChannelSubscriber("rt/lowstate", LowState_)
|
| 65 |
+
self.lowstate_subscriber.Init(self.LowStateMessageHandler, 10)
|
| 66 |
+
|
| 67 |
+
self.sc = SportClient()
|
| 68 |
+
self.sc.SetTimeout(5.0)
|
| 69 |
+
self.sc.Init()
|
| 70 |
+
|
| 71 |
+
self.msc = MotionSwitcherClient()
|
| 72 |
+
self.msc.SetTimeout(5.0)
|
| 73 |
+
self.msc.Init()
|
| 74 |
+
|
| 75 |
+
status, result = self.msc.CheckMode()
|
| 76 |
+
while result['name']:
|
| 77 |
+
self.sc.StandDown()
|
| 78 |
+
self.msc.ReleaseMode()
|
| 79 |
+
status, result = self.msc.CheckMode()
|
| 80 |
+
time.sleep(1)
|
| 81 |
+
|
| 82 |
+
def Start(self):
|
| 83 |
+
self.lowCmdWriteThreadPtr = RecurrentThread(
|
| 84 |
+
name="writebasiccmd", interval=self.dt, target=self.LowCmdWrite,
|
| 85 |
+
)
|
| 86 |
+
self.lowCmdWriteThreadPtr.Start()
|
| 87 |
+
|
| 88 |
+
def InitLowCmd(self):
|
| 89 |
+
self.low_cmd.head[0] = 0xFE
|
| 90 |
+
self.low_cmd.head[1] = 0xEF
|
| 91 |
+
self.low_cmd.level_flag = 0xFF
|
| 92 |
+
self.low_cmd.gpio = 0
|
| 93 |
+
for i in range(20):
|
| 94 |
+
self.low_cmd.motor_cmd[i].mode = 0x01 # (PMSM) mode
|
| 95 |
+
self.low_cmd.motor_cmd[i].q = b2w.PosStopF
|
| 96 |
+
self.low_cmd.motor_cmd[i].kp = 0
|
| 97 |
+
self.low_cmd.motor_cmd[i].dq = b2w.VelStopF
|
| 98 |
+
self.low_cmd.motor_cmd[i].kd = 0
|
| 99 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 100 |
+
|
| 101 |
+
def LowStateMessageHandler(self, msg: LowState_):
|
| 102 |
+
self.low_state = msg
|
| 103 |
+
|
| 104 |
+
def LowCmdWrite(self):
|
| 105 |
+
if self.firstRun:
|
| 106 |
+
for i in range(12):
|
| 107 |
+
self.startPos[i] = self.low_state.motor_state[i].q
|
| 108 |
+
self.firstRun = False
|
| 109 |
+
|
| 110 |
+
self.percent_1 += 1.0 / self.duration_1
|
| 111 |
+
self.percent_1 = min(self.percent_1, 1)
|
| 112 |
+
if self.percent_1 < 1:
|
| 113 |
+
for i in range(12):
|
| 114 |
+
self.low_cmd.motor_cmd[i].q = (1 - self.percent_1) * self.startPos[i] + self.percent_1 * self.targetPos_1[i]
|
| 115 |
+
self.low_cmd.motor_cmd[i].dq = 0
|
| 116 |
+
self.low_cmd.motor_cmd[i].kp = self.Kp
|
| 117 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 118 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 119 |
+
|
| 120 |
+
if (self.percent_1 == 1) and (self.percent_2 <= 1):
|
| 121 |
+
self.percent_2 += 1.0 / self.duration_2
|
| 122 |
+
self.percent_2 = min(self.percent_2, 1)
|
| 123 |
+
for i in range(12):
|
| 124 |
+
self.low_cmd.motor_cmd[i].q = (1 - self.percent_2) * self.targetPos_1[i] + self.percent_2 * self.targetPos_2[i]
|
| 125 |
+
self.low_cmd.motor_cmd[i].dq = 0
|
| 126 |
+
self.low_cmd.motor_cmd[i].kp = self.Kp
|
| 127 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 128 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 129 |
+
|
| 130 |
+
if (self.percent_1 == 1) and (self.percent_2 == 1) and (self.percent_3 < 1):
|
| 131 |
+
self.percent_3 += 1.0 / self.duration_3
|
| 132 |
+
self.percent_3 = min(self.percent_3, 1)
|
| 133 |
+
for i in range(12):
|
| 134 |
+
self.low_cmd.motor_cmd[i].q = self.targetPos_2[i]
|
| 135 |
+
self.low_cmd.motor_cmd[i].dq = 0
|
| 136 |
+
self.low_cmd.motor_cmd[i].kp = self.Kp
|
| 137 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 138 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 139 |
+
|
| 140 |
+
if self.percent_3 < 0.4:
|
| 141 |
+
for i in range(12, 16):
|
| 142 |
+
self.low_cmd.motor_cmd[i].q = 0
|
| 143 |
+
self.low_cmd.motor_cmd[i].kp = 0
|
| 144 |
+
self.low_cmd.motor_cmd[i].dq = 3
|
| 145 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 146 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 147 |
+
|
| 148 |
+
if 0.4 <= self.percent_3 < 0.8:
|
| 149 |
+
for i in range(12, 16):
|
| 150 |
+
self.low_cmd.motor_cmd[i].q = 0
|
| 151 |
+
self.low_cmd.motor_cmd[i].kp = 0
|
| 152 |
+
self.low_cmd.motor_cmd[i].dq = -3
|
| 153 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 154 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 155 |
+
|
| 156 |
+
if self.percent_3 >= 0.8:
|
| 157 |
+
for i in range(12, 16):
|
| 158 |
+
self.low_cmd.motor_cmd[i].q = 0
|
| 159 |
+
self.low_cmd.motor_cmd[i].kp = 0
|
| 160 |
+
self.low_cmd.motor_cmd[i].dq = 0
|
| 161 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 162 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 163 |
+
|
| 164 |
+
if (self.percent_1 == 1) and (self.percent_2 == 1) and (self.percent_3 == 1) and (self.percent_4 <= 1):
|
| 165 |
+
self.percent_4 += 1.0 / self.duration_4
|
| 166 |
+
self.percent_4 = min(self.percent_4, 1)
|
| 167 |
+
for i in range(12):
|
| 168 |
+
self.low_cmd.motor_cmd[i].q = (1 - self.percent_4) * self.targetPos_2[i] + self.percent_4 * self.targetPos_3[i]
|
| 169 |
+
self.low_cmd.motor_cmd[i].dq = 0
|
| 170 |
+
self.low_cmd.motor_cmd[i].kp = self.Kp
|
| 171 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 172 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 173 |
+
|
| 174 |
+
self.low_cmd.crc = self.crc.Crc(self.low_cmd)
|
| 175 |
+
self.lowcmd_publisher.Write(self.low_cmd)
|
| 176 |
+
|
| 177 |
+
if __name__ == '__main__':
|
| 178 |
+
|
| 179 |
+
print("WARNING: Please ensure there are no obstacles around the robot while running this example.")
|
| 180 |
+
input("Press Enter to continue...")
|
| 181 |
+
|
| 182 |
+
if len(sys.argv)>1:
|
| 183 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 184 |
+
else:
|
| 185 |
+
ChannelFactoryInitialize(0)
|
| 186 |
+
|
| 187 |
+
custom = Custom()
|
| 188 |
+
custom.Init()
|
| 189 |
+
custom.Start()
|
| 190 |
+
|
| 191 |
+
while True:
|
| 192 |
+
if custom.percent_4 == 1.0:
|
| 193 |
+
time.sleep(1)
|
| 194 |
+
print("Done!")
|
| 195 |
+
sys.exit(-1)
|
| 196 |
+
time.sleep(1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/b2w/low_level/unitree_legged_const.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
LegID = {
|
| 2 |
+
"FR_0": 0, # Front right hip
|
| 3 |
+
"FR_1": 1, # Front right thigh
|
| 4 |
+
"FR_2": 2, # Front right calf
|
| 5 |
+
"FL_0": 3,
|
| 6 |
+
"FL_1": 4,
|
| 7 |
+
"FL_2": 5,
|
| 8 |
+
"RR_0": 6,
|
| 9 |
+
"RR_1": 7,
|
| 10 |
+
"RR_2": 8,
|
| 11 |
+
"RL_0": 9,
|
| 12 |
+
"RL_1": 10,
|
| 13 |
+
"RL_2": 11,
|
| 14 |
+
"FR_w": 12, # Front right wheel
|
| 15 |
+
"FL_w": 13, # Front left wheel
|
| 16 |
+
"RR_w": 14, # Rear right wheel
|
| 17 |
+
"RL_w": 15, # Rear left wheel
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
HIGHLEVEL = 0xEE
|
| 21 |
+
LOWLEVEL = 0xFF
|
| 22 |
+
TRIGERLEVEL = 0xF0
|
| 23 |
+
PosStopF = 2.146e9
|
| 24 |
+
VelStopF = 16000.0
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/g1/audio/g1_audio_client_example.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
| 4 |
+
from unitree_sdk2py.g1.audio.g1_audio_client import AudioClient
|
| 5 |
+
from unitree_sdk2py.g1.loco.g1_loco_client import LocoClient
|
| 6 |
+
|
| 7 |
+
if __name__ == "__main__":
|
| 8 |
+
if len(sys.argv) < 2:
|
| 9 |
+
print(f"Usage: python3 {sys.argv[0]} networkInterface")
|
| 10 |
+
sys.exit(-1)
|
| 11 |
+
|
| 12 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 13 |
+
|
| 14 |
+
audio_client = AudioClient()
|
| 15 |
+
audio_client.SetTimeout(10.0)
|
| 16 |
+
audio_client.Init()
|
| 17 |
+
|
| 18 |
+
sport_client = LocoClient()
|
| 19 |
+
sport_client.SetTimeout(10.0)
|
| 20 |
+
sport_client.Init()
|
| 21 |
+
|
| 22 |
+
ret = audio_client.GetVolume()
|
| 23 |
+
print("debug GetVolume: ",ret)
|
| 24 |
+
|
| 25 |
+
audio_client.SetVolume(85)
|
| 26 |
+
|
| 27 |
+
ret = audio_client.GetVolume()
|
| 28 |
+
print("debug GetVolume: ",ret)
|
| 29 |
+
|
| 30 |
+
sport_client.WaveHand()
|
| 31 |
+
|
| 32 |
+
audio_client.TtsMaker("大家好!我是宇树科技人形机器人。语音开发测试例程运行成功! 很高兴认识你!",0)
|
| 33 |
+
time.sleep(8)
|
| 34 |
+
audio_client.TtsMaker("接下来测试灯带开发例程!",0)
|
| 35 |
+
time.sleep(1)
|
| 36 |
+
audio_client.LedControl(255,0,0)
|
| 37 |
+
time.sleep(1)
|
| 38 |
+
audio_client.LedControl(0,255,0)
|
| 39 |
+
time.sleep(1)
|
| 40 |
+
audio_client.LedControl(0,0,255)
|
| 41 |
+
|
| 42 |
+
time.sleep(3)
|
| 43 |
+
audio_client.TtsMaker("测试完毕,谢谢大家!",0)
|
| 44 |
+
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/g1/high_level/g1_arm5_sdk_dds_example.py
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactoryInitialize
|
| 5 |
+
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
| 6 |
+
from unitree_sdk2py.idl.default import unitree_hg_msg_dds__LowCmd_
|
| 7 |
+
from unitree_sdk2py.idl.default import unitree_hg_msg_dds__LowState_
|
| 8 |
+
from unitree_sdk2py.idl.unitree_hg.msg.dds_ import LowCmd_
|
| 9 |
+
from unitree_sdk2py.idl.unitree_hg.msg.dds_ import LowState_
|
| 10 |
+
from unitree_sdk2py.utils.crc import CRC
|
| 11 |
+
from unitree_sdk2py.utils.thread import RecurrentThread
|
| 12 |
+
from unitree_sdk2py.comm.motion_switcher.motion_switcher_client import MotionSwitcherClient
|
| 13 |
+
|
| 14 |
+
import numpy as np
|
| 15 |
+
|
| 16 |
+
kPi = 3.141592654
|
| 17 |
+
kPi_2 = 1.57079632
|
| 18 |
+
|
| 19 |
+
class G1JointIndex:
|
| 20 |
+
# Left leg
|
| 21 |
+
LeftHipPitch = 0
|
| 22 |
+
LeftHipRoll = 1
|
| 23 |
+
LeftHipYaw = 2
|
| 24 |
+
LeftKnee = 3
|
| 25 |
+
LeftAnklePitch = 4
|
| 26 |
+
LeftAnkleB = 4
|
| 27 |
+
LeftAnkleRoll = 5
|
| 28 |
+
LeftAnkleA = 5
|
| 29 |
+
|
| 30 |
+
# Right leg
|
| 31 |
+
RightHipPitch = 6
|
| 32 |
+
RightHipRoll = 7
|
| 33 |
+
RightHipYaw = 8
|
| 34 |
+
RightKnee = 9
|
| 35 |
+
RightAnklePitch = 10
|
| 36 |
+
RightAnkleB = 10
|
| 37 |
+
RightAnkleRoll = 11
|
| 38 |
+
RightAnkleA = 11
|
| 39 |
+
|
| 40 |
+
WaistYaw = 12
|
| 41 |
+
WaistRoll = 13 # NOTE: INVALID for g1 23dof/29dof with waist locked
|
| 42 |
+
WaistA = 13 # NOTE: INVALID for g1 23dof/29dof with waist locked
|
| 43 |
+
WaistPitch = 14 # NOTE: INVALID for g1 23dof/29dof with waist locked
|
| 44 |
+
WaistB = 14 # NOTE: INVALID for g1 23dof/29dof with waist locked
|
| 45 |
+
|
| 46 |
+
# Left arm
|
| 47 |
+
LeftShoulderPitch = 15
|
| 48 |
+
LeftShoulderRoll = 16
|
| 49 |
+
LeftShoulderYaw = 17
|
| 50 |
+
LeftElbow = 18
|
| 51 |
+
LeftWristRoll = 19
|
| 52 |
+
LeftWristPitch = 20 # NOTE: INVALID for g1 23dof
|
| 53 |
+
LeftWristYaw = 21 # NOTE: INVALID for g1 23dof
|
| 54 |
+
|
| 55 |
+
# Right arm
|
| 56 |
+
RightShoulderPitch = 22
|
| 57 |
+
RightShoulderRoll = 23
|
| 58 |
+
RightShoulderYaw = 24
|
| 59 |
+
RightElbow = 25
|
| 60 |
+
RightWristRoll = 26
|
| 61 |
+
RightWristPitch = 27 # NOTE: INVALID for g1 23dof
|
| 62 |
+
RightWristYaw = 28 # NOTE: INVALID for g1 23dof
|
| 63 |
+
|
| 64 |
+
kNotUsedJoint = 29 # NOTE: Weight
|
| 65 |
+
|
| 66 |
+
class Custom:
|
| 67 |
+
def __init__(self):
|
| 68 |
+
self.time_ = 0.0
|
| 69 |
+
self.control_dt_ = 0.02
|
| 70 |
+
self.duration_ = 3.0
|
| 71 |
+
self.counter_ = 0
|
| 72 |
+
self.weight = 0.
|
| 73 |
+
self.weight_rate = 0.2
|
| 74 |
+
self.kp = 60.
|
| 75 |
+
self.kd = 1.5
|
| 76 |
+
self.dq = 0.
|
| 77 |
+
self.tau_ff = 0.
|
| 78 |
+
self.mode_machine_ = 0
|
| 79 |
+
self.low_cmd = unitree_hg_msg_dds__LowCmd_()
|
| 80 |
+
self.low_state = None
|
| 81 |
+
self.first_update_low_state = False
|
| 82 |
+
self.crc = CRC()
|
| 83 |
+
self.done = False
|
| 84 |
+
|
| 85 |
+
self.target_pos = [
|
| 86 |
+
0.0, kPi_2, 0.0, kPi_2, 0.0,
|
| 87 |
+
0.0, -kPi_2, 0.0, kPi_2, 0.0,
|
| 88 |
+
0.0, 0.0, 0.0
|
| 89 |
+
]
|
| 90 |
+
|
| 91 |
+
self.arm_joints = [
|
| 92 |
+
G1JointIndex.LeftShoulderPitch, G1JointIndex.LeftShoulderRoll,
|
| 93 |
+
G1JointIndex.LeftShoulderYaw, G1JointIndex.LeftElbow,
|
| 94 |
+
G1JointIndex.LeftWristRoll,
|
| 95 |
+
G1JointIndex.RightShoulderPitch, G1JointIndex.RightShoulderRoll,
|
| 96 |
+
G1JointIndex.RightShoulderYaw, G1JointIndex.RightElbow,
|
| 97 |
+
G1JointIndex.RightWristRoll,
|
| 98 |
+
G1JointIndex.WaistYaw,
|
| 99 |
+
G1JointIndex.WaistRoll,
|
| 100 |
+
G1JointIndex.WaistPitch
|
| 101 |
+
]
|
| 102 |
+
|
| 103 |
+
def Init(self):
|
| 104 |
+
# create publisher #
|
| 105 |
+
self.arm_sdk_publisher = ChannelPublisher("rt/arm_sdk", LowCmd_)
|
| 106 |
+
self.arm_sdk_publisher.Init()
|
| 107 |
+
|
| 108 |
+
# create subscriber #
|
| 109 |
+
self.lowstate_subscriber = ChannelSubscriber("rt/lowstate", LowState_)
|
| 110 |
+
self.lowstate_subscriber.Init(self.LowStateHandler, 10)
|
| 111 |
+
|
| 112 |
+
def Start(self):
|
| 113 |
+
self.lowCmdWriteThreadPtr = RecurrentThread(
|
| 114 |
+
interval=self.control_dt_, target=self.LowCmdWrite, name="control"
|
| 115 |
+
)
|
| 116 |
+
while self.first_update_low_state == False:
|
| 117 |
+
time.sleep(1)
|
| 118 |
+
|
| 119 |
+
if self.first_update_low_state == True:
|
| 120 |
+
self.lowCmdWriteThreadPtr.Start()
|
| 121 |
+
|
| 122 |
+
def LowStateHandler(self, msg: LowState_):
|
| 123 |
+
self.low_state = msg
|
| 124 |
+
|
| 125 |
+
if self.first_update_low_state == False:
|
| 126 |
+
self.first_update_low_state = True
|
| 127 |
+
|
| 128 |
+
def LowCmdWrite(self):
|
| 129 |
+
self.time_ += self.control_dt_
|
| 130 |
+
|
| 131 |
+
if self.time_ < self.duration_ :
|
| 132 |
+
# [Stage 1]: set robot to zero posture
|
| 133 |
+
self.low_cmd.motor_cmd[G1JointIndex.kNotUsedJoint].q = 1 # 1:Enable arm_sdk, 0:Disable arm_sdk
|
| 134 |
+
for i,joint in enumerate(self.arm_joints):
|
| 135 |
+
ratio = np.clip(self.time_ / self.duration_, 0.0, 1.0)
|
| 136 |
+
self.low_cmd.motor_cmd[joint].tau = 0.
|
| 137 |
+
self.low_cmd.motor_cmd[joint].q = (1.0 - ratio) * self.low_state.motor_state[joint].q
|
| 138 |
+
self.low_cmd.motor_cmd[joint].dq = 0.
|
| 139 |
+
self.low_cmd.motor_cmd[joint].kp = self.kp
|
| 140 |
+
self.low_cmd.motor_cmd[joint].kd = self.kd
|
| 141 |
+
|
| 142 |
+
elif self.time_ < self.duration_ * 3 :
|
| 143 |
+
# [Stage 2]: lift arms up
|
| 144 |
+
for i,joint in enumerate(self.arm_joints):
|
| 145 |
+
ratio = np.clip((self.time_ - self.duration_) / (self.duration_ * 2), 0.0, 1.0)
|
| 146 |
+
self.low_cmd.motor_cmd[joint].tau = 0.
|
| 147 |
+
self.low_cmd.motor_cmd[joint].q = ratio * self.target_pos[i] + (1.0 - ratio) * self.low_state.motor_state[joint].q
|
| 148 |
+
self.low_cmd.motor_cmd[joint].dq = 0.
|
| 149 |
+
self.low_cmd.motor_cmd[joint].kp = self.kp
|
| 150 |
+
self.low_cmd.motor_cmd[joint].kd = self.kd
|
| 151 |
+
|
| 152 |
+
elif self.time_ < self.duration_ * 6 :
|
| 153 |
+
# [Stage 3]: set robot back to zero posture
|
| 154 |
+
for i,joint in enumerate(self.arm_joints):
|
| 155 |
+
ratio = np.clip((self.time_ - self.duration_*3) / (self.duration_ * 3), 0.0, 1.0)
|
| 156 |
+
self.low_cmd.motor_cmd[joint].tau = 0.
|
| 157 |
+
self.low_cmd.motor_cmd[joint].q = (1.0 - ratio) * self.low_state.motor_state[joint].q
|
| 158 |
+
self.low_cmd.motor_cmd[joint].dq = 0.
|
| 159 |
+
self.low_cmd.motor_cmd[joint].kp = self.kp
|
| 160 |
+
self.low_cmd.motor_cmd[joint].kd = self.kd
|
| 161 |
+
|
| 162 |
+
elif self.time_ < self.duration_ * 7 :
|
| 163 |
+
# [Stage 4]: release arm_sdk
|
| 164 |
+
for i,joint in enumerate(self.arm_joints):
|
| 165 |
+
ratio = np.clip((self.time_ - self.duration_*6) / (self.duration_), 0.0, 1.0)
|
| 166 |
+
self.low_cmd.motor_cmd[G1JointIndex.kNotUsedJoint].q = (1 - ratio) # 1:Enable arm_sdk, 0:Disable arm_sdk
|
| 167 |
+
|
| 168 |
+
else:
|
| 169 |
+
self.done = True
|
| 170 |
+
|
| 171 |
+
self.low_cmd.crc = self.crc.Crc(self.low_cmd)
|
| 172 |
+
self.arm_sdk_publisher.Write(self.low_cmd)
|
| 173 |
+
|
| 174 |
+
if __name__ == '__main__':
|
| 175 |
+
|
| 176 |
+
print("WARNING: Please ensure there are no obstacles around the robot while running this example.")
|
| 177 |
+
input("Press Enter to continue...")
|
| 178 |
+
|
| 179 |
+
if len(sys.argv)>1:
|
| 180 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 181 |
+
else:
|
| 182 |
+
ChannelFactoryInitialize(0)
|
| 183 |
+
|
| 184 |
+
custom = Custom()
|
| 185 |
+
custom.Init()
|
| 186 |
+
custom.Start()
|
| 187 |
+
|
| 188 |
+
while True:
|
| 189 |
+
time.sleep(1)
|
| 190 |
+
if custom.done:
|
| 191 |
+
print("Done!")
|
| 192 |
+
sys.exit(-1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/g1/high_level/g1_arm7_sdk_dds_example.py
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactoryInitialize
|
| 5 |
+
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
| 6 |
+
from unitree_sdk2py.idl.default import unitree_hg_msg_dds__LowCmd_
|
| 7 |
+
from unitree_sdk2py.idl.default import unitree_hg_msg_dds__LowState_
|
| 8 |
+
from unitree_sdk2py.idl.unitree_hg.msg.dds_ import LowCmd_
|
| 9 |
+
from unitree_sdk2py.idl.unitree_hg.msg.dds_ import LowState_
|
| 10 |
+
from unitree_sdk2py.utils.crc import CRC
|
| 11 |
+
from unitree_sdk2py.utils.thread import RecurrentThread
|
| 12 |
+
from unitree_sdk2py.comm.motion_switcher.motion_switcher_client import MotionSwitcherClient
|
| 13 |
+
|
| 14 |
+
import numpy as np
|
| 15 |
+
|
| 16 |
+
kPi = 3.141592654
|
| 17 |
+
kPi_2 = 1.57079632
|
| 18 |
+
|
| 19 |
+
class G1JointIndex:
|
| 20 |
+
# Left leg
|
| 21 |
+
LeftHipPitch = 0
|
| 22 |
+
LeftHipRoll = 1
|
| 23 |
+
LeftHipYaw = 2
|
| 24 |
+
LeftKnee = 3
|
| 25 |
+
LeftAnklePitch = 4
|
| 26 |
+
LeftAnkleB = 4
|
| 27 |
+
LeftAnkleRoll = 5
|
| 28 |
+
LeftAnkleA = 5
|
| 29 |
+
|
| 30 |
+
# Right leg
|
| 31 |
+
RightHipPitch = 6
|
| 32 |
+
RightHipRoll = 7
|
| 33 |
+
RightHipYaw = 8
|
| 34 |
+
RightKnee = 9
|
| 35 |
+
RightAnklePitch = 10
|
| 36 |
+
RightAnkleB = 10
|
| 37 |
+
RightAnkleRoll = 11
|
| 38 |
+
RightAnkleA = 11
|
| 39 |
+
|
| 40 |
+
WaistYaw = 12
|
| 41 |
+
WaistRoll = 13 # NOTE: INVALID for g1 23dof/29dof with waist locked
|
| 42 |
+
WaistA = 13 # NOTE: INVALID for g1 23dof/29dof with waist locked
|
| 43 |
+
WaistPitch = 14 # NOTE: INVALID for g1 23dof/29dof with waist locked
|
| 44 |
+
WaistB = 14 # NOTE: INVALID for g1 23dof/29dof with waist locked
|
| 45 |
+
|
| 46 |
+
# Left arm
|
| 47 |
+
LeftShoulderPitch = 15
|
| 48 |
+
LeftShoulderRoll = 16
|
| 49 |
+
LeftShoulderYaw = 17
|
| 50 |
+
LeftElbow = 18
|
| 51 |
+
LeftWristRoll = 19
|
| 52 |
+
LeftWristPitch = 20 # NOTE: INVALID for g1 23dof
|
| 53 |
+
LeftWristYaw = 21 # NOTE: INVALID for g1 23dof
|
| 54 |
+
|
| 55 |
+
# Right arm
|
| 56 |
+
RightShoulderPitch = 22
|
| 57 |
+
RightShoulderRoll = 23
|
| 58 |
+
RightShoulderYaw = 24
|
| 59 |
+
RightElbow = 25
|
| 60 |
+
RightWristRoll = 26
|
| 61 |
+
RightWristPitch = 27 # NOTE: INVALID for g1 23dof
|
| 62 |
+
RightWristYaw = 28 # NOTE: INVALID for g1 23dof
|
| 63 |
+
|
| 64 |
+
kNotUsedJoint = 29 # NOTE: Weight
|
| 65 |
+
|
| 66 |
+
class Custom:
|
| 67 |
+
def __init__(self):
|
| 68 |
+
self.time_ = 0.0
|
| 69 |
+
self.control_dt_ = 0.02
|
| 70 |
+
self.duration_ = 3.0
|
| 71 |
+
self.counter_ = 0
|
| 72 |
+
self.weight = 0.
|
| 73 |
+
self.weight_rate = 0.2
|
| 74 |
+
self.kp = 60.
|
| 75 |
+
self.kd = 1.5
|
| 76 |
+
self.dq = 0.
|
| 77 |
+
self.tau_ff = 0.
|
| 78 |
+
self.mode_machine_ = 0
|
| 79 |
+
self.low_cmd = unitree_hg_msg_dds__LowCmd_()
|
| 80 |
+
self.low_state = None
|
| 81 |
+
self.first_update_low_state = False
|
| 82 |
+
self.crc = CRC()
|
| 83 |
+
self.done = False
|
| 84 |
+
|
| 85 |
+
self.target_pos = [
|
| 86 |
+
0., kPi_2, 0., kPi_2, 0., 0., 0.,
|
| 87 |
+
0., -kPi_2, 0., kPi_2, 0., 0., 0.,
|
| 88 |
+
0, 0, 0
|
| 89 |
+
]
|
| 90 |
+
|
| 91 |
+
self.arm_joints = [
|
| 92 |
+
G1JointIndex.LeftShoulderPitch, G1JointIndex.LeftShoulderRoll,
|
| 93 |
+
G1JointIndex.LeftShoulderYaw, G1JointIndex.LeftElbow,
|
| 94 |
+
G1JointIndex.LeftWristRoll, G1JointIndex.LeftWristPitch,
|
| 95 |
+
G1JointIndex.LeftWristYaw,
|
| 96 |
+
G1JointIndex.RightShoulderPitch, G1JointIndex.RightShoulderRoll,
|
| 97 |
+
G1JointIndex.RightShoulderYaw, G1JointIndex.RightElbow,
|
| 98 |
+
G1JointIndex.RightWristRoll, G1JointIndex.RightWristPitch,
|
| 99 |
+
G1JointIndex.RightWristYaw,
|
| 100 |
+
G1JointIndex.WaistYaw,
|
| 101 |
+
G1JointIndex.WaistRoll,
|
| 102 |
+
G1JointIndex.WaistPitch
|
| 103 |
+
]
|
| 104 |
+
|
| 105 |
+
def Init(self):
|
| 106 |
+
# create publisher #
|
| 107 |
+
self.arm_sdk_publisher = ChannelPublisher("rt/arm_sdk", LowCmd_)
|
| 108 |
+
self.arm_sdk_publisher.Init()
|
| 109 |
+
|
| 110 |
+
# create subscriber #
|
| 111 |
+
self.lowstate_subscriber = ChannelSubscriber("rt/lowstate", LowState_)
|
| 112 |
+
self.lowstate_subscriber.Init(self.LowStateHandler, 10)
|
| 113 |
+
|
| 114 |
+
def Start(self):
|
| 115 |
+
self.lowCmdWriteThreadPtr = RecurrentThread(
|
| 116 |
+
interval=self.control_dt_, target=self.LowCmdWrite, name="control"
|
| 117 |
+
)
|
| 118 |
+
while self.first_update_low_state == False:
|
| 119 |
+
time.sleep(1)
|
| 120 |
+
|
| 121 |
+
if self.first_update_low_state == True:
|
| 122 |
+
self.lowCmdWriteThreadPtr.Start()
|
| 123 |
+
|
| 124 |
+
def LowStateHandler(self, msg: LowState_):
|
| 125 |
+
self.low_state = msg
|
| 126 |
+
|
| 127 |
+
if self.first_update_low_state == False:
|
| 128 |
+
self.first_update_low_state = True
|
| 129 |
+
|
| 130 |
+
def LowCmdWrite(self):
|
| 131 |
+
self.time_ += self.control_dt_
|
| 132 |
+
|
| 133 |
+
if self.time_ < self.duration_ :
|
| 134 |
+
# [Stage 1]: set robot to zero posture
|
| 135 |
+
self.low_cmd.motor_cmd[G1JointIndex.kNotUsedJoint].q = 1 # 1:Enable arm_sdk, 0:Disable arm_sdk
|
| 136 |
+
for i,joint in enumerate(self.arm_joints):
|
| 137 |
+
ratio = np.clip(self.time_ / self.duration_, 0.0, 1.0)
|
| 138 |
+
self.low_cmd.motor_cmd[joint].tau = 0.
|
| 139 |
+
self.low_cmd.motor_cmd[joint].q = (1.0 - ratio) * self.low_state.motor_state[joint].q
|
| 140 |
+
self.low_cmd.motor_cmd[joint].dq = 0.
|
| 141 |
+
self.low_cmd.motor_cmd[joint].kp = self.kp
|
| 142 |
+
self.low_cmd.motor_cmd[joint].kd = self.kd
|
| 143 |
+
|
| 144 |
+
elif self.time_ < self.duration_ * 3 :
|
| 145 |
+
# [Stage 2]: lift arms up
|
| 146 |
+
for i,joint in enumerate(self.arm_joints):
|
| 147 |
+
ratio = np.clip((self.time_ - self.duration_) / (self.duration_ * 2), 0.0, 1.0)
|
| 148 |
+
self.low_cmd.motor_cmd[joint].tau = 0.
|
| 149 |
+
self.low_cmd.motor_cmd[joint].q = ratio * self.target_pos[i] + (1.0 - ratio) * self.low_state.motor_state[joint].q
|
| 150 |
+
self.low_cmd.motor_cmd[joint].dq = 0.
|
| 151 |
+
self.low_cmd.motor_cmd[joint].kp = self.kp
|
| 152 |
+
self.low_cmd.motor_cmd[joint].kd = self.kd
|
| 153 |
+
|
| 154 |
+
elif self.time_ < self.duration_ * 6 :
|
| 155 |
+
# [Stage 3]: set robot back to zero posture
|
| 156 |
+
for i,joint in enumerate(self.arm_joints):
|
| 157 |
+
ratio = np.clip((self.time_ - self.duration_*3) / (self.duration_ * 3), 0.0, 1.0)
|
| 158 |
+
self.low_cmd.motor_cmd[joint].tau = 0.
|
| 159 |
+
self.low_cmd.motor_cmd[joint].q = (1.0 - ratio) * self.low_state.motor_state[joint].q
|
| 160 |
+
self.low_cmd.motor_cmd[joint].dq = 0.
|
| 161 |
+
self.low_cmd.motor_cmd[joint].kp = self.kp
|
| 162 |
+
self.low_cmd.motor_cmd[joint].kd = self.kd
|
| 163 |
+
|
| 164 |
+
elif self.time_ < self.duration_ * 7 :
|
| 165 |
+
# [Stage 4]: release arm_sdk
|
| 166 |
+
for i,joint in enumerate(self.arm_joints):
|
| 167 |
+
ratio = np.clip((self.time_ - self.duration_*6) / (self.duration_), 0.0, 1.0)
|
| 168 |
+
self.low_cmd.motor_cmd[G1JointIndex.kNotUsedJoint].q = (1 - ratio) # 1:Enable arm_sdk, 0:Disable arm_sdk
|
| 169 |
+
|
| 170 |
+
else:
|
| 171 |
+
self.done = True
|
| 172 |
+
|
| 173 |
+
self.low_cmd.crc = self.crc.Crc(self.low_cmd)
|
| 174 |
+
self.arm_sdk_publisher.Write(self.low_cmd)
|
| 175 |
+
|
| 176 |
+
if __name__ == '__main__':
|
| 177 |
+
|
| 178 |
+
print("WARNING: Please ensure there are no obstacles around the robot while running this example.")
|
| 179 |
+
input("Press Enter to continue...")
|
| 180 |
+
|
| 181 |
+
if len(sys.argv)>1:
|
| 182 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 183 |
+
else:
|
| 184 |
+
ChannelFactoryInitialize(0)
|
| 185 |
+
|
| 186 |
+
custom = Custom()
|
| 187 |
+
custom.Init()
|
| 188 |
+
custom.Start()
|
| 189 |
+
|
| 190 |
+
while True:
|
| 191 |
+
time.sleep(1)
|
| 192 |
+
if custom.done:
|
| 193 |
+
print("Done!")
|
| 194 |
+
sys.exit(-1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/g1/high_level/g1_loco_client_example.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
| 4 |
+
from unitree_sdk2py.idl.default import unitree_go_msg_dds__SportModeState_
|
| 5 |
+
from unitree_sdk2py.idl.unitree_go.msg.dds_ import SportModeState_
|
| 6 |
+
from unitree_sdk2py.g1.loco.g1_loco_client import LocoClient
|
| 7 |
+
import math
|
| 8 |
+
from dataclasses import dataclass
|
| 9 |
+
|
| 10 |
+
@dataclass
|
| 11 |
+
class TestOption:
|
| 12 |
+
name: str
|
| 13 |
+
id: int
|
| 14 |
+
|
| 15 |
+
option_list = [
|
| 16 |
+
TestOption(name="damp", id=0),
|
| 17 |
+
TestOption(name="Squat2StandUp", id=1),
|
| 18 |
+
TestOption(name="StandUp2Squat", id=2),
|
| 19 |
+
TestOption(name="move forward", id=3),
|
| 20 |
+
TestOption(name="move lateral", id=4),
|
| 21 |
+
TestOption(name="move rotate", id=5),
|
| 22 |
+
TestOption(name="low stand", id=6),
|
| 23 |
+
TestOption(name="high stand", id=7),
|
| 24 |
+
TestOption(name="zero torque", id=8),
|
| 25 |
+
TestOption(name="wave hand1", id=9), # wave hand without turning around
|
| 26 |
+
TestOption(name="wave hand2", id=10), # wave hand and trun around
|
| 27 |
+
TestOption(name="shake hand", id=11),
|
| 28 |
+
TestOption(name="Lie2StandUp", id=12),
|
| 29 |
+
]
|
| 30 |
+
|
| 31 |
+
class UserInterface:
|
| 32 |
+
def __init__(self):
|
| 33 |
+
self.test_option_ = None
|
| 34 |
+
|
| 35 |
+
def convert_to_int(self, input_str):
|
| 36 |
+
try:
|
| 37 |
+
return int(input_str)
|
| 38 |
+
except ValueError:
|
| 39 |
+
return None
|
| 40 |
+
|
| 41 |
+
def terminal_handle(self):
|
| 42 |
+
input_str = input("Enter id or name: \n")
|
| 43 |
+
|
| 44 |
+
if input_str == "list":
|
| 45 |
+
self.test_option_.name = None
|
| 46 |
+
self.test_option_.id = None
|
| 47 |
+
for option in option_list:
|
| 48 |
+
print(f"{option.name}, id: {option.id}")
|
| 49 |
+
return
|
| 50 |
+
|
| 51 |
+
for option in option_list:
|
| 52 |
+
if input_str == option.name or self.convert_to_int(input_str) == option.id:
|
| 53 |
+
self.test_option_.name = option.name
|
| 54 |
+
self.test_option_.id = option.id
|
| 55 |
+
print(f"Test: {self.test_option_.name}, test_id: {self.test_option_.id}")
|
| 56 |
+
return
|
| 57 |
+
|
| 58 |
+
print("No matching test option found.")
|
| 59 |
+
|
| 60 |
+
if __name__ == "__main__":
|
| 61 |
+
if len(sys.argv) < 2:
|
| 62 |
+
print(f"Usage: python3 {sys.argv[0]} networkInterface")
|
| 63 |
+
sys.exit(-1)
|
| 64 |
+
|
| 65 |
+
print("WARNING: Please ensure there are no obstacles around the robot while running this example.")
|
| 66 |
+
input("Press Enter to continue...")
|
| 67 |
+
|
| 68 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 69 |
+
|
| 70 |
+
test_option = TestOption(name=None, id=None)
|
| 71 |
+
user_interface = UserInterface()
|
| 72 |
+
user_interface.test_option_ = test_option
|
| 73 |
+
|
| 74 |
+
sport_client = LocoClient()
|
| 75 |
+
sport_client.SetTimeout(10.0)
|
| 76 |
+
sport_client.Init()
|
| 77 |
+
|
| 78 |
+
print("Input \"list\" to list all test option ...")
|
| 79 |
+
while True:
|
| 80 |
+
user_interface.terminal_handle()
|
| 81 |
+
|
| 82 |
+
print(f"Updated Test Option: Name = {test_option.name}, ID = {test_option.id}")
|
| 83 |
+
|
| 84 |
+
if test_option.id == 0:
|
| 85 |
+
sport_client.Damp()
|
| 86 |
+
elif test_option.id == 1:
|
| 87 |
+
sport_client.Damp()
|
| 88 |
+
time.sleep(0.5)
|
| 89 |
+
sport_client.Squat2StandUp()
|
| 90 |
+
elif test_option.id == 2:
|
| 91 |
+
sport_client.StandUp2Squat()
|
| 92 |
+
elif test_option.id == 3:
|
| 93 |
+
sport_client.Move(0.3,0,0)
|
| 94 |
+
elif test_option.id == 4:
|
| 95 |
+
sport_client.Move(0,0.3,0)
|
| 96 |
+
elif test_option.id == 5:
|
| 97 |
+
sport_client.Move(0,0,0.3)
|
| 98 |
+
elif test_option.id == 6:
|
| 99 |
+
sport_client.LowStand()
|
| 100 |
+
elif test_option.id == 7:
|
| 101 |
+
sport_client.HighStand()
|
| 102 |
+
elif test_option.id == 8:
|
| 103 |
+
sport_client.ZeroTorque()
|
| 104 |
+
elif test_option.id == 9:
|
| 105 |
+
sport_client.WaveHand()
|
| 106 |
+
elif test_option.id == 10:
|
| 107 |
+
sport_client.WaveHand(True)
|
| 108 |
+
elif test_option.id == 11:
|
| 109 |
+
sport_client.ShakeHand()
|
| 110 |
+
time.sleep(3)
|
| 111 |
+
sport_client.ShakeHand()
|
| 112 |
+
elif test_option.id == 12:
|
| 113 |
+
sport_client.Damp()
|
| 114 |
+
time.sleep(0.5)
|
| 115 |
+
sport_client.Lie2StandUp() # When using the Lie2StandUp function, ensure that the robot faces up and the ground is hard, flat and rough.
|
| 116 |
+
|
| 117 |
+
time.sleep(1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/g1/low_level/g1_low_level_example.py
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactoryInitialize
|
| 5 |
+
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
| 6 |
+
from unitree_sdk2py.idl.default import unitree_hg_msg_dds__LowCmd_
|
| 7 |
+
from unitree_sdk2py.idl.default import unitree_hg_msg_dds__LowState_
|
| 8 |
+
from unitree_sdk2py.idl.unitree_hg.msg.dds_ import LowCmd_
|
| 9 |
+
from unitree_sdk2py.idl.unitree_hg.msg.dds_ import LowState_
|
| 10 |
+
from unitree_sdk2py.utils.crc import CRC
|
| 11 |
+
from unitree_sdk2py.utils.thread import RecurrentThread
|
| 12 |
+
from unitree_sdk2py.comm.motion_switcher.motion_switcher_client import MotionSwitcherClient
|
| 13 |
+
|
| 14 |
+
import numpy as np
|
| 15 |
+
|
| 16 |
+
G1_NUM_MOTOR = 29
|
| 17 |
+
|
| 18 |
+
Kp = [
|
| 19 |
+
60, 60, 60, 100, 40, 40, # legs
|
| 20 |
+
60, 60, 60, 100, 40, 40, # legs
|
| 21 |
+
60, 40, 40, # waist
|
| 22 |
+
40, 40, 40, 40, 40, 40, 40, # arms
|
| 23 |
+
40, 40, 40, 40, 40, 40, 40 # arms
|
| 24 |
+
]
|
| 25 |
+
|
| 26 |
+
Kd = [
|
| 27 |
+
1, 1, 1, 2, 1, 1, # legs
|
| 28 |
+
1, 1, 1, 2, 1, 1, # legs
|
| 29 |
+
1, 1, 1, # waist
|
| 30 |
+
1, 1, 1, 1, 1, 1, 1, # arms
|
| 31 |
+
1, 1, 1, 1, 1, 1, 1 # arms
|
| 32 |
+
]
|
| 33 |
+
|
| 34 |
+
class G1JointIndex:
|
| 35 |
+
LeftHipPitch = 0
|
| 36 |
+
LeftHipRoll = 1
|
| 37 |
+
LeftHipYaw = 2
|
| 38 |
+
LeftKnee = 3
|
| 39 |
+
LeftAnklePitch = 4
|
| 40 |
+
LeftAnkleB = 4
|
| 41 |
+
LeftAnkleRoll = 5
|
| 42 |
+
LeftAnkleA = 5
|
| 43 |
+
RightHipPitch = 6
|
| 44 |
+
RightHipRoll = 7
|
| 45 |
+
RightHipYaw = 8
|
| 46 |
+
RightKnee = 9
|
| 47 |
+
RightAnklePitch = 10
|
| 48 |
+
RightAnkleB = 10
|
| 49 |
+
RightAnkleRoll = 11
|
| 50 |
+
RightAnkleA = 11
|
| 51 |
+
WaistYaw = 12
|
| 52 |
+
WaistRoll = 13 # NOTE: INVALID for g1 23dof/29dof with waist locked
|
| 53 |
+
WaistA = 13 # NOTE: INVALID for g1 23dof/29dof with waist locked
|
| 54 |
+
WaistPitch = 14 # NOTE: INVALID for g1 23dof/29dof with waist locked
|
| 55 |
+
WaistB = 14 # NOTE: INVALID for g1 23dof/29dof with waist locked
|
| 56 |
+
LeftShoulderPitch = 15
|
| 57 |
+
LeftShoulderRoll = 16
|
| 58 |
+
LeftShoulderYaw = 17
|
| 59 |
+
LeftElbow = 18
|
| 60 |
+
LeftWristRoll = 19
|
| 61 |
+
LeftWristPitch = 20 # NOTE: INVALID for g1 23dof
|
| 62 |
+
LeftWristYaw = 21 # NOTE: INVALID for g1 23dof
|
| 63 |
+
RightShoulderPitch = 22
|
| 64 |
+
RightShoulderRoll = 23
|
| 65 |
+
RightShoulderYaw = 24
|
| 66 |
+
RightElbow = 25
|
| 67 |
+
RightWristRoll = 26
|
| 68 |
+
RightWristPitch = 27 # NOTE: INVALID for g1 23dof
|
| 69 |
+
RightWristYaw = 28 # NOTE: INVALID for g1 23dof
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
class Mode:
|
| 73 |
+
PR = 0 # Series Control for Pitch/Roll Joints
|
| 74 |
+
AB = 1 # Parallel Control for A/B Joints
|
| 75 |
+
|
| 76 |
+
class Custom:
|
| 77 |
+
def __init__(self):
|
| 78 |
+
self.time_ = 0.0
|
| 79 |
+
self.control_dt_ = 0.002 # [2ms]
|
| 80 |
+
self.duration_ = 3.0 # [3 s]
|
| 81 |
+
self.counter_ = 0
|
| 82 |
+
self.mode_pr_ = Mode.PR
|
| 83 |
+
self.mode_machine_ = 0
|
| 84 |
+
self.low_cmd = unitree_hg_msg_dds__LowCmd_()
|
| 85 |
+
self.low_state = None
|
| 86 |
+
self.update_mode_machine_ = False
|
| 87 |
+
self.crc = CRC()
|
| 88 |
+
|
| 89 |
+
def Init(self):
|
| 90 |
+
self.msc = MotionSwitcherClient()
|
| 91 |
+
self.msc.SetTimeout(5.0)
|
| 92 |
+
self.msc.Init()
|
| 93 |
+
|
| 94 |
+
status, result = self.msc.CheckMode()
|
| 95 |
+
while result['name']:
|
| 96 |
+
self.msc.ReleaseMode()
|
| 97 |
+
status, result = self.msc.CheckMode()
|
| 98 |
+
time.sleep(1)
|
| 99 |
+
|
| 100 |
+
# create publisher #
|
| 101 |
+
self.lowcmd_publisher_ = ChannelPublisher("rt/lowcmd", LowCmd_)
|
| 102 |
+
self.lowcmd_publisher_.Init()
|
| 103 |
+
|
| 104 |
+
# create subscriber #
|
| 105 |
+
self.lowstate_subscriber = ChannelSubscriber("rt/lowstate", LowState_)
|
| 106 |
+
self.lowstate_subscriber.Init(self.LowStateHandler, 10)
|
| 107 |
+
|
| 108 |
+
def Start(self):
|
| 109 |
+
self.lowCmdWriteThreadPtr = RecurrentThread(
|
| 110 |
+
interval=self.control_dt_, target=self.LowCmdWrite, name="control"
|
| 111 |
+
)
|
| 112 |
+
while self.update_mode_machine_ == False:
|
| 113 |
+
time.sleep(1)
|
| 114 |
+
|
| 115 |
+
if self.update_mode_machine_ == True:
|
| 116 |
+
self.lowCmdWriteThreadPtr.Start()
|
| 117 |
+
|
| 118 |
+
def LowStateHandler(self, msg: LowState_):
|
| 119 |
+
self.low_state = msg
|
| 120 |
+
|
| 121 |
+
if self.update_mode_machine_ == False:
|
| 122 |
+
self.mode_machine_ = self.low_state.mode_machine
|
| 123 |
+
self.update_mode_machine_ = True
|
| 124 |
+
|
| 125 |
+
self.counter_ +=1
|
| 126 |
+
if (self.counter_ % 500 == 0) :
|
| 127 |
+
self.counter_ = 0
|
| 128 |
+
print(self.low_state.imu_state.rpy)
|
| 129 |
+
|
| 130 |
+
def LowCmdWrite(self):
|
| 131 |
+
self.time_ += self.control_dt_
|
| 132 |
+
|
| 133 |
+
if self.time_ < self.duration_ :
|
| 134 |
+
# [Stage 1]: set robot to zero posture
|
| 135 |
+
for i in range(G1_NUM_MOTOR):
|
| 136 |
+
ratio = np.clip(self.time_ / self.duration_, 0.0, 1.0)
|
| 137 |
+
self.low_cmd.mode_pr = Mode.PR
|
| 138 |
+
self.low_cmd.mode_machine = self.mode_machine_
|
| 139 |
+
self.low_cmd.motor_cmd[i].mode = 1 # 1:Enable, 0:Disable
|
| 140 |
+
self.low_cmd.motor_cmd[i].tau = 0.
|
| 141 |
+
self.low_cmd.motor_cmd[i].q = (1.0 - ratio) * self.low_state.motor_state[i].q
|
| 142 |
+
self.low_cmd.motor_cmd[i].dq = 0.
|
| 143 |
+
self.low_cmd.motor_cmd[i].kp = Kp[i]
|
| 144 |
+
self.low_cmd.motor_cmd[i].kd = Kd[i]
|
| 145 |
+
|
| 146 |
+
elif self.time_ < self.duration_ * 2 :
|
| 147 |
+
# [Stage 2]: swing ankle using PR mode
|
| 148 |
+
max_P = np.pi * 30.0 / 180.0
|
| 149 |
+
max_R = np.pi * 10.0 / 180.0
|
| 150 |
+
t = self.time_ - self.duration_
|
| 151 |
+
L_P_des = max_P * np.sin(2.0 * np.pi * t)
|
| 152 |
+
L_R_des = max_R * np.sin(2.0 * np.pi * t)
|
| 153 |
+
R_P_des = max_P * np.sin(2.0 * np.pi * t)
|
| 154 |
+
R_R_des = -max_R * np.sin(2.0 * np.pi * t)
|
| 155 |
+
|
| 156 |
+
self.low_cmd.mode_pr = Mode.PR
|
| 157 |
+
self.low_cmd.mode_machine = self.mode_machine_
|
| 158 |
+
self.low_cmd.motor_cmd[G1JointIndex.LeftAnklePitch].q = L_P_des
|
| 159 |
+
self.low_cmd.motor_cmd[G1JointIndex.LeftAnkleRoll].q = L_R_des
|
| 160 |
+
self.low_cmd.motor_cmd[G1JointIndex.RightAnklePitch].q = R_P_des
|
| 161 |
+
self.low_cmd.motor_cmd[G1JointIndex.RightAnkleRoll].q = R_R_des
|
| 162 |
+
|
| 163 |
+
else :
|
| 164 |
+
# [Stage 3]: swing ankle using AB mode
|
| 165 |
+
max_A = np.pi * 30.0 / 180.0
|
| 166 |
+
max_B = np.pi * 10.0 / 180.0
|
| 167 |
+
t = self.time_ - self.duration_ * 2
|
| 168 |
+
L_A_des = max_A * np.sin(2.0 * np.pi * t)
|
| 169 |
+
L_B_des = max_B * np.sin(2.0 * np.pi * t + np.pi)
|
| 170 |
+
R_A_des = -max_A * np.sin(2.0 * np.pi * t)
|
| 171 |
+
R_B_des = -max_B * np.sin(2.0 * np.pi * t + np.pi)
|
| 172 |
+
|
| 173 |
+
self.low_cmd.mode_pr = Mode.AB
|
| 174 |
+
self.low_cmd.mode_machine = self.mode_machine_
|
| 175 |
+
self.low_cmd.motor_cmd[G1JointIndex.LeftAnkleA].q = L_A_des
|
| 176 |
+
self.low_cmd.motor_cmd[G1JointIndex.LeftAnkleB].q = L_B_des
|
| 177 |
+
self.low_cmd.motor_cmd[G1JointIndex.RightAnkleA].q = R_A_des
|
| 178 |
+
self.low_cmd.motor_cmd[G1JointIndex.RightAnkleB].q = R_B_des
|
| 179 |
+
|
| 180 |
+
max_WristYaw = np.pi * 30.0 / 180.0
|
| 181 |
+
L_WristYaw_des = max_WristYaw * np.sin(2.0 * np.pi * t)
|
| 182 |
+
R_WristYaw_des = max_WristYaw * np.sin(2.0 * np.pi * t)
|
| 183 |
+
self.low_cmd.motor_cmd[G1JointIndex.LeftWristRoll].q = L_WristYaw_des
|
| 184 |
+
self.low_cmd.motor_cmd[G1JointIndex.RightWristRoll].q = R_WristYaw_des
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
self.low_cmd.crc = self.crc.Crc(self.low_cmd)
|
| 188 |
+
self.lowcmd_publisher_.Write(self.low_cmd)
|
| 189 |
+
|
| 190 |
+
if __name__ == '__main__':
|
| 191 |
+
|
| 192 |
+
print("WARNING: Please ensure there are no obstacles around the robot while running this example.")
|
| 193 |
+
input("Press Enter to continue...")
|
| 194 |
+
|
| 195 |
+
if len(sys.argv)>1:
|
| 196 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 197 |
+
else:
|
| 198 |
+
ChannelFactoryInitialize(0)
|
| 199 |
+
|
| 200 |
+
custom = Custom()
|
| 201 |
+
custom.Init()
|
| 202 |
+
custom.Start()
|
| 203 |
+
|
| 204 |
+
while True:
|
| 205 |
+
time.sleep(1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/g1/low_level/g1_move_hands_example.py
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
from unitree_sdk2py.core.channel import ChannelPublisher, ChannelSubscriber, ChannelFactoryInitialize
|
| 7 |
+
from unitree_sdk2py.idl.unitree_hg.msg.dds_ import HandCmd_, HandState_
|
| 8 |
+
from unitree_sdk2py.idl.default import unitree_hg_msg_dds__HandCmd_
|
| 9 |
+
from unitree_sdk2py.utils.crc import CRC
|
| 10 |
+
from unitree_sdk2py.utils.thread import RecurrentThread
|
| 11 |
+
|
| 12 |
+
MOTOR_NUM_HAND = 7
|
| 13 |
+
|
| 14 |
+
Kp = [0.5] * MOTOR_NUM_HAND
|
| 15 |
+
Kd = [0.1] * MOTOR_NUM_HAND
|
| 16 |
+
|
| 17 |
+
Kp[0] = 2.0
|
| 18 |
+
|
| 19 |
+
maxTorqueLimits_left = [1.05, 1.05, 1.75, 0.0, 0.0, 0.0, 0.0]
|
| 20 |
+
minTorqueLimits_left = [-1.05, -0.72, 0.0, -1.57, -1.75, -1.57, -1.75]
|
| 21 |
+
maxTorqueLimits_right = [1.05, 0.74, 0.0, 1.57, 1.75, 1.57, 1.75]
|
| 22 |
+
minTorqueLimits_right = [-1.05, -1.05, -1.75, 0.0, 0.0, 0.0, 0.0]
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def make_hand_mode(motor_index):
|
| 26 |
+
status = 0x01
|
| 27 |
+
timeout = 0x01
|
| 28 |
+
mode = (motor_index & 0x0F)
|
| 29 |
+
mode |= (status << 4) # bits [4..6]
|
| 30 |
+
mode |= (timeout << 7) # bit 7
|
| 31 |
+
return mode
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
class HandControl:
|
| 35 |
+
def __init__(self, network_interface="enp36s0f1"):
|
| 36 |
+
ChannelFactoryInitialize(0, network_interface)
|
| 37 |
+
|
| 38 |
+
self.left_cmd_pub = ChannelPublisher("rt/dex3/left/cmd", HandCmd_)
|
| 39 |
+
self.right_cmd_pub = ChannelPublisher("rt/dex3/right/cmd", HandCmd_)
|
| 40 |
+
|
| 41 |
+
self.left_state_sub = ChannelSubscriber("rt/dex3/left/state", HandState_)
|
| 42 |
+
self.right_state_sub = ChannelSubscriber("rt/dex3/right/state", HandState_)
|
| 43 |
+
|
| 44 |
+
self.left_cmd_pub.Init()
|
| 45 |
+
self.right_cmd_pub.Init()
|
| 46 |
+
|
| 47 |
+
self.left_state_sub.Init(self.left_state_handler, 10)
|
| 48 |
+
self.right_state_sub.Init(self.right_state_handler, 10)
|
| 49 |
+
|
| 50 |
+
self.left_state = None
|
| 51 |
+
self.right_state = None
|
| 52 |
+
|
| 53 |
+
self.crc = CRC()
|
| 54 |
+
|
| 55 |
+
# Control loop timing
|
| 56 |
+
self.control_dt = 0.01 # 10 ms
|
| 57 |
+
self.time_ = 0.0
|
| 58 |
+
self.stage_time = 3.0 # 3s per stage
|
| 59 |
+
|
| 60 |
+
# To let the code run once we start:
|
| 61 |
+
self.run_flag = False
|
| 62 |
+
|
| 63 |
+
self.counter = 0
|
| 64 |
+
|
| 65 |
+
def left_state_handler(self, msg: HandState_):
|
| 66 |
+
self.left_state = msg
|
| 67 |
+
|
| 68 |
+
# self.counter +=1
|
| 69 |
+
# if (self.counter % 1000 == 0) :
|
| 70 |
+
# self.counter = 0
|
| 71 |
+
# print('Left hand state:')
|
| 72 |
+
# for i in range(MOTOR_NUM_HAND):
|
| 73 |
+
# print(180/np.pi*self.left_state.motor_state[i].q)
|
| 74 |
+
|
| 75 |
+
def right_state_handler(self, msg: HandState_):
|
| 76 |
+
self.right_state = msg
|
| 77 |
+
|
| 78 |
+
self.counter += 1
|
| 79 |
+
if (self.counter % 1000 == 0):
|
| 80 |
+
self.counter = 0
|
| 81 |
+
print('Right hand state:')
|
| 82 |
+
for i in range(MOTOR_NUM_HAND):
|
| 83 |
+
print(180 / np.pi * self.right_state.motor_state[i].q)
|
| 84 |
+
|
| 85 |
+
def start(self):
|
| 86 |
+
"""
|
| 87 |
+
Kick off the main control loop thread.
|
| 88 |
+
"""
|
| 89 |
+
self.run_flag = True
|
| 90 |
+
self.control_thread = RecurrentThread(interval=self.control_dt,
|
| 91 |
+
target=self.hand_control_loop,
|
| 92 |
+
name="HandControlLoop")
|
| 93 |
+
self.control_thread.Start()
|
| 94 |
+
|
| 95 |
+
def hand_control_loop(self):
|
| 96 |
+
"""
|
| 97 |
+
This gets called at a fixed rate (every self.control_dt seconds).
|
| 98 |
+
We'll demonstrate 3 stages of motion:
|
| 99 |
+
1) Move from current position to 'zero' (or some nominal) in 3s
|
| 100 |
+
2) Sinusoidal motion in stage 2 (3s)
|
| 101 |
+
3) Another motion in stage 3 (final)
|
| 102 |
+
"""
|
| 103 |
+
if not self.run_flag:
|
| 104 |
+
return
|
| 105 |
+
|
| 106 |
+
self.time_ += self.control_dt
|
| 107 |
+
t = self.time_
|
| 108 |
+
cmd_left = unitree_hg_msg_dds__HandCmd_()
|
| 109 |
+
cmd_right = unitree_hg_msg_dds__HandCmd_()
|
| 110 |
+
|
| 111 |
+
# cmd_left.motor_cmd.resize(MOTOR_NUM_HAND)
|
| 112 |
+
# cmd_right.motor_cmd.resize(MOTOR_NUM_HAND)
|
| 113 |
+
|
| 114 |
+
# Prepare stage times
|
| 115 |
+
stage1_end = self.stage_time
|
| 116 |
+
stage2_end = self.stage_time * 2.0
|
| 117 |
+
|
| 118 |
+
# We'll fetch current positions for left and right if available
|
| 119 |
+
# so we can blend from actual state to zero.
|
| 120 |
+
# If we haven't gotten a state yet, default to 0.
|
| 121 |
+
left_q_now = [0.0] * MOTOR_NUM_HAND
|
| 122 |
+
right_q_now = [0.0] * MOTOR_NUM_HAND
|
| 123 |
+
|
| 124 |
+
if self.left_state is not None:
|
| 125 |
+
for i in range(MOTOR_NUM_HAND):
|
| 126 |
+
left_q_now[i] = self.left_state.motor_state[i].q
|
| 127 |
+
|
| 128 |
+
if self.right_state is not None:
|
| 129 |
+
for i in range(MOTOR_NUM_HAND):
|
| 130 |
+
right_q_now[i] = self.right_state.motor_state[i].q
|
| 131 |
+
|
| 132 |
+
left_q_desired = np.deg2rad([50.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
|
| 133 |
+
|
| 134 |
+
right_q_desired = np.deg2rad([50.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
|
| 135 |
+
|
| 136 |
+
# Decide the desired position for each stage:
|
| 137 |
+
if t < stage1_end:
|
| 138 |
+
# Stage 1: Move from the current joint positions to zero in [0..3s]
|
| 139 |
+
ratio = np.clip(t / stage1_end, 0.0, 1.0)
|
| 140 |
+
# Simple linear blend: final = (1-ratio)*initial + ratio*0
|
| 141 |
+
left_q_des = np.zeros(MOTOR_NUM_HAND)
|
| 142 |
+
right_q_des = np.zeros(MOTOR_NUM_HAND)
|
| 143 |
+
for i in range(MOTOR_NUM_HAND):
|
| 144 |
+
left_q_des[i] = (1.0 - ratio) * (left_q_now[i] - left_q_desired[i]) + left_q_desired[i]
|
| 145 |
+
right_q_des[i] = (1.0 - ratio) * (right_q_now[i] - right_q_desired[i]) + right_q_desired[i]
|
| 146 |
+
|
| 147 |
+
else:
|
| 148 |
+
# Stage 2: Some sinusoidal wave
|
| 149 |
+
# We'll wave only the first 2 or 3 motors, just as a demo
|
| 150 |
+
dt2 = t - stage1_end
|
| 151 |
+
freq = 1.0 # 1 Hz
|
| 152 |
+
amp = 0.3 # ~ 0.3 rad amplitude
|
| 153 |
+
|
| 154 |
+
left_q_des = left_q_desired
|
| 155 |
+
right_q_des = right_q_desired
|
| 156 |
+
|
| 157 |
+
# E.g. wave motor 0 and 1:
|
| 158 |
+
left_q_des[0] += amp * np.sin(2 * np.pi * freq * dt2)
|
| 159 |
+
left_q_des[1] += amp * (1 - np.cos(2 * np.pi * freq * dt2))
|
| 160 |
+
left_q_des[2] += amp * (1 - np.cos(2 * np.pi * freq * dt2))
|
| 161 |
+
right_q_des[0] += amp * np.sin(2 * np.pi * freq * dt2)
|
| 162 |
+
right_q_des[1] += amp * (np.cos(2 * np.pi * freq * dt2) - 1)
|
| 163 |
+
right_q_des[2] += amp * (np.cos(2 * np.pi * freq * dt2) - 1)
|
| 164 |
+
|
| 165 |
+
freqA = 2.0
|
| 166 |
+
freqB = 2.0
|
| 167 |
+
ampA = 0.2
|
| 168 |
+
ampB = 0.4
|
| 169 |
+
|
| 170 |
+
left_q_des[3] += ampA * (np.cos(2 * np.pi * freqA * dt2) - 1)
|
| 171 |
+
left_q_des[4] += ampB * (np.cos(2 * np.pi * freqB * dt2) - 1)
|
| 172 |
+
left_q_des[5] += ampA * (np.cos(2 * np.pi * freqA * dt2) - 1)
|
| 173 |
+
left_q_des[6] += ampB * (np.cos(2 * np.pi * freqB * dt2) - 1)
|
| 174 |
+
right_q_des[3] += ampA * (1 - np.cos(2 * np.pi * freqA * dt2))
|
| 175 |
+
right_q_des[4] += ampB * (1 - np.cos(2 * np.pi * freqB * dt2))
|
| 176 |
+
right_q_des[5] += ampA * (1 - np.cos(2 * np.pi * freqA * dt2))
|
| 177 |
+
right_q_des[6] += ampB * (1 - np.cos(2 * np.pi * freqB * dt2))
|
| 178 |
+
|
| 179 |
+
# Fill in the commands
|
| 180 |
+
for i in range(MOTOR_NUM_HAND):
|
| 181 |
+
# Build the bitfield mode (see your C++ example)
|
| 182 |
+
mode_val = make_hand_mode(i)
|
| 183 |
+
|
| 184 |
+
# Left
|
| 185 |
+
cmd_left.motor_cmd[i].mode = mode_val
|
| 186 |
+
cmd_left.motor_cmd[i].q = left_q_des[i]
|
| 187 |
+
cmd_left.motor_cmd[i].dq = 0.0
|
| 188 |
+
cmd_left.motor_cmd[i].tau = 0.0
|
| 189 |
+
cmd_left.motor_cmd[i].kp = Kp[i]
|
| 190 |
+
cmd_left.motor_cmd[i].kd = Kd[i]
|
| 191 |
+
|
| 192 |
+
# Right
|
| 193 |
+
cmd_right.motor_cmd[i].mode = mode_val
|
| 194 |
+
cmd_right.motor_cmd[i].q = right_q_des[i]
|
| 195 |
+
cmd_right.motor_cmd[i].dq = 0.0
|
| 196 |
+
cmd_right.motor_cmd[i].tau = 0.0
|
| 197 |
+
cmd_right.motor_cmd[i].kp = Kp[i]
|
| 198 |
+
cmd_right.motor_cmd[i].kd = Kd[i]
|
| 199 |
+
|
| 200 |
+
# Compute CRC if your firmware requires it
|
| 201 |
+
# cmd_left.crc = self.crc.Crc(cmd_left)
|
| 202 |
+
# cmd_right.crc = self.crc.Crc(cmd_right)
|
| 203 |
+
|
| 204 |
+
# Publish
|
| 205 |
+
self.left_cmd_pub.Write(cmd_left)
|
| 206 |
+
self.right_cmd_pub.Write(cmd_right)
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
if __name__ == "__main__":
|
| 210 |
+
print("WARNING: Make sure your robot’s hands can move freely before running.")
|
| 211 |
+
input("Press Enter to continue...")
|
| 212 |
+
|
| 213 |
+
# Optionally pass a specific interface name, e.g. "enp37s0f0" or "eth0"
|
| 214 |
+
if len(sys.argv) > 1:
|
| 215 |
+
net_if = sys.argv[1]
|
| 216 |
+
else:
|
| 217 |
+
net_if = "enp36s0f1"
|
| 218 |
+
|
| 219 |
+
# Create and start
|
| 220 |
+
hand_control = HandControl(network_interface=net_if)
|
| 221 |
+
hand_control.start()
|
| 222 |
+
|
| 223 |
+
# Just wait
|
| 224 |
+
while True:
|
| 225 |
+
time.sleep(1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/g1/readme.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
This example is a test of Unitree G1/H1-2 robot.
|
| 2 |
+
|
| 3 |
+
**Note:**
|
| 4 |
+
idl/unitree_go is used for Unitree Go2/B2/H1/B2w/Go2w robots
|
| 5 |
+
idl/unitree_hg is used for Unitree G1/H1-2 robots
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/go2/front_camera/camera_opencv.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from unitree_sdk2py.core.channel import ChannelFactoryInitialize
|
| 2 |
+
from unitree_sdk2py.go2.video.video_client import VideoClient
|
| 3 |
+
import cv2
|
| 4 |
+
import numpy as np
|
| 5 |
+
import sys
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
if __name__ == "__main__":
|
| 9 |
+
if len(sys.argv)>1:
|
| 10 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 11 |
+
else:
|
| 12 |
+
ChannelFactoryInitialize(0)
|
| 13 |
+
|
| 14 |
+
client = VideoClient() # Create a video client
|
| 15 |
+
client.SetTimeout(3.0)
|
| 16 |
+
client.Init()
|
| 17 |
+
|
| 18 |
+
code, data = client.GetImageSample()
|
| 19 |
+
|
| 20 |
+
# Request normal when code==0
|
| 21 |
+
while code == 0:
|
| 22 |
+
# Get Image data from Go2 robot
|
| 23 |
+
code, data = client.GetImageSample()
|
| 24 |
+
|
| 25 |
+
# Convert to numpy image
|
| 26 |
+
image_data = np.frombuffer(bytes(data), dtype=np.uint8)
|
| 27 |
+
image = cv2.imdecode(image_data, cv2.IMREAD_COLOR)
|
| 28 |
+
|
| 29 |
+
# Display image
|
| 30 |
+
cv2.imshow("front_camera", image)
|
| 31 |
+
# Press ESC to stop
|
| 32 |
+
if cv2.waitKey(20) == 27:
|
| 33 |
+
break
|
| 34 |
+
|
| 35 |
+
if code != 0:
|
| 36 |
+
print("Get image sample error. code:", code)
|
| 37 |
+
else:
|
| 38 |
+
# Capture an image
|
| 39 |
+
cv2.imwrite("front_image.jpg", image)
|
| 40 |
+
|
| 41 |
+
cv2.destroyWindow("front_camera")
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/go2/front_camera/capture_image.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import os
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
from unitree_sdk2py.core.channel import ChannelFactoryInitialize
|
| 6 |
+
from unitree_sdk2py.go2.video.video_client import VideoClient
|
| 7 |
+
|
| 8 |
+
if __name__ == "__main__":
|
| 9 |
+
if len(sys.argv)>1:
|
| 10 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 11 |
+
else:
|
| 12 |
+
ChannelFactoryInitialize(0)
|
| 13 |
+
|
| 14 |
+
client = VideoClient()
|
| 15 |
+
client.SetTimeout(3.0)
|
| 16 |
+
client.Init()
|
| 17 |
+
|
| 18 |
+
print("##################GetImageSample###################")
|
| 19 |
+
code, data = client.GetImageSample()
|
| 20 |
+
|
| 21 |
+
if code != 0:
|
| 22 |
+
print("get image sample error. code:", code)
|
| 23 |
+
else:
|
| 24 |
+
imageName = "./img.jpg"
|
| 25 |
+
print("ImageName:", imageName)
|
| 26 |
+
|
| 27 |
+
with open(imageName, "+wb") as f:
|
| 28 |
+
f.write(bytes(data))
|
| 29 |
+
|
| 30 |
+
time.sleep(1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/go2/high_level/go2_sport_client.py
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
| 4 |
+
from unitree_sdk2py.idl.default import unitree_go_msg_dds__SportModeState_
|
| 5 |
+
from unitree_sdk2py.idl.unitree_go.msg.dds_ import SportModeState_
|
| 6 |
+
from unitree_sdk2py.go2.sport.sport_client import (
|
| 7 |
+
SportClient,
|
| 8 |
+
PathPoint,
|
| 9 |
+
SPORT_PATH_POINT_SIZE,
|
| 10 |
+
)
|
| 11 |
+
import math
|
| 12 |
+
from dataclasses import dataclass
|
| 13 |
+
|
| 14 |
+
@dataclass
|
| 15 |
+
class TestOption:
|
| 16 |
+
name: str
|
| 17 |
+
id: int
|
| 18 |
+
|
| 19 |
+
option_list = [
|
| 20 |
+
TestOption(name="damp", id=0),
|
| 21 |
+
TestOption(name="stand_up", id=1),
|
| 22 |
+
TestOption(name="stand_down", id=2),
|
| 23 |
+
TestOption(name="move forward", id=3),
|
| 24 |
+
TestOption(name="move lateral", id=4),
|
| 25 |
+
TestOption(name="move rotate", id=5),
|
| 26 |
+
TestOption(name="stop_move", id=6),
|
| 27 |
+
TestOption(name="switch_gait", id=7),
|
| 28 |
+
TestOption(name="switch_gait", id=8),
|
| 29 |
+
TestOption(name="balanced stand", id=9),
|
| 30 |
+
TestOption(name="recovery", id=10),
|
| 31 |
+
TestOption(name="recovery", id=10),
|
| 32 |
+
TestOption(name="left flip", id=11),
|
| 33 |
+
TestOption(name="back flip", id=12),
|
| 34 |
+
TestOption(name="free walk", id=13),
|
| 35 |
+
TestOption(name="free bound", id=14),
|
| 36 |
+
TestOption(name="free avoid", id=15),
|
| 37 |
+
TestOption(name="walk stair", id=16),
|
| 38 |
+
TestOption(name="walk upright", id=17),
|
| 39 |
+
TestOption(name="cross step", id=18),
|
| 40 |
+
TestOption(name="free jump", id=19)
|
| 41 |
+
]
|
| 42 |
+
|
| 43 |
+
class UserInterface:
|
| 44 |
+
def __init__(self):
|
| 45 |
+
self.test_option_ = None
|
| 46 |
+
|
| 47 |
+
def convert_to_int(self, input_str):
|
| 48 |
+
try:
|
| 49 |
+
return int(input_str)
|
| 50 |
+
except ValueError:
|
| 51 |
+
return None
|
| 52 |
+
|
| 53 |
+
def terminal_handle(self):
|
| 54 |
+
input_str = input("Enter id or name: \n")
|
| 55 |
+
|
| 56 |
+
if input_str == "list":
|
| 57 |
+
self.test_option_.name = None
|
| 58 |
+
self.test_option_.id = None
|
| 59 |
+
for option in option_list:
|
| 60 |
+
print(f"{option.name}, id: {option.id}")
|
| 61 |
+
return
|
| 62 |
+
|
| 63 |
+
for option in option_list:
|
| 64 |
+
if input_str == option.name or self.convert_to_int(input_str) == option.id:
|
| 65 |
+
self.test_option_.name = option.name
|
| 66 |
+
self.test_option_.id = option.id
|
| 67 |
+
print(f"Test: {self.test_option_.name}, test_id: {self.test_option_.id}")
|
| 68 |
+
return
|
| 69 |
+
|
| 70 |
+
print("No matching test option found.")
|
| 71 |
+
|
| 72 |
+
if __name__ == "__main__":
|
| 73 |
+
|
| 74 |
+
if len(sys.argv) < 2:
|
| 75 |
+
print(f"Usage: python3 {sys.argv[0]} networkInterface")
|
| 76 |
+
sys.exit(-1)
|
| 77 |
+
|
| 78 |
+
print("WARNING: Please ensure there are no obstacles around the robot while running this example.")
|
| 79 |
+
input("Press Enter to continue...")
|
| 80 |
+
|
| 81 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 82 |
+
|
| 83 |
+
test_option = TestOption(name=None, id=None)
|
| 84 |
+
user_interface = UserInterface()
|
| 85 |
+
user_interface.test_option_ = test_option
|
| 86 |
+
|
| 87 |
+
sport_client = SportClient()
|
| 88 |
+
sport_client.SetTimeout(10.0)
|
| 89 |
+
sport_client.Init()
|
| 90 |
+
while True:
|
| 91 |
+
|
| 92 |
+
user_interface.terminal_handle()
|
| 93 |
+
|
| 94 |
+
print(f"Updated Test Option: Name = {test_option.name}, ID = {test_option.id}\n")
|
| 95 |
+
|
| 96 |
+
if test_option.id == 0:
|
| 97 |
+
sport_client.Damp()
|
| 98 |
+
elif test_option.id == 1:
|
| 99 |
+
sport_client.StandUp()
|
| 100 |
+
elif test_option.id == 2:
|
| 101 |
+
sport_client.StandDown()
|
| 102 |
+
elif test_option.id == 3:
|
| 103 |
+
sport_client.Move(0.3,0,0)
|
| 104 |
+
elif test_option.id == 4:
|
| 105 |
+
sport_client.Move(0,0.3,0)
|
| 106 |
+
elif test_option.id == 5:
|
| 107 |
+
sport_client.Move(0,0,0.5)
|
| 108 |
+
elif test_option.id == 6:
|
| 109 |
+
sport_client.StopMove()
|
| 110 |
+
elif test_option.id == 7:
|
| 111 |
+
sport_client.SwitchGait(0)
|
| 112 |
+
elif test_option.id == 8:
|
| 113 |
+
sport_client.SwitchGait(1)
|
| 114 |
+
elif test_option.id == 9:
|
| 115 |
+
sport_client.BalanceStand()
|
| 116 |
+
elif test_option.id == 10:
|
| 117 |
+
sport_client.RecoveryStand()
|
| 118 |
+
elif test_option.id == 11:
|
| 119 |
+
ret = sport_client.LeftFlip()
|
| 120 |
+
print("ret: ",ret)
|
| 121 |
+
elif test_option.id == 12:
|
| 122 |
+
ret = sport_client.BackFlip()
|
| 123 |
+
print("ret: ",ret)
|
| 124 |
+
elif test_option.id == 13:
|
| 125 |
+
ret = sport_client.FreeWalk(True)
|
| 126 |
+
print("ret: ",ret)
|
| 127 |
+
elif test_option.id == 14:
|
| 128 |
+
ret = sport_client.FreeBound(True)
|
| 129 |
+
print("ret: ",ret)
|
| 130 |
+
time.sleep(2)
|
| 131 |
+
ret = sport_client.FreeBound(False)
|
| 132 |
+
print("ret: ",ret)
|
| 133 |
+
elif test_option.id == 14:
|
| 134 |
+
ret = sport_client.FreeBound(True)
|
| 135 |
+
print("ret: ",ret)
|
| 136 |
+
time.sleep(2)
|
| 137 |
+
ret = sport_client.FreeBound(False)
|
| 138 |
+
print("ret: ",ret)
|
| 139 |
+
elif test_option.id == 15:
|
| 140 |
+
ret = sport_client.FreeAvoid(True)
|
| 141 |
+
print("ret: ",ret)
|
| 142 |
+
time.sleep(2)
|
| 143 |
+
ret = sport_client.FreeAvoid(False)
|
| 144 |
+
print("ret: ",ret)
|
| 145 |
+
elif test_option.id == 16:
|
| 146 |
+
ret = sport_client.WalkStair(True)
|
| 147 |
+
print("ret: ",ret)
|
| 148 |
+
time.sleep(10)
|
| 149 |
+
ret = sport_client.WalkStair(False)
|
| 150 |
+
print("ret: ",ret)
|
| 151 |
+
elif test_option.id == 17:
|
| 152 |
+
ret = sport_client.WalkUpright(True)
|
| 153 |
+
print("ret: ",ret)
|
| 154 |
+
time.sleep(4)
|
| 155 |
+
ret = sport_client.WalkUpright(False)
|
| 156 |
+
print("ret: ",ret)
|
| 157 |
+
elif test_option.id == 18:
|
| 158 |
+
ret = sport_client.CrossStep(True)
|
| 159 |
+
print("ret: ",ret)
|
| 160 |
+
time.sleep(4)
|
| 161 |
+
ret = sport_client.CrossStep(False)
|
| 162 |
+
print("ret: ",ret)
|
| 163 |
+
elif test_option.id == 19:
|
| 164 |
+
ret = sport_client.FreeJump(True)
|
| 165 |
+
print("ret: ",ret)
|
| 166 |
+
time.sleep(4)
|
| 167 |
+
ret = sport_client.FreeJump(False)
|
| 168 |
+
print("ret: ",ret)
|
| 169 |
+
|
| 170 |
+
time.sleep(1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/go2/high_level/go2_utlidar_switch.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactoryInitialize
|
| 5 |
+
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
| 6 |
+
from unitree_sdk2py.idl.std_msgs.msg.dds_ import String_
|
| 7 |
+
from unitree_sdk2py.idl.default import std_msgs_msg_dds__String_
|
| 8 |
+
|
| 9 |
+
class Custom:
|
| 10 |
+
def __init__(self):
|
| 11 |
+
# create publisher #
|
| 12 |
+
self.publisher = ChannelPublisher("rt/utlidar/switch", String_)
|
| 13 |
+
self.publisher.Init()
|
| 14 |
+
self.low_cmd = std_msgs_msg_dds__String_()
|
| 15 |
+
|
| 16 |
+
def go2_utlidar_switch(self,status):
|
| 17 |
+
if status == "OFF":
|
| 18 |
+
self.low_cmd.data = "OFF"
|
| 19 |
+
elif status == "ON":
|
| 20 |
+
self.low_cmd.data = "ON"
|
| 21 |
+
|
| 22 |
+
self.publisher.Write(self.low_cmd)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
if __name__ == '__main__':
|
| 26 |
+
|
| 27 |
+
print("WARNING: Please ensure there are no obstacles around the robot while running this example.")
|
| 28 |
+
input("Press Enter to continue...")
|
| 29 |
+
|
| 30 |
+
if len(sys.argv)>1:
|
| 31 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 32 |
+
else:
|
| 33 |
+
ChannelFactoryInitialize(0)
|
| 34 |
+
|
| 35 |
+
custom = Custom()
|
| 36 |
+
custom.go2_utlidar_switch("OFF")
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/go2/low_level/go2_stand_example.py
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactoryInitialize
|
| 5 |
+
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
| 6 |
+
from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowCmd_
|
| 7 |
+
from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowState_
|
| 8 |
+
from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowCmd_
|
| 9 |
+
from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowState_
|
| 10 |
+
from unitree_sdk2py.utils.crc import CRC
|
| 11 |
+
from unitree_sdk2py.utils.thread import RecurrentThread
|
| 12 |
+
import unitree_legged_const as go2
|
| 13 |
+
from unitree_sdk2py.comm.motion_switcher.motion_switcher_client import MotionSwitcherClient
|
| 14 |
+
from unitree_sdk2py.go2.sport.sport_client import SportClient
|
| 15 |
+
|
| 16 |
+
class Custom:
|
| 17 |
+
def __init__(self):
|
| 18 |
+
self.Kp = 60.0
|
| 19 |
+
self.Kd = 5.0
|
| 20 |
+
self.time_consume = 0
|
| 21 |
+
self.rate_count = 0
|
| 22 |
+
self.sin_count = 0
|
| 23 |
+
self.motiontime = 0
|
| 24 |
+
self.dt = 0.002 # 0.001~0.01
|
| 25 |
+
|
| 26 |
+
self.low_cmd = unitree_go_msg_dds__LowCmd_()
|
| 27 |
+
self.low_state = None
|
| 28 |
+
|
| 29 |
+
self._targetPos_1 = [0.0, 1.36, -2.65, 0.0, 1.36, -2.65,
|
| 30 |
+
-0.2, 1.36, -2.65, 0.2, 1.36, -2.65]
|
| 31 |
+
self._targetPos_2 = [0.0, 0.67, -1.3, 0.0, 0.67, -1.3,
|
| 32 |
+
0.0, 0.67, -1.3, 0.0, 0.67, -1.3]
|
| 33 |
+
self._targetPos_3 = [-0.35, 1.36, -2.65, 0.35, 1.36, -2.65,
|
| 34 |
+
-0.5, 1.36, -2.65, 0.5, 1.36, -2.65]
|
| 35 |
+
|
| 36 |
+
self.startPos = [0.0] * 12
|
| 37 |
+
self.duration_1 = 500
|
| 38 |
+
self.duration_2 = 500
|
| 39 |
+
self.duration_3 = 1000
|
| 40 |
+
self.duration_4 = 900
|
| 41 |
+
self.percent_1 = 0
|
| 42 |
+
self.percent_2 = 0
|
| 43 |
+
self.percent_3 = 0
|
| 44 |
+
self.percent_4 = 0
|
| 45 |
+
|
| 46 |
+
self.firstRun = True
|
| 47 |
+
self.done = False
|
| 48 |
+
|
| 49 |
+
# thread handling
|
| 50 |
+
self.lowCmdWriteThreadPtr = None
|
| 51 |
+
|
| 52 |
+
self.crc = CRC()
|
| 53 |
+
|
| 54 |
+
# Public methods
|
| 55 |
+
def Init(self):
|
| 56 |
+
self.InitLowCmd()
|
| 57 |
+
|
| 58 |
+
# create publisher #
|
| 59 |
+
self.lowcmd_publisher = ChannelPublisher("rt/lowcmd", LowCmd_)
|
| 60 |
+
self.lowcmd_publisher.Init()
|
| 61 |
+
|
| 62 |
+
# create subscriber #
|
| 63 |
+
self.lowstate_subscriber = ChannelSubscriber("rt/lowstate", LowState_)
|
| 64 |
+
self.lowstate_subscriber.Init(self.LowStateMessageHandler, 10)
|
| 65 |
+
|
| 66 |
+
self.sc = SportClient()
|
| 67 |
+
self.sc.SetTimeout(5.0)
|
| 68 |
+
self.sc.Init()
|
| 69 |
+
|
| 70 |
+
self.msc = MotionSwitcherClient()
|
| 71 |
+
self.msc.SetTimeout(5.0)
|
| 72 |
+
self.msc.Init()
|
| 73 |
+
|
| 74 |
+
status, result = self.msc.CheckMode()
|
| 75 |
+
while result['name']:
|
| 76 |
+
self.sc.StandDown()
|
| 77 |
+
self.msc.ReleaseMode()
|
| 78 |
+
status, result = self.msc.CheckMode()
|
| 79 |
+
time.sleep(1)
|
| 80 |
+
|
| 81 |
+
def Start(self):
|
| 82 |
+
self.lowCmdWriteThreadPtr = RecurrentThread(
|
| 83 |
+
interval=0.002, target=self.LowCmdWrite, name="writebasiccmd"
|
| 84 |
+
)
|
| 85 |
+
self.lowCmdWriteThreadPtr.Start()
|
| 86 |
+
|
| 87 |
+
# Private methods
|
| 88 |
+
def InitLowCmd(self):
|
| 89 |
+
self.low_cmd.head[0]=0xFE
|
| 90 |
+
self.low_cmd.head[1]=0xEF
|
| 91 |
+
self.low_cmd.level_flag = 0xFF
|
| 92 |
+
self.low_cmd.gpio = 0
|
| 93 |
+
for i in range(20):
|
| 94 |
+
self.low_cmd.motor_cmd[i].mode = 0x01 # (PMSM) mode
|
| 95 |
+
self.low_cmd.motor_cmd[i].q= go2.PosStopF
|
| 96 |
+
self.low_cmd.motor_cmd[i].kp = 0
|
| 97 |
+
self.low_cmd.motor_cmd[i].dq = go2.VelStopF
|
| 98 |
+
self.low_cmd.motor_cmd[i].kd = 0
|
| 99 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 100 |
+
|
| 101 |
+
def LowStateMessageHandler(self, msg: LowState_):
|
| 102 |
+
self.low_state = msg
|
| 103 |
+
# print("FR_0 motor state: ", msg.motor_state[go2.LegID["FR_0"]])
|
| 104 |
+
# print("IMU state: ", msg.imu_state)
|
| 105 |
+
# print("Battery state: voltage: ", msg.power_v, "current: ", msg.power_a)
|
| 106 |
+
|
| 107 |
+
def LowCmdWrite(self):
|
| 108 |
+
|
| 109 |
+
if self.firstRun:
|
| 110 |
+
for i in range(12):
|
| 111 |
+
self.startPos[i] = self.low_state.motor_state[i].q
|
| 112 |
+
self.firstRun = False
|
| 113 |
+
|
| 114 |
+
self.percent_1 += 1.0 / self.duration_1
|
| 115 |
+
self.percent_1 = min(self.percent_1, 1)
|
| 116 |
+
if self.percent_1 < 1:
|
| 117 |
+
for i in range(12):
|
| 118 |
+
self.low_cmd.motor_cmd[i].q = (1 - self.percent_1) * self.startPos[i] + self.percent_1 * self._targetPos_1[i]
|
| 119 |
+
self.low_cmd.motor_cmd[i].dq = 0
|
| 120 |
+
self.low_cmd.motor_cmd[i].kp = self.Kp
|
| 121 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 122 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 123 |
+
|
| 124 |
+
if (self.percent_1 == 1) and (self.percent_2 <= 1):
|
| 125 |
+
self.percent_2 += 1.0 / self.duration_2
|
| 126 |
+
self.percent_2 = min(self.percent_2, 1)
|
| 127 |
+
for i in range(12):
|
| 128 |
+
self.low_cmd.motor_cmd[i].q = (1 - self.percent_2) * self._targetPos_1[i] + self.percent_2 * self._targetPos_2[i]
|
| 129 |
+
self.low_cmd.motor_cmd[i].dq = 0
|
| 130 |
+
self.low_cmd.motor_cmd[i].kp = self.Kp
|
| 131 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 132 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 133 |
+
|
| 134 |
+
if (self.percent_1 == 1) and (self.percent_2 == 1) and (self.percent_3 < 1):
|
| 135 |
+
self.percent_3 += 1.0 / self.duration_3
|
| 136 |
+
self.percent_3 = min(self.percent_3, 1)
|
| 137 |
+
for i in range(12):
|
| 138 |
+
self.low_cmd.motor_cmd[i].q = self._targetPos_2[i]
|
| 139 |
+
self.low_cmd.motor_cmd[i].dq = 0
|
| 140 |
+
self.low_cmd.motor_cmd[i].kp = self.Kp
|
| 141 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 142 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 143 |
+
|
| 144 |
+
if (self.percent_1 == 1) and (self.percent_2 == 1) and (self.percent_3 == 1) and (self.percent_4 <= 1):
|
| 145 |
+
self.percent_4 += 1.0 / self.duration_4
|
| 146 |
+
self.percent_4 = min(self.percent_4, 1)
|
| 147 |
+
for i in range(12):
|
| 148 |
+
self.low_cmd.motor_cmd[i].q = (1 - self.percent_4) * self._targetPos_2[i] + self.percent_4 * self._targetPos_3[i]
|
| 149 |
+
self.low_cmd.motor_cmd[i].dq = 0
|
| 150 |
+
self.low_cmd.motor_cmd[i].kp = self.Kp
|
| 151 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 152 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 153 |
+
|
| 154 |
+
self.low_cmd.crc = self.crc.Crc(self.low_cmd)
|
| 155 |
+
self.lowcmd_publisher.Write(self.low_cmd)
|
| 156 |
+
|
| 157 |
+
if __name__ == '__main__':
|
| 158 |
+
|
| 159 |
+
print("WARNING: Please ensure there are no obstacles around the robot while running this example.")
|
| 160 |
+
input("Press Enter to continue...")
|
| 161 |
+
|
| 162 |
+
if len(sys.argv)>1:
|
| 163 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 164 |
+
else:
|
| 165 |
+
ChannelFactoryInitialize(0)
|
| 166 |
+
|
| 167 |
+
custom = Custom()
|
| 168 |
+
custom.Init()
|
| 169 |
+
custom.Start()
|
| 170 |
+
|
| 171 |
+
while True:
|
| 172 |
+
if custom.percent_4 == 1.0:
|
| 173 |
+
time.sleep(1)
|
| 174 |
+
print("Done!")
|
| 175 |
+
sys.exit(-1)
|
| 176 |
+
time.sleep(1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/go2/low_level/unitree_legged_const.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
LegID = {
|
| 2 |
+
"FR_0": 0, # Front right hip
|
| 3 |
+
"FR_1": 1, # Front right thigh
|
| 4 |
+
"FR_2": 2, # Front right calf
|
| 5 |
+
"FL_0": 3,
|
| 6 |
+
"FL_1": 4,
|
| 7 |
+
"FL_2": 5,
|
| 8 |
+
"RR_0": 6,
|
| 9 |
+
"RR_1": 7,
|
| 10 |
+
"RR_2": 8,
|
| 11 |
+
"RL_0": 9,
|
| 12 |
+
"RL_1": 10,
|
| 13 |
+
"RL_2": 11,
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
HIGHLEVEL = 0xEE
|
| 17 |
+
LOWLEVEL = 0xFF
|
| 18 |
+
TRIGERLEVEL = 0xF0
|
| 19 |
+
PosStopF = 2.146e9
|
| 20 |
+
VelStopF = 16000.0
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/go2w/high_level/go2w_sport_client.py
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
| 4 |
+
from unitree_sdk2py.idl.default import unitree_go_msg_dds__SportModeState_
|
| 5 |
+
from unitree_sdk2py.idl.unitree_go.msg.dds_ import SportModeState_
|
| 6 |
+
from unitree_sdk2py.go2.sport.sport_client import SportClient
|
| 7 |
+
import math
|
| 8 |
+
from dataclasses import dataclass
|
| 9 |
+
|
| 10 |
+
@dataclass
|
| 11 |
+
class TestOption:
|
| 12 |
+
name: str
|
| 13 |
+
id: int
|
| 14 |
+
|
| 15 |
+
option_list = [
|
| 16 |
+
TestOption(name="damp", id=0),
|
| 17 |
+
TestOption(name="stand_up", id=1),
|
| 18 |
+
TestOption(name="stand_down", id=2),
|
| 19 |
+
TestOption(name="move", id=3),
|
| 20 |
+
TestOption(name="stop_move", id=4),
|
| 21 |
+
TestOption(name="speed_level", id=5),
|
| 22 |
+
TestOption(name="switch_gait", id=6),
|
| 23 |
+
TestOption(name="get_state", id=7),
|
| 24 |
+
TestOption(name="recovery", id=8),
|
| 25 |
+
TestOption(name="balance", id=9)
|
| 26 |
+
]
|
| 27 |
+
|
| 28 |
+
class UserInterface:
|
| 29 |
+
def __init__(self):
|
| 30 |
+
self.test_option_ = None
|
| 31 |
+
|
| 32 |
+
def convert_to_int(self, input_str):
|
| 33 |
+
try:
|
| 34 |
+
return int(input_str)
|
| 35 |
+
except ValueError:
|
| 36 |
+
return None
|
| 37 |
+
|
| 38 |
+
def terminal_handle(self):
|
| 39 |
+
input_str = input("Enter id or name: \n")
|
| 40 |
+
|
| 41 |
+
if input_str == "list":
|
| 42 |
+
self.test_option_.name = None
|
| 43 |
+
self.test_option_.id = None
|
| 44 |
+
for option in option_list:
|
| 45 |
+
print(f"{option.name}, id: {option.id}")
|
| 46 |
+
return
|
| 47 |
+
|
| 48 |
+
for option in option_list:
|
| 49 |
+
if input_str == option.name or self.convert_to_int(input_str) == option.id:
|
| 50 |
+
self.test_option_.name = option.name
|
| 51 |
+
self.test_option_.id = option.id
|
| 52 |
+
print(f"Test: {self.test_option_.name}, test_id: {self.test_option_.id}")
|
| 53 |
+
return
|
| 54 |
+
|
| 55 |
+
print("No matching test option found.")
|
| 56 |
+
|
| 57 |
+
if __name__ == "__main__":
|
| 58 |
+
if len(sys.argv) < 2:
|
| 59 |
+
print(f"Usage: python3 {sys.argv[0]} networkInterface")
|
| 60 |
+
sys.exit(-1)
|
| 61 |
+
|
| 62 |
+
print("WARNING: Please ensure there are no obstacles around the robot while running this example.")
|
| 63 |
+
input("Press Enter to continue...")
|
| 64 |
+
|
| 65 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 66 |
+
|
| 67 |
+
test_option = TestOption(name=None, id=None)
|
| 68 |
+
user_interface = UserInterface()
|
| 69 |
+
user_interface.test_option_ = test_option
|
| 70 |
+
|
| 71 |
+
sport_client = SportClient()
|
| 72 |
+
sport_client.SetTimeout(10.0)
|
| 73 |
+
sport_client.Init()
|
| 74 |
+
|
| 75 |
+
while True:
|
| 76 |
+
user_interface.terminal_handle()
|
| 77 |
+
|
| 78 |
+
print(f"Updated Test Option: Name = {test_option.name}, ID = {test_option.id}\n")
|
| 79 |
+
|
| 80 |
+
if test_option.id == 0:
|
| 81 |
+
sport_client.Damp()
|
| 82 |
+
elif test_option.id == 1:
|
| 83 |
+
sport_client.StandUp()
|
| 84 |
+
elif test_option.id == 2:
|
| 85 |
+
sport_client.StandDown()
|
| 86 |
+
elif test_option.id == 3:
|
| 87 |
+
sport_client.Move(0.5,0,0)
|
| 88 |
+
elif test_option.id == 4:
|
| 89 |
+
sport_client.StopMove()
|
| 90 |
+
elif test_option.id == 5:
|
| 91 |
+
sport_client.SpeedLevel(1)
|
| 92 |
+
elif test_option.id == 6:
|
| 93 |
+
sport_client.SwitchGait(1)
|
| 94 |
+
elif test_option.id == 8:
|
| 95 |
+
sport_client.RecoveryStand()
|
| 96 |
+
elif test_option.id == 9:
|
| 97 |
+
sport_client.BalanceStand()
|
| 98 |
+
|
| 99 |
+
time.sleep(1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/go2w/low_level/go2w_stand_example.py
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactoryInitialize
|
| 5 |
+
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
| 6 |
+
from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowCmd_
|
| 7 |
+
from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowState_
|
| 8 |
+
from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowCmd_
|
| 9 |
+
from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowState_
|
| 10 |
+
from unitree_sdk2py.utils.crc import CRC
|
| 11 |
+
from unitree_sdk2py.utils.thread import RecurrentThread
|
| 12 |
+
import unitree_legged_const as go2w
|
| 13 |
+
from unitree_sdk2py.go2.robot_state.robot_state_client import RobotStateClient
|
| 14 |
+
from unitree_sdk2py.comm.motion_switcher.motion_switcher_client import MotionSwitcherClient
|
| 15 |
+
from unitree_sdk2py.go2.sport.sport_client import SportClient
|
| 16 |
+
|
| 17 |
+
class Custom:
|
| 18 |
+
def __init__(self):
|
| 19 |
+
self.Kp = 70.0
|
| 20 |
+
self.Kd = 5.0
|
| 21 |
+
self.time_consume = 0
|
| 22 |
+
self.rate_count = 0
|
| 23 |
+
self.sin_count = 0
|
| 24 |
+
self.motiontime = 0
|
| 25 |
+
self.dt = 0.002
|
| 26 |
+
|
| 27 |
+
self.low_cmd = unitree_go_msg_dds__LowCmd_()
|
| 28 |
+
self.low_state = None
|
| 29 |
+
|
| 30 |
+
self.targetPos_1 = [0.0, 1.36, -2.65, 0.0, 1.36, -2.65,
|
| 31 |
+
-0.2, 1.36, -2.65, 0.2, 1.36, -2.65]
|
| 32 |
+
|
| 33 |
+
self.targetPos_2 = [0.0, 0.67, -1.3, 0.0, 0.67, -1.3,
|
| 34 |
+
0.0, 0.67, -1.3, 0.0, 0.67, -1.3]
|
| 35 |
+
|
| 36 |
+
self.targetPos_3 = [-0.35, 1.36, -2.65, 0.35, 1.36, -2.65,
|
| 37 |
+
-0.5, 1.36, -2.65, 0.5, 1.36, -2.65]
|
| 38 |
+
|
| 39 |
+
self.startPos = [0.0] * 12
|
| 40 |
+
self.duration_1 = 500
|
| 41 |
+
self.duration_2 = 500
|
| 42 |
+
self.duration_3 = 2000
|
| 43 |
+
self.duration_4 = 900
|
| 44 |
+
self.percent_1 = 0
|
| 45 |
+
self.percent_2 = 0
|
| 46 |
+
self.percent_3 = 0
|
| 47 |
+
self.percent_4 = 0
|
| 48 |
+
|
| 49 |
+
self.firstRun = True
|
| 50 |
+
self.done = False
|
| 51 |
+
|
| 52 |
+
# thread handling
|
| 53 |
+
self.lowCmdWriteThreadPtr = None
|
| 54 |
+
|
| 55 |
+
self.crc = CRC()
|
| 56 |
+
|
| 57 |
+
# Public methods
|
| 58 |
+
def Init(self):
|
| 59 |
+
self.InitLowCmd()
|
| 60 |
+
|
| 61 |
+
# create publisher #
|
| 62 |
+
self.lowcmd_publisher = ChannelPublisher("rt/lowcmd", LowCmd_)
|
| 63 |
+
self.lowcmd_publisher.Init()
|
| 64 |
+
|
| 65 |
+
# create subscriber #
|
| 66 |
+
self.lowstate_subscriber = ChannelSubscriber("rt/lowstate", LowState_)
|
| 67 |
+
self.lowstate_subscriber.Init(self.LowStateMessageHandler, 10)
|
| 68 |
+
|
| 69 |
+
self.sc = SportClient()
|
| 70 |
+
self.sc.SetTimeout(5.0)
|
| 71 |
+
self.sc.Init()
|
| 72 |
+
|
| 73 |
+
self.msc = MotionSwitcherClient()
|
| 74 |
+
self.msc.SetTimeout(5.0)
|
| 75 |
+
self.msc.Init()
|
| 76 |
+
|
| 77 |
+
status, result = self.msc.CheckMode()
|
| 78 |
+
while result['name']:
|
| 79 |
+
self.sc.StandUp()
|
| 80 |
+
self.sc.StandDown()
|
| 81 |
+
self.msc.ReleaseMode()
|
| 82 |
+
status, result = self.msc.CheckMode()
|
| 83 |
+
time.sleep(1)
|
| 84 |
+
|
| 85 |
+
def Start(self):
|
| 86 |
+
self.lowCmdWriteThreadPtr = RecurrentThread(
|
| 87 |
+
name="writebasiccmd", interval=0.002, target=self.LowCmdWrite,
|
| 88 |
+
)
|
| 89 |
+
self.lowCmdWriteThreadPtr.Start()
|
| 90 |
+
|
| 91 |
+
def InitLowCmd(self):
|
| 92 |
+
self.low_cmd.head[0] = 0xFE
|
| 93 |
+
self.low_cmd.head[1] = 0xEF
|
| 94 |
+
self.low_cmd.level_flag = 0xFF
|
| 95 |
+
self.low_cmd.gpio = 0
|
| 96 |
+
for i in range(20):
|
| 97 |
+
self.low_cmd.motor_cmd[i].mode = 0x01
|
| 98 |
+
self.low_cmd.motor_cmd[i].q= go2w.PosStopF
|
| 99 |
+
self.low_cmd.motor_cmd[i].kp = 0
|
| 100 |
+
self.low_cmd.motor_cmd[i].dq = go2w.VelStopF
|
| 101 |
+
self.low_cmd.motor_cmd[i].kd = 0
|
| 102 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 103 |
+
|
| 104 |
+
def LowStateMessageHandler(self, msg: LowState_):
|
| 105 |
+
self.low_state = msg
|
| 106 |
+
|
| 107 |
+
def LowCmdWrite(self):
|
| 108 |
+
if self.firstRun:
|
| 109 |
+
for i in range(12):
|
| 110 |
+
self.startPos[i] = self.low_state.motor_state[i].q
|
| 111 |
+
self.firstRun = False
|
| 112 |
+
|
| 113 |
+
self.percent_1 += 1.0 / self.duration_1
|
| 114 |
+
self.percent_1 = min(self.percent_1, 1)
|
| 115 |
+
if self.percent_1 < 1:
|
| 116 |
+
for i in range(12):
|
| 117 |
+
self.low_cmd.motor_cmd[i].q = (1 - self.percent_1) * self.startPos[i] + self.percent_1 * self.targetPos_1[i]
|
| 118 |
+
self.low_cmd.motor_cmd[i].dq = 0
|
| 119 |
+
self.low_cmd.motor_cmd[i].kp = self.Kp
|
| 120 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 121 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 122 |
+
|
| 123 |
+
if (self.percent_1 == 1) and (self.percent_2 <= 1):
|
| 124 |
+
self.percent_2 += 1.0 / self.duration_2
|
| 125 |
+
self.percent_2 = min(self.percent_2, 1)
|
| 126 |
+
for i in range(12):
|
| 127 |
+
self.low_cmd.motor_cmd[i].q = (1 - self.percent_2) * self.targetPos_1[i] + self.percent_2 * self.targetPos_2[i]
|
| 128 |
+
self.low_cmd.motor_cmd[i].dq = 0
|
| 129 |
+
self.low_cmd.motor_cmd[i].kp = self.Kp
|
| 130 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 131 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 132 |
+
|
| 133 |
+
if (self.percent_1 == 1) and (self.percent_2 == 1) and (self.percent_3 < 1):
|
| 134 |
+
self.percent_3 += 1.0 / self.duration_3
|
| 135 |
+
self.percent_3 = min(self.percent_3, 1)
|
| 136 |
+
for i in range(12):
|
| 137 |
+
self.low_cmd.motor_cmd[i].q = self.targetPos_2[i]
|
| 138 |
+
self.low_cmd.motor_cmd[i].dq = 0
|
| 139 |
+
self.low_cmd.motor_cmd[i].kp = self.Kp
|
| 140 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 141 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 142 |
+
|
| 143 |
+
if self.percent_3 < 0.4:
|
| 144 |
+
for i in range(12, 16):
|
| 145 |
+
self.low_cmd.motor_cmd[i].q = 0
|
| 146 |
+
self.low_cmd.motor_cmd[i].kp = 0.0
|
| 147 |
+
self.low_cmd.motor_cmd[i].dq = 3
|
| 148 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 149 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 150 |
+
|
| 151 |
+
if 0.4 <= self.percent_3 < 0.8:
|
| 152 |
+
for i in range(12, 16):
|
| 153 |
+
self.low_cmd.motor_cmd[i].q = 0
|
| 154 |
+
self.low_cmd.motor_cmd[i].kp = 0
|
| 155 |
+
self.low_cmd.motor_cmd[i].dq = -3
|
| 156 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 157 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 158 |
+
|
| 159 |
+
if self.percent_3 >= 0.8:
|
| 160 |
+
for i in range(12, 16):
|
| 161 |
+
self.low_cmd.motor_cmd[i].q = 0
|
| 162 |
+
self.low_cmd.motor_cmd[i].kp = 0
|
| 163 |
+
self.low_cmd.motor_cmd[i].dq = 0
|
| 164 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 165 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 166 |
+
|
| 167 |
+
if (self.percent_1 == 1) and (self.percent_2 == 1) and (self.percent_3 == 1) and (self.percent_4 <= 1):
|
| 168 |
+
self.percent_4 += 1.0 / self.duration_4
|
| 169 |
+
self.percent_4 = min(self.percent_4, 1)
|
| 170 |
+
for i in range(12):
|
| 171 |
+
self.low_cmd.motor_cmd[i].q = (1 - self.percent_4) * self.targetPos_2[i] + self.percent_4 * self.targetPos_3[i]
|
| 172 |
+
self.low_cmd.motor_cmd[i].dq = 0
|
| 173 |
+
self.low_cmd.motor_cmd[i].kp = self.Kp
|
| 174 |
+
self.low_cmd.motor_cmd[i].kd = self.Kd
|
| 175 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 176 |
+
|
| 177 |
+
self.low_cmd.crc = self.crc.Crc(self.low_cmd)
|
| 178 |
+
self.lowcmd_publisher.Write(self.low_cmd)
|
| 179 |
+
|
| 180 |
+
if __name__ == '__main__':
|
| 181 |
+
|
| 182 |
+
if len(sys.argv)>1:
|
| 183 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 184 |
+
else:
|
| 185 |
+
ChannelFactoryInitialize(0)
|
| 186 |
+
|
| 187 |
+
custom = Custom()
|
| 188 |
+
custom.Init()
|
| 189 |
+
custom.Start()
|
| 190 |
+
|
| 191 |
+
while True:
|
| 192 |
+
if custom.percent_4 == 1.0:
|
| 193 |
+
time.sleep(1)
|
| 194 |
+
print("Done!")
|
| 195 |
+
sys.exit(-1)
|
| 196 |
+
time.sleep(1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/go2w/low_level/unitree_legged_const.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
LegID = {
|
| 2 |
+
"FR_0": 0, # Front right hip
|
| 3 |
+
"FR_1": 1, # Front right thigh
|
| 4 |
+
"FR_2": 2, # Front right calf
|
| 5 |
+
"FL_0": 3,
|
| 6 |
+
"FL_1": 4,
|
| 7 |
+
"FL_2": 5,
|
| 8 |
+
"RR_0": 6,
|
| 9 |
+
"RR_1": 7,
|
| 10 |
+
"RR_2": 8,
|
| 11 |
+
"RL_0": 9,
|
| 12 |
+
"RL_1": 10,
|
| 13 |
+
"RL_2": 11,
|
| 14 |
+
"FR_w": 12, # Front right wheel
|
| 15 |
+
"FL_w": 13, # Front left wheel
|
| 16 |
+
"RR_w": 14, # Rear right wheel
|
| 17 |
+
"RL_w": 15, # Rear left wheel
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
HIGHLEVEL = 0xEE
|
| 21 |
+
LOWLEVEL = 0xFF
|
| 22 |
+
TRIGERLEVEL = 0xF0
|
| 23 |
+
PosStopF = 2.146e9
|
| 24 |
+
VelStopF = 16000.0
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/h1/high_level/h1_loco_client_example.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
| 4 |
+
from unitree_sdk2py.idl.default import unitree_go_msg_dds__SportModeState_
|
| 5 |
+
from unitree_sdk2py.idl.unitree_go.msg.dds_ import SportModeState_
|
| 6 |
+
from unitree_sdk2py.h1.loco.h1_loco_client import LocoClient
|
| 7 |
+
import math
|
| 8 |
+
from dataclasses import dataclass
|
| 9 |
+
|
| 10 |
+
@dataclass
|
| 11 |
+
class TestOption:
|
| 12 |
+
name: str
|
| 13 |
+
id: int
|
| 14 |
+
|
| 15 |
+
option_list = [
|
| 16 |
+
TestOption(name="damp", id=0),
|
| 17 |
+
TestOption(name="stand_up", id=1),
|
| 18 |
+
TestOption(name="move forward", id=3),
|
| 19 |
+
TestOption(name="move lateral", id=4),
|
| 20 |
+
TestOption(name="move rotate", id=5),
|
| 21 |
+
TestOption(name="low stand", id=6),
|
| 22 |
+
TestOption(name="high stand", id=7),
|
| 23 |
+
TestOption(name="zero torque", id=8)
|
| 24 |
+
]
|
| 25 |
+
|
| 26 |
+
class UserInterface:
|
| 27 |
+
def __init__(self):
|
| 28 |
+
self.test_option_ = None
|
| 29 |
+
|
| 30 |
+
def convert_to_int(self, input_str):
|
| 31 |
+
try:
|
| 32 |
+
return int(input_str)
|
| 33 |
+
except ValueError:
|
| 34 |
+
return None
|
| 35 |
+
|
| 36 |
+
def terminal_handle(self):
|
| 37 |
+
input_str = input("Enter id or name: \n")
|
| 38 |
+
|
| 39 |
+
if input_str == "list":
|
| 40 |
+
self.test_option_.name = None
|
| 41 |
+
self.test_option_.id = None
|
| 42 |
+
for option in option_list:
|
| 43 |
+
print(f"{option.name}, id: {option.id}")
|
| 44 |
+
return
|
| 45 |
+
|
| 46 |
+
for option in option_list:
|
| 47 |
+
if input_str == option.name or self.convert_to_int(input_str) == option.id:
|
| 48 |
+
self.test_option_.name = option.name
|
| 49 |
+
self.test_option_.id = option.id
|
| 50 |
+
print(f"Test: {self.test_option_.name}, test_id: {self.test_option_.id}")
|
| 51 |
+
return
|
| 52 |
+
|
| 53 |
+
print("No matching test option found.")
|
| 54 |
+
|
| 55 |
+
if __name__ == "__main__":
|
| 56 |
+
|
| 57 |
+
print("WARNING: Please ensure there are no obstacles around the robot while running this example.")
|
| 58 |
+
input("Press Enter to continue...")
|
| 59 |
+
|
| 60 |
+
if len(sys.argv)>1:
|
| 61 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 62 |
+
else:
|
| 63 |
+
ChannelFactoryInitialize(0)
|
| 64 |
+
|
| 65 |
+
test_option = TestOption(name=None, id=None)
|
| 66 |
+
user_interface = UserInterface()
|
| 67 |
+
user_interface.test_option_ = test_option
|
| 68 |
+
|
| 69 |
+
sport_client = LocoClient()
|
| 70 |
+
sport_client.SetTimeout(10.0)
|
| 71 |
+
sport_client.Init()
|
| 72 |
+
|
| 73 |
+
while True:
|
| 74 |
+
|
| 75 |
+
user_interface.terminal_handle()
|
| 76 |
+
|
| 77 |
+
print(f"Updated Test Option: Name = {test_option.name}, ID = {test_option.id}\n")
|
| 78 |
+
|
| 79 |
+
if test_option.id == 0:
|
| 80 |
+
sport_client.Damp()
|
| 81 |
+
elif test_option.id == 1:
|
| 82 |
+
sport_client.StandUp()
|
| 83 |
+
elif test_option.id == 3:
|
| 84 |
+
sport_client.Move(0.3,0,0)
|
| 85 |
+
elif test_option.id == 4:
|
| 86 |
+
sport_client.Move(0,0.3,0)
|
| 87 |
+
elif test_option.id == 5:
|
| 88 |
+
sport_client.Move(0,0,0.3)
|
| 89 |
+
elif test_option.id == 6:
|
| 90 |
+
sport_client.LowStand()
|
| 91 |
+
elif test_option.id == 7:
|
| 92 |
+
sport_client.HighStand()
|
| 93 |
+
elif test_option.id == 8:
|
| 94 |
+
sport_client.ZeroTorque()
|
| 95 |
+
|
| 96 |
+
time.sleep(1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/h1/low_level/h1_low_level_example.py
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactoryInitialize
|
| 5 |
+
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
| 6 |
+
from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowCmd_
|
| 7 |
+
from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowState_
|
| 8 |
+
from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowCmd_
|
| 9 |
+
from unitree_sdk2py.idl.unitree_go.msg.dds_ import LowState_
|
| 10 |
+
from unitree_sdk2py.utils.crc import CRC
|
| 11 |
+
from unitree_sdk2py.utils.thread import RecurrentThread
|
| 12 |
+
from unitree_sdk2py.comm.motion_switcher.motion_switcher_client import MotionSwitcherClient
|
| 13 |
+
import unitree_legged_const as h1
|
| 14 |
+
import numpy as np
|
| 15 |
+
|
| 16 |
+
H1_NUM_MOTOR = 20
|
| 17 |
+
|
| 18 |
+
class H1JointIndex:
|
| 19 |
+
# Right leg
|
| 20 |
+
kRightHipYaw = 8
|
| 21 |
+
kRightHipRoll = 0
|
| 22 |
+
kRightHipPitch = 1
|
| 23 |
+
kRightKnee = 2
|
| 24 |
+
kRightAnkle = 11
|
| 25 |
+
# Left leg
|
| 26 |
+
kLeftHipYaw = 7
|
| 27 |
+
kLeftHipRoll = 3
|
| 28 |
+
kLeftHipPitch = 4
|
| 29 |
+
kLeftKnee = 5
|
| 30 |
+
kLeftAnkle = 10
|
| 31 |
+
|
| 32 |
+
kWaistYaw = 6
|
| 33 |
+
|
| 34 |
+
kNotUsedJoint = 9
|
| 35 |
+
|
| 36 |
+
# Right arm
|
| 37 |
+
kRightShoulderPitch = 12
|
| 38 |
+
kRightShoulderRoll = 13
|
| 39 |
+
kRightShoulderYaw = 14
|
| 40 |
+
kRightElbow = 15
|
| 41 |
+
# Left arm
|
| 42 |
+
kLeftShoulderPitch = 16
|
| 43 |
+
kLeftShoulderRoll = 17
|
| 44 |
+
kLeftShoulderYaw = 18
|
| 45 |
+
kLeftElbow = 19
|
| 46 |
+
|
| 47 |
+
class Custom:
|
| 48 |
+
def __init__(self):
|
| 49 |
+
self.time_ = 0.0
|
| 50 |
+
self.control_dt_ = 0.01
|
| 51 |
+
self.duration_ = 10.0
|
| 52 |
+
self.counter_ = 0
|
| 53 |
+
self.kp_low_ = 60.0
|
| 54 |
+
self.kp_high_ = 200.0
|
| 55 |
+
self.kd_low_ = 1.5
|
| 56 |
+
self.kd_high_ = 5.0
|
| 57 |
+
self.low_cmd = unitree_go_msg_dds__LowCmd_()
|
| 58 |
+
self.InitLowCmd()
|
| 59 |
+
self.low_state = None
|
| 60 |
+
self.crc = CRC()
|
| 61 |
+
|
| 62 |
+
def Init(self):
|
| 63 |
+
# # create publisher #
|
| 64 |
+
self.lowcmd_publisher_ = ChannelPublisher("rt/lowcmd", LowCmd_)
|
| 65 |
+
self.lowcmd_publisher_.Init()
|
| 66 |
+
|
| 67 |
+
# # create subscriber #
|
| 68 |
+
self.lowstate_subscriber = ChannelSubscriber("rt/lowstate", LowState_)
|
| 69 |
+
self.lowstate_subscriber.Init(self.LowStateHandler, 10)
|
| 70 |
+
|
| 71 |
+
self.msc = MotionSwitcherClient()
|
| 72 |
+
self.msc.SetTimeout(5.0)
|
| 73 |
+
self.msc.Init()
|
| 74 |
+
|
| 75 |
+
status, result = self.msc.CheckMode()
|
| 76 |
+
while result['name']:
|
| 77 |
+
self.msc.ReleaseMode()
|
| 78 |
+
status, result = self.msc.CheckMode()
|
| 79 |
+
time.sleep(1)
|
| 80 |
+
|
| 81 |
+
self.report_rpy_ptr_ = RecurrentThread(
|
| 82 |
+
interval=0.1, target=self.ReportRPY, name="report_rpy"
|
| 83 |
+
)
|
| 84 |
+
|
| 85 |
+
self.report_rpy_ptr_.Start()
|
| 86 |
+
|
| 87 |
+
def is_weak_motor(self,motor_index):
|
| 88 |
+
return motor_index in {
|
| 89 |
+
H1JointIndex.kLeftAnkle,
|
| 90 |
+
H1JointIndex.kRightAnkle,
|
| 91 |
+
H1JointIndex.kRightShoulderPitch,
|
| 92 |
+
H1JointIndex.kRightShoulderRoll,
|
| 93 |
+
H1JointIndex.kRightShoulderYaw,
|
| 94 |
+
H1JointIndex.kRightElbow,
|
| 95 |
+
H1JointIndex.kLeftShoulderPitch,
|
| 96 |
+
H1JointIndex.kLeftShoulderRoll,
|
| 97 |
+
H1JointIndex.kLeftShoulderYaw,
|
| 98 |
+
H1JointIndex.kLeftElbow,
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
def InitLowCmd(self):
|
| 102 |
+
self.low_cmd.head[0] = 0xFE
|
| 103 |
+
self.low_cmd.head[1] = 0xEF
|
| 104 |
+
self.low_cmd.level_flag = 0xFF
|
| 105 |
+
self.low_cmd.gpio = 0
|
| 106 |
+
for i in range(H1_NUM_MOTOR):
|
| 107 |
+
if self.is_weak_motor(i):
|
| 108 |
+
self.low_cmd.motor_cmd[i].mode = 0x01
|
| 109 |
+
else:
|
| 110 |
+
self.low_cmd.motor_cmd[i].mode = 0x0A
|
| 111 |
+
self.low_cmd.motor_cmd[i].q= h1.PosStopF
|
| 112 |
+
self.low_cmd.motor_cmd[i].kp = 0
|
| 113 |
+
self.low_cmd.motor_cmd[i].dq = h1.VelStopF
|
| 114 |
+
self.low_cmd.motor_cmd[i].kd = 0
|
| 115 |
+
self.low_cmd.motor_cmd[i].tau = 0
|
| 116 |
+
|
| 117 |
+
def Start(self):
|
| 118 |
+
self.lowCmdWriteThreadPtr = RecurrentThread(
|
| 119 |
+
interval=self.control_dt_, target=self.LowCmdWrite, name="control"
|
| 120 |
+
)
|
| 121 |
+
self.lowCmdWriteThreadPtr.Start()
|
| 122 |
+
|
| 123 |
+
def LowStateHandler(self, msg: LowState_):
|
| 124 |
+
self.low_state = msg
|
| 125 |
+
|
| 126 |
+
def ReportRPY(self):
|
| 127 |
+
print("rpy: [",self.low_state.imu_state.rpy[0],", "
|
| 128 |
+
,self.low_state.imu_state.rpy[1],", "
|
| 129 |
+
,self.low_state.imu_state.rpy[2],"]"
|
| 130 |
+
)
|
| 131 |
+
|
| 132 |
+
def LowCmdWrite(self):
|
| 133 |
+
self.time_ += self.control_dt_
|
| 134 |
+
self.time_ = np.clip(self.time_ , 0.0, self.duration_)
|
| 135 |
+
|
| 136 |
+
# set robot to zero posture
|
| 137 |
+
for i in range(H1_NUM_MOTOR):
|
| 138 |
+
ratio = self.time_ / self.duration_
|
| 139 |
+
self.low_cmd.motor_cmd[i].tau = 0.
|
| 140 |
+
self.low_cmd.motor_cmd[i].q = (1.0 - ratio) * self.low_state.motor_state[i].q
|
| 141 |
+
self.low_cmd.motor_cmd[i].dq = 0.
|
| 142 |
+
self.low_cmd.motor_cmd[i].kp = self.kp_low_ if self.is_weak_motor(i) else self.kp_high_
|
| 143 |
+
self.low_cmd.motor_cmd[i].kd = self.kd_low_ if self.is_weak_motor(i) else self.kd_high_
|
| 144 |
+
|
| 145 |
+
self.low_cmd.crc = self.crc.Crc(self.low_cmd)
|
| 146 |
+
self.lowcmd_publisher_.Write(self.low_cmd)
|
| 147 |
+
|
| 148 |
+
if __name__ == '__main__':
|
| 149 |
+
|
| 150 |
+
print("WARNING: Please ensure there are no obstacles around the robot while running this example.")
|
| 151 |
+
input("Press Enter to continue...")
|
| 152 |
+
|
| 153 |
+
if len(sys.argv)>1:
|
| 154 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 155 |
+
else:
|
| 156 |
+
ChannelFactoryInitialize(0)
|
| 157 |
+
|
| 158 |
+
custom = Custom()
|
| 159 |
+
custom.Init()
|
| 160 |
+
custom.Start()
|
| 161 |
+
|
| 162 |
+
while True:
|
| 163 |
+
if custom.time_ == custom.duration_:
|
| 164 |
+
time.sleep(1)
|
| 165 |
+
print("Done!")
|
| 166 |
+
sys.exit(-1)
|
| 167 |
+
time.sleep(1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/h1/low_level/unitree_legged_const.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
HIGHLEVEL = 0xEE
|
| 2 |
+
LOWLEVEL = 0xFF
|
| 3 |
+
TRIGERLEVEL = 0xF0
|
| 4 |
+
PosStopF = 2.146e9
|
| 5 |
+
VelStopF = 16000.0
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/h1_2/low_level/h1_2_low_level_example.py
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactoryInitialize
|
| 5 |
+
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
| 6 |
+
from unitree_sdk2py.idl.default import unitree_hg_msg_dds__LowCmd_
|
| 7 |
+
from unitree_sdk2py.idl.default import unitree_hg_msg_dds__LowState_
|
| 8 |
+
from unitree_sdk2py.idl.unitree_hg.msg.dds_ import LowCmd_
|
| 9 |
+
from unitree_sdk2py.idl.unitree_hg.msg.dds_ import LowState_
|
| 10 |
+
from unitree_sdk2py.utils.crc import CRC
|
| 11 |
+
from unitree_sdk2py.utils.thread import RecurrentThread
|
| 12 |
+
from unitree_sdk2py.comm.motion_switcher.motion_switcher_client import MotionSwitcherClient
|
| 13 |
+
|
| 14 |
+
import numpy as np
|
| 15 |
+
|
| 16 |
+
H1_2_NUM_MOTOR = 27
|
| 17 |
+
|
| 18 |
+
class H1_2_JointIndex:
|
| 19 |
+
# legs
|
| 20 |
+
LeftHipYaw = 0
|
| 21 |
+
LeftHipPitch = 1
|
| 22 |
+
LeftHipRoll = 2
|
| 23 |
+
LeftKnee = 3
|
| 24 |
+
LeftAnklePitch = 4
|
| 25 |
+
LeftAnkleB = 4
|
| 26 |
+
LeftAnkleRoll = 5
|
| 27 |
+
LeftAnkleA = 5
|
| 28 |
+
RightHipYaw = 6
|
| 29 |
+
RightHipPitch = 7
|
| 30 |
+
RightHipRoll = 8
|
| 31 |
+
RightKnee = 9
|
| 32 |
+
RightAnklePitch = 10
|
| 33 |
+
RightAnkleB = 10
|
| 34 |
+
RightAnkleRoll = 11
|
| 35 |
+
RightAnkleA = 11
|
| 36 |
+
# torso
|
| 37 |
+
WaistYaw = 12
|
| 38 |
+
# arms
|
| 39 |
+
LeftShoulderPitch = 13
|
| 40 |
+
LeftShoulderRoll = 14
|
| 41 |
+
LeftShoulderYaw = 15
|
| 42 |
+
LeftElbow = 16
|
| 43 |
+
LeftWristRoll = 17
|
| 44 |
+
LeftWristPitch = 18
|
| 45 |
+
LeftWristYaw = 19
|
| 46 |
+
RightShoulderPitch = 20
|
| 47 |
+
RightShoulderRoll = 21
|
| 48 |
+
RightShoulderYaw = 22
|
| 49 |
+
RightElbow = 23
|
| 50 |
+
RightWristRoll = 24
|
| 51 |
+
RightWristPitch = 25
|
| 52 |
+
RightWristYaw = 26
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
class Mode:
|
| 56 |
+
PR = 0 # Series Control for Pitch/Roll Joints
|
| 57 |
+
AB = 1 # Parallel Control for A/B Joints
|
| 58 |
+
|
| 59 |
+
class Custom:
|
| 60 |
+
def __init__(self):
|
| 61 |
+
self.time_ = 0.0
|
| 62 |
+
self.control_dt_ = 0.002 # [2ms]
|
| 63 |
+
self.duration_ = 3.0 # [3 s]
|
| 64 |
+
self.counter_ = 0
|
| 65 |
+
self.mode_pr_ = Mode.PR
|
| 66 |
+
self.mode_machine_ = 0
|
| 67 |
+
self.low_cmd = unitree_hg_msg_dds__LowCmd_()
|
| 68 |
+
self.low_state = None
|
| 69 |
+
self.update_mode_machine_ = False
|
| 70 |
+
self.crc = CRC()
|
| 71 |
+
|
| 72 |
+
def Init(self):
|
| 73 |
+
self.msc = MotionSwitcherClient()
|
| 74 |
+
self.msc.SetTimeout(5.0)
|
| 75 |
+
self.msc.Init()
|
| 76 |
+
|
| 77 |
+
status, result = self.msc.CheckMode()
|
| 78 |
+
while result['name']:
|
| 79 |
+
self.msc.ReleaseMode()
|
| 80 |
+
status, result = self.msc.CheckMode()
|
| 81 |
+
time.sleep(1)
|
| 82 |
+
|
| 83 |
+
# create publisher #
|
| 84 |
+
self.lowcmd_publisher_ = ChannelPublisher("rt/lowcmd", LowCmd_)
|
| 85 |
+
self.lowcmd_publisher_.Init()
|
| 86 |
+
|
| 87 |
+
# create subscriber #
|
| 88 |
+
self.lowstate_subscriber = ChannelSubscriber("rt/lowstate", LowState_)
|
| 89 |
+
self.lowstate_subscriber.Init(self.LowStateHandler, 10)
|
| 90 |
+
|
| 91 |
+
def Start(self):
|
| 92 |
+
self.lowCmdWriteThreadPtr = RecurrentThread(
|
| 93 |
+
interval=self.control_dt_, target=self.LowCmdWrite, name="control"
|
| 94 |
+
)
|
| 95 |
+
while self.update_mode_machine_ == False:
|
| 96 |
+
time.sleep(1)
|
| 97 |
+
|
| 98 |
+
if self.update_mode_machine_ == True:
|
| 99 |
+
self.lowCmdWriteThreadPtr.Start()
|
| 100 |
+
|
| 101 |
+
def LowStateHandler(self, msg: LowState_):
|
| 102 |
+
self.low_state = msg
|
| 103 |
+
|
| 104 |
+
if self.update_mode_machine_ == False:
|
| 105 |
+
self.mode_machine_ = self.low_state.mode_machine
|
| 106 |
+
self.update_mode_machine_ = True
|
| 107 |
+
|
| 108 |
+
self.counter_ +=1
|
| 109 |
+
if (self.counter_ % 500 == 0) :
|
| 110 |
+
self.counter_ = 0
|
| 111 |
+
print(self.low_state.imu_state.rpy)
|
| 112 |
+
|
| 113 |
+
def LowCmdWrite(self):
|
| 114 |
+
self.time_ += self.control_dt_
|
| 115 |
+
self.low_cmd.mode_pr = Mode.PR
|
| 116 |
+
self.low_cmd.mode_machine = self.mode_machine_
|
| 117 |
+
for i in range(H1_2_NUM_MOTOR):
|
| 118 |
+
ratio = np.clip(self.time_ / self.duration_, 0.0, 1.0)
|
| 119 |
+
self.low_cmd.motor_cmd[i].mode = 1 # 1:Enable, 0:Disable
|
| 120 |
+
self.low_cmd.motor_cmd[i].tau = 0.0
|
| 121 |
+
self.low_cmd.motor_cmd[i].q = 0.0
|
| 122 |
+
self.low_cmd.motor_cmd[i].dq = 0.0
|
| 123 |
+
self.low_cmd.motor_cmd[i].kp = 100.0 if i < 13 else 50.0
|
| 124 |
+
self.low_cmd.motor_cmd[i].kd = 1.0
|
| 125 |
+
|
| 126 |
+
if self.time_ < self.duration_ :
|
| 127 |
+
# [Stage 1]: set robot to zero posture
|
| 128 |
+
for i in range(H1_2_NUM_MOTOR):
|
| 129 |
+
ratio = np.clip(self.time_ / self.duration_, 0.0, 1.0)
|
| 130 |
+
self.low_cmd.mode_pr = Mode.PR
|
| 131 |
+
self.low_cmd.mode_machine = self.mode_machine_
|
| 132 |
+
self.low_cmd.motor_cmd[i].mode = 1 # 1:Enable, 0:Disable
|
| 133 |
+
self.low_cmd.motor_cmd[i].tau = 0.
|
| 134 |
+
self.low_cmd.motor_cmd[i].q = (1.0 - ratio) * self.low_state.motor_state[i].q
|
| 135 |
+
self.low_cmd.motor_cmd[i].dq = 0.
|
| 136 |
+
self.low_cmd.motor_cmd[i].kp = 100.0 if i < 13 else 50.0
|
| 137 |
+
self.low_cmd.motor_cmd[i].kd = 1.0
|
| 138 |
+
else :
|
| 139 |
+
# [Stage 2]: swing ankle using PR mode
|
| 140 |
+
max_P = 0.25
|
| 141 |
+
max_R = 0.25
|
| 142 |
+
t = self.time_ - self.duration_
|
| 143 |
+
L_P_des = max_P * np.cos(2.0 * np.pi * t)
|
| 144 |
+
L_R_des = max_R * np.sin(2.0 * np.pi * t)
|
| 145 |
+
R_P_des = max_P * np.cos(2.0 * np.pi * t)
|
| 146 |
+
R_R_des = -max_R * np.sin(2.0 * np.pi * t)
|
| 147 |
+
|
| 148 |
+
Kp_Pitch = 80
|
| 149 |
+
Kd_Pitch = 1
|
| 150 |
+
Kp_Roll = 80
|
| 151 |
+
Kd_Roll = 1
|
| 152 |
+
|
| 153 |
+
self.low_cmd.mode_pr = Mode.PR
|
| 154 |
+
self.low_cmd.mode_machine = self.mode_machine_
|
| 155 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.LeftAnklePitch].q = L_P_des
|
| 156 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.LeftAnklePitch].dq = 0
|
| 157 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.LeftAnklePitch].kp = Kp_Pitch
|
| 158 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.LeftAnklePitch].kd = Kd_Pitch
|
| 159 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.LeftAnkleRoll].q = L_R_des
|
| 160 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.LeftAnkleRoll].dq = 0
|
| 161 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.LeftAnkleRoll].kp = Kp_Roll
|
| 162 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.LeftAnkleRoll].kd = Kd_Roll
|
| 163 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.RightAnklePitch].q = R_P_des
|
| 164 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.RightAnklePitch].dq = 0
|
| 165 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.RightAnklePitch].kp = Kp_Pitch
|
| 166 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.RightAnklePitch].kd = Kd_Pitch
|
| 167 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.RightAnkleRoll].q = R_R_des
|
| 168 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.RightAnkleRoll].dq = 0
|
| 169 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.RightAnkleRoll].kp = Kp_Roll
|
| 170 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.RightAnkleRoll].kd = Kd_Roll
|
| 171 |
+
|
| 172 |
+
max_wrist_roll_angle = 0.5; # [rad]
|
| 173 |
+
WristRoll_des = max_wrist_roll_angle * np.sin(2.0 * np.pi * t)
|
| 174 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.LeftWristRoll].q = WristRoll_des
|
| 175 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.LeftWristRoll].dq = 0
|
| 176 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.LeftWristRoll].kp = 50
|
| 177 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.LeftWristRoll].kd = 1
|
| 178 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.RightWristRoll].q = WristRoll_des
|
| 179 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.RightWristRoll].dq = 0
|
| 180 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.RightWristRoll].kp = 50
|
| 181 |
+
self.low_cmd.motor_cmd[H1_2_JointIndex.RightWristRoll].kd = 1
|
| 182 |
+
|
| 183 |
+
self.low_cmd.crc = self.crc.Crc(self.low_cmd)
|
| 184 |
+
self.lowcmd_publisher_.Write(self.low_cmd)
|
| 185 |
+
|
| 186 |
+
if __name__ == '__main__':
|
| 187 |
+
|
| 188 |
+
print("WARNING: Please ensure there are no obstacles around the robot while running this example.")
|
| 189 |
+
input("Press Enter to continue...")
|
| 190 |
+
|
| 191 |
+
if len(sys.argv)>1:
|
| 192 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 193 |
+
else:
|
| 194 |
+
ChannelFactoryInitialize(0)
|
| 195 |
+
|
| 196 |
+
custom = Custom()
|
| 197 |
+
custom.Init()
|
| 198 |
+
custom.Start()
|
| 199 |
+
|
| 200 |
+
while True:
|
| 201 |
+
time.sleep(1)
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/helloworld/publisher.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
|
| 3 |
+
from unitree_sdk2py.core.channel import ChannelPublisher, ChannelFactoryInitialize
|
| 4 |
+
from user_data import *
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
if __name__ == "__main__":
|
| 8 |
+
ChannelFactoryInitialize()
|
| 9 |
+
|
| 10 |
+
# Create a publisher to publish the data defined in UserData class
|
| 11 |
+
pub = ChannelPublisher("topic", UserData)
|
| 12 |
+
pub.Init()
|
| 13 |
+
|
| 14 |
+
for i in range(30):
|
| 15 |
+
# Create a Userdata message
|
| 16 |
+
msg = UserData(" ", 0)
|
| 17 |
+
msg.string_data = "Hello world"
|
| 18 |
+
msg.float_data = time.time()
|
| 19 |
+
|
| 20 |
+
# Publish message
|
| 21 |
+
if pub.Write(msg, 0.5):
|
| 22 |
+
print("Publish success. msg:", msg)
|
| 23 |
+
else:
|
| 24 |
+
print("Waitting for subscriber.")
|
| 25 |
+
|
| 26 |
+
time.sleep(1)
|
| 27 |
+
|
| 28 |
+
pub.Close()
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/helloworld/subscriber.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
|
| 3 |
+
from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitialize
|
| 4 |
+
from user_data import *
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
if __name__ == "__main__":
|
| 8 |
+
ChannelFactoryInitialize()
|
| 9 |
+
# Create a subscriber to subscribe the data defined in UserData class
|
| 10 |
+
sub = ChannelSubscriber("topic", UserData)
|
| 11 |
+
sub.Init()
|
| 12 |
+
|
| 13 |
+
while True:
|
| 14 |
+
msg = sub.Read()
|
| 15 |
+
if msg is not None:
|
| 16 |
+
print("Subscribe success. msg:", msg)
|
| 17 |
+
else:
|
| 18 |
+
print("No data subscribed.")
|
| 19 |
+
break
|
| 20 |
+
sub.Close()
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/helloworld/user_data.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from dataclasses import dataclass
|
| 2 |
+
from cyclonedds.idl import IdlStruct
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
# This class defines user data consisting of a float data and a string data
|
| 6 |
+
@dataclass
|
| 7 |
+
class UserData(IdlStruct, typename="UserData"):
|
| 8 |
+
string_data: str
|
| 9 |
+
float_data: float
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/motionSwitcher/motion_switcher_example.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
from unitree_sdk2py.core.channel import ChannelFactoryInitialize
|
| 5 |
+
from unitree_sdk2py.comm.motion_switcher.motion_switcher_client import MotionSwitcherClient
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class Custom:
|
| 9 |
+
def __init__(self):
|
| 10 |
+
self.msc = MotionSwitcherClient()
|
| 11 |
+
self.msc.SetTimeout(5.0)
|
| 12 |
+
self.msc.Init()
|
| 13 |
+
|
| 14 |
+
def selectMode(self,name):
|
| 15 |
+
ret = self.msc.SelectMode(name)
|
| 16 |
+
return ret
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
if __name__ == '__main__':
|
| 20 |
+
|
| 21 |
+
print("WARNING: Please ensure there are no obstacles around the robot while running this example.")
|
| 22 |
+
input("Press Enter to continue...")
|
| 23 |
+
|
| 24 |
+
if len(sys.argv)>1:
|
| 25 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 26 |
+
else:
|
| 27 |
+
ChannelFactoryInitialize(0)
|
| 28 |
+
|
| 29 |
+
custom = Custom()
|
| 30 |
+
selectMode = "ai"
|
| 31 |
+
# selectMode = "normal"
|
| 32 |
+
# selectMode = "advanced"
|
| 33 |
+
# selectMode = "ai-w" # for wheeled robot
|
| 34 |
+
ret = custom.selectMode(selectMode)
|
| 35 |
+
print("ret: ",ret)
|
| 36 |
+
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/obstacles_avoid/obstacles_avoid_move.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
from unitree_sdk2py.core.channel import ChannelFactoryInitialize
|
| 5 |
+
from unitree_sdk2py.go2.obstacles_avoid.obstacles_avoid_client import ObstaclesAvoidClient
|
| 6 |
+
|
| 7 |
+
if __name__ == "__main__":
|
| 8 |
+
if len(sys.argv)>1:
|
| 9 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 10 |
+
else:
|
| 11 |
+
ChannelFactoryInitialize(0)
|
| 12 |
+
|
| 13 |
+
try:
|
| 14 |
+
client = ObstaclesAvoidClient()
|
| 15 |
+
client.SetTimeout(3.0)
|
| 16 |
+
client.Init()
|
| 17 |
+
|
| 18 |
+
while not client.SwitchGet()[1]:
|
| 19 |
+
client.SwitchSet(True)
|
| 20 |
+
time.sleep(0.1)
|
| 21 |
+
|
| 22 |
+
print("obstacles avoid switch on")
|
| 23 |
+
|
| 24 |
+
client.UseRemoteCommandFromApi(True)
|
| 25 |
+
time.sleep(0.5)
|
| 26 |
+
client.Move(0.5, 0.0, 0.0)
|
| 27 |
+
time.sleep(1.0) # move 1s
|
| 28 |
+
client.Move(0.0, 0.0, 0.0)
|
| 29 |
+
client.UseRemoteCommandFromApi(False)
|
| 30 |
+
|
| 31 |
+
except KeyboardInterrupt:
|
| 32 |
+
client.Move(0.0, 0.0, 0.0)
|
| 33 |
+
client.UseRemoteCommandFromApi(False)
|
| 34 |
+
print("exit!!")
|
| 35 |
+
|
GR00T-WholeBodyControl/external_dependencies/unitree_sdk2_python/example/obstacles_avoid/obstacles_avoid_switch.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
from unitree_sdk2py.core.channel import ChannelFactoryInitialize
|
| 5 |
+
from unitree_sdk2py.go2.obstacles_avoid.obstacles_avoid_client import ObstaclesAvoidClient
|
| 6 |
+
|
| 7 |
+
if __name__ == "__main__":
|
| 8 |
+
if len(sys.argv)>1:
|
| 9 |
+
ChannelFactoryInitialize(0, sys.argv[1])
|
| 10 |
+
else:
|
| 11 |
+
ChannelFactoryInitialize(0)
|
| 12 |
+
|
| 13 |
+
client = ObstaclesAvoidClient()
|
| 14 |
+
client.SetTimeout(3.0)
|
| 15 |
+
client.Init()
|
| 16 |
+
|
| 17 |
+
while True:
|
| 18 |
+
print("##################GetServerApiVersion###################")
|
| 19 |
+
code, serverAPiVersion = client.GetServerApiVersion()
|
| 20 |
+
if code != 0:
|
| 21 |
+
print("get server api error. code:", code)
|
| 22 |
+
else:
|
| 23 |
+
print("get server api version:", serverAPiVersion)
|
| 24 |
+
|
| 25 |
+
if serverAPiVersion != client.GetApiVersion():
|
| 26 |
+
print("api version not equal.")
|
| 27 |
+
|
| 28 |
+
time.sleep(3)
|
| 29 |
+
|
| 30 |
+
print("##################SwitchGet###################")
|
| 31 |
+
code, enable = client.SwitchGet()
|
| 32 |
+
if code != 0:
|
| 33 |
+
print("switch get error. code:", code)
|
| 34 |
+
else:
|
| 35 |
+
print("switch get success. enable:", enable)
|
| 36 |
+
|
| 37 |
+
time.sleep(3)
|
| 38 |
+
|
| 39 |
+
print("##################SwitchSet (on)###################")
|
| 40 |
+
code = client.SwitchSet(True)
|
| 41 |
+
if code != 0:
|
| 42 |
+
print("switch set error. code:", code)
|
| 43 |
+
else:
|
| 44 |
+
print("switch set success.")
|
| 45 |
+
|
| 46 |
+
time.sleep(3)
|
| 47 |
+
|
| 48 |
+
print("##################SwitchGet###################")
|
| 49 |
+
code, enable1 = client.SwitchGet()
|
| 50 |
+
if code != 0:
|
| 51 |
+
print("switch get error. code:", code)
|
| 52 |
+
else:
|
| 53 |
+
print("switch get success. enable:", enable1)
|
| 54 |
+
|
| 55 |
+
time.sleep(3)
|
| 56 |
+
|
| 57 |
+
print("##################SwitchSet (off)###################")
|
| 58 |
+
code = client.SwitchSet(False)
|
| 59 |
+
if code != 0:
|
| 60 |
+
print("switch set error. code:", code)
|
| 61 |
+
else:
|
| 62 |
+
print("switch set success.")
|
| 63 |
+
|
| 64 |
+
time.sleep(3)
|
| 65 |
+
|
| 66 |
+
print("##################SwitchGet###################")
|
| 67 |
+
code, enable1 = client.SwitchGet()
|
| 68 |
+
if code != 0:
|
| 69 |
+
print("switch get error. code:", code)
|
| 70 |
+
else:
|
| 71 |
+
print("switch get success. enable:", enable1)
|
| 72 |
+
|
| 73 |
+
time.sleep(3)
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
print("##################SwitchSet (enable)###################")
|
| 77 |
+
|
| 78 |
+
code = client.SwitchSet(enable)
|
| 79 |
+
if code != 0:
|
| 80 |
+
print("switch set error. code:", code)
|
| 81 |
+
else:
|
| 82 |
+
print("switch set success. enable:", enable)
|
| 83 |
+
|
| 84 |
+
time.sleep(3)
|
| 85 |
+
|
| 86 |
+
print("##################SwitchGet###################")
|
| 87 |
+
code, enable = client.SwitchGet()
|
| 88 |
+
if code != 0:
|
| 89 |
+
print("switch get error. code:", code)
|
| 90 |
+
else:
|
| 91 |
+
print("switch get success. enable:", enable)
|
| 92 |
+
|
| 93 |
+
time.sleep(3)
|
| 94 |
+
|