Upload third-party source (skip LFS pointer assets)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +3 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/model_data/g1/g1_29dof_with_hand.xml +748 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/model_data/g1/g1_29dof_with_hand_rev_1_0_activatedfinger.xml +669 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/model_data/g1/lift_box_43dof.xml +49 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/model_data/g1/pnp_bottle_43dof.xml +49 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/model_data/g1/pnp_cube_43dof.xml +49 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/model_data/g1/scene_29dof.xml +33 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/model_data/g1/scene_29dof_activated3dex.xml +30 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/model_data/g1/scene_43dof.xml +30 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/robot_model.py +772 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/supplemental_info/__init__.py +5 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/supplemental_info/g1/__init__.py +0 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/supplemental_info/g1/g1_supplemental_info.py +330 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/supplemental_info/robot_supplemental_info.py +91 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/sensor/__init__.py +0 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/sensor/composed_camera.py +440 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/sensor/oak.py +324 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/sensor/sensor_server.py +128 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/ClientLogging.hpp +158 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/ClientPlatformSpecific.cpp +559 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/ClientPlatformSpecific.hpp +90 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/ClientPlatformSpecificTypes.hpp +48 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/Dockerfile +88 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/Dockerfile.Integrated +69 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/Main.cpp +52 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/Makefile +59 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/ManusSDK/include/ManusSDK.h +1058 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/ManusSDK/include/ManusSDKTypeInitializers.h +397 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/ManusSDK/include/ManusSDKTypes.h +1717 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/Readme.md +4 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/SDKClient.cpp +0 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/SDKClient.hpp +349 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/SDKClient_Linux.vcxproj +249 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/SDKClient_Linux.vcxproj.filters +25 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/objects/ClientPlatformSpecific.d +4 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/objects/ClientPlatformSpecific.o +3 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/objects/Main.d +124 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/objects/Main.o +3 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/objects/SDKClient.d +5 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/objects/SDKClient.o +3 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/test.py +14 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/iphone/iphone.py +102 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/manus.py +138 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/pico/xr_client.py +155 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/gui/cli.py +20 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/gui/core/events3d.py +253 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/gui/core/gui3d.py +670 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/gui/core/guicommon.py +860 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/gui/core/module3d.py +1307 -0
- third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/gui/core/selection.py +165 -0
.gitattributes
CHANGED
|
@@ -169,3 +169,6 @@ simulation/assets/g1/configuration/g1_29dof_rev_1_0_with_inspire_hand_retarget_i
|
|
| 169 |
simulation/modules/IsaacLab/source/isaaclab/isaaclab/assets/articulation/__pycache__/base_articulation.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 170 |
simulation/modules/IsaacLab/source/isaaclab/isaaclab/envs/mdp/__pycache__/events.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 171 |
simulation/modules/IsaacLab/source/isaaclab_physx/isaaclab_physx/assets/articulation/__pycache__/articulation.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
simulation/modules/IsaacLab/source/isaaclab/isaaclab/assets/articulation/__pycache__/base_articulation.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 170 |
simulation/modules/IsaacLab/source/isaaclab/isaaclab/envs/mdp/__pycache__/events.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 171 |
simulation/modules/IsaacLab/source/isaaclab_physx/isaaclab_physx/assets/articulation/__pycache__/articulation.cpython-312.pyc filter=lfs diff=lfs merge=lfs -text
|
| 172 |
+
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/objects/ClientPlatformSpecific.o filter=lfs diff=lfs merge=lfs -text
|
| 173 |
+
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/objects/Main.o filter=lfs diff=lfs merge=lfs -text
|
| 174 |
+
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/objects/SDKClient.o filter=lfs diff=lfs merge=lfs -text
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/model_data/g1/g1_29dof_with_hand.xml
ADDED
|
@@ -0,0 +1,748 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<mujoco model="g1_29dof_with_hand">
|
| 2 |
+
<compiler angle="radian" meshdir="meshes" />
|
| 3 |
+
|
| 4 |
+
<default>
|
| 5 |
+
<default class="torso_motor">
|
| 6 |
+
<joint damping="0.05" armature="0.01" frictionloss="0.2"/>
|
| 7 |
+
</default>
|
| 8 |
+
<default class="leg_motor">
|
| 9 |
+
<joint damping="0.05" armature="0.01" frictionloss="0.2"/>
|
| 10 |
+
</default>
|
| 11 |
+
<default class="ankle_motor">
|
| 12 |
+
<joint damping="0.05" armature="0.01" frictionloss="0.2"/>
|
| 13 |
+
</default>
|
| 14 |
+
<default class="arm_motor">
|
| 15 |
+
<joint damping="0.05" armature="0.01" frictionloss="0.2"/>
|
| 16 |
+
</default>
|
| 17 |
+
<default class="wrist_motor">
|
| 18 |
+
<joint damping="0.05" armature="0.01" frictionloss="0.1"/>
|
| 19 |
+
</default>
|
| 20 |
+
<default class="finger_motor">
|
| 21 |
+
<joint damping="0.05" armature="0.01" frictionloss="0.1"/>
|
| 22 |
+
</default>
|
| 23 |
+
</default>
|
| 24 |
+
<asset>
|
| 25 |
+
<mesh name="pelvis" file="pelvis.STL" />
|
| 26 |
+
<mesh name="pelvis_contour_link" file="pelvis_contour_link.STL" />
|
| 27 |
+
<mesh name="left_hip_pitch_link" file="left_hip_pitch_link.STL" />
|
| 28 |
+
<mesh name="left_hip_roll_link" file="left_hip_roll_link.STL" />
|
| 29 |
+
<mesh name="left_hip_yaw_link" file="left_hip_yaw_link.STL" />
|
| 30 |
+
<mesh name="left_knee_link" file="left_knee_link.STL" />
|
| 31 |
+
<mesh name="left_ankle_pitch_link" file="left_ankle_pitch_link.STL" />
|
| 32 |
+
<mesh name="left_ankle_roll_link" file="left_ankle_roll_link.STL" />
|
| 33 |
+
<mesh name="right_hip_pitch_link" file="right_hip_pitch_link.STL" />
|
| 34 |
+
<mesh name="right_hip_roll_link" file="right_hip_roll_link.STL" />
|
| 35 |
+
<mesh name="right_hip_yaw_link" file="right_hip_yaw_link.STL" />
|
| 36 |
+
<mesh name="right_knee_link" file="right_knee_link.STL" />
|
| 37 |
+
<mesh name="right_ankle_pitch_link" file="right_ankle_pitch_link.STL" />
|
| 38 |
+
<mesh name="right_ankle_roll_link" file="right_ankle_roll_link.STL" />
|
| 39 |
+
<mesh name="waist_yaw_link" file="waist_yaw_link.STL" />
|
| 40 |
+
<mesh name="waist_roll_link" file="waist_roll_link.STL" />
|
| 41 |
+
<mesh name="torso_link" file="torso_link.STL" />
|
| 42 |
+
<mesh name="logo_link" file="logo_link.STL" />
|
| 43 |
+
<mesh name="head_link" file="head_link.STL" />
|
| 44 |
+
<mesh name="waist_support_link" file="waist_support_link.STL" />
|
| 45 |
+
<mesh name="left_shoulder_pitch_link" file="left_shoulder_pitch_link.STL" />
|
| 46 |
+
<mesh name="left_shoulder_roll_link" file="left_shoulder_roll_link.STL" />
|
| 47 |
+
<mesh name="left_shoulder_yaw_link" file="left_shoulder_yaw_link.STL" />
|
| 48 |
+
<mesh name="left_elbow_link" file="left_elbow_link.STL" />
|
| 49 |
+
<mesh name="left_wrist_roll_link" file="left_wrist_roll_link.STL" />
|
| 50 |
+
<mesh name="left_wrist_pitch_link" file="left_wrist_pitch_link.STL" />
|
| 51 |
+
<mesh name="left_wrist_yaw_link" file="left_wrist_yaw_link.STL" />
|
| 52 |
+
<mesh name="left_hand_palm_link" file="left_hand_palm_link.STL" />
|
| 53 |
+
<mesh name="left_hand_thumb_0_link" file="left_hand_thumb_0_link.STL" />
|
| 54 |
+
<mesh name="left_hand_thumb_1_link" file="left_hand_thumb_1_link.STL" />
|
| 55 |
+
<mesh name="left_hand_thumb_2_link" file="left_hand_thumb_2_link.STL" />
|
| 56 |
+
<mesh name="left_hand_middle_0_link" file="left_hand_middle_0_link.STL" />
|
| 57 |
+
<mesh name="left_hand_middle_1_link" file="left_hand_middle_1_link.STL" />
|
| 58 |
+
<mesh name="left_hand_index_0_link" file="left_hand_index_0_link.STL" />
|
| 59 |
+
<mesh name="left_hand_index_1_link" file="left_hand_index_1_link.STL" />
|
| 60 |
+
<mesh name="right_shoulder_pitch_link" file="right_shoulder_pitch_link.STL" />
|
| 61 |
+
<mesh name="right_shoulder_roll_link" file="right_shoulder_roll_link.STL" />
|
| 62 |
+
<mesh name="right_shoulder_yaw_link" file="right_shoulder_yaw_link.STL" />
|
| 63 |
+
<mesh name="right_elbow_link" file="right_elbow_link.STL" />
|
| 64 |
+
<mesh name="right_wrist_roll_link" file="right_wrist_roll_link.STL" />
|
| 65 |
+
<mesh name="right_wrist_pitch_link" file="right_wrist_pitch_link.STL" />
|
| 66 |
+
<mesh name="right_wrist_yaw_link" file="right_wrist_yaw_link.STL" />
|
| 67 |
+
<mesh name="right_hand_palm_link" file="right_hand_palm_link.STL" />
|
| 68 |
+
<mesh name="right_hand_thumb_0_link" file="right_hand_thumb_0_link.STL" />
|
| 69 |
+
<mesh name="right_hand_thumb_1_link" file="right_hand_thumb_1_link.STL" />
|
| 70 |
+
<mesh name="right_hand_thumb_2_link" file="right_hand_thumb_2_link.STL" />
|
| 71 |
+
<mesh name="right_hand_middle_0_link" file="right_hand_middle_0_link.STL" />
|
| 72 |
+
<mesh name="right_hand_middle_1_link" file="right_hand_middle_1_link.STL" />
|
| 73 |
+
<mesh name="right_hand_index_0_link" file="right_hand_index_0_link.STL" />
|
| 74 |
+
<mesh name="right_hand_index_1_link" file="right_hand_index_1_link.STL" />
|
| 75 |
+
</asset>
|
| 76 |
+
|
| 77 |
+
<worldbody>
|
| 78 |
+
<body name="pelvis" pos="0 0 0.793">
|
| 79 |
+
<inertial pos="0 0 -0.07605" quat="1 0 -0.000399148 0" mass="3.813"
|
| 80 |
+
diaginertia="0.010549 0.0093089 0.0079184" />
|
| 81 |
+
<joint name="floating_base_joint" type="free" limited="false" actuatorfrclimited="false" />
|
| 82 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.2 0.2 0.2 1"
|
| 83 |
+
mesh="pelvis" />
|
| 84 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 85 |
+
mesh="pelvis_contour_link" />
|
| 86 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="pelvis_contour_link" />
|
| 87 |
+
<body name="left_hip_pitch_link" pos="0 0.064452 -0.1027">
|
| 88 |
+
<inertial pos="0.002741 0.047791 -0.02606" quat="0.954862 0.293964 0.0302556 0.030122"
|
| 89 |
+
mass="1.35" diaginertia="0.00181517 0.00153422 0.00116212" />
|
| 90 |
+
<joint name="left_hip_pitch_joint" pos="0 0 0" axis="0 1 0" range="-2.5307 2.8798"
|
| 91 |
+
actuatorfrcrange="-88 88" class="leg_motor" />
|
| 92 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.2 0.2 0.2 1"
|
| 93 |
+
mesh="left_hip_pitch_link" />
|
| 94 |
+
<geom type="mesh" rgba="0.2 0.2 0.2 1" mesh="left_hip_pitch_link" />
|
| 95 |
+
<body name="left_hip_roll_link" pos="0 0.052 -0.030465" quat="0.996179 0 -0.0873386 0">
|
| 96 |
+
<inertial pos="0.029812 -0.001045 -0.087934"
|
| 97 |
+
quat="0.977808 -1.97119e-05 0.205576 -0.0403793" mass="1.52"
|
| 98 |
+
diaginertia="0.00254986 0.00241169 0.00148755" />
|
| 99 |
+
<joint name="left_hip_roll_joint" pos="0 0 0" axis="1 0 0" range="-0.5236 2.9671"
|
| 100 |
+
actuatorfrcrange="-88 88" class="leg_motor" />
|
| 101 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 102 |
+
mesh="left_hip_roll_link" />
|
| 103 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_hip_roll_link" />
|
| 104 |
+
<body name="left_hip_yaw_link" pos="0.025001 0 -0.12412">
|
| 105 |
+
<inertial pos="-0.057709 -0.010981 -0.15078" quat="0.600598 0.15832 0.223482 0.751181"
|
| 106 |
+
mass="1.702" diaginertia="0.00776166 0.00717575 0.00160139" />
|
| 107 |
+
<joint name="left_hip_yaw_joint" pos="0 0 0" axis="0 0 1" range="-2.7576 2.7576"
|
| 108 |
+
actuatorfrcrange="-88 88" class="leg_motor" />
|
| 109 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 110 |
+
mesh="left_hip_yaw_link" />
|
| 111 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_hip_yaw_link" />
|
| 112 |
+
<body name="left_knee_link" pos="-0.078273 0.0021489 -0.17734"
|
| 113 |
+
quat="0.996179 0 0.0873386 0">
|
| 114 |
+
<inertial pos="0.005457 0.003964 -0.12074"
|
| 115 |
+
quat="0.923418 -0.0327699 0.0158246 0.382067" mass="1.932"
|
| 116 |
+
diaginertia="0.0113804 0.0112778 0.00146458" />
|
| 117 |
+
<joint name="left_knee_joint" pos="0 0 0" axis="0 1 0" range="-0.087267 2.8798"
|
| 118 |
+
actuatorfrcrange="-139 139" class="leg_motor" />
|
| 119 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 120 |
+
rgba="0.7 0.7 0.7 1" mesh="left_knee_link" />
|
| 121 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_knee_link" />
|
| 122 |
+
<body name="left_ankle_pitch_link" pos="0 -9.4445e-05 -0.30001">
|
| 123 |
+
<inertial pos="-0.007269 0 0.011137" quat="0.603053 0.369225 0.369225 0.603053"
|
| 124 |
+
mass="0.074" diaginertia="1.89e-05 1.40805e-05 6.9195e-06" />
|
| 125 |
+
<joint name="left_ankle_pitch_joint" pos="0 0 0" axis="0 1 0"
|
| 126 |
+
range="-0.87267 0.5236" actuatorfrcrange="-50 50" class="ankle_motor" />
|
| 127 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 128 |
+
rgba="0.7 0.7 0.7 1" mesh="left_ankle_pitch_link" />
|
| 129 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_ankle_pitch_link" />
|
| 130 |
+
<body name="left_ankle_roll_link" pos="0 0 -0.017558">
|
| 131 |
+
<inertial pos="0.026505 0 -0.016425"
|
| 132 |
+
quat="-0.000481092 0.728482 -0.000618967 0.685065" mass="0.608"
|
| 133 |
+
diaginertia="0.00167218 0.0016161 0.000217621" />
|
| 134 |
+
<joint name="left_ankle_roll_joint" pos="0 0 0" axis="1 0 0"
|
| 135 |
+
range="-0.2618 0.2618" actuatorfrcrange="-50 50" class="ankle_motor" />
|
| 136 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 137 |
+
rgba="0.2 0.2 0.2 1" mesh="left_ankle_roll_link" />
|
| 138 |
+
<geom size="0.005" pos="-0.05 0.025 -0.03" rgba="0.2 0.2 0.2 1" />
|
| 139 |
+
<geom size="0.005" pos="-0.05 -0.025 -0.03" rgba="0.2 0.2 0.2 1" />
|
| 140 |
+
<geom size="0.005" pos="0.12 0.03 -0.03" rgba="0.2 0.2 0.2 1" />
|
| 141 |
+
<geom size="0.005" pos="0.12 -0.03 -0.03" rgba="0.2 0.2 0.2 1" />
|
| 142 |
+
</body>
|
| 143 |
+
</body>
|
| 144 |
+
</body>
|
| 145 |
+
</body>
|
| 146 |
+
</body>
|
| 147 |
+
</body>
|
| 148 |
+
<body name="right_hip_pitch_link" pos="0 -0.064452 -0.1027">
|
| 149 |
+
<inertial pos="0.002741 -0.047791 -0.02606" quat="0.954862 -0.293964 0.0302556 -0.030122"
|
| 150 |
+
mass="1.35" diaginertia="0.00181517 0.00153422 0.00116212" />
|
| 151 |
+
<joint name="right_hip_pitch_joint" pos="0 0 0" axis="0 1 0" range="-2.5307 2.8798"
|
| 152 |
+
actuatorfrcrange="-88 88" class="leg_motor" />
|
| 153 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.2 0.2 0.2 1"
|
| 154 |
+
mesh="right_hip_pitch_link" />
|
| 155 |
+
<geom type="mesh" rgba="0.2 0.2 0.2 1" mesh="right_hip_pitch_link" />
|
| 156 |
+
<body name="right_hip_roll_link" pos="0 -0.052 -0.030465" quat="0.996179 0 -0.0873386 0">
|
| 157 |
+
<inertial pos="0.029812 0.001045 -0.087934" quat="0.977808 1.97119e-05 0.205576 0.0403793"
|
| 158 |
+
mass="1.52" diaginertia="0.00254986 0.00241169 0.00148755" />
|
| 159 |
+
<joint name="right_hip_roll_joint" pos="0 0 0" axis="1 0 0" range="-2.9671 0.5236"
|
| 160 |
+
actuatorfrcrange="-88 88" class="leg_motor" />
|
| 161 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 162 |
+
mesh="right_hip_roll_link" />
|
| 163 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_hip_roll_link" />
|
| 164 |
+
<body name="right_hip_yaw_link" pos="0.025001 0 -0.12412">
|
| 165 |
+
<inertial pos="-0.057709 0.010981 -0.15078" quat="0.751181 0.223482 0.15832 0.600598"
|
| 166 |
+
mass="1.702" diaginertia="0.00776166 0.00717575 0.00160139" />
|
| 167 |
+
<joint name="right_hip_yaw_joint" pos="0 0 0" axis="0 0 1" range="-2.7576 2.7576"
|
| 168 |
+
actuatorfrcrange="-88 88" class="leg_motor" />
|
| 169 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 170 |
+
mesh="right_hip_yaw_link" />
|
| 171 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_hip_yaw_link" />
|
| 172 |
+
<body name="right_knee_link" pos="-0.078273 -0.0021489 -0.17734"
|
| 173 |
+
quat="0.996179 0 0.0873386 0">
|
| 174 |
+
<inertial pos="0.005457 -0.003964 -0.12074"
|
| 175 |
+
quat="0.923439 0.0345276 0.0116333 -0.382012" mass="1.932"
|
| 176 |
+
diaginertia="0.011374 0.0112843 0.00146452" />
|
| 177 |
+
<joint name="right_knee_joint" pos="0 0 0" axis="0 1 0" range="-0.087267 2.8798"
|
| 178 |
+
actuatorfrcrange="-139 139" class="leg_motor" />
|
| 179 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 180 |
+
rgba="0.7 0.7 0.7 1" mesh="right_knee_link" />
|
| 181 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_knee_link" />
|
| 182 |
+
<body name="right_ankle_pitch_link" pos="0 9.4445e-05 -0.30001">
|
| 183 |
+
<inertial pos="-0.007269 0 0.011137" quat="0.603053 0.369225 0.369225 0.603053"
|
| 184 |
+
mass="0.074" diaginertia="1.89e-05 1.40805e-05 6.9195e-06" />
|
| 185 |
+
<joint name="right_ankle_pitch_joint" pos="0 0 0" axis="0 1 0"
|
| 186 |
+
range="-0.87267 0.5236" actuatorfrcrange="-50 50" class="ankle_motor" />
|
| 187 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 188 |
+
rgba="0.7 0.7 0.7 1" mesh="right_ankle_pitch_link" />
|
| 189 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_ankle_pitch_link" />
|
| 190 |
+
<body name="right_ankle_roll_link" pos="0 0 -0.017558">
|
| 191 |
+
<inertial pos="0.026505 0 -0.016425"
|
| 192 |
+
quat="0.000481092 0.728482 0.000618967 0.685065" mass="0.608"
|
| 193 |
+
diaginertia="0.00167218 0.0016161 0.000217621" />
|
| 194 |
+
<joint name="right_ankle_roll_joint" pos="0 0 0" axis="1 0 0"
|
| 195 |
+
range="-0.2618 0.2618" actuatorfrcrange="-50 50" class="ankle_motor" />
|
| 196 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 197 |
+
rgba="0.2 0.2 0.2 1" mesh="right_ankle_roll_link" />
|
| 198 |
+
<geom size="0.005" pos="-0.05 0.025 -0.03" rgba="0.2 0.2 0.2 1" />
|
| 199 |
+
<geom size="0.005" pos="-0.05 -0.025 -0.03" rgba="0.2 0.2 0.2 1" />
|
| 200 |
+
<geom size="0.005" pos="0.12 0.03 -0.03" rgba="0.2 0.2 0.2 1" />
|
| 201 |
+
<geom size="0.005" pos="0.12 -0.03 -0.03" rgba="0.2 0.2 0.2 1" />
|
| 202 |
+
</body>
|
| 203 |
+
</body>
|
| 204 |
+
</body>
|
| 205 |
+
</body>
|
| 206 |
+
</body>
|
| 207 |
+
</body>
|
| 208 |
+
<body name="waist_yaw_link">
|
| 209 |
+
<inertial pos="0.003964 0 0.018769" quat="-0.0178291 0.628464 0.0282471 0.777121"
|
| 210 |
+
mass="0.244" diaginertia="0.000158561 0.000124229 9.67669e-05" />
|
| 211 |
+
<joint name="waist_yaw_joint" pos="0 0 0" axis="0 0 1" range="-2.618 2.618"
|
| 212 |
+
actuatorfrcrange="-88 88" class="torso_motor" />
|
| 213 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 214 |
+
mesh="waist_yaw_link" />
|
| 215 |
+
<body name="waist_roll_link" pos="-0.0039635 0 0.035">
|
| 216 |
+
<inertial pos="0 -0.000236 0.010111" quat="0.99979 0.020492 0 0" mass="0.047"
|
| 217 |
+
diaginertia="7.515e-06 6.40206e-06 3.98394e-06" />
|
| 218 |
+
<joint name="waist_roll_joint" pos="0 0 0" axis="1 0 0" range="-0.52 0.52"
|
| 219 |
+
actuatorfrcrange="-50 50" class="torso_motor"/>
|
| 220 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 221 |
+
mesh="waist_roll_link" />
|
| 222 |
+
<body name="torso_link" pos="0 0 0.019">
|
| 223 |
+
<inertial pos="0.00331658 0.000261533 0.179856"
|
| 224 |
+
quat="0.999831 0.000376204 0.0179895 -0.00377704" mass="9.598"
|
| 225 |
+
diaginertia="0.12407 0.111951 0.0325382" />
|
| 226 |
+
<joint name="waist_pitch_joint" pos="0 0 0" axis="0 1 0" range="-0.52 0.52"
|
| 227 |
+
actuatorfrcrange="-50 50" class="torso_motor"/>
|
| 228 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 229 |
+
mesh="torso_link" />
|
| 230 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="torso_link" />
|
| 231 |
+
<geom pos="0.0039635 0 -0.054" quat="1 0 0 0" type="mesh" contype="0" conaffinity="0"
|
| 232 |
+
group="1" density="0" rgba="0.2 0.2 0.2 1" mesh="logo_link" />
|
| 233 |
+
<geom pos="0.0039635 0 -0.054" quat="1 0 0 0" type="mesh" rgba="0.2 0.2 0.2 1"
|
| 234 |
+
mesh="logo_link" />
|
| 235 |
+
<geom pos="0.0039635 0 -0.054" type="mesh" contype="0" conaffinity="0" group="1"
|
| 236 |
+
density="0" rgba="0.2 0.2 0.2 1" mesh="head_link" />
|
| 237 |
+
<geom pos="0.0039635 0 -0.054" type="mesh" rgba="0.2 0.2 0.2 1" mesh="head_link" />
|
| 238 |
+
<geom pos="0.0039635 0 -0.054" quat="1 0 0 0" type="mesh" contype="0" conaffinity="0"
|
| 239 |
+
group="1" density="0" rgba="0.7 0.7 0.7 1" mesh="waist_support_link" />
|
| 240 |
+
<geom pos="0.0039635 0 -0.054" quat="1 0 0 0" type="mesh" rgba="0.7 0.7 0.7 1"
|
| 241 |
+
mesh="waist_support_link" />
|
| 242 |
+
<site name="imu" size="0.01" pos="-0.03959 -0.00224 0.13792" />
|
| 243 |
+
<body name="left_shoulder_pitch_link" pos="0.0039563 0.10022 0.23778"
|
| 244 |
+
quat="0.990264 0.139201 1.38722e-05 -9.86868e-05">
|
| 245 |
+
<inertial pos="0 0.035892 -0.011628" quat="0.654152 0.0130458 -0.326267 0.68225"
|
| 246 |
+
mass="0.718" diaginertia="0.000465864 0.000432842 0.000406394" />
|
| 247 |
+
<joint name="left_shoulder_pitch_joint" pos="0 0 0" axis="0 1 0"
|
| 248 |
+
range="-3.0892 2.6704" actuatorfrcrange="-25 25" class="arm_motor" />
|
| 249 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 250 |
+
rgba="0.7 0.7 0.7 1" mesh="left_shoulder_pitch_link" />
|
| 251 |
+
<geom size="0.03 0.025" pos="0 0.04 -0.01" quat="0.707107 0 0.707107 0"
|
| 252 |
+
type="cylinder" rgba="0.7 0.7 0.7 1" />
|
| 253 |
+
<body name="left_shoulder_roll_link" pos="0 0.038 -0.013831"
|
| 254 |
+
quat="0.990268 -0.139172 0 0">
|
| 255 |
+
<inertial pos="-0.000227 0.00727 -0.063243"
|
| 256 |
+
quat="0.701256 -0.0196223 -0.00710317 0.712604" mass="0.643"
|
| 257 |
+
diaginertia="0.000691311 0.000618011 0.000388977" />
|
| 258 |
+
<joint name="left_shoulder_roll_joint" pos="0 0 0" axis="1 0 0"
|
| 259 |
+
range="-1.5882 2.2515" actuatorfrcrange="-25 25" class="arm_motor" />
|
| 260 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 261 |
+
rgba="0.7 0.7 0.7 1" mesh="left_shoulder_roll_link" />
|
| 262 |
+
<geom size="0.03 0.015" pos="-0.004 0.006 -0.053" type="cylinder"
|
| 263 |
+
rgba="0.7 0.7 0.7 1" />
|
| 264 |
+
<body name="left_shoulder_yaw_link" pos="0 0.00624 -0.1032">
|
| 265 |
+
<inertial pos="0.010773 -0.002949 -0.072009"
|
| 266 |
+
quat="0.716879 -0.0964829 -0.0679942 0.687134" mass="0.734"
|
| 267 |
+
diaginertia="0.00106187 0.00103217 0.000400661" />
|
| 268 |
+
<joint name="left_shoulder_yaw_joint" pos="0 0 0" axis="0 0 1"
|
| 269 |
+
range="-2.618 2.618" actuatorfrcrange="-25 25" class="arm_motor" />
|
| 270 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 271 |
+
rgba="0.7 0.7 0.7 1" mesh="left_shoulder_yaw_link" />
|
| 272 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_shoulder_yaw_link" />
|
| 273 |
+
<body name="left_elbow_link" pos="0.015783 0 -0.080518">
|
| 274 |
+
<inertial pos="0.064956 0.004454 -0.010062"
|
| 275 |
+
quat="0.541765 0.636132 0.388821 0.388129" mass="0.6"
|
| 276 |
+
diaginertia="0.000443035 0.000421612 0.000259353" />
|
| 277 |
+
<joint name="left_elbow_joint" pos="0 0 0" axis="0 1 0" range="-1.0472 2.0944"
|
| 278 |
+
actuatorfrcrange="-25 25" class="arm_motor" />
|
| 279 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 280 |
+
rgba="0.7 0.7 0.7 1" mesh="left_elbow_link" />
|
| 281 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_elbow_link" />
|
| 282 |
+
<body name="left_wrist_roll_link" pos="0.1 0.00188791 -0.01">
|
| 283 |
+
<inertial pos="0.0171394 0.000537591 4.8864e-07"
|
| 284 |
+
quat="0.575338 0.411667 -0.574906 0.411094" mass="0.085445"
|
| 285 |
+
diaginertia="5.48211e-05 4.96646e-05 3.57798e-05" />
|
| 286 |
+
<joint name="left_wrist_roll_joint" pos="0 0 0" axis="1 0 0"
|
| 287 |
+
range="-1.97222 1.97222" actuatorfrcrange="-25 25" class="arm_motor" />
|
| 288 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 289 |
+
rgba="0.7 0.7 0.7 1" mesh="left_wrist_roll_link" />
|
| 290 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_wrist_roll_link" />
|
| 291 |
+
<body name="left_wrist_pitch_link" pos="0.038 0 0">
|
| 292 |
+
<inertial pos="0.0229999 -0.00111685 -0.00111658"
|
| 293 |
+
quat="0.249998 0.661363 0.293036 0.643608" mass="0.48405"
|
| 294 |
+
diaginertia="0.000430353 0.000429873 0.000164648" />
|
| 295 |
+
<joint name="left_wrist_pitch_joint" pos="0 0 0" axis="0 1 0"
|
| 296 |
+
range="-1.61443 1.61443" actuatorfrcrange="-5 5" class="wrist_motor" />
|
| 297 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 298 |
+
rgba="0.7 0.7 0.7 1" mesh="left_wrist_pitch_link" />
|
| 299 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_wrist_pitch_link" />
|
| 300 |
+
<body name="left_wrist_yaw_link" pos="0.046 0 0">
|
| 301 |
+
<inertial pos="0.0885506 0.00212216 -0.000374562"
|
| 302 |
+
quat="0.487149 0.493844 0.513241 0.505358" mass="0.457415"
|
| 303 |
+
diaginertia="0.00105989 0.000895419 0.000323842" />
|
| 304 |
+
<joint name="left_wrist_yaw_joint" pos="0 0 0" axis="0 0 1"
|
| 305 |
+
range="-1.61443 1.61443" actuatorfrcrange="-5 5" class="wrist_motor" />
|
| 306 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 307 |
+
rgba="0.7 0.7 0.7 1" mesh="left_wrist_yaw_link" />
|
| 308 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_wrist_yaw_link" />
|
| 309 |
+
<geom pos="0.0415 0.003 0" quat="1 0 0 0" type="mesh" contype="0"
|
| 310 |
+
conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 311 |
+
mesh="left_hand_palm_link" />
|
| 312 |
+
<geom pos="0.0415 0.003 0" quat="1 0 0 0" type="mesh" rgba="0.7 0.7 0.7 1"
|
| 313 |
+
mesh="left_hand_palm_link" />
|
| 314 |
+
<body name="left_hand_thumb_0_link" pos="0.067 0.003 0">
|
| 315 |
+
<inertial pos="-0.000884246 -0.00863407 0.000944293"
|
| 316 |
+
quat="0.462991 0.643965 -0.460173 0.398986" mass="0.0862366"
|
| 317 |
+
diaginertia="1.6546e-05 1.60058e-05 1.43741e-05" />
|
| 318 |
+
<joint name="left_hand_thumb_0_joint" pos="0 0 0" axis="0 1 0"
|
| 319 |
+
range="-1.0472 1.0472" actuatorfrcrange="-2.45 2.45"
|
| 320 |
+
class="finger_motor" />
|
| 321 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 322 |
+
rgba="0.7 0.7 0.7 1" mesh="left_hand_thumb_0_link" />
|
| 323 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_hand_thumb_0_link" />
|
| 324 |
+
<body name="left_hand_thumb_1_link" pos="-0.0025 -0.0193 0">
|
| 325 |
+
<inertial pos="-0.000827888 -0.0354744 -0.0003809"
|
| 326 |
+
quat="0.685598 0.705471 -0.15207 0.0956069" mass="0.0588507"
|
| 327 |
+
diaginertia="1.28514e-05 1.22902e-05 5.9666e-06" />
|
| 328 |
+
<joint name="left_hand_thumb_1_joint" pos="0 0 0" axis="0 0 1"
|
| 329 |
+
range="-0.724312 1.0472" actuatorfrcrange="-1.4 1.4"
|
| 330 |
+
class="finger_motor" />
|
| 331 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 332 |
+
rgba="0.7 0.7 0.7 1" mesh="left_hand_thumb_1_link" />
|
| 333 |
+
<geom size="0.01 0.015 0.01" pos="-0.001 -0.032 0" type="box"
|
| 334 |
+
rgba="0.7 0.7 0.7 1" />
|
| 335 |
+
<body name="left_hand_thumb_2_link" pos="0 -0.0458 0">
|
| 336 |
+
<inertial pos="-0.00171735 -0.0262819 0.000107789"
|
| 337 |
+
quat="0.703174 0.710977 -0.00017564 -0.00766553" mass="0.0203063"
|
| 338 |
+
diaginertia="4.61314e-06 3.86645e-06 1.53495e-06" />
|
| 339 |
+
<joint name="left_hand_thumb_2_joint" pos="0 0 0" axis="0 0 1"
|
| 340 |
+
range="0 1.74533" actuatorfrcrange="-1.4 1.4" class="finger_motor" />
|
| 341 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 342 |
+
rgba="0.7 0.7 0.7 1" mesh="left_hand_thumb_2_link" />
|
| 343 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_hand_thumb_2_link" />
|
| 344 |
+
</body>
|
| 345 |
+
</body>
|
| 346 |
+
</body>
|
| 347 |
+
<body name="left_hand_middle_0_link" pos="0.1192 0.0046 -0.0285">
|
| 348 |
+
<inertial pos="0.0354744 0.000827888 0.0003809"
|
| 349 |
+
quat="0.391313 0.552395 0.417187 0.606373" mass="0.0588507"
|
| 350 |
+
diaginertia="1.28514e-05 1.22902e-05 5.9666e-06" />
|
| 351 |
+
<joint name="left_hand_middle_0_joint" pos="0 0 0" axis="0 0 1"
|
| 352 |
+
range="-1.5708 0" actuatorfrcrange="-1.4 1.4" class="finger_motor" />
|
| 353 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 354 |
+
rgba="0.7 0.7 0.7 1" mesh="left_hand_middle_0_link" />
|
| 355 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_hand_middle_0_link" />
|
| 356 |
+
<body name="left_hand_middle_1_link" pos="0.0458 0 0">
|
| 357 |
+
<inertial pos="0.0262819 0.00171735 -0.000107789"
|
| 358 |
+
quat="0.502612 0.491799 0.502639 0.502861" mass="0.0203063"
|
| 359 |
+
diaginertia="4.61314e-06 3.86645e-06 1.53495e-06" />
|
| 360 |
+
<joint name="left_hand_middle_1_joint" pos="0 0 0" axis="0 0 1"
|
| 361 |
+
range="-1.74533 0" actuatorfrcrange="-1.4 1.4" class="finger_motor" />
|
| 362 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 363 |
+
rgba="0.7 0.7 0.7 1" mesh="left_hand_middle_1_link" />
|
| 364 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_hand_middle_1_link" />
|
| 365 |
+
</body>
|
| 366 |
+
</body>
|
| 367 |
+
<body name="left_hand_index_0_link" pos="0.1192 0.0046 0.0285">
|
| 368 |
+
<inertial pos="0.0354744 0.000827888 0.0003809"
|
| 369 |
+
quat="0.391313 0.552395 0.417187 0.606373" mass="0.0588507"
|
| 370 |
+
diaginertia="1.28514e-05 1.22902e-05 5.9666e-06" />
|
| 371 |
+
<joint name="left_hand_index_0_joint" pos="0 0 0" axis="0 0 1"
|
| 372 |
+
range="-1.5708 0" actuatorfrcrange="-1.4 1.4" class="finger_motor" />
|
| 373 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 374 |
+
rgba="0.7 0.7 0.7 1" mesh="left_hand_index_0_link" />
|
| 375 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_hand_index_0_link" />
|
| 376 |
+
<body name="left_hand_index_1_link" pos="0.0458 0 0">
|
| 377 |
+
<inertial pos="0.0262819 0.00171735 -0.000107789"
|
| 378 |
+
quat="0.502612 0.491799 0.502639 0.502861" mass="0.0203063"
|
| 379 |
+
diaginertia="4.61314e-06 3.86645e-06 1.53495e-06" />
|
| 380 |
+
<joint name="left_hand_index_1_joint" pos="0 0 0" axis="0 0 1"
|
| 381 |
+
range="-1.74533 0" actuatorfrcrange="-1.4 1.4" class="finger_motor" />
|
| 382 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 383 |
+
rgba="0.7 0.7 0.7 1" mesh="left_hand_index_1_link" />
|
| 384 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_hand_index_1_link" />
|
| 385 |
+
</body>
|
| 386 |
+
</body>
|
| 387 |
+
</body>
|
| 388 |
+
</body>
|
| 389 |
+
</body>
|
| 390 |
+
</body>
|
| 391 |
+
</body>
|
| 392 |
+
</body>
|
| 393 |
+
</body>
|
| 394 |
+
<body name="right_shoulder_pitch_link" pos="0.0039563 -0.10021 0.23778"
|
| 395 |
+
quat="0.990264 -0.139201 1.38722e-05 9.86868e-05">
|
| 396 |
+
<inertial pos="0 -0.035892 -0.011628" quat="0.68225 -0.326267 0.0130458 0.654152"
|
| 397 |
+
mass="0.718" diaginertia="0.000465864 0.000432842 0.000406394" />
|
| 398 |
+
<joint name="right_shoulder_pitch_joint" pos="0 0 0" axis="0 1 0"
|
| 399 |
+
range="-3.0892 2.6704" actuatorfrcrange="-25 25" class="arm_motor" />
|
| 400 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 401 |
+
rgba="0.7 0.7 0.7 1" mesh="right_shoulder_pitch_link" />
|
| 402 |
+
<geom size="0.03 0.025" pos="0 -0.04 -0.01" quat="0.707107 0 0.707107 0"
|
| 403 |
+
type="cylinder" rgba="0.7 0.7 0.7 1" />
|
| 404 |
+
<body name="right_shoulder_roll_link" pos="0 -0.038 -0.013831"
|
| 405 |
+
quat="0.990268 0.139172 0 0">
|
| 406 |
+
<inertial pos="-0.000227 -0.00727 -0.063243"
|
| 407 |
+
quat="0.712604 -0.00710317 -0.0196223 0.701256" mass="0.643"
|
| 408 |
+
diaginertia="0.000691311 0.000618011 0.000388977" />
|
| 409 |
+
<joint name="right_shoulder_roll_joint" pos="0 0 0" axis="1 0 0"
|
| 410 |
+
range="-2.2515 1.5882" actuatorfrcrange="-25 25" class="arm_motor" />
|
| 411 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 412 |
+
rgba="0.7 0.7 0.7 1" mesh="right_shoulder_roll_link" />
|
| 413 |
+
<geom size="0.03 0.015" pos="-0.004 -0.006 -0.053" type="cylinder"
|
| 414 |
+
rgba="0.7 0.7 0.7 1" />
|
| 415 |
+
<body name="right_shoulder_yaw_link" pos="0 -0.00624 -0.1032">
|
| 416 |
+
<inertial pos="0.010773 0.002949 -0.072009"
|
| 417 |
+
quat="0.687134 -0.0679942 -0.0964829 0.716879" mass="0.734"
|
| 418 |
+
diaginertia="0.00106187 0.00103217 0.000400661" />
|
| 419 |
+
<joint name="right_shoulder_yaw_joint" pos="0 0 0" axis="0 0 1"
|
| 420 |
+
range="-2.618 2.618" actuatorfrcrange="-25 25" class="arm_motor" />
|
| 421 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 422 |
+
rgba="0.7 0.7 0.7 1" mesh="right_shoulder_yaw_link" />
|
| 423 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_shoulder_yaw_link" />
|
| 424 |
+
<body name="right_elbow_link" pos="0.015783 0 -0.080518">
|
| 425 |
+
<inertial pos="0.064956 -0.004454 -0.010062"
|
| 426 |
+
quat="0.388129 0.388821 0.636132 0.541765" mass="0.6"
|
| 427 |
+
diaginertia="0.000443035 0.000421612 0.000259353" />
|
| 428 |
+
<joint name="right_elbow_joint" pos="0 0 0" axis="0 1 0" range="-1.0472 2.0944"
|
| 429 |
+
actuatorfrcrange="-25 25" class="arm_motor" />
|
| 430 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 431 |
+
rgba="0.7 0.7 0.7 1" mesh="right_elbow_link" />
|
| 432 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_elbow_link" />
|
| 433 |
+
<body name="right_wrist_roll_link" pos="0.1 -0.00188791 -0.01">
|
| 434 |
+
<inertial pos="0.0171394 -0.000537591 4.8864e-07"
|
| 435 |
+
quat="0.411667 0.575338 -0.411094 0.574906" mass="0.085445"
|
| 436 |
+
diaginertia="5.48211e-05 4.96646e-05 3.57798e-05" />
|
| 437 |
+
<joint name="right_wrist_roll_joint" pos="0 0 0" axis="1 0 0"
|
| 438 |
+
range="-1.97222 1.97222" actuatorfrcrange="-25 25" class="arm_motor" />
|
| 439 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 440 |
+
rgba="0.7 0.7 0.7 1" mesh="right_wrist_roll_link" />
|
| 441 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_wrist_roll_link" />
|
| 442 |
+
<body name="right_wrist_pitch_link" pos="0.038 0 0">
|
| 443 |
+
<inertial pos="0.0229999 0.00111685 -0.00111658"
|
| 444 |
+
quat="0.643608 0.293036 0.661363 0.249998" mass="0.48405"
|
| 445 |
+
diaginertia="0.000430353 0.000429873 0.000164648" />
|
| 446 |
+
<joint name="right_wrist_pitch_joint" pos="0 0 0" axis="0 1 0"
|
| 447 |
+
range="-1.61443 1.61443" actuatorfrcrange="-5 5" class="wrist_motor" />
|
| 448 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 449 |
+
rgba="0.7 0.7 0.7 1" mesh="right_wrist_pitch_link" />
|
| 450 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_wrist_pitch_link" />
|
| 451 |
+
<body name="right_wrist_yaw_link" pos="0.046 0 0">
|
| 452 |
+
<inertial pos="0.0885506 -0.00212216 0.000573742"
|
| 453 |
+
quat="0.507224 0.511377 0.494292 0.486717" mass="0.457415"
|
| 454 |
+
diaginertia="0.0010598 0.000895373 0.0003238" />
|
| 455 |
+
<joint name="right_wrist_yaw_joint" pos="0 0 0" axis="0 0 1"
|
| 456 |
+
range="-1.61443 1.61443" actuatorfrcrange="-5 5" class="wrist_motor" />
|
| 457 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 458 |
+
rgba="0.7 0.7 0.7 1" mesh="right_wrist_yaw_link" />
|
| 459 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_wrist_yaw_link" />
|
| 460 |
+
<geom pos="0.0415 -0.003 0" quat="1 0 0 0" type="mesh" contype="0"
|
| 461 |
+
conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 462 |
+
mesh="right_hand_palm_link" />
|
| 463 |
+
<geom pos="0.0415 -0.003 0" quat="1 0 0 0" type="mesh"
|
| 464 |
+
rgba="0.7 0.7 0.7 1" mesh="right_hand_palm_link" />
|
| 465 |
+
<body name="right_hand_thumb_0_link" pos="0.067 -0.003 0">
|
| 466 |
+
<inertial pos="-0.000884246 0.00863407 0.000944293"
|
| 467 |
+
quat="0.643965 0.462991 -0.398986 0.460173" mass="0.0862366"
|
| 468 |
+
diaginertia="1.6546e-05 1.60058e-05 1.43741e-05" />
|
| 469 |
+
<joint name="right_hand_thumb_0_joint" pos="0 0 0" axis="0 1 0"
|
| 470 |
+
range="-1.0472 1.0472" actuatorfrcrange="-2.45 2.45"
|
| 471 |
+
class="finger_motor" />
|
| 472 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 473 |
+
rgba="0.7 0.7 0.7 1" mesh="right_hand_thumb_0_link" />
|
| 474 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_hand_thumb_0_link" />
|
| 475 |
+
<body name="right_hand_thumb_1_link" pos="-0.0025 0.0193 0">
|
| 476 |
+
<inertial pos="-0.000827888 0.0354744 -0.0003809"
|
| 477 |
+
quat="0.705471 0.685598 -0.0956069 0.15207" mass="0.0588507"
|
| 478 |
+
diaginertia="1.28514e-05 1.22902e-05 5.9666e-06" />
|
| 479 |
+
<joint name="right_hand_thumb_1_joint" pos="0 0 0" axis="0 0 1"
|
| 480 |
+
range="-1.0472 0.724312" actuatorfrcrange="-1.4 1.4"
|
| 481 |
+
class="finger_motor" />
|
| 482 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 483 |
+
rgba="0.7 0.7 0.7 1" mesh="right_hand_thumb_1_link" />
|
| 484 |
+
<geom size="0.01 0.015 0.01" pos="-0.001 0.032 0" type="box"
|
| 485 |
+
rgba="0.7 0.7 0.7 1" />
|
| 486 |
+
<body name="right_hand_thumb_2_link" pos="0 0.0458 0">
|
| 487 |
+
<inertial pos="-0.00171735 0.0262819 0.000107789"
|
| 488 |
+
quat="0.710977 0.703174 0.00766553 0.00017564" mass="0.0203063"
|
| 489 |
+
diaginertia="4.61314e-06 3.86645e-06 1.53495e-06" />
|
| 490 |
+
<joint name="right_hand_thumb_2_joint" pos="0 0 0" axis="0 0 1"
|
| 491 |
+
range="-1.74533 0" actuatorfrcrange="-1.4 1.4"
|
| 492 |
+
class="finger_motor" />
|
| 493 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 494 |
+
rgba="0.7 0.7 0.7 1" mesh="right_hand_thumb_2_link" />
|
| 495 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1"
|
| 496 |
+
mesh="right_hand_thumb_2_link" />
|
| 497 |
+
</body>
|
| 498 |
+
</body>
|
| 499 |
+
</body>
|
| 500 |
+
<body name="right_hand_middle_0_link" pos="0.1192 -0.0046 -0.0285">
|
| 501 |
+
<inertial pos="0.0354744 -0.000827888 0.0003809"
|
| 502 |
+
quat="0.606373 0.417187 0.552395 0.391313" mass="0.0588507"
|
| 503 |
+
diaginertia="1.28514e-05 1.22902e-05 5.9666e-06" />
|
| 504 |
+
<joint name="right_hand_middle_0_joint" pos="0 0 0" axis="0 0 1"
|
| 505 |
+
range="0 1.5708" actuatorfrcrange="-1.4 1.4" class="finger_motor" />
|
| 506 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 507 |
+
rgba="0.7 0.7 0.7 1" mesh="right_hand_middle_0_link" />
|
| 508 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_hand_middle_0_link" />
|
| 509 |
+
<body name="right_hand_middle_1_link" pos="0.0458 0 0">
|
| 510 |
+
<inertial pos="0.0262819 -0.00171735 -0.000107789"
|
| 511 |
+
quat="0.502861 0.502639 0.491799 0.502612" mass="0.0203063"
|
| 512 |
+
diaginertia="4.61314e-06 3.86645e-06 1.53495e-06" />
|
| 513 |
+
<joint name="right_hand_middle_1_joint" pos="0 0 0" axis="0 0 1"
|
| 514 |
+
range="0 1.74533" actuatorfrcrange="-1.4 1.4" class="finger_motor" />
|
| 515 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 516 |
+
rgba="0.7 0.7 0.7 1" mesh="right_hand_middle_1_link" />
|
| 517 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_hand_middle_1_link" />
|
| 518 |
+
</body>
|
| 519 |
+
</body>
|
| 520 |
+
<body name="right_hand_index_0_link" pos="0.1192 -0.0046 0.0285">
|
| 521 |
+
<inertial pos="0.0354744 -0.000827888 0.0003809"
|
| 522 |
+
quat="0.606373 0.417187 0.552395 0.391313" mass="0.0588507"
|
| 523 |
+
diaginertia="1.28514e-05 1.22902e-05 5.9666e-06" />
|
| 524 |
+
<joint name="right_hand_index_0_joint" pos="0 0 0" axis="0 0 1"
|
| 525 |
+
range="0 1.5708" actuatorfrcrange="-1.4 1.4" class="finger_motor" />
|
| 526 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 527 |
+
rgba="0.7 0.7 0.7 1" mesh="right_hand_index_0_link" />
|
| 528 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_hand_index_0_link" />
|
| 529 |
+
<body name="right_hand_index_1_link" pos="0.0458 0 0">
|
| 530 |
+
<inertial pos="0.0262819 -0.00171735 -0.000107789"
|
| 531 |
+
quat="0.502861 0.502639 0.491799 0.502612" mass="0.0203063"
|
| 532 |
+
diaginertia="4.61314e-06 3.86645e-06 1.53495e-06" />
|
| 533 |
+
<joint name="right_hand_index_1_joint" pos="0 0 0" axis="0 0 1"
|
| 534 |
+
range="0 1.74533" actuatorfrcrange="-1.4 1.4" class="finger_motor" />
|
| 535 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 536 |
+
rgba="0.7 0.7 0.7 1" mesh="right_hand_index_1_link" />
|
| 537 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_hand_index_1_link" />
|
| 538 |
+
</body>
|
| 539 |
+
</body>
|
| 540 |
+
</body>
|
| 541 |
+
</body>
|
| 542 |
+
</body>
|
| 543 |
+
</body>
|
| 544 |
+
</body>
|
| 545 |
+
</body>
|
| 546 |
+
</body>
|
| 547 |
+
</body>
|
| 548 |
+
</body>
|
| 549 |
+
</body>
|
| 550 |
+
</body>
|
| 551 |
+
</worldbody>
|
| 552 |
+
|
| 553 |
+
<actuator>
|
| 554 |
+
<motor name="left_hip_pitch" joint="left_hip_pitch_joint" ctrlrange="-88 88" />
|
| 555 |
+
<motor name="left_hip_roll" joint="left_hip_roll_joint" ctrlrange="-88 88" />
|
| 556 |
+
<motor name="left_hip_yaw" joint="left_hip_yaw_joint" ctrlrange="-88 88" />
|
| 557 |
+
<motor name="left_knee" joint="left_knee_joint" ctrlrange="-139 139" />
|
| 558 |
+
<motor name="left_ankle_pitch" joint="left_ankle_pitch_joint" ctrlrange="-50 50" />
|
| 559 |
+
<motor name="left_ankle_roll" joint="left_ankle_roll_joint" ctrlrange="-50 50" />
|
| 560 |
+
|
| 561 |
+
<motor name="right_hip_pitch" joint="right_hip_pitch_joint" ctrlrange="-88 88" />
|
| 562 |
+
<motor name="right_hip_roll" joint="right_hip_roll_joint" ctrlrange="-88 88" />
|
| 563 |
+
<motor name="right_hip_yaw" joint="right_hip_yaw_joint" ctrlrange="-88 88" />
|
| 564 |
+
<motor name="right_knee" joint="right_knee_joint" ctrlrange="-139 139" />
|
| 565 |
+
<motor name="right_ankle_pitch" joint="right_ankle_pitch_joint" ctrlrange="-50 50" />
|
| 566 |
+
<motor name="right_ankle_roll" joint="right_ankle_roll_joint" ctrlrange="-50 50" />
|
| 567 |
+
|
| 568 |
+
<motor name="waist_yaw" joint="waist_yaw_joint" ctrlrange="-88 88" />
|
| 569 |
+
<motor name="waist_roll" joint="waist_roll_joint" ctrlrange="-50 50" />
|
| 570 |
+
<motor name="waist_pitch" joint="waist_pitch_joint" ctrlrange="-50 50" />
|
| 571 |
+
|
| 572 |
+
<motor name="left_shoulder_pitch" joint="left_shoulder_pitch_joint" ctrlrange="-25 25" />
|
| 573 |
+
<motor name="left_shoulder_roll" joint="left_shoulder_roll_joint" ctrlrange="-25 25" />
|
| 574 |
+
<motor name="left_shoulder_yaw" joint="left_shoulder_yaw_joint" ctrlrange="-25 25" />
|
| 575 |
+
<motor name="left_elbow" joint="left_elbow_joint" ctrlrange="-25 25" />
|
| 576 |
+
<motor name="left_wrist_roll" joint="left_wrist_roll_joint" ctrlrange="-25 25" />
|
| 577 |
+
<motor name="left_wrist_pitch" joint="left_wrist_pitch_joint" ctrlrange="-5 5" />
|
| 578 |
+
<motor name="left_wrist_yaw" joint="left_wrist_yaw_joint" ctrlrange="-5 5" />
|
| 579 |
+
|
| 580 |
+
<motor name="left_hand_thumb_0" joint="left_hand_thumb_0_joint" ctrlrange="-2.45 2.45" />
|
| 581 |
+
<motor name="left_hand_thumb_1" joint="left_hand_thumb_1_joint" ctrlrange="-1.4 1.4" />
|
| 582 |
+
<motor name="left_hand_thumb_2" joint="left_hand_thumb_2_joint" ctrlrange="-1.4 1.4" />
|
| 583 |
+
<motor name="left_hand_middle_0" joint="left_hand_middle_0_joint" ctrlrange="-1.4 1.4" />
|
| 584 |
+
<motor name="left_hand_middle_1" joint="left_hand_middle_1_joint" ctrlrange="-1.4 1.4" />
|
| 585 |
+
<motor name="left_hand_index_0" joint="left_hand_index_0_joint" ctrlrange="-1.4 1.4" />
|
| 586 |
+
<motor name="left_hand_index_1" joint="left_hand_index_1_joint" ctrlrange="-1.4 1.4" />
|
| 587 |
+
|
| 588 |
+
<motor name="right_shoulder_pitch" joint="right_shoulder_pitch_joint" ctrlrange="-25 25" />
|
| 589 |
+
<motor name="right_shoulder_roll" joint="right_shoulder_roll_joint" ctrlrange="-25 25" />
|
| 590 |
+
<motor name="right_shoulder_yaw" joint="right_shoulder_yaw_joint" ctrlrange="-25 25" />
|
| 591 |
+
<motor name="right_elbow" joint="right_elbow_joint" ctrlrange="-25 25" />
|
| 592 |
+
<motor name="right_wrist_roll" joint="right_wrist_roll_joint" ctrlrange="-25 25" />
|
| 593 |
+
<motor name="right_wrist_pitch" joint="right_wrist_pitch_joint" ctrlrange="-5 5" />
|
| 594 |
+
<motor name="right_wrist_yaw" joint="right_wrist_yaw_joint" ctrlrange="-5 5" />
|
| 595 |
+
|
| 596 |
+
<motor name="right_hand_thumb_0" joint="right_hand_thumb_0_joint" ctrlrange="-2.45 2.45" />
|
| 597 |
+
<motor name="right_hand_thumb_1" joint="right_hand_thumb_1_joint" ctrlrange="-1.4 1.4" />
|
| 598 |
+
<motor name="right_hand_thumb_2" joint="right_hand_thumb_2_joint" ctrlrange="-1.4 1.4" />
|
| 599 |
+
<motor name="right_hand_middle_0" joint="right_hand_middle_0_joint" ctrlrange="-1.4 1.4" />
|
| 600 |
+
<motor name="right_hand_middle_1" joint="right_hand_middle_1_joint" ctrlrange="-1.4 1.4" />
|
| 601 |
+
<motor name="right_hand_index_0" joint="right_hand_index_0_joint" ctrlrange="-1.4 1.4" />
|
| 602 |
+
<motor name="right_hand_index_1" joint="right_hand_index_1_joint" ctrlrange="-1.4 1.4" />
|
| 603 |
+
</actuator>
|
| 604 |
+
|
| 605 |
+
<sensor>
|
| 606 |
+
<jointpos name="left_hip_pitch_pos" joint="left_hip_pitch_joint" />
|
| 607 |
+
<jointpos name="left_hip_roll_pos" joint="left_hip_roll_joint" />
|
| 608 |
+
<jointpos name="left_hip_yaw_pos" joint="left_hip_yaw_joint" />
|
| 609 |
+
<jointpos name="left_knee_pos" joint="left_knee_joint" />
|
| 610 |
+
<jointpos name="left_ankle_pitch_pos" joint="left_ankle_pitch_joint" />
|
| 611 |
+
<jointpos name="left_ankle_roll_pos" joint="left_ankle_roll_joint" />
|
| 612 |
+
<jointpos name="right_hip_pitch_pos" joint="right_hip_pitch_joint" />
|
| 613 |
+
<jointpos name="right_hip_roll_pos" joint="right_hip_roll_joint" />
|
| 614 |
+
<jointpos name="right_hip_yaw_pos" joint="right_hip_yaw_joint" />
|
| 615 |
+
<jointpos name="right_knee_pos" joint="right_knee_joint" />
|
| 616 |
+
<jointpos name="right_ankle_pitch_pos" joint="right_ankle_pitch_joint" />
|
| 617 |
+
<jointpos name="right_ankle_roll_pos" joint="right_ankle_roll_joint" />
|
| 618 |
+
<jointpos name="waist_yaw_pos" joint="waist_yaw_joint" />
|
| 619 |
+
<jointpos name="waist_roll_pos" joint="waist_roll_joint" />
|
| 620 |
+
<jointpos name="waist_pitch_pos" joint="waist_pitch_joint" />
|
| 621 |
+
<jointpos name="left_shoulder_pitch_pos" joint="left_shoulder_pitch_joint" />
|
| 622 |
+
<jointpos name="left_shoulder_roll_pos" joint="left_shoulder_roll_joint" />
|
| 623 |
+
<jointpos name="left_shoulder_yaw_pos" joint="left_shoulder_yaw_joint" />
|
| 624 |
+
<jointpos name="left_elbow_pos" joint="left_elbow_joint" />
|
| 625 |
+
<jointpos name="left_wrist_roll_pos" joint="left_wrist_roll_joint" />
|
| 626 |
+
<jointpos name="left_wrist_pitch_pos" joint="left_wrist_pitch_joint" />
|
| 627 |
+
<jointpos name="left_wrist_yaw_pos" joint="left_wrist_yaw_joint" />
|
| 628 |
+
<jointpos name="right_shoulder_pitch_pos" joint="right_shoulder_pitch_joint" />
|
| 629 |
+
<jointpos name="right_shoulder_roll_pos" joint="right_shoulder_roll_joint" />
|
| 630 |
+
<jointpos name="right_shoulder_yaw_pos" joint="right_shoulder_yaw_joint" />
|
| 631 |
+
<jointpos name="right_elbow_pos" joint="right_elbow_joint" />
|
| 632 |
+
<jointpos name="right_wrist_roll_pos" joint="right_wrist_roll_joint" />
|
| 633 |
+
<jointpos name="right_wrist_pitch_pos" joint="right_wrist_pitch_joint" />
|
| 634 |
+
<jointpos name="right_wrist_yaw_pos" joint="right_wrist_yaw_joint" />
|
| 635 |
+
|
| 636 |
+
<jointpos name="left_hand_thumb_0_pos" joint="left_hand_thumb_0_joint" />
|
| 637 |
+
<jointpos name="left_hand_thumb_1_pos" joint="left_hand_thumb_1_joint" />
|
| 638 |
+
<jointpos name="left_hand_thumb_2_pos" joint="left_hand_thumb_2_joint" />
|
| 639 |
+
<jointpos name="left_hand_middle_0_pos" joint="left_hand_middle_0_joint" />
|
| 640 |
+
<jointpos name="left_hand_middle_1_pos" joint="left_hand_middle_1_joint" />
|
| 641 |
+
<jointpos name="left_hand_index_0_pos" joint="left_hand_index_0_joint" />
|
| 642 |
+
<jointpos name="left_hand_index_1_pos" joint="left_hand_index_1_joint" />
|
| 643 |
+
<jointpos name="right_hand_thumb_0_pos" joint="right_hand_thumb_0_joint" />
|
| 644 |
+
<jointpos name="right_hand_thumb_1_pos" joint="right_hand_thumb_1_joint" />
|
| 645 |
+
<jointpos name="right_hand_thumb_2_pos" joint="right_hand_thumb_2_joint" />
|
| 646 |
+
<jointpos name="right_hand_middle_0_pos" joint="right_hand_middle_0_joint" />
|
| 647 |
+
<jointpos name="right_hand_middle_1_pos" joint="right_hand_middle_1_joint" />
|
| 648 |
+
<jointpos name="right_hand_index_0_pos" joint="right_hand_index_0_joint" />
|
| 649 |
+
<jointpos name="right_hand_index_1_pos" joint="right_hand_index_1_joint" />
|
| 650 |
+
|
| 651 |
+
<jointvel name="left_hip_pitch_vel" joint="left_hip_pitch_joint" />
|
| 652 |
+
<jointvel name="left_hip_roll_vel" joint="left_hip_roll_joint" />
|
| 653 |
+
<jointvel name="left_hip_yaw_vel" joint="left_hip_yaw_joint" />
|
| 654 |
+
<jointvel name="left_knee_vel" joint="left_knee_joint" />
|
| 655 |
+
<jointvel name="left_ankle_pitch_vel" joint="left_ankle_pitch_joint" />
|
| 656 |
+
<jointvel name="left_ankle_roll_vel" joint="left_ankle_roll_joint" />
|
| 657 |
+
<jointvel name="right_hip_pitch_vel" joint="right_hip_pitch_joint" />
|
| 658 |
+
<jointvel name="right_hip_roll_vel" joint="right_hip_roll_joint" />
|
| 659 |
+
<jointvel name="right_hip_yaw_vel" joint="right_hip_yaw_joint" />
|
| 660 |
+
<jointvel name="right_knee_vel" joint="right_knee_joint" />
|
| 661 |
+
<jointvel name="right_ankle_pitch_vel" joint="right_ankle_pitch_joint" />
|
| 662 |
+
<jointvel name="right_ankle_roll_vel" joint="right_ankle_roll_joint" />
|
| 663 |
+
<jointvel name="waist_yaw_vel" joint="waist_yaw_joint" />
|
| 664 |
+
<jointvel name="waist_roll_vel" joint="waist_roll_joint" />
|
| 665 |
+
<jointvel name="waist_pitch_vel" joint="waist_pitch_joint" />
|
| 666 |
+
<jointvel name="left_shoulder_pitch_vel" joint="left_shoulder_pitch_joint" />
|
| 667 |
+
<jointvel name="left_shoulder_roll_vel" joint="left_shoulder_roll_joint" />
|
| 668 |
+
<jointvel name="left_shoulder_yaw_vel" joint="left_shoulder_yaw_joint" />
|
| 669 |
+
<jointvel name="left_elbow_vel" joint="left_elbow_joint" />
|
| 670 |
+
<jointvel name="left_wrist_roll_vel" joint="left_wrist_roll_joint" />
|
| 671 |
+
<jointvel name="left_wrist_pitch_vel" joint="left_wrist_pitch_joint" />
|
| 672 |
+
<jointvel name="left_wrist_yaw_vel" joint="left_wrist_yaw_joint" />
|
| 673 |
+
<jointvel name="right_shoulder_pitch_vel" joint="right_shoulder_pitch_joint" />
|
| 674 |
+
<jointvel name="right_shoulder_roll_vel" joint="right_shoulder_roll_joint" />
|
| 675 |
+
<jointvel name="right_shoulder_yaw_vel" joint="right_shoulder_yaw_joint" />
|
| 676 |
+
<jointvel name="right_elbow_vel" joint="right_elbow_joint" />
|
| 677 |
+
<jointvel name="right_wrist_roll_vel" joint="right_wrist_roll_joint" />
|
| 678 |
+
<jointvel name="right_wrist_pitch_vel" joint="right_wrist_pitch_joint" />
|
| 679 |
+
<jointvel name="right_wrist_yaw_vel" joint="right_wrist_yaw_joint" />
|
| 680 |
+
|
| 681 |
+
<jointvel name="left_hand_thumb_0_vel" joint="left_hand_thumb_0_joint" />
|
| 682 |
+
<jointvel name="left_hand_thumb_1_vel" joint="left_hand_thumb_1_joint" />
|
| 683 |
+
<jointvel name="left_hand_thumb_2_vel" joint="left_hand_thumb_2_joint" />
|
| 684 |
+
<jointvel name="left_hand_middle_0_vel" joint="left_hand_middle_0_joint" />
|
| 685 |
+
<jointvel name="left_hand_middle_1_vel" joint="left_hand_middle_1_joint" />
|
| 686 |
+
<jointvel name="left_hand_index_0_vel" joint="left_hand_index_0_joint" />
|
| 687 |
+
<jointvel name="left_hand_index_1_vel" joint="left_hand_index_1_joint" />
|
| 688 |
+
<jointvel name="right_hand_thumb_0_vel" joint="right_hand_thumb_0_joint" />
|
| 689 |
+
<jointvel name="right_hand_thumb_1_vel" joint="right_hand_thumb_1_joint" />
|
| 690 |
+
<jointvel name="right_hand_thumb_2_vel" joint="right_hand_thumb_2_joint" />
|
| 691 |
+
<jointvel name="right_hand_middle_0_vel" joint="right_hand_middle_0_joint" />
|
| 692 |
+
<jointvel name="right_hand_middle_1_vel" joint="right_hand_middle_1_joint" />
|
| 693 |
+
<jointvel name="right_hand_index_0_vel" joint="right_hand_index_0_joint" />
|
| 694 |
+
<jointvel name="right_hand_index_1_vel" joint="right_hand_index_1_joint" />
|
| 695 |
+
|
| 696 |
+
<jointactuatorfrc name="left_hip_pitch_torque" joint="left_hip_pitch_joint" />
|
| 697 |
+
<jointactuatorfrc name="left_hip_roll_torque" joint="left_hip_roll_joint" />
|
| 698 |
+
<jointactuatorfrc name="left_hip_yaw_torque" joint="left_hip_yaw_joint" />
|
| 699 |
+
<jointactuatorfrc name="left_knee_torque" joint="left_knee_joint" />
|
| 700 |
+
<jointactuatorfrc name="left_ankle_pitch_torque" joint="left_ankle_pitch_joint" />
|
| 701 |
+
<jointactuatorfrc name="left_ankle_roll_torque" joint="left_ankle_roll_joint" />
|
| 702 |
+
<jointactuatorfrc name="right_hip_pitch_torque" joint="right_hip_pitch_joint" />
|
| 703 |
+
<jointactuatorfrc name="right_hip_roll_torque" joint="right_hip_roll_joint" />
|
| 704 |
+
<jointactuatorfrc name="right_hip_yaw_torque" joint="right_hip_yaw_joint" />
|
| 705 |
+
<jointactuatorfrc name="right_knee_torque" joint="right_knee_joint" />
|
| 706 |
+
<jointactuatorfrc name="right_ankle_pitch_torque" joint="right_ankle_pitch_joint" />
|
| 707 |
+
<jointactuatorfrc name="right_ankle_roll_torque" joint="right_ankle_roll_joint" />
|
| 708 |
+
<jointactuatorfrc name="waist_yaw_torque" joint="waist_yaw_joint" />
|
| 709 |
+
<jointactuatorfrc name="waist_roll_torque" joint="waist_roll_joint" />
|
| 710 |
+
<jointactuatorfrc name="waist_pitch_torque" joint="waist_pitch_joint" />
|
| 711 |
+
<jointactuatorfrc name="left_shoulder_pitch_torque" joint="left_shoulder_pitch_joint" />
|
| 712 |
+
<jointactuatorfrc name="left_shoulder_roll_torque" joint="left_shoulder_roll_joint" />
|
| 713 |
+
<jointactuatorfrc name="left_shoulder_yaw_torque" joint="left_shoulder_yaw_joint" />
|
| 714 |
+
<jointactuatorfrc name="left_elbow_torque" joint="left_elbow_joint" />
|
| 715 |
+
<jointactuatorfrc name="left_wrist_roll_torque" joint="left_wrist_roll_joint" />
|
| 716 |
+
<jointactuatorfrc name="left_wrist_pitch_torque" joint="left_wrist_pitch_joint" />
|
| 717 |
+
<jointactuatorfrc name="left_wrist_yaw_torque" joint="left_wrist_yaw_joint" />
|
| 718 |
+
<jointactuatorfrc name="right_shoulder_pitch_torque" joint="right_shoulder_pitch_joint" />
|
| 719 |
+
<jointactuatorfrc name="right_shoulder_roll_torque" joint="right_shoulder_roll_joint" />
|
| 720 |
+
<jointactuatorfrc name="right_shoulder_yaw_torque" joint="right_shoulder_yaw_joint" />
|
| 721 |
+
<jointactuatorfrc name="right_elbow_torque" joint="right_elbow_joint" />
|
| 722 |
+
<jointactuatorfrc name="right_wrist_roll_torque" joint="right_wrist_roll_joint" />
|
| 723 |
+
<jointactuatorfrc name="right_wrist_pitch_torque" joint="right_wrist_pitch_joint" />
|
| 724 |
+
<jointactuatorfrc name="right_wrist_yaw_torque" joint="right_wrist_yaw_joint" />
|
| 725 |
+
|
| 726 |
+
<jointactuatorfrc name="left_hand_thumb_0_torque" joint="left_hand_thumb_0_joint" />
|
| 727 |
+
<jointactuatorfrc name="left_hand_thumb_1_torque" joint="left_hand_thumb_1_joint" />
|
| 728 |
+
<jointactuatorfrc name="left_hand_thumb_2_torque" joint="left_hand_thumb_2_joint" />
|
| 729 |
+
<jointactuatorfrc name="left_hand_middle_0_torque" joint="left_hand_middle_0_joint" />
|
| 730 |
+
<jointactuatorfrc name="left_hand_middle_1_torque" joint="left_hand_middle_1_joint" />
|
| 731 |
+
<jointactuatorfrc name="left_hand_index_0_torque" joint="left_hand_index_0_joint" />
|
| 732 |
+
<jointactuatorfrc name="left_hand_index_1_torque" joint="left_hand_index_1_joint" />
|
| 733 |
+
<jointactuatorfrc name="right_hand_thumb_0_torque" joint="right_hand_thumb_0_joint" />
|
| 734 |
+
<jointactuatorfrc name="right_hand_thumb_1_torque" joint="right_hand_thumb_1_joint" />
|
| 735 |
+
<jointactuatorfrc name="right_hand_thumb_2_torque" joint="right_hand_thumb_2_joint" />
|
| 736 |
+
<jointactuatorfrc name="right_hand_middle_0_torque" joint="right_hand_middle_0_joint" />
|
| 737 |
+
<jointactuatorfrc name="right_hand_middle_1_torque" joint="right_hand_middle_1_joint" />
|
| 738 |
+
<jointactuatorfrc name="right_hand_index_0_torque" joint="right_hand_index_0_joint" />
|
| 739 |
+
<jointactuatorfrc name="right_hand_index_1_torque" joint="right_hand_index_1_joint" />
|
| 740 |
+
|
| 741 |
+
<framequat name="imu_quat" objtype="site" objname="imu" />
|
| 742 |
+
<gyro name="imu_gyro" site="imu" />
|
| 743 |
+
<accelerometer name="imu_acc" site="imu" />
|
| 744 |
+
|
| 745 |
+
<framepos name="frame_pos" objtype="site" objname="imu" />
|
| 746 |
+
<framelinvel name="frame_vel" objtype="site" objname="imu" />
|
| 747 |
+
</sensor>
|
| 748 |
+
</mujoco>
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/model_data/g1/g1_29dof_with_hand_rev_1_0_activatedfinger.xml
ADDED
|
@@ -0,0 +1,669 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<mujoco model="g1_29dof_with_hand_rev_1_0">
|
| 2 |
+
<compiler angle="radian" meshdir="meshes" />
|
| 3 |
+
<default>
|
| 4 |
+
<default class="torso_motor">
|
| 5 |
+
<joint damping="0.05" armature="0.01" frictionloss="0.2" />
|
| 6 |
+
</default>
|
| 7 |
+
<default class="leg_motor">
|
| 8 |
+
<joint damping="0.05" armature="0.01" frictionloss="0.2" />
|
| 9 |
+
</default>
|
| 10 |
+
<default class="ankle_motor">
|
| 11 |
+
<joint damping="0.05" armature="0.01" frictionloss="0.2" />
|
| 12 |
+
</default>
|
| 13 |
+
<default class="arm_motor">
|
| 14 |
+
<joint damping="0.05" armature="0.01" frictionloss="0.2" />
|
| 15 |
+
</default>
|
| 16 |
+
<default class="wrist_motor">
|
| 17 |
+
<joint damping="0.05" armature="0.01" frictionloss="0.1" />
|
| 18 |
+
</default>
|
| 19 |
+
<default class="finger_motor">
|
| 20 |
+
<joint damping="0.05" armature="0.01" frictionloss="0.1" />
|
| 21 |
+
</default>
|
| 22 |
+
|
| 23 |
+
</default>
|
| 24 |
+
|
| 25 |
+
<asset>
|
| 26 |
+
<mesh name="pelvis" file="pelvis.STL" />
|
| 27 |
+
<mesh name="pelvis_contour_link" file="pelvis_contour_link.STL" />
|
| 28 |
+
<mesh name="left_hip_pitch_link" file="left_hip_pitch_link.STL" />
|
| 29 |
+
<mesh name="left_hip_roll_link" file="left_hip_roll_link.STL" />
|
| 30 |
+
<mesh name="left_hip_yaw_link" file="left_hip_yaw_link.STL" />
|
| 31 |
+
<mesh name="left_knee_link" file="left_knee_link.STL" />
|
| 32 |
+
<mesh name="left_ankle_pitch_link" file="left_ankle_pitch_link.STL" />
|
| 33 |
+
<mesh name="left_ankle_roll_link" file="left_ankle_roll_link.STL" />
|
| 34 |
+
<mesh name="right_hip_pitch_link" file="right_hip_pitch_link.STL" />
|
| 35 |
+
<mesh name="right_hip_roll_link" file="right_hip_roll_link.STL" />
|
| 36 |
+
<mesh name="right_hip_yaw_link" file="right_hip_yaw_link.STL" />
|
| 37 |
+
<mesh name="right_knee_link" file="right_knee_link.STL" />
|
| 38 |
+
<mesh name="right_ankle_pitch_link" file="right_ankle_pitch_link.STL" />
|
| 39 |
+
<mesh name="right_ankle_roll_link" file="right_ankle_roll_link.STL" />
|
| 40 |
+
<mesh name="waist_yaw_link" file="waist_yaw_link_rev_1_0.STL" />
|
| 41 |
+
<mesh name="waist_roll_link" file="waist_roll_link_rev_1_0.STL" />
|
| 42 |
+
<mesh name="torso_link" file="torso_link_rev_1_0.STL" />
|
| 43 |
+
<mesh name="logo_link" file="logo_link.STL" />
|
| 44 |
+
<mesh name="head_link" file="head_link.STL" />
|
| 45 |
+
<mesh name="left_shoulder_pitch_link" file="left_shoulder_pitch_link.STL" />
|
| 46 |
+
<mesh name="left_shoulder_roll_link" file="left_shoulder_roll_link.STL" />
|
| 47 |
+
<mesh name="left_shoulder_yaw_link" file="left_shoulder_yaw_link.STL" />
|
| 48 |
+
<mesh name="left_elbow_link" file="left_elbow_link.STL" />
|
| 49 |
+
<mesh name="left_wrist_roll_link" file="left_wrist_roll_link.STL" />
|
| 50 |
+
<mesh name="left_wrist_pitch_link" file="left_wrist_pitch_link.STL" />
|
| 51 |
+
<mesh name="left_wrist_yaw_link" file="left_wrist_yaw_link.STL" />
|
| 52 |
+
<mesh name="left_hand_palm_link" file="left_hand_palm_link.STL" />
|
| 53 |
+
<mesh name="left_hand_thumb_0_link" file="left_hand_thumb_0_link.STL" />
|
| 54 |
+
<mesh name="left_hand_thumb_1_link" file="left_hand_thumb_1_link.STL" />
|
| 55 |
+
<mesh name="left_hand_thumb_2_link" file="left_hand_thumb_2_link.STL" />
|
| 56 |
+
<mesh name="left_hand_middle_0_link" file="left_hand_middle_0_link.STL" />
|
| 57 |
+
<mesh name="left_hand_middle_1_link" file="left_hand_middle_1_link.STL" />
|
| 58 |
+
<mesh name="left_hand_index_0_link" file="left_hand_index_0_link.STL" />
|
| 59 |
+
<mesh name="left_hand_index_1_link" file="left_hand_index_1_link.STL" />
|
| 60 |
+
<mesh name="right_shoulder_pitch_link" file="right_shoulder_pitch_link.STL" />
|
| 61 |
+
<mesh name="right_shoulder_roll_link" file="right_shoulder_roll_link.STL" />
|
| 62 |
+
<mesh name="right_shoulder_yaw_link" file="right_shoulder_yaw_link.STL" />
|
| 63 |
+
<mesh name="right_elbow_link" file="right_elbow_link.STL" />
|
| 64 |
+
<mesh name="right_wrist_roll_link" file="right_wrist_roll_link.STL" />
|
| 65 |
+
<mesh name="right_wrist_pitch_link" file="right_wrist_pitch_link.STL" />
|
| 66 |
+
<mesh name="right_wrist_yaw_link" file="right_wrist_yaw_link.STL" />
|
| 67 |
+
<mesh name="right_hand_palm_link" file="right_hand_palm_link.STL" />
|
| 68 |
+
<mesh name="right_hand_thumb_0_link" file="right_hand_thumb_0_link.STL" />
|
| 69 |
+
<mesh name="right_hand_thumb_1_link" file="right_hand_thumb_1_link.STL" />
|
| 70 |
+
<mesh name="right_hand_thumb_2_link" file="right_hand_thumb_2_link.STL" />
|
| 71 |
+
<mesh name="right_hand_middle_0_link" file="right_hand_middle_0_link.STL" />
|
| 72 |
+
<mesh name="right_hand_middle_1_link" file="right_hand_middle_1_link.STL" />
|
| 73 |
+
<mesh name="right_hand_index_0_link" file="right_hand_index_0_link.STL" />
|
| 74 |
+
<mesh name="right_hand_index_1_link" file="right_hand_index_1_link.STL" />
|
| 75 |
+
</asset>
|
| 76 |
+
|
| 77 |
+
<worldbody>
|
| 78 |
+
<body name="pelvis" pos="0 0 0.793">
|
| 79 |
+
<inertial pos="0 0 -0.07605" quat="1 0 -0.000399148 0" mass="3.813"
|
| 80 |
+
diaginertia="0.010549 0.0093089 0.0079184" />
|
| 81 |
+
<joint name="floating_base_joint" type="free" limited="false" actuatorfrclimited="false" />
|
| 82 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.2 0.2 0.2 1"
|
| 83 |
+
mesh="pelvis" />
|
| 84 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 85 |
+
mesh="pelvis_contour_link" />
|
| 86 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="pelvis_contour_link" />
|
| 87 |
+
<site name="imu_in_pelvis" size="0.01" pos="0.04525 0 -0.08339" />
|
| 88 |
+
<body name="left_hip_pitch_link" pos="0 0.064452 -0.1027">
|
| 89 |
+
<inertial pos="0.002741 0.047791 -0.02606" quat="0.954862 0.293964 0.0302556 0.030122"
|
| 90 |
+
mass="1.35" diaginertia="0.00181517 0.00153422 0.00116212" />
|
| 91 |
+
<joint name="left_hip_pitch_joint" pos="0 0 0" axis="0 1 0" range="-2.5307 2.8798"
|
| 92 |
+
actuatorfrcrange="-88 88" class="leg_motor" />
|
| 93 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.2 0.2 0.2 1"
|
| 94 |
+
mesh="left_hip_pitch_link" />
|
| 95 |
+
<geom type="mesh" rgba="0.2 0.2 0.2 1" mesh="left_hip_pitch_link" />
|
| 96 |
+
<body name="left_hip_roll_link" pos="0 0.052 -0.030465" quat="0.996179 0 -0.0873386 0">
|
| 97 |
+
<inertial pos="0.029812 -0.001045 -0.087934"
|
| 98 |
+
quat="0.977808 -1.97119e-05 0.205576 -0.0403793" mass="1.52"
|
| 99 |
+
diaginertia="0.00254986 0.00241169 0.00148755" />
|
| 100 |
+
<joint name="left_hip_roll_joint" pos="0 0 0" axis="1 0 0" range="-0.5236 2.9671"
|
| 101 |
+
actuatorfrcrange="-139 139" class="leg_motor" />
|
| 102 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 103 |
+
mesh="left_hip_roll_link" />
|
| 104 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_hip_roll_link" />
|
| 105 |
+
<body name="left_hip_yaw_link" pos="0.025001 0 -0.12412">
|
| 106 |
+
<inertial pos="-0.057709 -0.010981 -0.15078" quat="0.600598 0.15832 0.223482 0.751181"
|
| 107 |
+
mass="1.702" diaginertia="0.00776166 0.00717575 0.00160139" />
|
| 108 |
+
<joint name="left_hip_yaw_joint" pos="0 0 0" axis="0 0 1" range="-2.7576 2.7576"
|
| 109 |
+
actuatorfrcrange="-88 88" class="leg_motor" />
|
| 110 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 111 |
+
mesh="left_hip_yaw_link" />
|
| 112 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_hip_yaw_link" />
|
| 113 |
+
<body name="left_knee_link" pos="-0.078273 0.0021489 -0.17734"
|
| 114 |
+
quat="0.996179 0 0.0873386 0">
|
| 115 |
+
<inertial pos="0.005457 0.003964 -0.12074"
|
| 116 |
+
quat="0.923418 -0.0327699 0.0158246 0.382067" mass="1.932"
|
| 117 |
+
diaginertia="0.0113804 0.0112778 0.00146458" />
|
| 118 |
+
<joint name="left_knee_joint" pos="0 0 0" axis="0 1 0" range="-0.087267 2.8798"
|
| 119 |
+
actuatorfrcrange="-139 139" class="leg_motor" />
|
| 120 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 121 |
+
rgba="0.7 0.7 0.7 1" mesh="left_knee_link" />
|
| 122 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_knee_link" />
|
| 123 |
+
<body name="left_ankle_pitch_link" pos="0 -9.4445e-05 -0.30001">
|
| 124 |
+
<inertial pos="-0.007269 0 0.011137" quat="0.603053 0.369225 0.369225 0.603053"
|
| 125 |
+
mass="0.074" diaginertia="1.89e-05 1.40805e-05 6.9195e-06" />
|
| 126 |
+
<joint name="left_ankle_pitch_joint" pos="0 0 0" axis="0 1 0"
|
| 127 |
+
range="-0.87267 0.5236" actuatorfrcrange="-50 50" class="ankle_motor" />
|
| 128 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 129 |
+
rgba="0.7 0.7 0.7 1" mesh="left_ankle_pitch_link" />
|
| 130 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_ankle_pitch_link" />
|
| 131 |
+
<body name="left_ankle_roll_link" pos="0 0 -0.017558">
|
| 132 |
+
<inertial pos="0.026505 0 -0.016425"
|
| 133 |
+
quat="-0.000481092 0.728482 -0.000618967 0.685065" mass="0.608"
|
| 134 |
+
diaginertia="0.00167218 0.0016161 0.000217621" />
|
| 135 |
+
<joint name="left_ankle_roll_joint" pos="0 0 0" axis="1 0 0"
|
| 136 |
+
range="-0.2618 0.2618" actuatorfrcrange="-50 50" class="ankle_motor" />
|
| 137 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 138 |
+
rgba="0.2 0.2 0.2 1" mesh="left_ankle_roll_link" />
|
| 139 |
+
<geom size="0.005" pos="-0.05 0.025 -0.03" rgba="0.2 0.2 0.2 1" />
|
| 140 |
+
<geom size="0.005" pos="-0.05 -0.025 -0.03" rgba="0.2 0.2 0.2 1" />
|
| 141 |
+
<geom size="0.005" pos="0.12 0.03 -0.03" rgba="0.2 0.2 0.2 1" />
|
| 142 |
+
<geom size="0.005" pos="0.12 -0.03 -0.03" rgba="0.2 0.2 0.2 1" />
|
| 143 |
+
</body>
|
| 144 |
+
</body>
|
| 145 |
+
</body>
|
| 146 |
+
</body>
|
| 147 |
+
</body>
|
| 148 |
+
</body>
|
| 149 |
+
<body name="right_hip_pitch_link" pos="0 -0.064452 -0.1027">
|
| 150 |
+
<inertial pos="0.002741 -0.047791 -0.02606" quat="0.954862 -0.293964 0.0302556 -0.030122"
|
| 151 |
+
mass="1.35" diaginertia="0.00181517 0.00153422 0.00116212" />
|
| 152 |
+
<joint name="right_hip_pitch_joint" pos="0 0 0" axis="0 1 0" range="-2.5307 2.8798"
|
| 153 |
+
actuatorfrcrange="-88 88" class="leg_motor" />
|
| 154 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.2 0.2 0.2 1"
|
| 155 |
+
mesh="right_hip_pitch_link" />
|
| 156 |
+
<geom type="mesh" rgba="0.2 0.2 0.2 1" mesh="right_hip_pitch_link" />
|
| 157 |
+
<body name="right_hip_roll_link" pos="0 -0.052 -0.030465" quat="0.996179 0 -0.0873386 0">
|
| 158 |
+
<inertial pos="0.029812 0.001045 -0.087934" quat="0.977808 1.97119e-05 0.205576 0.0403793"
|
| 159 |
+
mass="1.52" diaginertia="0.00254986 0.00241169 0.00148755" />
|
| 160 |
+
<joint name="right_hip_roll_joint" pos="0 0 0" axis="1 0 0" range="-2.9671 0.5236"
|
| 161 |
+
actuatorfrcrange="-139 139" class="leg_motor" />
|
| 162 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 163 |
+
mesh="right_hip_roll_link" />
|
| 164 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_hip_roll_link" />
|
| 165 |
+
<body name="right_hip_yaw_link" pos="0.025001 0 -0.12412">
|
| 166 |
+
<inertial pos="-0.057709 0.010981 -0.15078" quat="0.751181 0.223482 0.15832 0.600598"
|
| 167 |
+
mass="1.702" diaginertia="0.00776166 0.00717575 0.00160139" />
|
| 168 |
+
<joint name="right_hip_yaw_joint" pos="0 0 0" axis="0 0 1" range="-2.7576 2.7576"
|
| 169 |
+
actuatorfrcrange="-88 88" class="leg_motor" />
|
| 170 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 171 |
+
mesh="right_hip_yaw_link" />
|
| 172 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_hip_yaw_link" />
|
| 173 |
+
<body name="right_knee_link" pos="-0.078273 -0.0021489 -0.17734"
|
| 174 |
+
quat="0.996179 0 0.0873386 0">
|
| 175 |
+
<inertial pos="0.005457 -0.003964 -0.12074"
|
| 176 |
+
quat="0.923439 0.0345276 0.0116333 -0.382012" mass="1.932"
|
| 177 |
+
diaginertia="0.011374 0.0112843 0.00146452" />
|
| 178 |
+
<joint name="right_knee_joint" pos="0 0 0" axis="0 1 0" range="-0.087267 2.8798"
|
| 179 |
+
actuatorfrcrange="-139 139" class="leg_motor" />
|
| 180 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 181 |
+
rgba="0.7 0.7 0.7 1" mesh="right_knee_link" />
|
| 182 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_knee_link" />
|
| 183 |
+
<body name="right_ankle_pitch_link" pos="0 9.4445e-05 -0.30001">
|
| 184 |
+
<inertial pos="-0.007269 0 0.011137" quat="0.603053 0.369225 0.369225 0.603053"
|
| 185 |
+
mass="0.074" diaginertia="1.89e-05 1.40805e-05 6.9195e-06" />
|
| 186 |
+
<joint name="right_ankle_pitch_joint" pos="0 0 0" axis="0 1 0"
|
| 187 |
+
range="-0.87267 0.5236" actuatorfrcrange="-50 50" class="ankle_motor" />
|
| 188 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 189 |
+
rgba="0.7 0.7 0.7 1" mesh="right_ankle_pitch_link" />
|
| 190 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_ankle_pitch_link" />
|
| 191 |
+
<body name="right_ankle_roll_link" pos="0 0 -0.017558">
|
| 192 |
+
<inertial pos="0.026505 0 -0.016425"
|
| 193 |
+
quat="0.000481092 0.728482 0.000618967 0.685065" mass="0.608"
|
| 194 |
+
diaginertia="0.00167218 0.0016161 0.000217621" />
|
| 195 |
+
<joint name="right_ankle_roll_joint" pos="0 0 0" axis="1 0 0"
|
| 196 |
+
range="-0.2618 0.2618" actuatorfrcrange="-50 50" class="ankle_motor" />
|
| 197 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 198 |
+
rgba="0.2 0.2 0.2 1" mesh="right_ankle_roll_link" />
|
| 199 |
+
<geom size="0.005" pos="-0.05 0.025 -0.03" rgba="0.2 0.2 0.2 1" />
|
| 200 |
+
<geom size="0.005" pos="-0.05 -0.025 -0.03" rgba="0.2 0.2 0.2 1" />
|
| 201 |
+
<geom size="0.005" pos="0.12 0.03 -0.03" rgba="0.2 0.2 0.2 1" />
|
| 202 |
+
<geom size="0.005" pos="0.12 -0.03 -0.03" rgba="0.2 0.2 0.2 1" />
|
| 203 |
+
</body>
|
| 204 |
+
</body>
|
| 205 |
+
</body>
|
| 206 |
+
</body>
|
| 207 |
+
</body>
|
| 208 |
+
</body>
|
| 209 |
+
<body name="waist_yaw_link">
|
| 210 |
+
<inertial pos="0.003494 0.000233 0.018034" quat="0.289697 0.591001 -0.337795 0.672821"
|
| 211 |
+
mass="0.214" diaginertia="0.000163531 0.000107714 0.000102205" />
|
| 212 |
+
<joint name="waist_yaw_joint" pos="0 0 0" axis="0 0 1" range="-2.618 2.618"
|
| 213 |
+
actuatorfrcrange="-88 88" class="torso_motor" />
|
| 214 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 215 |
+
mesh="waist_yaw_link" />
|
| 216 |
+
<body name="waist_roll_link" pos="-0.0039635 0 0.044">
|
| 217 |
+
<inertial pos="0 2.3e-05 0" quat="0.5 0.5 -0.5 0.5" mass="0.086"
|
| 218 |
+
diaginertia="8.245e-06 7.079e-06 6.339e-06" />
|
| 219 |
+
<joint name="waist_roll_joint" pos="0 0 0" axis="1 0 0" range="-0.52 0.52"
|
| 220 |
+
actuatorfrcrange="-50 50" class="torso_motor" />
|
| 221 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 222 |
+
mesh="waist_roll_link" />
|
| 223 |
+
<body name="torso_link">
|
| 224 |
+
<inertial pos="0.00203158 0.000339683 0.184568"
|
| 225 |
+
quat="0.999803 -6.03319e-05 0.0198256 0.00131986" mass="7.818"
|
| 226 |
+
diaginertia="0.121847 0.109825 0.0273735" />
|
| 227 |
+
<joint name="waist_pitch_joint" pos="0 0 0" axis="0 1 0" range="-0.52 0.52"
|
| 228 |
+
actuatorfrcrange="-50 50" class="torso_motor" />
|
| 229 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 230 |
+
mesh="torso_link" />
|
| 231 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="torso_link" />
|
| 232 |
+
<geom pos="0.0039635 0 -0.044" quat="1 0 0 0" type="mesh" contype="0" conaffinity="0"
|
| 233 |
+
group="1" density="0" rgba="0.2 0.2 0.2 1" mesh="logo_link" />
|
| 234 |
+
<geom pos="0.0039635 0 -0.044" quat="1 0 0 0" type="mesh" rgba="0.2 0.2 0.2 1"
|
| 235 |
+
mesh="logo_link" />
|
| 236 |
+
<geom pos="0.0039635 0 -0.044" type="mesh" contype="0" conaffinity="0" group="1"
|
| 237 |
+
density="0" rgba="0.2 0.2 0.2 1" mesh="head_link" />
|
| 238 |
+
<geom pos="0.0039635 0 -0.044" type="mesh" rgba="0.2 0.2 0.2 1" mesh="head_link" />
|
| 239 |
+
<site name="imu_in_torso" size="0.01" pos="-0.03959 -0.00224 0.14792" />
|
| 240 |
+
<body name="left_shoulder_pitch_link" pos="0.0039563 0.10022 0.24778"
|
| 241 |
+
quat="0.990264 0.139201 1.38722e-05 -9.86868e-05">
|
| 242 |
+
<inertial pos="0 0.035892 -0.011628" quat="0.654152 0.0130458 -0.326267 0.68225"
|
| 243 |
+
mass="0.718" diaginertia="0.000465864 0.000432842 0.000406394" />
|
| 244 |
+
<joint name="left_shoulder_pitch_joint" pos="0 0 0" axis="0 1 0"
|
| 245 |
+
range="-3.0892 2.6704" actuatorfrcrange="-25 25" class="arm_motor" />
|
| 246 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 247 |
+
rgba="0.7 0.7 0.7 1" mesh="left_shoulder_pitch_link" />
|
| 248 |
+
<geom size="0.03 0.025" pos="0 0.04 -0.01" quat="0.707107 0 0.707107 0"
|
| 249 |
+
type="cylinder" rgba="0.7 0.7 0.7 1" />
|
| 250 |
+
<body name="left_shoulder_roll_link" pos="0 0.038 -0.013831"
|
| 251 |
+
quat="0.990268 -0.139172 0 0">
|
| 252 |
+
<inertial pos="-0.000227 0.00727 -0.063243"
|
| 253 |
+
quat="0.701256 -0.0196223 -0.00710317 0.712604" mass="0.643"
|
| 254 |
+
diaginertia="0.000691311 0.000618011 0.000388977" />
|
| 255 |
+
<joint name="left_shoulder_roll_joint" pos="0 0 0" axis="1 0 0"
|
| 256 |
+
range="-1.5882 2.2515" actuatorfrcrange="-25 25" class="arm_motor" />
|
| 257 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 258 |
+
rgba="0.7 0.7 0.7 1" mesh="left_shoulder_roll_link" />
|
| 259 |
+
<geom size="0.03 0.015" pos="-0.004 0.006 -0.053" type="cylinder"
|
| 260 |
+
rgba="0.7 0.7 0.7 1" />
|
| 261 |
+
<body name="left_shoulder_yaw_link" pos="0 0.00624 -0.1032">
|
| 262 |
+
<inertial pos="0.010773 -0.002949 -0.072009"
|
| 263 |
+
quat="0.716879 -0.0964829 -0.0679942 0.687134" mass="0.734"
|
| 264 |
+
diaginertia="0.00106187 0.00103217 0.000400661" />
|
| 265 |
+
<joint name="left_shoulder_yaw_joint" pos="0 0 0" axis="0 0 1"
|
| 266 |
+
range="-2.618 2.618" actuatorfrcrange="-25 25" class="arm_motor" />
|
| 267 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 268 |
+
rgba="0.7 0.7 0.7 1" mesh="left_shoulder_yaw_link" />
|
| 269 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_shoulder_yaw_link" />
|
| 270 |
+
<body name="left_elbow_link" pos="0.015783 0 -0.080518">
|
| 271 |
+
<inertial pos="0.064956 0.004454 -0.010062"
|
| 272 |
+
quat="0.541765 0.636132 0.388821 0.388129" mass="0.6"
|
| 273 |
+
diaginertia="0.000443035 0.000421612 0.000259353" />
|
| 274 |
+
<joint name="left_elbow_joint" pos="0 0 0" axis="0 1 0" range="-1.0472 2.0944"
|
| 275 |
+
actuatorfrcrange="-25 25" class="arm_motor" />
|
| 276 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 277 |
+
rgba="0.7 0.7 0.7 1" mesh="left_elbow_link" />
|
| 278 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_elbow_link" />
|
| 279 |
+
<body name="left_wrist_roll_link" pos="0.1 0.00188791 -0.01">
|
| 280 |
+
<inertial pos="0.0171394 0.000537591 4.8864e-07"
|
| 281 |
+
quat="0.575338 0.411667 -0.574906 0.411094" mass="0.085445"
|
| 282 |
+
diaginertia="5.48211e-05 4.96646e-05 3.57798e-05" />
|
| 283 |
+
<joint name="left_wrist_roll_joint" pos="0 0 0" axis="1 0 0"
|
| 284 |
+
range="-1.97222 1.97222" actuatorfrcrange="-25 25" class="wrist_motor" />
|
| 285 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 286 |
+
rgba="0.7 0.7 0.7 1" mesh="left_wrist_roll_link" />
|
| 287 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_wrist_roll_link" />
|
| 288 |
+
<body name="left_wrist_pitch_link" pos="0.038 0 0">
|
| 289 |
+
<inertial pos="0.0229999 -0.00111685 -0.00111658"
|
| 290 |
+
quat="0.249998 0.661363 0.293036 0.643608" mass="0.48405"
|
| 291 |
+
diaginertia="0.000430353 0.000429873 0.000164648" />
|
| 292 |
+
<joint name="left_wrist_pitch_joint" pos="0 0 0" axis="0 1 0"
|
| 293 |
+
range="-1.61443 1.61443" actuatorfrcrange="-5 5" class="wrist_motor" />
|
| 294 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 295 |
+
rgba="0.7 0.7 0.7 1" mesh="left_wrist_pitch_link" />
|
| 296 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_wrist_pitch_link" />
|
| 297 |
+
<body name="left_wrist_yaw_link" pos="0.046 0 0">
|
| 298 |
+
<inertial pos="0.0885506 0.00212216 -0.000374562"
|
| 299 |
+
quat="0.487149 0.493844 0.513241 0.505358" mass="0.457415"
|
| 300 |
+
diaginertia="0.00105989 0.000895419 0.000323842" />
|
| 301 |
+
<joint name="left_wrist_yaw_joint" pos="0 0 0" axis="0 0 1"
|
| 302 |
+
range="-1.61443 1.61443" actuatorfrcrange="-5 5" class="wrist_motor" />
|
| 303 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 304 |
+
rgba="0.7 0.7 0.7 1" mesh="left_wrist_yaw_link" />
|
| 305 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_wrist_yaw_link" />
|
| 306 |
+
<geom pos="0.0415 0.003 0" quat="1 0 0 0" type="mesh" contype="0"
|
| 307 |
+
conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 308 |
+
mesh="left_hand_palm_link" />
|
| 309 |
+
<geom pos="0.0415 0.003 0" quat="1 0 0 0" type="mesh" rgba="0.7 0.7 0.7 1"
|
| 310 |
+
mesh="left_hand_palm_link" />
|
| 311 |
+
<body name="left_hand_thumb_0_link" pos="0.067 0.003 0">
|
| 312 |
+
<inertial pos="-0.000884246 -0.00863407 0.000944293"
|
| 313 |
+
quat="0.462991 0.643965 -0.460173 0.398986" mass="0.0862366"
|
| 314 |
+
diaginertia="1.6546e-05 1.60058e-05 1.43741e-05" />
|
| 315 |
+
<joint name="left_hand_thumb_0_joint" pos="0 0 0" axis="0 1 0"
|
| 316 |
+
range="-1.0472 1.0472" actuatorfrcrange="-2.45 2.45"
|
| 317 |
+
class="finger_motor" />
|
| 318 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 319 |
+
rgba="0.7 0.7 0.7 1" mesh="left_hand_thumb_0_link" />
|
| 320 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_hand_thumb_0_link" />
|
| 321 |
+
<body name="left_hand_thumb_1_link" pos="-0.0025 -0.0193 0">
|
| 322 |
+
<inertial pos="-0.000827888 -0.0354744 -0.0003809"
|
| 323 |
+
quat="0.685598 0.705471 -0.15207 0.0956069" mass="0.0588507"
|
| 324 |
+
diaginertia="1.28514e-05 1.22902e-05 5.9666e-06" />
|
| 325 |
+
<joint name="left_hand_thumb_1_joint" pos="0 0 0" axis="0 0 1"
|
| 326 |
+
range="-0.724312 1.0472" actuatorfrcrange="-1.4 1.4"
|
| 327 |
+
class="finger_motor" />
|
| 328 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 329 |
+
rgba="0.7 0.7 0.7 1" mesh="left_hand_thumb_1_link" />
|
| 330 |
+
<geom size="0.01 0.015 0.01" pos="-0.001 -0.032 0" type="box"
|
| 331 |
+
rgba="0.7 0.7 0.7 1" />
|
| 332 |
+
<body name="left_hand_thumb_2_link" pos="0 -0.0458 0">
|
| 333 |
+
<inertial pos="-0.00171735 -0.0262819 0.000107789"
|
| 334 |
+
quat="0.703174 0.710977 -0.00017564 -0.00766553" mass="0.0203063"
|
| 335 |
+
diaginertia="4.61314e-06 3.86645e-06 1.53495e-06" />
|
| 336 |
+
<joint name="left_hand_thumb_2_joint" pos="0 0 0" axis="0 0 1"
|
| 337 |
+
range="0 1.74533" actuatorfrcrange="-1.4 1.4" class="finger_motor" />
|
| 338 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 339 |
+
rgba="0.7 0.7 0.7 1" mesh="left_hand_thumb_2_link" />
|
| 340 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_hand_thumb_2_link" />
|
| 341 |
+
</body>
|
| 342 |
+
</body>
|
| 343 |
+
</body>
|
| 344 |
+
<body name="left_hand_middle_0_link" pos="0.1192 0.0046 -0.0285">
|
| 345 |
+
<inertial pos="0.0354744 0.000827888 0.0003809"
|
| 346 |
+
quat="0.391313 0.552395 0.417187 0.606373" mass="0.0588507"
|
| 347 |
+
diaginertia="1.28514e-05 1.22902e-05 5.9666e-06" />
|
| 348 |
+
<joint name="left_hand_middle_0_joint" pos="0 0 0" axis="0 0 1"
|
| 349 |
+
range="-1.5708 0" actuatorfrcrange="-1.4 1.4" class="finger_motor" />
|
| 350 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 351 |
+
rgba="0.7 0.7 0.7 1" mesh="left_hand_middle_0_link" />
|
| 352 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_hand_middle_0_link" />
|
| 353 |
+
<body name="left_hand_middle_1_link" pos="0.0458 0 0">
|
| 354 |
+
<inertial pos="0.0262819 0.00171735 -0.000107789"
|
| 355 |
+
quat="0.502612 0.491799 0.502639 0.502861" mass="0.0203063"
|
| 356 |
+
diaginertia="4.61314e-06 3.86645e-06 1.53495e-06" />
|
| 357 |
+
<joint name="left_hand_middle_1_joint" pos="0 0 0" axis="0 0 1"
|
| 358 |
+
range="-1.74533 0" actuatorfrcrange="-1.4 1.4" class="finger_motor" />
|
| 359 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 360 |
+
rgba="0.7 0.7 0.7 1" mesh="left_hand_middle_1_link" />
|
| 361 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_hand_middle_1_link" />
|
| 362 |
+
</body>
|
| 363 |
+
</body>
|
| 364 |
+
<body name="left_hand_index_0_link" pos="0.1192 0.0046 0.0285">
|
| 365 |
+
<inertial pos="0.0354744 0.000827888 0.0003809"
|
| 366 |
+
quat="0.391313 0.552395 0.417187 0.606373" mass="0.0588507"
|
| 367 |
+
diaginertia="1.28514e-05 1.22902e-05 5.9666e-06" />
|
| 368 |
+
<joint name="left_hand_index_0_joint" pos="0 0 0" axis="0 0 1"
|
| 369 |
+
range="-1.5708 0" actuatorfrcrange="-1.4 1.4" class="finger_motor" />
|
| 370 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 371 |
+
rgba="0.7 0.7 0.7 1" mesh="left_hand_index_0_link" />
|
| 372 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_hand_index_0_link" />
|
| 373 |
+
<body name="left_hand_index_1_link" pos="0.0458 0 0">
|
| 374 |
+
<inertial pos="0.0262819 0.00171735 -0.000107789"
|
| 375 |
+
quat="0.502612 0.491799 0.502639 0.502861" mass="0.0203063"
|
| 376 |
+
diaginertia="4.61314e-06 3.86645e-06 1.53495e-06" />
|
| 377 |
+
<joint name="left_hand_index_1_joint" pos="0 0 0" axis="0 0 1"
|
| 378 |
+
range="-1.74533 0" actuatorfrcrange="-1.4 1.4" class="finger_motor" />
|
| 379 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 380 |
+
rgba="0.7 0.7 0.7 1" mesh="left_hand_index_1_link" />
|
| 381 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="left_hand_index_1_link" />
|
| 382 |
+
</body>
|
| 383 |
+
</body>
|
| 384 |
+
</body>
|
| 385 |
+
</body>
|
| 386 |
+
</body>
|
| 387 |
+
</body>
|
| 388 |
+
</body>
|
| 389 |
+
</body>
|
| 390 |
+
</body>
|
| 391 |
+
<body name="right_shoulder_pitch_link" pos="0.0039563 -0.10021 0.24778"
|
| 392 |
+
quat="0.990264 -0.139201 1.38722e-05 9.86868e-05">
|
| 393 |
+
<inertial pos="0 -0.035892 -0.011628" quat="0.68225 -0.326267 0.0130458 0.654152"
|
| 394 |
+
mass="0.718" diaginertia="0.000465864 0.000432842 0.000406394" />
|
| 395 |
+
<joint name="right_shoulder_pitch_joint" pos="0 0 0" axis="0 1 0"
|
| 396 |
+
range="-3.0892 2.6704" actuatorfrcrange="-25 25" class="arm_motor" />
|
| 397 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 398 |
+
rgba="0.7 0.7 0.7 1" mesh="right_shoulder_pitch_link" />
|
| 399 |
+
<geom size="0.03 0.025" pos="0 -0.04 -0.01" quat="0.707107 0 0.707107 0"
|
| 400 |
+
type="cylinder" rgba="0.7 0.7 0.7 1" />
|
| 401 |
+
<body name="right_shoulder_roll_link" pos="0 -0.038 -0.013831"
|
| 402 |
+
quat="0.990268 0.139172 0 0">
|
| 403 |
+
<inertial pos="-0.000227 -0.00727 -0.063243"
|
| 404 |
+
quat="0.712604 -0.00710317 -0.0196223 0.701256" mass="0.643"
|
| 405 |
+
diaginertia="0.000691311 0.000618011 0.000388977" />
|
| 406 |
+
<joint name="right_shoulder_roll_joint" pos="0 0 0" axis="1 0 0"
|
| 407 |
+
range="-2.2515 1.5882" actuatorfrcrange="-25 25" class="arm_motor" />
|
| 408 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 409 |
+
rgba="0.7 0.7 0.7 1" mesh="right_shoulder_roll_link" />
|
| 410 |
+
<geom size="0.03 0.015" pos="-0.004 -0.006 -0.053" type="cylinder"
|
| 411 |
+
rgba="0.7 0.7 0.7 1" />
|
| 412 |
+
<body name="right_shoulder_yaw_link" pos="0 -0.00624 -0.1032">
|
| 413 |
+
<inertial pos="0.010773 0.002949 -0.072009"
|
| 414 |
+
quat="0.687134 -0.0679942 -0.0964829 0.716879" mass="0.734"
|
| 415 |
+
diaginertia="0.00106187 0.00103217 0.000400661" />
|
| 416 |
+
<joint name="right_shoulder_yaw_joint" pos="0 0 0" axis="0 0 1"
|
| 417 |
+
range="-2.618 2.618" actuatorfrcrange="-25 25" class="arm_motor" />
|
| 418 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 419 |
+
rgba="0.7 0.7 0.7 1" mesh="right_shoulder_yaw_link" />
|
| 420 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_shoulder_yaw_link" />
|
| 421 |
+
<body name="right_elbow_link" pos="0.015783 0 -0.080518">
|
| 422 |
+
<inertial pos="0.064956 -0.004454 -0.010062"
|
| 423 |
+
quat="0.388129 0.388821 0.636132 0.541765" mass="0.6"
|
| 424 |
+
diaginertia="0.000443035 0.000421612 0.000259353" />
|
| 425 |
+
<joint name="right_elbow_joint" pos="0 0 0" axis="0 1 0" range="-1.0472 2.0944"
|
| 426 |
+
actuatorfrcrange="-25 25" class="arm_motor" />
|
| 427 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 428 |
+
rgba="0.7 0.7 0.7 1" mesh="right_elbow_link" />
|
| 429 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_elbow_link" />
|
| 430 |
+
<body name="right_wrist_roll_link" pos="0.1 -0.00188791 -0.01">
|
| 431 |
+
<inertial pos="0.0171394 -0.000537591 4.8864e-07"
|
| 432 |
+
quat="0.411667 0.575338 -0.411094 0.574906" mass="0.085445"
|
| 433 |
+
diaginertia="5.48211e-05 4.96646e-05 3.57798e-05" />
|
| 434 |
+
<joint name="right_wrist_roll_joint" pos="0 0 0" axis="1 0 0"
|
| 435 |
+
range="-1.97222 1.97222" actuatorfrcrange="-25 25" class="wrist_motor" />
|
| 436 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 437 |
+
rgba="0.7 0.7 0.7 1" mesh="right_wrist_roll_link" />
|
| 438 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_wrist_roll_link" />
|
| 439 |
+
<body name="right_wrist_pitch_link" pos="0.038 0 0">
|
| 440 |
+
<inertial pos="0.0229999 0.00111685 -0.00111658"
|
| 441 |
+
quat="0.643608 0.293036 0.661363 0.249998" mass="0.48405"
|
| 442 |
+
diaginertia="0.000430353 0.000429873 0.000164648" />
|
| 443 |
+
<joint name="right_wrist_pitch_joint" pos="0 0 0" axis="0 1 0"
|
| 444 |
+
range="-1.61443 1.61443" actuatorfrcrange="-5 5" class="wrist_motor" />
|
| 445 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 446 |
+
rgba="0.7 0.7 0.7 1" mesh="right_wrist_pitch_link" />
|
| 447 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_wrist_pitch_link" />
|
| 448 |
+
<body name="right_wrist_yaw_link" pos="0.046 0 0">
|
| 449 |
+
<inertial pos="0.0885506 -0.00212216 -0.000374562"
|
| 450 |
+
quat="0.505358 0.513241 0.493844 0.487149" mass="0.457415"
|
| 451 |
+
diaginertia="0.00105989 0.000895419 0.000323842" />
|
| 452 |
+
<joint name="right_wrist_yaw_joint" pos="0 0 0" axis="0 0 1"
|
| 453 |
+
range="-1.61443 1.61443" actuatorfrcrange="-5 5" class="wrist_motor" />
|
| 454 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 455 |
+
rgba="0.7 0.7 0.7 1" mesh="right_wrist_yaw_link" />
|
| 456 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_wrist_yaw_link" />
|
| 457 |
+
<geom pos="0.0415 -0.003 0" quat="1 0 0 0" type="mesh" contype="0"
|
| 458 |
+
conaffinity="0" group="1" density="0" rgba="0.7 0.7 0.7 1"
|
| 459 |
+
mesh="right_hand_palm_link" />
|
| 460 |
+
<geom pos="0.0415 -0.003 0" quat="1 0 0 0" type="mesh"
|
| 461 |
+
rgba="0.7 0.7 0.7 1" mesh="right_hand_palm_link" />
|
| 462 |
+
<body name="right_hand_thumb_0_link" pos="0.067 -0.003 0">
|
| 463 |
+
<inertial pos="-0.000884246 0.00863407 0.000944293"
|
| 464 |
+
quat="0.643965 0.462991 -0.398986 0.460173" mass="0.0862366"
|
| 465 |
+
diaginertia="1.6546e-05 1.60058e-05 1.43741e-05" />
|
| 466 |
+
<joint name="right_hand_thumb_0_joint" pos="0 0 0" axis="0 1 0"
|
| 467 |
+
range="-1.0472 1.0472" actuatorfrcrange="-2.45 2.45"
|
| 468 |
+
class="finger_motor" />
|
| 469 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 470 |
+
rgba="0.7 0.7 0.7 1" mesh="right_hand_thumb_0_link" />
|
| 471 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_hand_thumb_0_link" />
|
| 472 |
+
<body name="right_hand_thumb_1_link" pos="-0.0025 0.0193 0">
|
| 473 |
+
<inertial pos="-0.000827888 0.0354744 -0.0003809"
|
| 474 |
+
quat="0.705471 0.685598 -0.0956069 0.15207" mass="0.0588507"
|
| 475 |
+
diaginertia="1.28514e-05 1.22902e-05 5.9666e-06" />
|
| 476 |
+
<joint name="right_hand_thumb_1_joint" pos="0 0 0" axis="0 0 1"
|
| 477 |
+
range="-1.0472 0.724312" actuatorfrcrange="-1.4 1.4"
|
| 478 |
+
class="finger_motor" />
|
| 479 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 480 |
+
rgba="0.7 0.7 0.7 1" mesh="right_hand_thumb_1_link" />
|
| 481 |
+
<geom size="0.01 0.015 0.01" pos="-0.001 0.032 0" type="box"
|
| 482 |
+
rgba="0.7 0.7 0.7 1" />
|
| 483 |
+
<body name="right_hand_thumb_2_link" pos="0 0.0458 0">
|
| 484 |
+
<inertial pos="-0.00171735 0.0262819 0.000107789"
|
| 485 |
+
quat="0.710977 0.703174 0.00766553 0.00017564" mass="0.0203063"
|
| 486 |
+
diaginertia="4.61314e-06 3.86645e-06 1.53495e-06" />
|
| 487 |
+
<joint name="right_hand_thumb_2_joint" pos="0 0 0" axis="0 0 1"
|
| 488 |
+
range="-1.74533 0" actuatorfrcrange="-1.4 1.4"
|
| 489 |
+
class="finger_motor" />
|
| 490 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 491 |
+
rgba="0.7 0.7 0.7 1" mesh="right_hand_thumb_2_link" />
|
| 492 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1"
|
| 493 |
+
mesh="right_hand_thumb_2_link" />
|
| 494 |
+
</body>
|
| 495 |
+
</body>
|
| 496 |
+
</body>
|
| 497 |
+
<body name="right_hand_middle_0_link" pos="0.1192 -0.0046 -0.0285">
|
| 498 |
+
<inertial pos="0.0354744 -0.000827888 0.0003809"
|
| 499 |
+
quat="0.606373 0.417187 0.552395 0.391313" mass="0.0588507"
|
| 500 |
+
diaginertia="1.28514e-05 1.22902e-05 5.9666e-06" />
|
| 501 |
+
<joint name="right_hand_middle_0_joint" pos="0 0 0" axis="0 0 1"
|
| 502 |
+
range="0 1.5708" actuatorfrcrange="-1.4 1.4" class="finger_motor" />
|
| 503 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 504 |
+
rgba="0.7 0.7 0.7 1" mesh="right_hand_middle_0_link" />
|
| 505 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_hand_middle_0_link" />
|
| 506 |
+
<body name="right_hand_middle_1_link" pos="0.0458 0 0">
|
| 507 |
+
<inertial pos="0.0262819 -0.00171735 -0.000107789"
|
| 508 |
+
quat="0.502861 0.502639 0.491799 0.502612" mass="0.0203063"
|
| 509 |
+
diaginertia="4.61314e-06 3.86645e-06 1.53495e-06" />
|
| 510 |
+
<joint name="right_hand_middle_1_joint" pos="0 0 0" axis="0 0 1"
|
| 511 |
+
range="0 1.74533" actuatorfrcrange="-1.4 1.4" class="finger_motor" />
|
| 512 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 513 |
+
rgba="0.7 0.7 0.7 1" mesh="right_hand_middle_1_link" />
|
| 514 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_hand_middle_1_link" />
|
| 515 |
+
</body>
|
| 516 |
+
</body>
|
| 517 |
+
<body name="right_hand_index_0_link" pos="0.1192 -0.0046 0.0285">
|
| 518 |
+
<inertial pos="0.0354744 -0.000827888 0.0003809"
|
| 519 |
+
quat="0.606373 0.417187 0.552395 0.391313" mass="0.0588507"
|
| 520 |
+
diaginertia="1.28514e-05 1.22902e-05 5.9666e-06" />
|
| 521 |
+
<joint name="right_hand_index_0_joint" pos="0 0 0" axis="0 0 1"
|
| 522 |
+
range="0 1.5708" actuatorfrcrange="-1.4 1.4" class="finger_motor" />
|
| 523 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 524 |
+
rgba="0.7 0.7 0.7 1" mesh="right_hand_index_0_link" />
|
| 525 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_hand_index_0_link" />
|
| 526 |
+
<body name="right_hand_index_1_link" pos="0.0458 0 0">
|
| 527 |
+
<inertial pos="0.0262819 -0.00171735 -0.000107789"
|
| 528 |
+
quat="0.502861 0.502639 0.491799 0.502612" mass="0.0203063"
|
| 529 |
+
diaginertia="4.61314e-06 3.86645e-06 1.53495e-06" />
|
| 530 |
+
<joint name="right_hand_index_1_joint" pos="0 0 0" axis="0 0 1"
|
| 531 |
+
range="0 1.74533" actuatorfrcrange="-1.4 1.4" class="finger_motor" />
|
| 532 |
+
<geom type="mesh" contype="0" conaffinity="0" group="1" density="0"
|
| 533 |
+
rgba="0.7 0.7 0.7 1" mesh="right_hand_index_1_link" />
|
| 534 |
+
<geom type="mesh" rgba="0.7 0.7 0.7 1" mesh="right_hand_index_1_link" />
|
| 535 |
+
</body>
|
| 536 |
+
</body>
|
| 537 |
+
</body>
|
| 538 |
+
</body>
|
| 539 |
+
</body>
|
| 540 |
+
</body>
|
| 541 |
+
</body>
|
| 542 |
+
</body>
|
| 543 |
+
</body>
|
| 544 |
+
</body>
|
| 545 |
+
</body>
|
| 546 |
+
</body>
|
| 547 |
+
</body>
|
| 548 |
+
</worldbody>
|
| 549 |
+
|
| 550 |
+
<actuator>
|
| 551 |
+
<!-- <motor name="fx" joint="floating_base_joint" gear="1 0 0 0 0 0" />
|
| 552 |
+
<motor name="fy" joint="floating_base_joint" gear="0 1 0 0 0 0" />
|
| 553 |
+
<motor name="fz" joint="floating_base_joint" gear="0 0 1 0 0 0" />
|
| 554 |
+
<motor name="tx" joint="floating_base_joint" gear="0 0 0 1 0 0" />
|
| 555 |
+
<motor name="ty" joint="floating_base_joint" gear="0 0 0 0 1 0" />
|
| 556 |
+
<motor name="tz" joint="floating_base_joint" gear="0 0 0 0 0 1" /> -->
|
| 557 |
+
|
| 558 |
+
<motor name="left_hip_pitch_joint" joint="left_hip_pitch_joint" />
|
| 559 |
+
<motor
|
| 560 |
+
name="left_hip_roll_joint" joint="left_hip_roll_joint" />
|
| 561 |
+
<motor name="left_hip_yaw_joint"
|
| 562 |
+
joint="left_hip_yaw_joint" />
|
| 563 |
+
<motor name="left_knee_joint" joint="left_knee_joint" />
|
| 564 |
+
<motor
|
| 565 |
+
name="left_ankle_pitch_joint" joint="left_ankle_pitch_joint" />
|
| 566 |
+
<motor
|
| 567 |
+
name="left_ankle_roll_joint" joint="left_ankle_roll_joint" />
|
| 568 |
+
<motor
|
| 569 |
+
name="right_hip_pitch_joint" joint="right_hip_pitch_joint" />
|
| 570 |
+
<motor
|
| 571 |
+
name="right_hip_roll_joint" joint="right_hip_roll_joint" />
|
| 572 |
+
<motor name="right_hip_yaw_joint"
|
| 573 |
+
joint="right_hip_yaw_joint" />
|
| 574 |
+
<motor name="right_knee_joint" joint="right_knee_joint" />
|
| 575 |
+
<motor
|
| 576 |
+
name="right_ankle_pitch_joint" joint="right_ankle_pitch_joint" />
|
| 577 |
+
<motor
|
| 578 |
+
name="right_ankle_roll_joint" joint="right_ankle_roll_joint" />
|
| 579 |
+
<motor name="waist_yaw_joint"
|
| 580 |
+
joint="waist_yaw_joint" />
|
| 581 |
+
<motor name="waist_roll_joint" joint="waist_roll_joint" />
|
| 582 |
+
<motor
|
| 583 |
+
name="waist_pitch_joint" joint="waist_pitch_joint" />
|
| 584 |
+
<motor name="left_shoulder_pitch_joint"
|
| 585 |
+
joint="left_shoulder_pitch_joint" />
|
| 586 |
+
<motor name="left_shoulder_roll_joint"
|
| 587 |
+
joint="left_shoulder_roll_joint" />
|
| 588 |
+
<motor name="left_shoulder_yaw_joint"
|
| 589 |
+
joint="left_shoulder_yaw_joint" />
|
| 590 |
+
<motor name="left_elbow_joint" joint="left_elbow_joint" />
|
| 591 |
+
<motor
|
| 592 |
+
name="left_wrist_roll_joint" joint="left_wrist_roll_joint" />
|
| 593 |
+
<motor
|
| 594 |
+
name="left_wrist_pitch_joint" joint="left_wrist_pitch_joint" />
|
| 595 |
+
<motor
|
| 596 |
+
name="left_wrist_yaw_joint" joint="left_wrist_yaw_joint" />
|
| 597 |
+
<motor
|
| 598 |
+
name="left_hand_thumb_0_joint" joint="left_hand_thumb_0_joint" />
|
| 599 |
+
<motor
|
| 600 |
+
name="left_hand_thumb_1_joint" joint="left_hand_thumb_1_joint" />
|
| 601 |
+
<motor
|
| 602 |
+
name="left_hand_thumb_2_joint" joint="left_hand_thumb_2_joint" />
|
| 603 |
+
<motor
|
| 604 |
+
name="left_hand_middle_0_joint" joint="left_hand_middle_0_joint" />
|
| 605 |
+
<motor
|
| 606 |
+
name="left_hand_middle_1_joint" joint="left_hand_middle_1_joint" />
|
| 607 |
+
<motor
|
| 608 |
+
name="left_hand_index_0_joint" joint="left_hand_index_0_joint" />
|
| 609 |
+
<motor
|
| 610 |
+
name="left_hand_index_1_joint" joint="left_hand_index_1_joint" />
|
| 611 |
+
<motor
|
| 612 |
+
name="right_shoulder_pitch_joint" joint="right_shoulder_pitch_joint" />
|
| 613 |
+
<motor
|
| 614 |
+
name="right_shoulder_roll_joint" joint="right_shoulder_roll_joint" />
|
| 615 |
+
<motor
|
| 616 |
+
name="right_shoulder_yaw_joint" joint="right_shoulder_yaw_joint" />
|
| 617 |
+
<motor
|
| 618 |
+
name="right_elbow_joint" joint="right_elbow_joint" />
|
| 619 |
+
<motor name="right_wrist_roll_joint"
|
| 620 |
+
joint="right_wrist_roll_joint" />
|
| 621 |
+
<motor name="right_wrist_pitch_joint"
|
| 622 |
+
joint="right_wrist_pitch_joint" />
|
| 623 |
+
<motor name="right_wrist_yaw_joint"
|
| 624 |
+
joint="right_wrist_yaw_joint" />
|
| 625 |
+
<motor name="right_hand_thumb_0_joint"
|
| 626 |
+
joint="right_hand_thumb_0_joint" />
|
| 627 |
+
<motor name="right_hand_thumb_1_joint"
|
| 628 |
+
joint="right_hand_thumb_1_joint" />
|
| 629 |
+
<motor name="right_hand_thumb_2_joint"
|
| 630 |
+
joint="right_hand_thumb_2_joint" />
|
| 631 |
+
<motor name="right_hand_index_0_joint"
|
| 632 |
+
joint="right_hand_index_0_joint" />
|
| 633 |
+
<motor name="right_hand_index_1_joint"
|
| 634 |
+
joint="right_hand_index_1_joint" />
|
| 635 |
+
<motor name="right_hand_middle_0_joint"
|
| 636 |
+
joint="right_hand_middle_0_joint" />
|
| 637 |
+
<motor name="right_hand_middle_1_joint"
|
| 638 |
+
joint="right_hand_middle_1_joint" /> --> </actuator>
|
| 639 |
+
|
| 640 |
+
<sensor>
|
| 641 |
+
<gyro name="imu-torso-angular-velocity" site="imu_in_torso" noise="5e-4" cutoff="34.9" />
|
| 642 |
+
<accelerometer name="imu-torso-linear-acceleration" site="imu_in_torso" noise="1e-2"
|
| 643 |
+
cutoff="157" />
|
| 644 |
+
<gyro name="imu-pelvis-angular-velocity" site="imu_in_pelvis" noise="5e-4" cutoff="34.9" />
|
| 645 |
+
<accelerometer name="imu-pelvis-linear-acceleration" site="imu_in_pelvis" noise="1e-2"
|
| 646 |
+
cutoff="157" />
|
| 647 |
+
</sensor>
|
| 648 |
+
|
| 649 |
+
|
| 650 |
+
<!-- setup scene -->
|
| 651 |
+
<!-- <statistic center="1.0 0.7 1.0" extent="0.8"/>
|
| 652 |
+
<visual>
|
| 653 |
+
<headlight diffuse="0.6 0.6 0.6" ambient="0.1 0.1 0.1" specular="0.9 0.9 0.9"/>
|
| 654 |
+
<rgba haze="0.15 0.25 0.35 1"/>
|
| 655 |
+
<global azimuth="-140" elevation="-20"/>
|
| 656 |
+
</visual>
|
| 657 |
+
<asset>
|
| 658 |
+
<texture type="skybox" builtin="flat" rgb1="0 0 0" rgb2="0 0 0" width="512" height="3072"/>
|
| 659 |
+
<texture type="2d" name="groundplane" builtin="checker" mark="edge" rgb1="0.2 0.3 0.4" rgb2="0.1
|
| 660 |
+
0.2 0.3" markrgb="0.8 0.8 0.8" width="300" height="300"/>
|
| 661 |
+
<material name="groundplane" texture="groundplane" texuniform="true" texrepeat="5 5"
|
| 662 |
+
reflectance="0.2"/>
|
| 663 |
+
</asset>
|
| 664 |
+
<worldbody>
|
| 665 |
+
<light pos="1 0 3.5" dir="0 0 -1" directional="true"/>
|
| 666 |
+
<geom name="floor" size="0 0 0.05" type="plane" material="groundplane"/>
|
| 667 |
+
</worldbody> -->
|
| 668 |
+
</mujoco>
|
| 669 |
+
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/model_data/g1/lift_box_43dof.xml
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<mujoco model="g1_43dof_lift_box scene">
|
| 2 |
+
<include file="g1_29dof_with_hand_rev_1_0_activatedfinger.xml" />
|
| 3 |
+
<!-- Note that the hand model in g1_29dof_with_hand.xml is not stable for simulation. -->
|
| 4 |
+
|
| 5 |
+
<statistic center="0 0 0.5" extent="2.0" />
|
| 6 |
+
|
| 7 |
+
<visual>
|
| 8 |
+
<headlight diffuse="0.6 0.6 0.6" ambient="0.3 0.3 0.3" specular="0 0 0" />
|
| 9 |
+
<rgba haze="0.15 0.25 0.35 1" />
|
| 10 |
+
<global azimuth="-130" elevation="-20" />
|
| 11 |
+
</visual>
|
| 12 |
+
|
| 13 |
+
<asset>
|
| 14 |
+
<texture type="skybox" builtin="gradient" rgb1="0.3 0.5 0.7" rgb2="0 0 0" width="512"
|
| 15 |
+
height="3072" />
|
| 16 |
+
<texture type="2d" name="groundplane" builtin="checker" mark="edge" rgb1="0.2 0.3 0.4"
|
| 17 |
+
rgb2="0.1 0.2 0.3"
|
| 18 |
+
markrgb="0.8 0.8 0.8" width="300" height="300" />
|
| 19 |
+
<texture type="2d" name="table" builtin="flat" rgb1="0.7 0.6 0.5" width="512" height="512" />
|
| 20 |
+
<material name="groundplane" texture="groundplane" texuniform="true" texrepeat="5 5"
|
| 21 |
+
reflectance="0.2" />
|
| 22 |
+
<material name="table" texture="table" texuniform="true" reflectance="0.1" />
|
| 23 |
+
<texture type="2d" name="cube" builtin="flat" rgb1="0.3 0.7 0.8" width="512" height="512" />
|
| 24 |
+
<material name="cube" texture="cube" texuniform="true" reflectance="0.1" />
|
| 25 |
+
</asset>
|
| 26 |
+
|
| 27 |
+
<worldbody>
|
| 28 |
+
<light pos="0 0 1.5" dir="0 0 -1" directional="true" />
|
| 29 |
+
<geom name="floor" size="0 0 0.05" type="plane" material="groundplane" />
|
| 30 |
+
<!-- Site -->
|
| 31 |
+
<site name="com_marker" pos="0.1 0 0" size="0.05" rgba="1 0 0 1" type="sphere" />
|
| 32 |
+
|
| 33 |
+
<body name="table_body" pos="0.6 0 0.4">
|
| 34 |
+
<geom name="table_top" pos="0 0 0.3" size="0.5 1.0 0.05" type="box" material="table"/>
|
| 35 |
+
<geom name="table_leg1" pos="0.0 0.9 -0.05" size="0.5 0.05 0.4" type="box" material="table"/>
|
| 36 |
+
<geom name="table_leg2" pos="0.0 -0.9 -0.05" size="0.5 0.05 0.4" type="box" material="table"/>
|
| 37 |
+
</body>
|
| 38 |
+
<body name="box_body" pos="0.35 0 0.9">
|
| 39 |
+
<joint type="free" damping="0.0005" name="box_joint" />
|
| 40 |
+
<geom name="box" size="0.1 0.1 0.1" type="box" material="cube" solimp="0.998 0.998 0.001"
|
| 41 |
+
solref="0.001 2" density="100" friction="0.95 0.3 0.1" />
|
| 42 |
+
</body>
|
| 43 |
+
|
| 44 |
+
</worldbody>
|
| 45 |
+
|
| 46 |
+
<default>
|
| 47 |
+
<geom friction="1.0" />
|
| 48 |
+
</default>
|
| 49 |
+
</mujoco>
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/model_data/g1/pnp_bottle_43dof.xml
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<mujoco model="g1_43dof_pnp_cube scene">
|
| 2 |
+
<include file="g1_29dof_with_hand_rev_1_0_activatedfinger.xml" />
|
| 3 |
+
<!-- Note that the hand model in g1_29dof_with_hand.xml is not stable for simulation. -->
|
| 4 |
+
|
| 5 |
+
<statistic center="0 0 0.5" extent="2.0" />
|
| 6 |
+
|
| 7 |
+
<visual>
|
| 8 |
+
<headlight diffuse="0.6 0.6 0.6" ambient="0.3 0.3 0.3" specular="0 0 0" />
|
| 9 |
+
<rgba haze="0.15 0.25 0.35 1" />
|
| 10 |
+
<global azimuth="-130" elevation="-20" />
|
| 11 |
+
</visual>
|
| 12 |
+
|
| 13 |
+
<asset>
|
| 14 |
+
<texture type="skybox" builtin="gradient" rgb1="0.3 0.5 0.7" rgb2="0 0 0" width="512"
|
| 15 |
+
height="3072" />
|
| 16 |
+
<texture type="2d" name="groundplane" builtin="checker" mark="edge" rgb1="0.2 0.3 0.4"
|
| 17 |
+
rgb2="0.1 0.2 0.3"
|
| 18 |
+
markrgb="0.8 0.8 0.8" width="300" height="300" />
|
| 19 |
+
<texture type="2d" name="table" builtin="flat" rgb1="0.7 0.6 0.5" width="512" height="512" />
|
| 20 |
+
<material name="groundplane" texture="groundplane" texuniform="true" texrepeat="5 5"
|
| 21 |
+
reflectance="0.2" />
|
| 22 |
+
<material name="table" texture="table" texuniform="true" reflectance="0.1" />
|
| 23 |
+
<texture type="2d" name="cube" builtin="flat" rgb1="0.3 0.7 0.8" width="512" height="512" />
|
| 24 |
+
<material name="cube" texture="cube" texuniform="true" reflectance="0.1" />
|
| 25 |
+
</asset>
|
| 26 |
+
|
| 27 |
+
<worldbody>
|
| 28 |
+
<light pos="0 0 1.5" dir="0 0 -1" directional="true" />
|
| 29 |
+
<geom name="floor" size="0 0 0.05" type="plane" material="groundplane" />
|
| 30 |
+
<!-- Site -->
|
| 31 |
+
<site name="com_marker" pos="0.1 0 0" size="0.05" rgba="1 0 0 1" type="sphere" />
|
| 32 |
+
|
| 33 |
+
<body name="table_body" pos="0.4 0 0.4">
|
| 34 |
+
<geom name="table" pos="0 0 0" size="0.237 0.717 0.4" type="box" material="table"/>
|
| 35 |
+
</body>
|
| 36 |
+
<body name="bottle_body" pos="0.4 0 0.875">
|
| 37 |
+
<joint type="free" damping="0.0005" name="cube_joint" />
|
| 38 |
+
<geom name="bottle" size="0.03 0.075" type="cylinder" material="cube" solimp="0.998 0.998 0.001"
|
| 39 |
+
solref="0.001 2" density="100" friction="0.95 0.3 0.1" />
|
| 40 |
+
</body>
|
| 41 |
+
|
| 42 |
+
<camera name="egoview" pos="0.078 0 1.308" xyaxes="0.000 -1.000 0.000 0.767 0.001 0.641" fovy="90"/>
|
| 43 |
+
|
| 44 |
+
</worldbody>
|
| 45 |
+
|
| 46 |
+
<default>
|
| 47 |
+
<geom friction="1.0" />
|
| 48 |
+
</default>
|
| 49 |
+
</mujoco>
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/model_data/g1/pnp_cube_43dof.xml
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<mujoco model="g1_43dof_pnp_cube scene">
|
| 2 |
+
<include file="g1_29dof_with_hand_rev_1_0_activatedfinger.xml" />
|
| 3 |
+
<!-- Note that the hand model in g1_29dof_with_hand.xml is not stable for simulation. -->
|
| 4 |
+
|
| 5 |
+
<statistic center="0 0 0.5" extent="2.0" />
|
| 6 |
+
|
| 7 |
+
<visual>
|
| 8 |
+
<headlight diffuse="0.6 0.6 0.6" ambient="0.3 0.3 0.3" specular="0 0 0" />
|
| 9 |
+
<rgba haze="0.15 0.25 0.35 1" />
|
| 10 |
+
<global azimuth="-130" elevation="-20" />
|
| 11 |
+
</visual>
|
| 12 |
+
|
| 13 |
+
<asset>
|
| 14 |
+
<texture type="skybox" builtin="gradient" rgb1="0.3 0.5 0.7" rgb2="0 0 0" width="512"
|
| 15 |
+
height="3072" />
|
| 16 |
+
<texture type="2d" name="groundplane" builtin="checker" mark="edge" rgb1="0.2 0.3 0.4"
|
| 17 |
+
rgb2="0.1 0.2 0.3"
|
| 18 |
+
markrgb="0.8 0.8 0.8" width="300" height="300" />
|
| 19 |
+
<texture type="2d" name="table" builtin="flat" rgb1="0.7 0.6 0.5" width="512" height="512" />
|
| 20 |
+
<material name="groundplane" texture="groundplane" texuniform="true" texrepeat="5 5"
|
| 21 |
+
reflectance="0.2" />
|
| 22 |
+
<material name="table" texture="table" texuniform="true" reflectance="0.1" />
|
| 23 |
+
<texture type="2d" name="cube" builtin="flat" rgb1="0.3 0.7 0.8" width="512" height="512" />
|
| 24 |
+
<material name="cube" texture="cube" texuniform="true" reflectance="0.1" />
|
| 25 |
+
</asset>
|
| 26 |
+
|
| 27 |
+
<worldbody>
|
| 28 |
+
<light pos="0 0 1.5" dir="0 0 -1" directional="true" />
|
| 29 |
+
<geom name="floor" size="0 0 0.05" type="plane" material="groundplane" />
|
| 30 |
+
<!-- Site -->
|
| 31 |
+
<site name="com_marker" pos="0.1 0 0" size="0.05" rgba="1 0 0 1" type="sphere" />
|
| 32 |
+
|
| 33 |
+
<body name="table_body" pos="0.6 0 0.4">
|
| 34 |
+
<geom name="table_top" pos="0 0 0.3" size="0.5 1.0 0.05" type="box" material="table"/>
|
| 35 |
+
<geom name="table_leg1" pos="0.0 0.9 -0.05" size="0.5 0.05 0.4" type="box" material="table"/>
|
| 36 |
+
<geom name="table_leg2" pos="0.0 -0.9 -0.05" size="0.5 0.05 0.4" type="box" material="table"/>
|
| 37 |
+
</body>
|
| 38 |
+
<body name="cube_body" pos="0.28 0 0.8">
|
| 39 |
+
<joint type="free" damping="0.0005" name="cube_joint" />
|
| 40 |
+
<geom name="cube" size="0.035 0.035 0.035" type="box" material="cube" solimp="0.998 0.998 0.001"
|
| 41 |
+
solref="0.001 2" density="100" friction="0.95 0.3 0.1" />
|
| 42 |
+
</body>
|
| 43 |
+
|
| 44 |
+
</worldbody>
|
| 45 |
+
|
| 46 |
+
<default>
|
| 47 |
+
<geom friction="1.0" />
|
| 48 |
+
</default>
|
| 49 |
+
</mujoco>
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/model_data/g1/scene_29dof.xml
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<mujoco model="g1_29dof scene">
|
| 2 |
+
<include file="g1_29dof_old.xml"/>
|
| 3 |
+
|
| 4 |
+
<statistic center="0 0 0.5" extent="2.0"/>
|
| 5 |
+
|
| 6 |
+
<visual>
|
| 7 |
+
<headlight diffuse="0.6 0.6 0.6" ambient="0.3 0.3 0.3" specular="0 0 0"/>
|
| 8 |
+
<rgba haze="0.15 0.25 0.35 1"/>
|
| 9 |
+
<global azimuth="-130" elevation="-20"/>
|
| 10 |
+
</visual>
|
| 11 |
+
|
| 12 |
+
<asset>
|
| 13 |
+
<texture type="skybox" builtin="gradient" rgb1="0.3 0.5 0.7" rgb2="0 0 0" width="512" height="3072"/>
|
| 14 |
+
<texture type="2d" name="groundplane" builtin="checker" mark="edge" rgb1="0.2 0.3 0.4" rgb2="0.1 0.2 0.3"
|
| 15 |
+
markrgb="0.8 0.8 0.8" width="300" height="300"/>
|
| 16 |
+
<material name="groundplane" texture="groundplane" texuniform="true" texrepeat="5 5" reflectance="0.2"/>
|
| 17 |
+
</asset>
|
| 18 |
+
|
| 19 |
+
<worldbody>
|
| 20 |
+
<light pos="0 0 1.5" dir="0 0 -1" directional="true"/>
|
| 21 |
+
<geom name="floor" size="0 0 0.05" type="plane" material="groundplane"/>
|
| 22 |
+
<!-- Site -->
|
| 23 |
+
<site name="com_marker" pos="0.1 0 0" size="0.05" rgba="1 0 0 1" type="sphere"/>
|
| 24 |
+
<site name="left_hand_marker" pos="0.1 0 0" size="0.025" rgba="0 1 0 1" type="sphere"/>
|
| 25 |
+
<site name="right_hand_marker" pos="0.1 0 0" size="0.025" rgba="0 1 0 1" type="sphere"/>
|
| 26 |
+
<site name="left_foot_marker" pos="0.1 0 0" size="0.025" rgba="1 0 0 1" type="sphere"/>
|
| 27 |
+
<site name="right_foot_marker" pos="0.1 0 0" size="0.025" rgba="1 0 0 1" type="sphere"/>
|
| 28 |
+
<camera name="global_view" pos="2.910 -5.040 3.860" xyaxes="0.866 0.500 0.000 -0.250 0.433 0.866"/>
|
| 29 |
+
</worldbody>
|
| 30 |
+
<!-- <default>
|
| 31 |
+
<geom friction="0.5"/>
|
| 32 |
+
</default> -->
|
| 33 |
+
</mujoco>
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/model_data/g1/scene_29dof_activated3dex.xml
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<mujoco model="g1_29dof_activated_3dex scene">
|
| 2 |
+
<include file="g1_29dof_with_hand_rev_1_0_activatedfinger.xml"/>
|
| 3 |
+
<!-- Note that the hand model in g1_29dof_with_hand.xml is not stable for simulation. -->
|
| 4 |
+
|
| 5 |
+
<statistic center="0 0 0.5" extent="2.0"/>
|
| 6 |
+
|
| 7 |
+
<visual>
|
| 8 |
+
<headlight diffuse="0.6 0.6 0.6" ambient="0.3 0.3 0.3" specular="0 0 0"/>
|
| 9 |
+
<rgba haze="0.15 0.25 0.35 1"/>
|
| 10 |
+
<global azimuth="-130" elevation="-20"/>
|
| 11 |
+
</visual>
|
| 12 |
+
|
| 13 |
+
<asset>
|
| 14 |
+
<texture type="skybox" builtin="gradient" rgb1="0.3 0.5 0.7" rgb2="0 0 0" width="512" height="3072"/>
|
| 15 |
+
<texture type="2d" name="groundplane" builtin="checker" mark="edge" rgb1="0.2 0.3 0.4" rgb2="0.1 0.2 0.3"
|
| 16 |
+
markrgb="0.8 0.8 0.8" width="300" height="300"/>
|
| 17 |
+
<material name="groundplane" texture="groundplane" texuniform="true" texrepeat="5 5" reflectance="0.2"/>
|
| 18 |
+
</asset>
|
| 19 |
+
|
| 20 |
+
<worldbody>
|
| 21 |
+
<light pos="0 0 1.5" dir="0 0 -1" directional="true"/>
|
| 22 |
+
<geom name="floor" size="0 0 0.05" type="plane" material="groundplane"/>
|
| 23 |
+
<!-- Site -->
|
| 24 |
+
<site name="com_marker" pos="0.1 0 0" size="0.05" rgba="1 0 0 1" type="sphere"/>
|
| 25 |
+
</worldbody>
|
| 26 |
+
|
| 27 |
+
<default>
|
| 28 |
+
<geom friction="1.0"/>
|
| 29 |
+
</default>
|
| 30 |
+
</mujoco>
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/model_data/g1/scene_43dof.xml
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<mujoco model="g1_43dof scene">
|
| 2 |
+
<include file="g1_29dof_with_hand.xml"/>
|
| 3 |
+
<!-- Note that the hand model in g1_29dof_with_hand.xml is not stable for simulation. -->
|
| 4 |
+
|
| 5 |
+
<statistic center="0 0 0.5" extent="2.0"/>
|
| 6 |
+
|
| 7 |
+
<visual>
|
| 8 |
+
<headlight diffuse="0.6 0.6 0.6" ambient="0.3 0.3 0.3" specular="0 0 0"/>
|
| 9 |
+
<rgba haze="0.15 0.25 0.35 1"/>
|
| 10 |
+
<global azimuth="-130" elevation="-20"/>
|
| 11 |
+
</visual>
|
| 12 |
+
|
| 13 |
+
<asset>
|
| 14 |
+
<texture type="skybox" builtin="gradient" rgb1="0.3 0.5 0.7" rgb2="0 0 0" width="512" height="3072"/>
|
| 15 |
+
<texture type="2d" name="groundplane" builtin="checker" mark="edge" rgb1="0.2 0.3 0.4" rgb2="0.1 0.2 0.3"
|
| 16 |
+
markrgb="0.8 0.8 0.8" width="300" height="300"/>
|
| 17 |
+
<material name="groundplane" texture="groundplane" texuniform="true" texrepeat="5 5" reflectance="0.2"/>
|
| 18 |
+
</asset>
|
| 19 |
+
|
| 20 |
+
<worldbody>
|
| 21 |
+
<light pos="0 0 1.5" dir="0 0 -1" directional="true"/>
|
| 22 |
+
<geom name="floor" size="0 0 0.05" type="plane" material="groundplane"/>
|
| 23 |
+
<!-- Site -->
|
| 24 |
+
<site name="com_marker" pos="0.1 0 0" size="0.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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import List, Optional, Set, Union
|
| 2 |
+
|
| 3 |
+
import numpy as np
|
| 4 |
+
import pinocchio as pin
|
| 5 |
+
|
| 6 |
+
from decoupled_wbc.control.robot_model.supplemental_info import RobotSupplementalInfo
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class RobotModel:
|
| 10 |
+
def __init__(
|
| 11 |
+
self,
|
| 12 |
+
urdf_path,
|
| 13 |
+
asset_path,
|
| 14 |
+
set_floating_base=False,
|
| 15 |
+
supplemental_info: Optional[RobotSupplementalInfo] = None,
|
| 16 |
+
):
|
| 17 |
+
self.pinocchio_wrapper = pin.RobotWrapper.BuildFromURDF(
|
| 18 |
+
filename=urdf_path,
|
| 19 |
+
package_dirs=[asset_path],
|
| 20 |
+
root_joint=pin.JointModelFreeFlyer() if set_floating_base else None,
|
| 21 |
+
)
|
| 22 |
+
self.is_floating_base_model = set_floating_base
|
| 23 |
+
|
| 24 |
+
self.joint_to_dof_index = {}
|
| 25 |
+
# Assume we only have single-dof joints
|
| 26 |
+
# First two names correspond to universe and floating base joints
|
| 27 |
+
names = (
|
| 28 |
+
self.pinocchio_wrapper.model.names[2:]
|
| 29 |
+
if set_floating_base
|
| 30 |
+
else self.pinocchio_wrapper.model.names[1:]
|
| 31 |
+
)
|
| 32 |
+
for name in names:
|
| 33 |
+
j_id = self.pinocchio_wrapper.model.getJointId(name)
|
| 34 |
+
jmodel = self.pinocchio_wrapper.model.joints[j_id]
|
| 35 |
+
self.joint_to_dof_index[name] = jmodel.idx_q
|
| 36 |
+
|
| 37 |
+
# Store joint limits only for actual joints (excluding floating base)
|
| 38 |
+
# if set floating base is true and the robot can move in the world
|
| 39 |
+
# then we don't want to impose joint limits for the 7 dofs corresponding
|
| 40 |
+
# to the floating base dofs.
|
| 41 |
+
root_nq = 7 if set_floating_base else 0
|
| 42 |
+
self.upper_joint_limits = self.pinocchio_wrapper.model.upperPositionLimit[root_nq:].copy()
|
| 43 |
+
self.lower_joint_limits = self.pinocchio_wrapper.model.lowerPositionLimit[root_nq:].copy()
|
| 44 |
+
|
| 45 |
+
# Set up supplemental info if provided
|
| 46 |
+
self.supplemental_info = supplemental_info
|
| 47 |
+
if self.supplemental_info is not None:
|
| 48 |
+
# Cache indices for body and hand actuated joints separately
|
| 49 |
+
self._body_actuated_joint_indices = [
|
| 50 |
+
self.dof_index(name) for name in self.supplemental_info.body_actuated_joints
|
| 51 |
+
]
|
| 52 |
+
self._left_hand_actuated_joint_indices = [
|
| 53 |
+
self.dof_index(name) for name in self.supplemental_info.left_hand_actuated_joints
|
| 54 |
+
]
|
| 55 |
+
self._right_hand_actuated_joint_indices = [
|
| 56 |
+
self.dof_index(name) for name in self.supplemental_info.right_hand_actuated_joints
|
| 57 |
+
]
|
| 58 |
+
self._hand_actuated_joint_indices = (
|
| 59 |
+
self._left_hand_actuated_joint_indices + self._right_hand_actuated_joint_indices
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
# Cache indices for joint groups, handling nested groups
|
| 63 |
+
self._joint_group_indices = {}
|
| 64 |
+
for group_name, group_info in self.supplemental_info.joint_groups.items():
|
| 65 |
+
indices = []
|
| 66 |
+
# Add indices for direct joints
|
| 67 |
+
indices.extend([self.dof_index(name) for name in group_info["joints"]])
|
| 68 |
+
# Add indices from subgroups
|
| 69 |
+
for subgroup_name in group_info["groups"]:
|
| 70 |
+
indices.extend(self.get_joint_group_indices(subgroup_name))
|
| 71 |
+
self._joint_group_indices[group_name] = sorted(set(indices))
|
| 72 |
+
|
| 73 |
+
# Update joint limits from supplemental info if available
|
| 74 |
+
if (
|
| 75 |
+
hasattr(self.supplemental_info, "joint_limits")
|
| 76 |
+
and self.supplemental_info.joint_limits
|
| 77 |
+
):
|
| 78 |
+
for joint_name, limits in self.supplemental_info.joint_limits.items():
|
| 79 |
+
if joint_name in self.joint_to_dof_index:
|
| 80 |
+
idx = self.joint_to_dof_index[joint_name] - root_nq
|
| 81 |
+
self.lower_joint_limits[idx] = limits[0]
|
| 82 |
+
self.upper_joint_limits[idx] = limits[1]
|
| 83 |
+
|
| 84 |
+
# Initialize default body pose
|
| 85 |
+
self.default_body_pose = self.q_zero.copy()
|
| 86 |
+
|
| 87 |
+
# Update with supplemental info if available
|
| 88 |
+
if self.supplemental_info is not None:
|
| 89 |
+
default_joint_q = self.supplemental_info.default_joint_q
|
| 90 |
+
for joint, joint_values in default_joint_q.items():
|
| 91 |
+
# Get the joint name mapping for this type
|
| 92 |
+
joint_mapping = self.supplemental_info.joint_name_mapping[joint]
|
| 93 |
+
|
| 94 |
+
# Handle both single joint names and left/right mappings
|
| 95 |
+
if isinstance(joint_mapping, str):
|
| 96 |
+
# Single joint (e.g., waist joints)
|
| 97 |
+
if joint_mapping in self.joint_to_dof_index:
|
| 98 |
+
joint_idx = self.dof_index(joint_mapping)
|
| 99 |
+
self.default_body_pose[joint_idx] = (
|
| 100 |
+
joint_values # joint_values is the value for single joints
|
| 101 |
+
)
|
| 102 |
+
else:
|
| 103 |
+
# Left/right mapping (e.g., arm joints)
|
| 104 |
+
for side, value in joint_values.items():
|
| 105 |
+
if side in joint_mapping and joint_mapping[side] in self.joint_to_dof_index:
|
| 106 |
+
joint_idx = self.dof_index(joint_mapping[side])
|
| 107 |
+
self.default_body_pose[joint_idx] = value
|
| 108 |
+
|
| 109 |
+
# Initialize initial body pose
|
| 110 |
+
self.initial_body_pose = self.default_body_pose.copy()
|
| 111 |
+
|
| 112 |
+
@property
|
| 113 |
+
def num_dofs(self) -> int:
|
| 114 |
+
"""Get the number of degrees of freedom of the robot (floating base pose + joints)."""
|
| 115 |
+
return self.pinocchio_wrapper.model.nq
|
| 116 |
+
|
| 117 |
+
@property
|
| 118 |
+
def q_zero(self) -> np.ndarray:
|
| 119 |
+
"""Get the zero pose of the robot."""
|
| 120 |
+
return self.pinocchio_wrapper.q0
|
| 121 |
+
|
| 122 |
+
@property
|
| 123 |
+
def joint_names(self) -> List[str]:
|
| 124 |
+
"""Get the names of the joints of the robot."""
|
| 125 |
+
return list(self.joint_to_dof_index.keys())
|
| 126 |
+
|
| 127 |
+
@property
|
| 128 |
+
def num_joints(self) -> int:
|
| 129 |
+
"""Get the number of joints of the robot."""
|
| 130 |
+
return len(self.joint_to_dof_index)
|
| 131 |
+
|
| 132 |
+
def dof_index(self, joint_name: str) -> int:
|
| 133 |
+
"""
|
| 134 |
+
Get the index in the degrees of freedom vector corresponding
|
| 135 |
+
to the single-DoF joint with name `joint_name`.
|
| 136 |
+
"""
|
| 137 |
+
if joint_name not in self.joint_to_dof_index:
|
| 138 |
+
raise ValueError(
|
| 139 |
+
f"Unknown joint name: '{joint_name}'. "
|
| 140 |
+
f"Available joints: {list(self.joint_to_dof_index.keys())}"
|
| 141 |
+
)
|
| 142 |
+
return self.joint_to_dof_index[joint_name]
|
| 143 |
+
|
| 144 |
+
def get_body_actuated_joint_indices(self) -> List[int]:
|
| 145 |
+
"""
|
| 146 |
+
Get the indices of body actuated joints in the full configuration.
|
| 147 |
+
Ordering is that of the actuated joints as defined in the supplemental info.
|
| 148 |
+
Requires supplemental_info to be provided.
|
| 149 |
+
"""
|
| 150 |
+
if self.supplemental_info is None:
|
| 151 |
+
raise ValueError("supplemental_info must be provided to use this method")
|
| 152 |
+
return self._body_actuated_joint_indices
|
| 153 |
+
|
| 154 |
+
def get_hand_actuated_joint_indices(self, side: str = "both") -> List[int]:
|
| 155 |
+
"""
|
| 156 |
+
Get the indices of hand actuated joints in the full configuration.
|
| 157 |
+
Ordering is that of the actuated joints as defined in the supplemental info.
|
| 158 |
+
Requires supplemental_info to be provided.
|
| 159 |
+
|
| 160 |
+
Args:
|
| 161 |
+
side: String specifying which hand to get indices for ('left', 'right', or 'both')
|
| 162 |
+
"""
|
| 163 |
+
if self.supplemental_info is None:
|
| 164 |
+
raise ValueError("supplemental_info must be provided to use this method")
|
| 165 |
+
|
| 166 |
+
if side.lower() == "both":
|
| 167 |
+
return self._hand_actuated_joint_indices
|
| 168 |
+
elif side.lower() == "left":
|
| 169 |
+
return self._left_hand_actuated_joint_indices
|
| 170 |
+
elif side.lower() == "right":
|
| 171 |
+
return self._right_hand_actuated_joint_indices
|
| 172 |
+
else:
|
| 173 |
+
raise ValueError("side must be 'left', 'right', or 'both'")
|
| 174 |
+
|
| 175 |
+
def get_joint_group_indices(self, group_names: Union[str, Set[str]]) -> List[int]:
|
| 176 |
+
"""
|
| 177 |
+
Get the indices of joints in one or more groups in the full configuration.
|
| 178 |
+
Requires supplemental_info to be provided.
|
| 179 |
+
The returned indices are sorted in ascending order, so that the joint ordering
|
| 180 |
+
of the full model is preserved.
|
| 181 |
+
|
| 182 |
+
Args:
|
| 183 |
+
group_names: Either a single group name (str) or a set of group names (Set[str])
|
| 184 |
+
|
| 185 |
+
Returns:
|
| 186 |
+
List of joint indices in sorted order with no duplicates
|
| 187 |
+
"""
|
| 188 |
+
if self.supplemental_info is None:
|
| 189 |
+
raise ValueError("supplemental_info must be provided to use this method")
|
| 190 |
+
|
| 191 |
+
# Convert single string to set for uniform handling
|
| 192 |
+
if isinstance(group_names, str):
|
| 193 |
+
group_names = {group_names}
|
| 194 |
+
|
| 195 |
+
# Collect indices from all groups
|
| 196 |
+
all_indices = set()
|
| 197 |
+
for group_name in group_names:
|
| 198 |
+
if group_name not in self._joint_group_indices:
|
| 199 |
+
raise ValueError(f"Unknown joint group: {group_name}")
|
| 200 |
+
all_indices.update(self._joint_group_indices[group_name])
|
| 201 |
+
|
| 202 |
+
return sorted(all_indices)
|
| 203 |
+
|
| 204 |
+
def cache_forward_kinematics(self, q: np.ndarray, auto_clip=True) -> None:
|
| 205 |
+
"""
|
| 206 |
+
Perform forward kinematics to update the pose of every joint and frame
|
| 207 |
+
in the Pinocchio data structures for the given configuration `q`.
|
| 208 |
+
|
| 209 |
+
:param q: A numpy array of shape (num_dofs,) representing the robot configuration.
|
| 210 |
+
"""
|
| 211 |
+
if q.shape[0] != self.num_dofs:
|
| 212 |
+
raise ValueError(f"Expected q of length {self.num_dofs}, got {q.shape[0]} instead.")
|
| 213 |
+
|
| 214 |
+
# Apply auto-clip if enabled
|
| 215 |
+
if auto_clip:
|
| 216 |
+
q = self.clip_configuration(q)
|
| 217 |
+
|
| 218 |
+
pin.framesForwardKinematics(self.pinocchio_wrapper.model, self.pinocchio_wrapper.data, q)
|
| 219 |
+
|
| 220 |
+
def compute_gravity_compensation_torques(
|
| 221 |
+
self, q: np.ndarray, joint_groups: Union[str, List[str], Set[str]] = None, auto_clip=True
|
| 222 |
+
) -> np.ndarray:
|
| 223 |
+
"""
|
| 224 |
+
Compute gravity compensation torques for specified joint groups using pinocchio.
|
| 225 |
+
|
| 226 |
+
:param q: Robot configuration (joint positions)
|
| 227 |
+
:param joint_groups: Joint groups to compensate (e.g., "arms", ["left_arm", "waist"],
|
| 228 |
+
{"left_arm", "waist"}). If None, compensates all joints
|
| 229 |
+
:param auto_clip: Whether to automatically clip joint values to limits
|
| 230 |
+
:return: Array of gravity compensation torques for all DOFs (zero for non-compensated joints)
|
| 231 |
+
"""
|
| 232 |
+
if q.shape[0] != self.num_dofs:
|
| 233 |
+
raise ValueError(f"Expected q of length {self.num_dofs}, got {q.shape[0]} instead.")
|
| 234 |
+
|
| 235 |
+
# Apply auto-clip if enabled
|
| 236 |
+
if auto_clip:
|
| 237 |
+
q = self.clip_configuration(q)
|
| 238 |
+
|
| 239 |
+
try:
|
| 240 |
+
# Cache forward kinematics for the current configuration
|
| 241 |
+
self.cache_forward_kinematics(q, auto_clip=False) # Already clipped if needed
|
| 242 |
+
|
| 243 |
+
# Compute gravity vector using RNEA with zero velocity and acceleration
|
| 244 |
+
v = np.zeros(self.num_dofs)
|
| 245 |
+
a = np.zeros(self.num_dofs)
|
| 246 |
+
|
| 247 |
+
gravity_torques_full = pin.rnea(
|
| 248 |
+
self.pinocchio_wrapper.model, self.pinocchio_wrapper.data, q, v, a
|
| 249 |
+
)
|
| 250 |
+
|
| 251 |
+
# If no joint groups specified, return full gravity torques
|
| 252 |
+
if joint_groups is None:
|
| 253 |
+
return gravity_torques_full
|
| 254 |
+
|
| 255 |
+
# Convert list to set for get_joint_group_indices compatibility
|
| 256 |
+
if isinstance(joint_groups, list):
|
| 257 |
+
joint_groups = set(joint_groups)
|
| 258 |
+
|
| 259 |
+
# Get joint indices for specified groups - get_joint_group_indices handles str and Set[str]
|
| 260 |
+
try:
|
| 261 |
+
compensated_joint_indices = self.get_joint_group_indices(joint_groups)
|
| 262 |
+
except ValueError as e:
|
| 263 |
+
raise ValueError(f"Error resolving joint groups {joint_groups}: {e}")
|
| 264 |
+
|
| 265 |
+
# Create mask for joints that should receive gravity compensation
|
| 266 |
+
compensation_mask = np.zeros(self.num_dofs, dtype=bool)
|
| 267 |
+
for joint_idx in compensated_joint_indices:
|
| 268 |
+
if 0 <= joint_idx < len(compensation_mask):
|
| 269 |
+
compensation_mask[joint_idx] = True
|
| 270 |
+
|
| 271 |
+
# Apply mask to only compensate specified joints
|
| 272 |
+
compensated_torques = np.zeros_like(gravity_torques_full)
|
| 273 |
+
compensated_torques[compensation_mask] = gravity_torques_full[compensation_mask]
|
| 274 |
+
|
| 275 |
+
return compensated_torques
|
| 276 |
+
|
| 277 |
+
except Exception as e:
|
| 278 |
+
raise RuntimeError(f"Error computing gravity compensation: {e}")
|
| 279 |
+
|
| 280 |
+
def clip_configuration(self, q: np.ndarray, margin: float = 1e-6) -> np.ndarray:
|
| 281 |
+
"""
|
| 282 |
+
Clip the configuration to stay within joint limits with a small tolerance.
|
| 283 |
+
|
| 284 |
+
:param q: Configuration to clip
|
| 285 |
+
:param margin: Tolerance to keep away from joint limits
|
| 286 |
+
:return: Clipped configuration
|
| 287 |
+
"""
|
| 288 |
+
q_clipped = q.copy()
|
| 289 |
+
|
| 290 |
+
# Only clip joint positions, not floating base
|
| 291 |
+
root_nq = 7 if self.is_floating_base_model else 0
|
| 292 |
+
q_clipped[root_nq:] = np.clip(
|
| 293 |
+
q[root_nq:], self.lower_joint_limits + margin, self.upper_joint_limits - margin
|
| 294 |
+
)
|
| 295 |
+
|
| 296 |
+
return q_clipped
|
| 297 |
+
|
| 298 |
+
def frame_placement(self, frame_name: str) -> pin.SE3:
|
| 299 |
+
"""
|
| 300 |
+
Returns the SE3 transform of the specified frame in the world coordinate system.
|
| 301 |
+
Note: make sure cache_forward_kinematics() has been previously called.
|
| 302 |
+
|
| 303 |
+
:param frame_name: Name of the frame, e.g. "link_elbow_frame", "hand_imu_frame", etc.
|
| 304 |
+
:return: A pin.SE3 object representing the pose of the frame.
|
| 305 |
+
"""
|
| 306 |
+
model = self.pinocchio_wrapper.model
|
| 307 |
+
data = self.pinocchio_wrapper.data
|
| 308 |
+
|
| 309 |
+
frame_id = model.getFrameId(frame_name)
|
| 310 |
+
if frame_id < 0 or frame_id >= len(model.frames):
|
| 311 |
+
valid_frames = [f.name for f in model.frames]
|
| 312 |
+
raise ValueError(f"Unknown frame '{frame_name}'. Valid frames: {valid_frames}")
|
| 313 |
+
|
| 314 |
+
# Pinocchio's data.oMf[frame_id] is a pin.SE3.
|
| 315 |
+
return data.oMf[frame_id].copy()
|
| 316 |
+
|
| 317 |
+
def get_body_actuated_joints(self, q: np.ndarray) -> np.ndarray:
|
| 318 |
+
"""
|
| 319 |
+
Get the configuration of body actuated joints from a full configuration.
|
| 320 |
+
|
| 321 |
+
:param q: Configuration in full space
|
| 322 |
+
:return: Configuration of body actuated joints
|
| 323 |
+
"""
|
| 324 |
+
indices = self.get_body_actuated_joint_indices()
|
| 325 |
+
|
| 326 |
+
return q[indices]
|
| 327 |
+
|
| 328 |
+
def get_hand_actuated_joints(self, q: np.ndarray, side: str = "both") -> np.ndarray:
|
| 329 |
+
"""
|
| 330 |
+
Get the configuration of hand actuated joints from a full configuration.
|
| 331 |
+
|
| 332 |
+
Args:
|
| 333 |
+
q: Configuration in full space
|
| 334 |
+
side: String specifying which hand to get joints for ('left', 'right', or 'both')
|
| 335 |
+
"""
|
| 336 |
+
indices = self.get_hand_actuated_joint_indices(side)
|
| 337 |
+
return q[indices]
|
| 338 |
+
|
| 339 |
+
def get_configuration_from_actuated_joints(
|
| 340 |
+
self,
|
| 341 |
+
body_actuated_joint_values: np.ndarray,
|
| 342 |
+
hand_actuated_joint_values: Optional[np.ndarray] = None,
|
| 343 |
+
left_hand_actuated_joint_values: Optional[np.ndarray] = None,
|
| 344 |
+
right_hand_actuated_joint_values: Optional[np.ndarray] = None,
|
| 345 |
+
) -> np.ndarray:
|
| 346 |
+
"""
|
| 347 |
+
Get the full configuration from the body and hand actuated joint configurations.
|
| 348 |
+
Can specify either both hands together or left and right hands separately.
|
| 349 |
+
|
| 350 |
+
Args:
|
| 351 |
+
body_actuated_joint_values: Configuration of body actuated joints
|
| 352 |
+
hand_actuated_joint_values: Configuration of both hands' actuated joints (optional)
|
| 353 |
+
left_hand_actuated_joint_values: Configuration of left hand actuated joints (optional)
|
| 354 |
+
right_hand_actuated_joint_values: Configuration of right hand actuated joints (optional)
|
| 355 |
+
|
| 356 |
+
Returns:
|
| 357 |
+
Full configuration including body and hand joints
|
| 358 |
+
"""
|
| 359 |
+
q = self.pinocchio_wrapper.q0.copy()
|
| 360 |
+
q[self.get_body_actuated_joint_indices()] = body_actuated_joint_values
|
| 361 |
+
|
| 362 |
+
# Handle hand configurations
|
| 363 |
+
if hand_actuated_joint_values is not None:
|
| 364 |
+
# Use combined hand configuration
|
| 365 |
+
q[self.get_hand_actuated_joint_indices("both")] = hand_actuated_joint_values
|
| 366 |
+
else:
|
| 367 |
+
# Use separate hand configurations
|
| 368 |
+
if left_hand_actuated_joint_values is not None:
|
| 369 |
+
q[self.get_hand_actuated_joint_indices("left")] = left_hand_actuated_joint_values
|
| 370 |
+
if right_hand_actuated_joint_values is not None:
|
| 371 |
+
q[self.get_hand_actuated_joint_indices("right")] = right_hand_actuated_joint_values
|
| 372 |
+
|
| 373 |
+
return q
|
| 374 |
+
|
| 375 |
+
def reset_forward_kinematics(self) -> None:
|
| 376 |
+
"""
|
| 377 |
+
Reset the forward kinematics to the initial configuration.
|
| 378 |
+
"""
|
| 379 |
+
self.cache_forward_kinematics(self.q_zero)
|
| 380 |
+
|
| 381 |
+
def get_initial_upper_body_pose(self) -> np.ndarray:
|
| 382 |
+
"""
|
| 383 |
+
Get the initial upper body pose of the robot.
|
| 384 |
+
"""
|
| 385 |
+
return self.initial_body_pose[self.get_joint_group_indices("upper_body")]
|
| 386 |
+
|
| 387 |
+
def get_default_body_pose(self) -> np.ndarray:
|
| 388 |
+
"""
|
| 389 |
+
Get the default body pose of the robot.
|
| 390 |
+
"""
|
| 391 |
+
return self.default_body_pose
|
| 392 |
+
|
| 393 |
+
def set_initial_body_pose(self, q: np.ndarray, q_idx=None) -> None:
|
| 394 |
+
"""
|
| 395 |
+
Set the initial body pose of the robot.
|
| 396 |
+
"""
|
| 397 |
+
if q_idx is None:
|
| 398 |
+
self.initial_body_pose = q
|
| 399 |
+
else:
|
| 400 |
+
self.initial_body_pose[q_idx] = q
|
| 401 |
+
|
| 402 |
+
|
| 403 |
+
class ReducedRobotModel(RobotModel):
|
| 404 |
+
"""
|
| 405 |
+
A class that creates a reduced order robot model by fixing certain joints.
|
| 406 |
+
This class maintains a mapping between the reduced state space and the full state space.
|
| 407 |
+
"""
|
| 408 |
+
|
| 409 |
+
def __init__(
|
| 410 |
+
self,
|
| 411 |
+
full_robot_model: RobotModel,
|
| 412 |
+
fixed_joints: List[str],
|
| 413 |
+
fixed_values: Optional[List[float]] = None,
|
| 414 |
+
):
|
| 415 |
+
"""
|
| 416 |
+
Create a reduced order robot model by fixing specified joints.
|
| 417 |
+
|
| 418 |
+
:param full_robot_model: The original robot model
|
| 419 |
+
:param fixed_joints: List of joint names to fix
|
| 420 |
+
:param fixed_values: Optional list of values to fix the joints to. If None, uses the initial
|
| 421 |
+
joint positions (q0) from the full robot model.
|
| 422 |
+
"""
|
| 423 |
+
self.full_robot = full_robot_model
|
| 424 |
+
self.supplemental_info = full_robot_model.supplemental_info
|
| 425 |
+
|
| 426 |
+
# If fixed_values is None, use q0 from the full robot model
|
| 427 |
+
if fixed_values is None:
|
| 428 |
+
fixed_values = []
|
| 429 |
+
for joint_name in fixed_joints:
|
| 430 |
+
full_idx = full_robot_model.dof_index(joint_name)
|
| 431 |
+
fixed_values.append(full_robot_model.pinocchio_wrapper.q0[full_idx])
|
| 432 |
+
elif len(fixed_joints) != len(fixed_values):
|
| 433 |
+
raise ValueError("fixed_joints and fixed_values must have the same length")
|
| 434 |
+
|
| 435 |
+
# Store fixed joints and their values
|
| 436 |
+
self.fixed_joints = fixed_joints
|
| 437 |
+
self.fixed_values = fixed_values
|
| 438 |
+
|
| 439 |
+
# Create mapping between reduced and full state spaces
|
| 440 |
+
self.reduced_to_full = []
|
| 441 |
+
self.full_to_reduced = {}
|
| 442 |
+
|
| 443 |
+
# Initialize with floating base indices if present
|
| 444 |
+
if full_robot_model.is_floating_base_model:
|
| 445 |
+
self.reduced_to_full.extend(range(7)) # Floating base indices
|
| 446 |
+
for i in range(7):
|
| 447 |
+
self.full_to_reduced[i] = i
|
| 448 |
+
|
| 449 |
+
# Add active joint indices
|
| 450 |
+
for joint_name in full_robot_model.joint_names:
|
| 451 |
+
if joint_name not in fixed_joints:
|
| 452 |
+
full_idx = full_robot_model.dof_index(joint_name)
|
| 453 |
+
reduced_idx = len(self.reduced_to_full)
|
| 454 |
+
self.reduced_to_full.append(full_idx)
|
| 455 |
+
self.full_to_reduced[full_idx] = reduced_idx
|
| 456 |
+
|
| 457 |
+
# Create a reduced Pinocchio model using buildReducedModel
|
| 458 |
+
# First, get the list of joint IDs to lock
|
| 459 |
+
locked_joint_ids = []
|
| 460 |
+
for joint_name in fixed_joints:
|
| 461 |
+
joint_id = full_robot_model.pinocchio_wrapper.model.getJointId(joint_name)
|
| 462 |
+
if (full_robot_model.is_floating_base_model and joint_id > 1) or (
|
| 463 |
+
not full_robot_model.is_floating_base_model and joint_id > 0
|
| 464 |
+
):
|
| 465 |
+
locked_joint_ids.append(joint_id)
|
| 466 |
+
|
| 467 |
+
# First build the reduced kinematic model
|
| 468 |
+
reduced_model = pin.buildReducedModel(
|
| 469 |
+
full_robot_model.pinocchio_wrapper.model,
|
| 470 |
+
locked_joint_ids,
|
| 471 |
+
full_robot_model.pinocchio_wrapper.q0,
|
| 472 |
+
)
|
| 473 |
+
|
| 474 |
+
# Then build the reduced geometry models using the reduced kinematic model
|
| 475 |
+
self.pinocchio_wrapper = pin.RobotWrapper(
|
| 476 |
+
model=reduced_model,
|
| 477 |
+
)
|
| 478 |
+
|
| 479 |
+
# Create joint to dof index mapping
|
| 480 |
+
self.joint_to_dof_index = {}
|
| 481 |
+
# Assume we only have single-dof joints
|
| 482 |
+
# First two names correspond to universe and floating base joints
|
| 483 |
+
names = (
|
| 484 |
+
self.pinocchio_wrapper.model.names[2:]
|
| 485 |
+
if self.full_robot.is_floating_base_model
|
| 486 |
+
else self.pinocchio_wrapper.model.names[1:]
|
| 487 |
+
)
|
| 488 |
+
for name in names:
|
| 489 |
+
j_id = self.pinocchio_wrapper.model.getJointId(name)
|
| 490 |
+
jmodel = self.pinocchio_wrapper.model.joints[j_id]
|
| 491 |
+
self.joint_to_dof_index[name] = jmodel.idx_q
|
| 492 |
+
|
| 493 |
+
# Initialize joint limits
|
| 494 |
+
root_nq = 7 if self.full_robot.is_floating_base_model else 0
|
| 495 |
+
self.lower_joint_limits = self.pinocchio_wrapper.model.lowerPositionLimit[root_nq:].copy()
|
| 496 |
+
self.upper_joint_limits = self.pinocchio_wrapper.model.upperPositionLimit[root_nq:].copy()
|
| 497 |
+
|
| 498 |
+
# Update joint limits from supplemental info if available
|
| 499 |
+
if self.supplemental_info is not None:
|
| 500 |
+
if (
|
| 501 |
+
hasattr(self.supplemental_info, "joint_limits")
|
| 502 |
+
and self.supplemental_info.joint_limits
|
| 503 |
+
):
|
| 504 |
+
for joint_name, limits in self.supplemental_info.joint_limits.items():
|
| 505 |
+
if joint_name in self.joint_to_dof_index:
|
| 506 |
+
idx = self.joint_to_dof_index[joint_name] - root_nq
|
| 507 |
+
self.lower_joint_limits[idx] = limits[0]
|
| 508 |
+
self.upper_joint_limits[idx] = limits[1]
|
| 509 |
+
|
| 510 |
+
# Get full indices for body and hand actuated joints
|
| 511 |
+
full_body_indices = full_robot_model.get_body_actuated_joint_indices()
|
| 512 |
+
full_hand_indices = full_robot_model.get_hand_actuated_joint_indices("both")
|
| 513 |
+
full_left_hand_indices = full_robot_model.get_hand_actuated_joint_indices("left")
|
| 514 |
+
full_right_hand_indices = full_robot_model.get_hand_actuated_joint_indices("right")
|
| 515 |
+
|
| 516 |
+
# Map to reduced indices
|
| 517 |
+
self._body_actuated_joint_indices = []
|
| 518 |
+
for idx in full_body_indices:
|
| 519 |
+
if idx in self.full_to_reduced:
|
| 520 |
+
self._body_actuated_joint_indices.append(self.full_to_reduced[idx])
|
| 521 |
+
|
| 522 |
+
self._hand_actuated_joint_indices = []
|
| 523 |
+
for idx in full_hand_indices:
|
| 524 |
+
if idx in self.full_to_reduced:
|
| 525 |
+
self._hand_actuated_joint_indices.append(self.full_to_reduced[idx])
|
| 526 |
+
|
| 527 |
+
self._left_hand_actuated_joint_indices = []
|
| 528 |
+
for idx in full_left_hand_indices:
|
| 529 |
+
if idx in self.full_to_reduced:
|
| 530 |
+
self._left_hand_actuated_joint_indices.append(self.full_to_reduced[idx])
|
| 531 |
+
|
| 532 |
+
self._right_hand_actuated_joint_indices = []
|
| 533 |
+
for idx in full_right_hand_indices:
|
| 534 |
+
if idx in self.full_to_reduced:
|
| 535 |
+
self._right_hand_actuated_joint_indices.append(self.full_to_reduced[idx])
|
| 536 |
+
|
| 537 |
+
# Cache indices for joint groups in reduced space
|
| 538 |
+
self._joint_group_indices = {}
|
| 539 |
+
for group_name in self.supplemental_info.joint_groups:
|
| 540 |
+
full_indices = full_robot_model.get_joint_group_indices(group_name)
|
| 541 |
+
reduced_indices = []
|
| 542 |
+
for idx in full_indices:
|
| 543 |
+
if idx in self.full_to_reduced:
|
| 544 |
+
reduced_indices.append(self.full_to_reduced[idx])
|
| 545 |
+
self._joint_group_indices[group_name] = sorted(set(reduced_indices))
|
| 546 |
+
|
| 547 |
+
# Initialize default body pose in reduced space
|
| 548 |
+
self.default_body_pose = self.full_to_reduced_configuration(
|
| 549 |
+
full_robot_model.default_body_pose
|
| 550 |
+
)
|
| 551 |
+
|
| 552 |
+
# Initialize initial body pose in reduced space
|
| 553 |
+
self.initial_body_pose = self.full_to_reduced_configuration(
|
| 554 |
+
full_robot_model.initial_body_pose
|
| 555 |
+
)
|
| 556 |
+
|
| 557 |
+
@property
|
| 558 |
+
def num_joints(self) -> int:
|
| 559 |
+
"""Get the number of active joints in the reduced model."""
|
| 560 |
+
return len(self.joint_names)
|
| 561 |
+
|
| 562 |
+
@property
|
| 563 |
+
def joint_names(self) -> List[str]:
|
| 564 |
+
"""Get the names of the active joints in the reduced model."""
|
| 565 |
+
return [name for name in self.full_robot.joint_names if name not in self.fixed_joints]
|
| 566 |
+
|
| 567 |
+
@classmethod
|
| 568 |
+
def from_fixed_groups(
|
| 569 |
+
cls,
|
| 570 |
+
full_robot_model: RobotModel,
|
| 571 |
+
fixed_group_names: List[str],
|
| 572 |
+
fixed_values: Optional[List[float]] = None,
|
| 573 |
+
) -> "ReducedRobotModel":
|
| 574 |
+
"""
|
| 575 |
+
Create a reduced order robot model by fixing all joints in specified groups.
|
| 576 |
+
|
| 577 |
+
:param full_robot_model: The original robot model
|
| 578 |
+
:param fixed_group_names: List of joint group names to fix
|
| 579 |
+
:param fixed_values: Optional list of values to fix the joints to. If None, uses the initial
|
| 580 |
+
joint positions (q0) from the full robot model.
|
| 581 |
+
:return: A ReducedRobotModel instance
|
| 582 |
+
"""
|
| 583 |
+
if full_robot_model.supplemental_info is None:
|
| 584 |
+
raise ValueError("supplemental_info must be provided to use this method")
|
| 585 |
+
|
| 586 |
+
# Get all joints in the groups, including those from subgroups
|
| 587 |
+
fixed_joints = set() # Use a set to avoid duplicates
|
| 588 |
+
|
| 589 |
+
for group_name in fixed_group_names:
|
| 590 |
+
if group_name not in full_robot_model.supplemental_info.joint_groups:
|
| 591 |
+
raise ValueError(f"Unknown joint group: {group_name}")
|
| 592 |
+
|
| 593 |
+
group_info = full_robot_model.supplemental_info.joint_groups[group_name]
|
| 594 |
+
|
| 595 |
+
# Add direct joints
|
| 596 |
+
fixed_joints.update(group_info["joints"])
|
| 597 |
+
|
| 598 |
+
# Add joints from subgroups
|
| 599 |
+
for subgroup_name in group_info["groups"]:
|
| 600 |
+
subgroup_joints = full_robot_model.get_joint_group_indices(subgroup_name)
|
| 601 |
+
fixed_joints.update([full_robot_model.joint_names[idx] for idx in subgroup_joints])
|
| 602 |
+
|
| 603 |
+
# Convert set back to list for compatibility with the original constructor
|
| 604 |
+
return cls(full_robot_model, list(fixed_joints), fixed_values)
|
| 605 |
+
|
| 606 |
+
@classmethod
|
| 607 |
+
def from_fixed_group(
|
| 608 |
+
cls,
|
| 609 |
+
full_robot_model: RobotModel,
|
| 610 |
+
fixed_group_name: str,
|
| 611 |
+
fixed_values: Optional[List[float]] = None,
|
| 612 |
+
) -> "ReducedRobotModel":
|
| 613 |
+
"""
|
| 614 |
+
Create a reduced order robot model by fixing all joints in a specified group.
|
| 615 |
+
This is a convenience method that calls from_fixed_groups with a single group.
|
| 616 |
+
|
| 617 |
+
:param full_robot_model: The original robot model
|
| 618 |
+
:param fixed_group_name: Name of the joint group to fix
|
| 619 |
+
:param fixed_values: Optional list of values to fix the joints to. If None, uses the initial
|
| 620 |
+
joint positions (q0) from the full robot model.
|
| 621 |
+
:return: A ReducedRobotModel instance
|
| 622 |
+
"""
|
| 623 |
+
return cls.from_fixed_groups(full_robot_model, [fixed_group_name], fixed_values)
|
| 624 |
+
|
| 625 |
+
@classmethod
|
| 626 |
+
def from_active_group(
|
| 627 |
+
cls,
|
| 628 |
+
full_robot_model: RobotModel,
|
| 629 |
+
active_group_name: str,
|
| 630 |
+
fixed_values: Optional[List[float]] = None,
|
| 631 |
+
) -> "ReducedRobotModel":
|
| 632 |
+
"""
|
| 633 |
+
Create a reduced order robot model by fixing all joints EXCEPT those in the specified group.
|
| 634 |
+
This is a convenience method that calls from_active_groups with a single group.
|
| 635 |
+
|
| 636 |
+
:param full_robot_model: The original robot model
|
| 637 |
+
:param active_group_name: Name of the joint group to keep active (all other joints will be fixed)
|
| 638 |
+
:param fixed_values: Optional list of values to fix the joints to. If None, uses the initial
|
| 639 |
+
joint positions (q0) from the full robot model.
|
| 640 |
+
:return: A ReducedRobotModel instance
|
| 641 |
+
"""
|
| 642 |
+
return cls.from_active_groups(full_robot_model, [active_group_name], fixed_values)
|
| 643 |
+
|
| 644 |
+
@classmethod
|
| 645 |
+
def from_active_groups(
|
| 646 |
+
cls,
|
| 647 |
+
full_robot_model: RobotModel,
|
| 648 |
+
active_group_names: List[str],
|
| 649 |
+
fixed_values: Optional[List[float]] = None,
|
| 650 |
+
) -> "ReducedRobotModel":
|
| 651 |
+
"""
|
| 652 |
+
Create a reduced order robot model by fixing all joints EXCEPT those in the specified groups.
|
| 653 |
+
This is useful when you want to keep multiple groups active and fix everything else.
|
| 654 |
+
|
| 655 |
+
:param full_robot_model: The original robot model
|
| 656 |
+
:param active_group_names: List of joint group names to keep active (all other joints will be fixed)
|
| 657 |
+
:param fixed_values: Optional list of values to fix the joints to. If None, uses the initial
|
| 658 |
+
joint positions (q0) from the full robot model.
|
| 659 |
+
:return: A ReducedRobotModel instance
|
| 660 |
+
"""
|
| 661 |
+
if full_robot_model.supplemental_info is None:
|
| 662 |
+
raise ValueError("supplemental_info must be provided to use this method")
|
| 663 |
+
|
| 664 |
+
# Get all joints in the active groups, including those from subgroups
|
| 665 |
+
active_joints = set()
|
| 666 |
+
|
| 667 |
+
def add_group_joints(group_name: str):
|
| 668 |
+
if group_name not in full_robot_model.supplemental_info.joint_groups:
|
| 669 |
+
raise ValueError(f"Unknown joint group: {group_name}")
|
| 670 |
+
|
| 671 |
+
group_info = full_robot_model.supplemental_info.joint_groups[group_name]
|
| 672 |
+
|
| 673 |
+
# Add direct joints
|
| 674 |
+
if "joints" in group_info:
|
| 675 |
+
active_joints.update(group_info["joints"])
|
| 676 |
+
|
| 677 |
+
# Add joints from subgroups
|
| 678 |
+
if "groups" in group_info:
|
| 679 |
+
for subgroup_name in group_info["groups"]:
|
| 680 |
+
add_group_joints(subgroup_name)
|
| 681 |
+
|
| 682 |
+
for group_name in active_group_names:
|
| 683 |
+
add_group_joints(group_name)
|
| 684 |
+
|
| 685 |
+
# Get all joints from the model
|
| 686 |
+
all_joints = set(full_robot_model.joint_names)
|
| 687 |
+
|
| 688 |
+
# The fixed joints are all joints minus the active joints
|
| 689 |
+
fixed_joints = list(all_joints - active_joints)
|
| 690 |
+
|
| 691 |
+
return cls(full_robot_model, fixed_joints, fixed_values)
|
| 692 |
+
|
| 693 |
+
def reduced_to_full_configuration(self, q_reduced: np.ndarray) -> np.ndarray:
|
| 694 |
+
"""
|
| 695 |
+
Convert a reduced configuration to the full configuration space.
|
| 696 |
+
|
| 697 |
+
:param q_reduced: Configuration in reduced space
|
| 698 |
+
:return: Configuration in full space with fixed joints set to their fixed values
|
| 699 |
+
"""
|
| 700 |
+
if q_reduced.shape[0] != self.num_dofs:
|
| 701 |
+
raise ValueError(
|
| 702 |
+
f"Expected q_reduced of length {self.num_dofs}, got {q_reduced.shape[0]} instead"
|
| 703 |
+
)
|
| 704 |
+
|
| 705 |
+
q_full = np.zeros(self.full_robot.num_dofs)
|
| 706 |
+
|
| 707 |
+
# Set active joints
|
| 708 |
+
for reduced_idx, full_idx in enumerate(self.reduced_to_full):
|
| 709 |
+
q_full[full_idx] = q_reduced[reduced_idx]
|
| 710 |
+
|
| 711 |
+
# Set fixed joints
|
| 712 |
+
for joint_name, value in zip(self.fixed_joints, self.fixed_values):
|
| 713 |
+
full_idx = self.full_robot.dof_index(joint_name)
|
| 714 |
+
q_full[full_idx] = value
|
| 715 |
+
|
| 716 |
+
return q_full
|
| 717 |
+
|
| 718 |
+
def full_to_reduced_configuration(self, q_full: np.ndarray) -> np.ndarray:
|
| 719 |
+
"""
|
| 720 |
+
Convert a full configuration to the reduced configuration space.
|
| 721 |
+
|
| 722 |
+
:param q_full: Configuration in full space
|
| 723 |
+
:return: Configuration in reduced space
|
| 724 |
+
"""
|
| 725 |
+
if q_full.shape[0] != self.full_robot.num_dofs:
|
| 726 |
+
raise ValueError(
|
| 727 |
+
f"Expected q_full of length {self.full_robot.num_dofs}, got {q_full.shape[0]} instead"
|
| 728 |
+
)
|
| 729 |
+
|
| 730 |
+
q_reduced = np.zeros(self.num_dofs)
|
| 731 |
+
|
| 732 |
+
# Copy active joints
|
| 733 |
+
for reduced_idx, full_idx in enumerate(self.reduced_to_full):
|
| 734 |
+
q_reduced[reduced_idx] = q_full[full_idx]
|
| 735 |
+
|
| 736 |
+
return q_reduced
|
| 737 |
+
|
| 738 |
+
def cache_forward_kinematics(self, q_reduced: np.ndarray, auto_clip=True) -> None:
|
| 739 |
+
"""
|
| 740 |
+
Perform forward kinematics using the reduced configuration.
|
| 741 |
+
|
| 742 |
+
:param q_reduced: Configuration in reduced space
|
| 743 |
+
"""
|
| 744 |
+
# First update the full robot's forward kinematics
|
| 745 |
+
q_full = self.reduced_to_full_configuration(q_reduced)
|
| 746 |
+
self.full_robot.cache_forward_kinematics(q_full, auto_clip)
|
| 747 |
+
|
| 748 |
+
# Then update the reduced model's forward kinematics
|
| 749 |
+
pin.framesForwardKinematics(
|
| 750 |
+
self.pinocchio_wrapper.model, self.pinocchio_wrapper.data, q_reduced
|
| 751 |
+
)
|
| 752 |
+
|
| 753 |
+
def clip_configuration(self, q_reduced: np.ndarray, margin: float = 1e-6) -> np.ndarray:
|
| 754 |
+
"""
|
| 755 |
+
Clip the reduced configuration to stay within joint limits with a small tolerance.
|
| 756 |
+
|
| 757 |
+
:param q_reduced: Configuration to clip
|
| 758 |
+
:param margin: Tolerance to keep away from joint limits
|
| 759 |
+
:return: Clipped configuration
|
| 760 |
+
"""
|
| 761 |
+
q_full = self.reduced_to_full_configuration(q_reduced)
|
| 762 |
+
q_full_clipped = self.full_robot.clip_configuration(q_full, margin)
|
| 763 |
+
return self.full_to_reduced_configuration(q_full_clipped)
|
| 764 |
+
|
| 765 |
+
def reset_forward_kinematics(self):
|
| 766 |
+
"""
|
| 767 |
+
Reset the forward kinematics to the initial configuration.
|
| 768 |
+
"""
|
| 769 |
+
# Reset full robot's forward kinematics
|
| 770 |
+
self.full_robot.reset_forward_kinematics()
|
| 771 |
+
# Reset reduced model's forward kinematics
|
| 772 |
+
self.cache_forward_kinematics(self.q_zero)
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/supplemental_info/__init__.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from decoupled_wbc.control.robot_model.supplemental_info.robot_supplemental_info import (
|
| 2 |
+
RobotSupplementalInfo,
|
| 3 |
+
)
|
| 4 |
+
|
| 5 |
+
__all__ = ["RobotSupplementalInfo"]
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/supplemental_info/g1/__init__.py
ADDED
|
File without changes
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/supplemental_info/g1/g1_supplemental_info.py
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from dataclasses import dataclass
|
| 2 |
+
from enum import Enum
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
from decoupled_wbc.control.robot_model.supplemental_info.robot_supplemental_info import (
|
| 7 |
+
RobotSupplementalInfo,
|
| 8 |
+
)
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class WaistLocation(Enum):
|
| 12 |
+
"""Enum for waist location configuration."""
|
| 13 |
+
|
| 14 |
+
LOWER_BODY = "lower_body"
|
| 15 |
+
UPPER_BODY = "upper_body"
|
| 16 |
+
LOWER_AND_UPPER_BODY = "lower_and_upper_body"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class ElbowPose(Enum):
|
| 20 |
+
"""Enum for elbow pose configuration."""
|
| 21 |
+
|
| 22 |
+
LOW = "low"
|
| 23 |
+
HIGH = "high"
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
@dataclass
|
| 27 |
+
class G1SupplementalInfo(RobotSupplementalInfo):
|
| 28 |
+
"""
|
| 29 |
+
Supplemental information for the G1 robot.
|
| 30 |
+
|
| 31 |
+
Args:
|
| 32 |
+
waist_location: Where to place waist joints in the joint groups
|
| 33 |
+
elbow_pose: Which elbow pose configuration to use for default joint positions
|
| 34 |
+
"""
|
| 35 |
+
|
| 36 |
+
def __init__(
|
| 37 |
+
self,
|
| 38 |
+
waist_location: WaistLocation = WaistLocation.LOWER_BODY,
|
| 39 |
+
elbow_pose: ElbowPose = ElbowPose.LOW,
|
| 40 |
+
):
|
| 41 |
+
name = "G1_G1ThreeFinger"
|
| 42 |
+
|
| 43 |
+
# Define all actuated joints
|
| 44 |
+
body_actuated_joints = [
|
| 45 |
+
# Left leg
|
| 46 |
+
"left_hip_pitch_joint",
|
| 47 |
+
"left_hip_roll_joint",
|
| 48 |
+
"left_hip_yaw_joint",
|
| 49 |
+
"left_knee_joint",
|
| 50 |
+
"left_ankle_pitch_joint",
|
| 51 |
+
"left_ankle_roll_joint",
|
| 52 |
+
# Right leg
|
| 53 |
+
"right_hip_pitch_joint",
|
| 54 |
+
"right_hip_roll_joint",
|
| 55 |
+
"right_hip_yaw_joint",
|
| 56 |
+
"right_knee_joint",
|
| 57 |
+
"right_ankle_pitch_joint",
|
| 58 |
+
"right_ankle_roll_joint",
|
| 59 |
+
# Waist
|
| 60 |
+
"waist_yaw_joint",
|
| 61 |
+
"waist_roll_joint",
|
| 62 |
+
"waist_pitch_joint",
|
| 63 |
+
# Left arm
|
| 64 |
+
"left_shoulder_pitch_joint",
|
| 65 |
+
"left_shoulder_roll_joint",
|
| 66 |
+
"left_shoulder_yaw_joint",
|
| 67 |
+
"left_elbow_joint",
|
| 68 |
+
"left_wrist_roll_joint",
|
| 69 |
+
"left_wrist_pitch_joint",
|
| 70 |
+
"left_wrist_yaw_joint",
|
| 71 |
+
# Right arm
|
| 72 |
+
"right_shoulder_pitch_joint",
|
| 73 |
+
"right_shoulder_roll_joint",
|
| 74 |
+
"right_shoulder_yaw_joint",
|
| 75 |
+
"right_elbow_joint",
|
| 76 |
+
"right_wrist_roll_joint",
|
| 77 |
+
"right_wrist_pitch_joint",
|
| 78 |
+
"right_wrist_yaw_joint",
|
| 79 |
+
]
|
| 80 |
+
|
| 81 |
+
left_hand_actuated_joints = [
|
| 82 |
+
# Left hand
|
| 83 |
+
"left_hand_thumb_0_joint",
|
| 84 |
+
"left_hand_thumb_1_joint",
|
| 85 |
+
"left_hand_thumb_2_joint",
|
| 86 |
+
"left_hand_index_0_joint",
|
| 87 |
+
"left_hand_index_1_joint",
|
| 88 |
+
"left_hand_middle_0_joint",
|
| 89 |
+
"left_hand_middle_1_joint",
|
| 90 |
+
]
|
| 91 |
+
|
| 92 |
+
right_hand_actuated_joints = [
|
| 93 |
+
# Right hand
|
| 94 |
+
"right_hand_thumb_0_joint",
|
| 95 |
+
"right_hand_thumb_1_joint",
|
| 96 |
+
"right_hand_thumb_2_joint",
|
| 97 |
+
"right_hand_index_0_joint",
|
| 98 |
+
"right_hand_index_1_joint",
|
| 99 |
+
"right_hand_middle_0_joint",
|
| 100 |
+
"right_hand_middle_1_joint",
|
| 101 |
+
]
|
| 102 |
+
|
| 103 |
+
# Define joint limits from URDF
|
| 104 |
+
joint_limits = {
|
| 105 |
+
# Left leg
|
| 106 |
+
"left_hip_pitch_joint": [-2.5307, 2.8798],
|
| 107 |
+
"left_hip_roll_joint": [-0.5236, 2.9671],
|
| 108 |
+
"left_hip_yaw_joint": [-2.7576, 2.7576],
|
| 109 |
+
"left_knee_joint": [-0.087267, 2.8798],
|
| 110 |
+
"left_ankle_pitch_joint": [-0.87267, 0.5236],
|
| 111 |
+
"left_ankle_roll_joint": [-0.2618, 0.2618],
|
| 112 |
+
# Right leg
|
| 113 |
+
"right_hip_pitch_joint": [-2.5307, 2.8798],
|
| 114 |
+
"right_hip_roll_joint": [-2.9671, 0.5236],
|
| 115 |
+
"right_hip_yaw_joint": [-2.7576, 2.7576],
|
| 116 |
+
"right_knee_joint": [-0.087267, 2.8798],
|
| 117 |
+
"right_ankle_pitch_joint": [-0.87267, 0.5236],
|
| 118 |
+
"right_ankle_roll_joint": [-0.2618, 0.2618],
|
| 119 |
+
# Waist
|
| 120 |
+
"waist_yaw_joint": [-2.618, 2.618],
|
| 121 |
+
"waist_roll_joint": [-0.52, 0.52],
|
| 122 |
+
"waist_pitch_joint": [-0.52, 0.52],
|
| 123 |
+
# Left arm
|
| 124 |
+
"left_shoulder_pitch_joint": [-3.0892, 2.6704],
|
| 125 |
+
"left_shoulder_roll_joint": [0.19, 2.2515],
|
| 126 |
+
"left_shoulder_yaw_joint": [-2.618, 2.618],
|
| 127 |
+
"left_elbow_joint": [-1.0472, 2.0944],
|
| 128 |
+
"left_wrist_roll_joint": [-1.972222054, 1.972222054],
|
| 129 |
+
"left_wrist_pitch_joint": [-1.614429558, 1.614429558],
|
| 130 |
+
"left_wrist_yaw_joint": [-1.614429558, 1.614429558],
|
| 131 |
+
# Right arm
|
| 132 |
+
"right_shoulder_pitch_joint": [-3.0892, 2.6704],
|
| 133 |
+
"right_shoulder_roll_joint": [-2.2515, -0.19],
|
| 134 |
+
"right_shoulder_yaw_joint": [-2.618, 2.618],
|
| 135 |
+
"right_elbow_joint": [-1.0472, 2.0944],
|
| 136 |
+
"right_wrist_roll_joint": [-1.972222054, 1.972222054],
|
| 137 |
+
"right_wrist_pitch_joint": [-1.614429558, 1.614429558],
|
| 138 |
+
"right_wrist_yaw_joint": [-1.614429558, 1.614429558],
|
| 139 |
+
# Left hand
|
| 140 |
+
"left_hand_thumb_0_joint": [-1.04719755, 1.04719755],
|
| 141 |
+
"left_hand_thumb_1_joint": [-0.72431163, 1.04719755],
|
| 142 |
+
"left_hand_thumb_2_joint": [0, 1.74532925],
|
| 143 |
+
"left_hand_index_0_joint": [-1.57079632, 0],
|
| 144 |
+
"left_hand_index_1_joint": [-1.74532925, 0],
|
| 145 |
+
"left_hand_middle_0_joint": [-1.57079632, 0],
|
| 146 |
+
"left_hand_middle_1_joint": [-1.74532925, 0],
|
| 147 |
+
# Right hand
|
| 148 |
+
"right_hand_thumb_0_joint": [-1.04719755, 1.04719755],
|
| 149 |
+
"right_hand_thumb_1_joint": [-0.72431163, 1.04719755],
|
| 150 |
+
"right_hand_thumb_2_joint": [0, 1.74532925],
|
| 151 |
+
"right_hand_index_0_joint": [-1.57079632, 0],
|
| 152 |
+
"right_hand_index_1_joint": [-1.74532925, 0],
|
| 153 |
+
"right_hand_middle_0_joint": [-1.57079632, 0],
|
| 154 |
+
"right_hand_middle_1_joint": [-1.74532925, 0],
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
# Define joint groups
|
| 158 |
+
joint_groups = {
|
| 159 |
+
# Body groups
|
| 160 |
+
"waist": {
|
| 161 |
+
"joints": ["waist_yaw_joint", "waist_roll_joint", "waist_pitch_joint"],
|
| 162 |
+
"groups": [],
|
| 163 |
+
},
|
| 164 |
+
# Leg groups
|
| 165 |
+
"left_leg": {
|
| 166 |
+
"joints": [
|
| 167 |
+
"left_hip_pitch_joint",
|
| 168 |
+
"left_hip_roll_joint",
|
| 169 |
+
"left_hip_yaw_joint",
|
| 170 |
+
"left_knee_joint",
|
| 171 |
+
"left_ankle_pitch_joint",
|
| 172 |
+
"left_ankle_roll_joint",
|
| 173 |
+
],
|
| 174 |
+
"groups": [],
|
| 175 |
+
},
|
| 176 |
+
"right_leg": {
|
| 177 |
+
"joints": [
|
| 178 |
+
"right_hip_pitch_joint",
|
| 179 |
+
"right_hip_roll_joint",
|
| 180 |
+
"right_hip_yaw_joint",
|
| 181 |
+
"right_knee_joint",
|
| 182 |
+
"right_ankle_pitch_joint",
|
| 183 |
+
"right_ankle_roll_joint",
|
| 184 |
+
],
|
| 185 |
+
"groups": [],
|
| 186 |
+
},
|
| 187 |
+
"legs": {"joints": [], "groups": ["left_leg", "right_leg"]},
|
| 188 |
+
# Arm groups
|
| 189 |
+
"left_arm": {
|
| 190 |
+
"joints": [
|
| 191 |
+
"left_shoulder_pitch_joint",
|
| 192 |
+
"left_shoulder_roll_joint",
|
| 193 |
+
"left_shoulder_yaw_joint",
|
| 194 |
+
"left_elbow_joint",
|
| 195 |
+
"left_wrist_roll_joint",
|
| 196 |
+
"left_wrist_pitch_joint",
|
| 197 |
+
"left_wrist_yaw_joint",
|
| 198 |
+
],
|
| 199 |
+
"groups": [],
|
| 200 |
+
},
|
| 201 |
+
"right_arm": {
|
| 202 |
+
"joints": [
|
| 203 |
+
"right_shoulder_pitch_joint",
|
| 204 |
+
"right_shoulder_roll_joint",
|
| 205 |
+
"right_shoulder_yaw_joint",
|
| 206 |
+
"right_elbow_joint",
|
| 207 |
+
"right_wrist_roll_joint",
|
| 208 |
+
"right_wrist_pitch_joint",
|
| 209 |
+
"right_wrist_yaw_joint",
|
| 210 |
+
],
|
| 211 |
+
"groups": [],
|
| 212 |
+
},
|
| 213 |
+
"arms": {"joints": [], "groups": ["left_arm", "right_arm"]},
|
| 214 |
+
# Hand groups
|
| 215 |
+
"left_hand": {
|
| 216 |
+
"joints": [
|
| 217 |
+
"left_hand_index_0_joint",
|
| 218 |
+
"left_hand_index_1_joint",
|
| 219 |
+
"left_hand_middle_0_joint",
|
| 220 |
+
"left_hand_middle_1_joint",
|
| 221 |
+
"left_hand_thumb_0_joint",
|
| 222 |
+
"left_hand_thumb_1_joint",
|
| 223 |
+
"left_hand_thumb_2_joint",
|
| 224 |
+
],
|
| 225 |
+
"groups": [],
|
| 226 |
+
},
|
| 227 |
+
"right_hand": {
|
| 228 |
+
"joints": [
|
| 229 |
+
"right_hand_index_0_joint",
|
| 230 |
+
"right_hand_index_1_joint",
|
| 231 |
+
"right_hand_middle_0_joint",
|
| 232 |
+
"right_hand_middle_1_joint",
|
| 233 |
+
"right_hand_thumb_0_joint",
|
| 234 |
+
"right_hand_thumb_1_joint",
|
| 235 |
+
"right_hand_thumb_2_joint",
|
| 236 |
+
],
|
| 237 |
+
"groups": [],
|
| 238 |
+
},
|
| 239 |
+
"hands": {"joints": [], "groups": ["left_hand", "right_hand"]},
|
| 240 |
+
# Full body groups
|
| 241 |
+
"lower_body": {"joints": [], "groups": ["waist", "legs"]},
|
| 242 |
+
"upper_body_no_hands": {"joints": [], "groups": ["arms"]},
|
| 243 |
+
"body": {"joints": [], "groups": ["lower_body", "upper_body_no_hands"]},
|
| 244 |
+
"upper_body": {"joints": [], "groups": ["upper_body_no_hands", "hands"]},
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
# Define joint name mapping from generic types to robot-specific names
|
| 248 |
+
joint_name_mapping = {
|
| 249 |
+
# Waist joints
|
| 250 |
+
"waist_pitch": "waist_pitch_joint",
|
| 251 |
+
"waist_roll": "waist_roll_joint",
|
| 252 |
+
"waist_yaw": "waist_yaw_joint",
|
| 253 |
+
# Shoulder joints
|
| 254 |
+
"shoulder_pitch": {
|
| 255 |
+
"left": "left_shoulder_pitch_joint",
|
| 256 |
+
"right": "right_shoulder_pitch_joint",
|
| 257 |
+
},
|
| 258 |
+
"shoulder_roll": {
|
| 259 |
+
"left": "left_shoulder_roll_joint",
|
| 260 |
+
"right": "right_shoulder_roll_joint",
|
| 261 |
+
},
|
| 262 |
+
"shoulder_yaw": {
|
| 263 |
+
"left": "left_shoulder_yaw_joint",
|
| 264 |
+
"right": "right_shoulder_yaw_joint",
|
| 265 |
+
},
|
| 266 |
+
# Elbow joints
|
| 267 |
+
"elbow_pitch": {"left": "left_elbow_joint", "right": "right_elbow_joint"},
|
| 268 |
+
# Wrist joints
|
| 269 |
+
"wrist_pitch": {"left": "left_wrist_pitch_joint", "right": "right_wrist_pitch_joint"},
|
| 270 |
+
"wrist_roll": {"left": "left_wrist_roll_joint", "right": "right_wrist_roll_joint"},
|
| 271 |
+
"wrist_yaw": {"left": "left_wrist_yaw_joint", "right": "right_wrist_yaw_joint"},
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
root_frame_name = "pelvis"
|
| 275 |
+
|
| 276 |
+
hand_frame_names = {"left": "left_wrist_yaw_link", "right": "right_wrist_yaw_link"}
|
| 277 |
+
|
| 278 |
+
elbow_calibration_joint_angles = {"left": 0.0, "right": 0.0}
|
| 279 |
+
|
| 280 |
+
hand_rotation_correction = np.array([[0, 0, 1], [0, 1, 0], [-1, 0, 0]])
|
| 281 |
+
|
| 282 |
+
# Configure default joint positions based on elbow pose
|
| 283 |
+
if elbow_pose == ElbowPose.HIGH:
|
| 284 |
+
default_joint_q = {
|
| 285 |
+
"shoulder_roll": {"left": 0.5, "right": -0.5},
|
| 286 |
+
"shoulder_pitch": {"left": -0.2, "right": -0.2},
|
| 287 |
+
"shoulder_yaw": {"left": -0.5, "right": 0.5},
|
| 288 |
+
"wrist_roll": {"left": -0.5, "right": 0.5},
|
| 289 |
+
"wrist_yaw": {"left": 0.5, "right": -0.5},
|
| 290 |
+
"wrist_pitch": {"left": -0.2, "right": -0.2},
|
| 291 |
+
}
|
| 292 |
+
else: # ElbowPose.LOW
|
| 293 |
+
default_joint_q = {
|
| 294 |
+
"shoulder_roll": {"left": 0.2, "right": -0.2},
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
teleop_upper_body_motion_scale = 1.0
|
| 298 |
+
|
| 299 |
+
# Configure joint groups based on waist location
|
| 300 |
+
modified_joint_groups = joint_groups.copy()
|
| 301 |
+
if waist_location == WaistLocation.UPPER_BODY:
|
| 302 |
+
# Move waist from lower_body to upper_body_no_hands
|
| 303 |
+
modified_joint_groups["lower_body"] = {"joints": [], "groups": ["legs"]}
|
| 304 |
+
modified_joint_groups["upper_body_no_hands"] = {
|
| 305 |
+
"joints": [],
|
| 306 |
+
"groups": ["arms", "waist"],
|
| 307 |
+
}
|
| 308 |
+
elif waist_location == WaistLocation.LOWER_AND_UPPER_BODY:
|
| 309 |
+
# Add waist to upper_body_no_hands while keeping it in lower_body
|
| 310 |
+
modified_joint_groups["upper_body_no_hands"] = {
|
| 311 |
+
"joints": [],
|
| 312 |
+
"groups": ["arms", "waist"],
|
| 313 |
+
}
|
| 314 |
+
# For LOWER_BODY, keep default joint_groups as is
|
| 315 |
+
|
| 316 |
+
super().__init__(
|
| 317 |
+
name=name,
|
| 318 |
+
body_actuated_joints=body_actuated_joints,
|
| 319 |
+
left_hand_actuated_joints=left_hand_actuated_joints,
|
| 320 |
+
right_hand_actuated_joints=right_hand_actuated_joints,
|
| 321 |
+
joint_limits=joint_limits,
|
| 322 |
+
joint_groups=modified_joint_groups,
|
| 323 |
+
root_frame_name=root_frame_name,
|
| 324 |
+
hand_frame_names=hand_frame_names,
|
| 325 |
+
elbow_calibration_joint_angles=elbow_calibration_joint_angles,
|
| 326 |
+
joint_name_mapping=joint_name_mapping,
|
| 327 |
+
hand_rotation_correction=hand_rotation_correction,
|
| 328 |
+
default_joint_q=default_joint_q,
|
| 329 |
+
teleop_upper_body_motion_scale=teleop_upper_body_motion_scale,
|
| 330 |
+
)
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/robot_model/supplemental_info/robot_supplemental_info.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from dataclasses import dataclass
|
| 2 |
+
from typing import Dict, List, Union
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
@dataclass
|
| 8 |
+
class RobotSupplementalInfo:
|
| 9 |
+
"""
|
| 10 |
+
Base class for robot-specific information that is not easily extractable from URDF.
|
| 11 |
+
This includes information about actuated joints, joint hierarchies, etc.
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
name: str
|
| 15 |
+
|
| 16 |
+
# List of body actuated joint names (excluding hands)
|
| 17 |
+
body_actuated_joints: List[str]
|
| 18 |
+
|
| 19 |
+
# List of left hand actuated joint names
|
| 20 |
+
left_hand_actuated_joints: List[str]
|
| 21 |
+
|
| 22 |
+
# List of right hand actuated joint names
|
| 23 |
+
right_hand_actuated_joints: List[str]
|
| 24 |
+
|
| 25 |
+
# Dictionary of joint groups, where each group is a dictionary with:
|
| 26 |
+
# - "joints": list of joint names
|
| 27 |
+
# - "groups": list of subgroup names (optional)
|
| 28 |
+
# Example: {
|
| 29 |
+
# "right_arm": {
|
| 30 |
+
# "joints": ["right_shoulder_pitch_joint", "right_shoulder_roll_joint", "right_elbow_joint"],
|
| 31 |
+
# "groups": []
|
| 32 |
+
# },
|
| 33 |
+
# "left_arm": {
|
| 34 |
+
# "joints": ["left_shoulder_pitch_joint", "left_shoulder_roll_joint", "left_elbow_joint"],
|
| 35 |
+
# "groups": []
|
| 36 |
+
# },
|
| 37 |
+
# "upper_body": {
|
| 38 |
+
# "joints": ["torso_pitch_joint", "torso_yaw_joint", "torso_roll_joint"],
|
| 39 |
+
# "groups": ["right_arm", "left_arm"]
|
| 40 |
+
# }
|
| 41 |
+
# }
|
| 42 |
+
joint_groups: Dict[str, Dict[str, List[str]]]
|
| 43 |
+
|
| 44 |
+
# Name of the root frame
|
| 45 |
+
root_frame_name: str
|
| 46 |
+
|
| 47 |
+
# Dictionary of hand frame names
|
| 48 |
+
# Example: {
|
| 49 |
+
# "left": "left_hand_frame",
|
| 50 |
+
# "right": "right_hand_frame"
|
| 51 |
+
# }
|
| 52 |
+
hand_frame_names: Dict[str, str]
|
| 53 |
+
|
| 54 |
+
# Dictionary of joint limits
|
| 55 |
+
# Example: {
|
| 56 |
+
# "left_shoulder_pitch_joint": [-np.pi / 2, np.pi / 2],
|
| 57 |
+
# "right_shoulder_pitch_joint": [-np.pi / 2, np.pi / 2]
|
| 58 |
+
# }
|
| 59 |
+
joint_limits: Dict[str, List[float]]
|
| 60 |
+
|
| 61 |
+
# Dictionary of elbow calibration joint angles
|
| 62 |
+
# Example: {
|
| 63 |
+
# "left": -90.0,
|
| 64 |
+
# "right": -90.0
|
| 65 |
+
# }
|
| 66 |
+
elbow_calibration_joint_angles: Dict[str, float]
|
| 67 |
+
|
| 68 |
+
# Dictionary of joint name mapping from generic types to robot-specific names
|
| 69 |
+
# Example: {
|
| 70 |
+
# "waist_pitch": "waist_pitch_joint",
|
| 71 |
+
# "shoulder_pitch": {
|
| 72 |
+
# "left": "left_shoulder_pitch_joint",
|
| 73 |
+
# "right": "right_shoulder_pitch_joint"
|
| 74 |
+
# },
|
| 75 |
+
# "elbow_pitch": {
|
| 76 |
+
# "left": "left_elbow_pitch_joint",
|
| 77 |
+
# "right": "right_elbow_pitch_joint"
|
| 78 |
+
# }
|
| 79 |
+
# }
|
| 80 |
+
joint_name_mapping: Dict[str, Union[str, Dict[str, str]]]
|
| 81 |
+
|
| 82 |
+
# Maps from generic joint names to robot-specific joint values
|
| 83 |
+
# Example: {
|
| 84 |
+
# "waist_roll": 0.2,
|
| 85 |
+
# "elbow_pitch": {"left": 1.0, "right": 1.0}
|
| 86 |
+
# }
|
| 87 |
+
default_joint_q: Dict[str, Union[float, Dict[str, float]]]
|
| 88 |
+
|
| 89 |
+
hand_rotation_correction: np.ndarray
|
| 90 |
+
|
| 91 |
+
teleop_upper_body_motion_scale: float
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/sensor/__init__.py
ADDED
|
File without changes
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/sensor/composed_camera.py
ADDED
|
@@ -0,0 +1,440 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections import deque
|
| 2 |
+
from dataclasses import dataclass
|
| 3 |
+
import queue
|
| 4 |
+
import threading
|
| 5 |
+
import time
|
| 6 |
+
from typing import Any, Dict, Optional
|
| 7 |
+
|
| 8 |
+
# we need to import these first in this order to avoid TSL segmentation fault
|
| 9 |
+
# caused by zed and oak libraries
|
| 10 |
+
try:
|
| 11 |
+
import cv2 # noqa
|
| 12 |
+
import depthai as dai # noqa
|
| 13 |
+
import pyzed.sl as sl # noqa
|
| 14 |
+
except ImportError:
|
| 15 |
+
print(
|
| 16 |
+
"""
|
| 17 |
+
Some of the camera specific dependencies are not installed. If you are
|
| 18 |
+
not running this on the robot, having these libraries is optional.
|
| 19 |
+
"""
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
import numpy as np # noqa
|
| 23 |
+
|
| 24 |
+
from decoupled_wbc.control.base.sensor import Sensor
|
| 25 |
+
from decoupled_wbc.control.sensor.sensor_server import (
|
| 26 |
+
ImageMessageSchema,
|
| 27 |
+
SensorClient,
|
| 28 |
+
SensorServer,
|
| 29 |
+
CameraMountPosition,
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def read_qr_code(data):
|
| 34 |
+
current_time = time.monotonic()
|
| 35 |
+
detector = cv2.QRCodeDetector()
|
| 36 |
+
for key, img in data["images"].items():
|
| 37 |
+
decoded_time, bbox, _ = detector.detectAndDecode(img)
|
| 38 |
+
if bbox is not None and decoded_time:
|
| 39 |
+
print(f"{key} latency: {(current_time - float(decoded_time)) * 1e3:.1f} ms")
|
| 40 |
+
else:
|
| 41 |
+
print(f"{key} QR code not detected.")
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
@dataclass
|
| 45 |
+
class ComposedCameraConfig:
|
| 46 |
+
"""Camera configuration for composed camera"""
|
| 47 |
+
|
| 48 |
+
ego_view_camera: Optional[str] = "oak"
|
| 49 |
+
"""Camera type for ego view: oak, realsense, zed, or None"""
|
| 50 |
+
|
| 51 |
+
ego_view_device_id: Optional[str] = None
|
| 52 |
+
"""Device ID for ego view camera (optional, used for OAK cameras)"""
|
| 53 |
+
|
| 54 |
+
head_camera: Optional[str] = None
|
| 55 |
+
"""Camera type for head view: oak, oak_mono, realsense, zed or None"""
|
| 56 |
+
|
| 57 |
+
head_device_id: Optional[str] = None
|
| 58 |
+
"""Device ID for head camera (optional, used for OAK cameras)"""
|
| 59 |
+
|
| 60 |
+
left_wrist_camera: Optional[str] = None
|
| 61 |
+
"""Camera type for left wrist view: oak, realsense, zed or None"""
|
| 62 |
+
|
| 63 |
+
left_wrist_device_id: Optional[str] = None
|
| 64 |
+
"""Device ID for left wrist camera (optional, used for OAK cameras)"""
|
| 65 |
+
|
| 66 |
+
right_wrist_camera: Optional[str] = None
|
| 67 |
+
"""Camera type for right wrist view: oak, realsense, zed or None"""
|
| 68 |
+
|
| 69 |
+
right_wrist_device_id: Optional[str] = None
|
| 70 |
+
"""Device ID for right wrist camera (optional, used for OAK cameras)"""
|
| 71 |
+
|
| 72 |
+
fps: int = 30
|
| 73 |
+
"""Rate at which the composed camera will publish the images. Since composed camera
|
| 74 |
+
can read from multiple cameras, it will publish all the images.
|
| 75 |
+
Note that OAK can only run at 30 FPS. 20 FPS will cause large latency.
|
| 76 |
+
"""
|
| 77 |
+
|
| 78 |
+
# Server configuration
|
| 79 |
+
run_as_server: bool = True
|
| 80 |
+
"""Whether to run as server or client"""
|
| 81 |
+
|
| 82 |
+
server: bool = True
|
| 83 |
+
"""Whether to run the camera as a server"""
|
| 84 |
+
|
| 85 |
+
port: int = 5555
|
| 86 |
+
"""Port number for server/client communication"""
|
| 87 |
+
|
| 88 |
+
test_latency: bool = False
|
| 89 |
+
"""Whether to test latency"""
|
| 90 |
+
|
| 91 |
+
# Queue configuration
|
| 92 |
+
queue_size: int = 3
|
| 93 |
+
"""Size of each camera's image queue"""
|
| 94 |
+
|
| 95 |
+
def __post_init__(self):
|
| 96 |
+
# runyu: Note that this is a hack to make the config work with G1 camera server in orin
|
| 97 |
+
# we should not use this hack in the future
|
| 98 |
+
self.run_as_server: bool = self.server
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
class ComposedCameraSensor(Sensor, SensorServer):
|
| 102 |
+
|
| 103 |
+
def __init__(self, config: ComposedCameraConfig):
|
| 104 |
+
self.config = config
|
| 105 |
+
self.camera_queues: Dict[str, queue.Queue] = {}
|
| 106 |
+
self.camera_threads: Dict[str, threading.Thread] = {}
|
| 107 |
+
self.shutdown_events: Dict[str, threading.Event] = {}
|
| 108 |
+
self.error_events: Dict[str, threading.Event] = {}
|
| 109 |
+
self.error_messages: Dict[str, str] = {}
|
| 110 |
+
self._observation_spaces: Dict[str, Any] = {}
|
| 111 |
+
|
| 112 |
+
camera_configs = self._get_camera_configs()
|
| 113 |
+
|
| 114 |
+
# Then create worker threads
|
| 115 |
+
for mount_position, camera_config in camera_configs.items():
|
| 116 |
+
# Create queue and shutdown event for this camera
|
| 117 |
+
camera_queue = queue.Queue(maxsize=config.queue_size)
|
| 118 |
+
shutdown_event = threading.Event()
|
| 119 |
+
error_event = threading.Event()
|
| 120 |
+
|
| 121 |
+
self.camera_queues[mount_position] = camera_queue
|
| 122 |
+
self.shutdown_events[mount_position] = shutdown_event
|
| 123 |
+
self.error_events[mount_position] = error_event
|
| 124 |
+
|
| 125 |
+
# Start camera thread
|
| 126 |
+
thread = threading.Thread(
|
| 127 |
+
target=self._camera_worker_wrapper,
|
| 128 |
+
args=(
|
| 129 |
+
mount_position,
|
| 130 |
+
camera_config["camera_type"],
|
| 131 |
+
camera_config["device_id"],
|
| 132 |
+
camera_queue,
|
| 133 |
+
shutdown_event,
|
| 134 |
+
error_event,
|
| 135 |
+
),
|
| 136 |
+
)
|
| 137 |
+
thread.start()
|
| 138 |
+
self.camera_threads[mount_position] = thread
|
| 139 |
+
|
| 140 |
+
if config.run_as_server:
|
| 141 |
+
self.start_server(config.port)
|
| 142 |
+
|
| 143 |
+
def _get_camera_configs(self) -> Dict[str, str]:
|
| 144 |
+
"""Get camera configurations as mount_position -> camera_type mapping"""
|
| 145 |
+
camera_configs = {}
|
| 146 |
+
|
| 147 |
+
if self.config.ego_view_camera is not None:
|
| 148 |
+
camera_configs[CameraMountPosition.EGO_VIEW.value] = {
|
| 149 |
+
"camera_type": self.config.ego_view_camera,
|
| 150 |
+
"device_id": self.config.ego_view_device_id,
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
if self.config.head_camera is not None:
|
| 154 |
+
camera_configs[CameraMountPosition.HEAD.value] = {
|
| 155 |
+
"camera_type": self.config.head_camera,
|
| 156 |
+
"device_id": self.config.head_device_id,
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
if self.config.left_wrist_camera is not None:
|
| 160 |
+
camera_configs[CameraMountPosition.LEFT_WRIST.value] = {
|
| 161 |
+
"camera_type": self.config.left_wrist_camera,
|
| 162 |
+
"device_id": self.config.left_wrist_device_id,
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
if self.config.right_wrist_camera is not None:
|
| 166 |
+
camera_configs[CameraMountPosition.RIGHT_WRIST.value] = {
|
| 167 |
+
"camera_type": self.config.right_wrist_camera,
|
| 168 |
+
"device_id": self.config.right_wrist_device_id,
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
return camera_configs
|
| 172 |
+
|
| 173 |
+
def _camera_worker_wrapper(
|
| 174 |
+
self,
|
| 175 |
+
mount_position: str,
|
| 176 |
+
camera_type: str,
|
| 177 |
+
device_id: Optional[str],
|
| 178 |
+
image_queue: queue.Queue,
|
| 179 |
+
shutdown_event: threading.Event,
|
| 180 |
+
error_event: threading.Event,
|
| 181 |
+
):
|
| 182 |
+
"""Worker thread that continuously captures from a single camera"""
|
| 183 |
+
try:
|
| 184 |
+
camera = self._instantiate_camera(mount_position, camera_type, device_id)
|
| 185 |
+
self._observation_spaces[mount_position] = camera.observation_space()
|
| 186 |
+
|
| 187 |
+
consecutive_failures = 0
|
| 188 |
+
max_consecutive_failures = 5
|
| 189 |
+
|
| 190 |
+
while not shutdown_event.is_set():
|
| 191 |
+
frame = camera.read()
|
| 192 |
+
if frame:
|
| 193 |
+
consecutive_failures = 0 # Reset on successful read
|
| 194 |
+
# Non-blocking queue put with frame dropping
|
| 195 |
+
try:
|
| 196 |
+
image_queue.put_nowait(frame)
|
| 197 |
+
except queue.Full:
|
| 198 |
+
# Remove oldest frame and add new one
|
| 199 |
+
try:
|
| 200 |
+
image_queue.get_nowait()
|
| 201 |
+
image_queue.put_nowait(frame)
|
| 202 |
+
except queue.Empty:
|
| 203 |
+
pass
|
| 204 |
+
else:
|
| 205 |
+
consecutive_failures += 1
|
| 206 |
+
if consecutive_failures >= max_consecutive_failures:
|
| 207 |
+
error_msg = (
|
| 208 |
+
f"Camera {mount_position} ({camera_type}) dropped: "
|
| 209 |
+
f"failed to read {consecutive_failures} consecutive frames"
|
| 210 |
+
)
|
| 211 |
+
print(f"[ERROR] {error_msg}")
|
| 212 |
+
self.error_messages[mount_position] = error_msg
|
| 213 |
+
error_event.set()
|
| 214 |
+
break
|
| 215 |
+
|
| 216 |
+
camera.close()
|
| 217 |
+
|
| 218 |
+
except Exception as e:
|
| 219 |
+
error_msg = f"Camera {mount_position} ({camera_type}) error: {str(e)}"
|
| 220 |
+
print(f"[ERROR] {error_msg}")
|
| 221 |
+
self.error_messages[mount_position] = error_msg
|
| 222 |
+
error_event.set()
|
| 223 |
+
|
| 224 |
+
def _instantiate_camera(
|
| 225 |
+
self, mount_position: str, camera_type: str, device_id: Optional[str] = None
|
| 226 |
+
) -> Sensor:
|
| 227 |
+
"""
|
| 228 |
+
Instantiate a camera sensor based on the camera type.
|
| 229 |
+
|
| 230 |
+
Args:
|
| 231 |
+
camera_type: Type of camera ("oak", "oak_mono", "realsense", "zed")
|
| 232 |
+
device_id: Optional device ID for the camera (used for OAK cameras)
|
| 233 |
+
|
| 234 |
+
Returns:
|
| 235 |
+
Sensor instance for the specified camera type
|
| 236 |
+
"""
|
| 237 |
+
if camera_type in ("oak", "oak_mono"):
|
| 238 |
+
from decoupled_wbc.control.sensor.oak import OAKConfig, OAKSensor
|
| 239 |
+
|
| 240 |
+
oak_config = OAKConfig()
|
| 241 |
+
if camera_type == "oak_mono":
|
| 242 |
+
oak_config.enable_mono_cameras = True
|
| 243 |
+
print("Initializing OAK sensor for camera type: ", camera_type)
|
| 244 |
+
return OAKSensor(config=oak_config, mount_position=mount_position, device_id=device_id)
|
| 245 |
+
elif camera_type == "realsense":
|
| 246 |
+
from decoupled_wbc.control.sensor.realsense import RealSenseSensor
|
| 247 |
+
|
| 248 |
+
print("Initializing RealSense sensor for camera type: ", camera_type)
|
| 249 |
+
return RealSenseSensor(mount_position=mount_position)
|
| 250 |
+
elif camera_type == "zed":
|
| 251 |
+
from decoupled_wbc.control.sensor.zed import ZEDSensor
|
| 252 |
+
|
| 253 |
+
print("Initializing ZED sensor for camera type: ", camera_type)
|
| 254 |
+
return ZEDSensor(mount_position=mount_position)
|
| 255 |
+
elif camera_type.endswith(".mp4"):
|
| 256 |
+
from decoupled_wbc.control.sensor.dummy import ReplayDummySensor
|
| 257 |
+
|
| 258 |
+
print("Initializing Replay Dummy Sensor for camera type: ", camera_type)
|
| 259 |
+
return ReplayDummySensor(video_path=camera_type)
|
| 260 |
+
else:
|
| 261 |
+
raise ValueError(f"Unsupported camera type: {camera_type}")
|
| 262 |
+
|
| 263 |
+
def _check_for_errors(self):
|
| 264 |
+
"""Check if any camera thread has encountered an error and raise exception if so."""
|
| 265 |
+
for mount_position, error_event in self.error_events.items():
|
| 266 |
+
if error_event.is_set():
|
| 267 |
+
error_msg = self.error_messages.get(
|
| 268 |
+
mount_position, f"Camera {mount_position} encountered an unknown error"
|
| 269 |
+
)
|
| 270 |
+
raise RuntimeError(error_msg)
|
| 271 |
+
|
| 272 |
+
def read(self):
|
| 273 |
+
"""Read frames from all cameras."""
|
| 274 |
+
# Check for errors from camera threads
|
| 275 |
+
self._check_for_errors()
|
| 276 |
+
|
| 277 |
+
message = {}
|
| 278 |
+
for mount_position, camera_queue in self.camera_queues.items():
|
| 279 |
+
frame = self._get_latest_from_queue(camera_queue)
|
| 280 |
+
if frame is not None:
|
| 281 |
+
message[mount_position] = frame
|
| 282 |
+
return message
|
| 283 |
+
|
| 284 |
+
def _get_latest_from_queue(self, camera_queue: queue.Queue) -> Optional[Dict[str, Any]]:
|
| 285 |
+
"""Get most recent frame, discard older ones"""
|
| 286 |
+
latest = None
|
| 287 |
+
try:
|
| 288 |
+
while True:
|
| 289 |
+
latest = camera_queue.get_nowait()
|
| 290 |
+
except queue.Empty:
|
| 291 |
+
pass
|
| 292 |
+
return latest
|
| 293 |
+
|
| 294 |
+
def close(self):
|
| 295 |
+
"""Close all cameras."""
|
| 296 |
+
# Signal all worker threads to shutdown
|
| 297 |
+
for shutdown_event in self.shutdown_events.values():
|
| 298 |
+
shutdown_event.set()
|
| 299 |
+
|
| 300 |
+
# Wait for all threads to finish
|
| 301 |
+
for thread in self.camera_threads.values():
|
| 302 |
+
thread.join(timeout=5.0)
|
| 303 |
+
|
| 304 |
+
# Clear queues
|
| 305 |
+
for camera_queue in self.camera_queues.values():
|
| 306 |
+
try:
|
| 307 |
+
while True:
|
| 308 |
+
camera_queue.get_nowait()
|
| 309 |
+
except queue.Empty:
|
| 310 |
+
pass
|
| 311 |
+
|
| 312 |
+
# Stop server if running
|
| 313 |
+
if self.config.run_as_server:
|
| 314 |
+
self.stop_server()
|
| 315 |
+
|
| 316 |
+
def serialize_message(self, message: Dict[str, Any]) -> Dict[str, Any]:
|
| 317 |
+
"""Merge all camera data into a single ImageMessageSchema."""
|
| 318 |
+
all_timestamps = {}
|
| 319 |
+
all_images = {}
|
| 320 |
+
|
| 321 |
+
for _, camera_data in message.items():
|
| 322 |
+
all_timestamps.update(camera_data.get("timestamps", {}))
|
| 323 |
+
all_images.update(camera_data.get("images", {}))
|
| 324 |
+
|
| 325 |
+
# Create a single ImageMessageSchema with all data
|
| 326 |
+
img_schema = ImageMessageSchema(timestamps=all_timestamps, images=all_images)
|
| 327 |
+
return img_schema.serialize()
|
| 328 |
+
|
| 329 |
+
def run_server(self):
|
| 330 |
+
"""Run the server."""
|
| 331 |
+
idx = 0
|
| 332 |
+
server_start_time = time.monotonic()
|
| 333 |
+
fps_print_time = time.monotonic()
|
| 334 |
+
frame_interval = 1.0 / self.config.fps
|
| 335 |
+
|
| 336 |
+
while True:
|
| 337 |
+
# Calculate when this frame should ideally complete
|
| 338 |
+
target_time = server_start_time + (idx + 1) * frame_interval
|
| 339 |
+
|
| 340 |
+
message = self.read()
|
| 341 |
+
if message:
|
| 342 |
+
if self.config.test_latency:
|
| 343 |
+
read_qr_code(message)
|
| 344 |
+
|
| 345 |
+
serialized_message = self.serialize_message(message)
|
| 346 |
+
self.send_message(serialized_message)
|
| 347 |
+
idx += 1
|
| 348 |
+
|
| 349 |
+
if idx % 10 == 0:
|
| 350 |
+
print(f"Image sending FPS: {10 / (time.monotonic() - fps_print_time):.2f}")
|
| 351 |
+
fps_print_time = time.monotonic()
|
| 352 |
+
|
| 353 |
+
# Sleep to maintain precise timing
|
| 354 |
+
current_time = time.monotonic()
|
| 355 |
+
sleep_time = target_time - current_time
|
| 356 |
+
if sleep_time > 0:
|
| 357 |
+
time.sleep(sleep_time)
|
| 358 |
+
else:
|
| 359 |
+
# If we're behind, increment idx to stay on schedule
|
| 360 |
+
if not message:
|
| 361 |
+
idx += 1
|
| 362 |
+
|
| 363 |
+
def observation_space(self):
|
| 364 |
+
"""Return the observation space."""
|
| 365 |
+
import gymnasium as gym
|
| 366 |
+
|
| 367 |
+
return gym.spaces.Dict(self._observation_spaces)
|
| 368 |
+
|
| 369 |
+
|
| 370 |
+
class ComposedCameraClientSensor(Sensor, SensorClient):
|
| 371 |
+
"""Class that serves as client for multiple different cameras."""
|
| 372 |
+
|
| 373 |
+
def __init__(self, server_ip: str = "localhost", port: int = 5555):
|
| 374 |
+
self.start_client(server_ip, port)
|
| 375 |
+
|
| 376 |
+
# Initialize tracking variables
|
| 377 |
+
self._latest_message = {}
|
| 378 |
+
self._avg_time_per_frame = deque(maxlen=20)
|
| 379 |
+
self._msg_received_time = 0
|
| 380 |
+
self._start_time = 0.0 # Initialize _start_time
|
| 381 |
+
self.idx = 0
|
| 382 |
+
|
| 383 |
+
print("Initialized composed camera client sensor")
|
| 384 |
+
|
| 385 |
+
def read(self, **kwargs) -> Optional[Dict[str, Any]]:
|
| 386 |
+
self._start_time = time.time()
|
| 387 |
+
message = self.receive_message()
|
| 388 |
+
if not message:
|
| 389 |
+
return None
|
| 390 |
+
self.idx += 1
|
| 391 |
+
|
| 392 |
+
self._latest_message = ImageMessageSchema.deserialize(message).asdict()
|
| 393 |
+
|
| 394 |
+
# if self.idx % 10 == 0:
|
| 395 |
+
# for image_key, image_time in self._latest_message["timestamps"].items():
|
| 396 |
+
# image_latency = (time.time() - image_time) * 1000
|
| 397 |
+
# print(f"Image latency for {image_key}: {image_latency:.2f} ms")
|
| 398 |
+
|
| 399 |
+
self._msg_received_time = time.time()
|
| 400 |
+
self._avg_time_per_frame.append(self._msg_received_time - self._start_time)
|
| 401 |
+
|
| 402 |
+
return self._latest_message
|
| 403 |
+
|
| 404 |
+
def close(self):
|
| 405 |
+
"""Close the client connection."""
|
| 406 |
+
self.stop_client()
|
| 407 |
+
|
| 408 |
+
def fps(self) -> float:
|
| 409 |
+
"""Get the current FPS of the client."""
|
| 410 |
+
if len(self._avg_time_per_frame) == 0:
|
| 411 |
+
return 0.0
|
| 412 |
+
return float(1 / np.mean(self._avg_time_per_frame))
|
| 413 |
+
|
| 414 |
+
|
| 415 |
+
if __name__ == "__main__":
|
| 416 |
+
"""Test function for ComposedCamera."""
|
| 417 |
+
import tyro
|
| 418 |
+
|
| 419 |
+
config = tyro.cli(ComposedCameraConfig)
|
| 420 |
+
|
| 421 |
+
if config.run_as_server:
|
| 422 |
+
composed_camera = ComposedCameraSensor(config)
|
| 423 |
+
print("Running composed camera server...")
|
| 424 |
+
composed_camera.run_server()
|
| 425 |
+
|
| 426 |
+
else:
|
| 427 |
+
# Client mode
|
| 428 |
+
composed_client = ComposedCameraClientSensor(server_ip="localhost", port=config.port)
|
| 429 |
+
|
| 430 |
+
try:
|
| 431 |
+
while True:
|
| 432 |
+
data = composed_client.read()
|
| 433 |
+
if data is not None:
|
| 434 |
+
print(f"FPS: {composed_client.fps():.2f}")
|
| 435 |
+
if "timestamp" in data:
|
| 436 |
+
print(f"Timestamp: {data['timestamp']}")
|
| 437 |
+
time.sleep(0.1)
|
| 438 |
+
except KeyboardInterrupt:
|
| 439 |
+
print("Stopping client...")
|
| 440 |
+
composed_client.close()
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/sensor/oak.py
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
from typing import Any, Dict, Optional, Tuple
|
| 3 |
+
|
| 4 |
+
import cv2
|
| 5 |
+
import depthai as dai
|
| 6 |
+
import gymnasium as gym
|
| 7 |
+
import numpy as np
|
| 8 |
+
|
| 9 |
+
from decoupled_wbc.control.base.sensor import Sensor
|
| 10 |
+
from decoupled_wbc.control.sensor.sensor_server import (
|
| 11 |
+
CameraMountPosition,
|
| 12 |
+
ImageMessageSchema,
|
| 13 |
+
SensorServer,
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class OAKConfig:
|
| 18 |
+
"""Configuration for the OAK camera."""
|
| 19 |
+
|
| 20 |
+
color_image_dim: Tuple[int, int] = (640, 480) # RGB camera resolution
|
| 21 |
+
monochrome_image_dim: Tuple[int, int] = (640, 480) # Monochrome camera resolution
|
| 22 |
+
fps: int = 30
|
| 23 |
+
enable_color: bool = True # Enable CAM_A (RGB)
|
| 24 |
+
enable_mono_cameras: bool = False # Enable CAM_B & CAM_C (Monochrome stereo pair)
|
| 25 |
+
mount_position: str = CameraMountPosition.EGO_VIEW.value
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class OAKSensor(Sensor, SensorServer):
|
| 29 |
+
"""Sensor for the OAK camera family."""
|
| 30 |
+
|
| 31 |
+
def __init__(
|
| 32 |
+
self,
|
| 33 |
+
run_as_server: bool = False,
|
| 34 |
+
port: int = 5555,
|
| 35 |
+
config: OAKConfig = OAKConfig(),
|
| 36 |
+
device_id: Optional[str] = None,
|
| 37 |
+
mount_position: str = CameraMountPosition.EGO_VIEW.value,
|
| 38 |
+
):
|
| 39 |
+
"""Initialize the OAK camera."""
|
| 40 |
+
self.config = config
|
| 41 |
+
self.mount_position = mount_position
|
| 42 |
+
self._run_as_server = run_as_server
|
| 43 |
+
|
| 44 |
+
device_infos = dai.Device.getAllAvailableDevices()
|
| 45 |
+
assert len(device_infos) > 0, f"No OAK devices found for {mount_position}"
|
| 46 |
+
print(f"Device infos: {device_infos}")
|
| 47 |
+
if device_id is not None:
|
| 48 |
+
device_found = False
|
| 49 |
+
for device_info in device_infos:
|
| 50 |
+
if device_info.getDeviceId() == device_id:
|
| 51 |
+
self.device = dai.Device(device_info)
|
| 52 |
+
device_found = True
|
| 53 |
+
break
|
| 54 |
+
if not device_found:
|
| 55 |
+
raise ValueError(f"Device with ID {device_id} not found")
|
| 56 |
+
else:
|
| 57 |
+
self.device = dai.Device()
|
| 58 |
+
|
| 59 |
+
print(f"Connected to OAK device: {self.device.getDeviceName(), self.device.getDeviceId()}")
|
| 60 |
+
print(f"Device ID: {self.device.getDeviceId()}")
|
| 61 |
+
|
| 62 |
+
sockets: list[dai.CameraBoardSocket] = self.device.getConnectedCameras()
|
| 63 |
+
print(f"Available cameras: {[str(s) for s in sockets]}")
|
| 64 |
+
|
| 65 |
+
# Create pipeline (without context manager to persist across method calls)
|
| 66 |
+
self.pipeline = dai.Pipeline(self.device)
|
| 67 |
+
self.output_queues = {}
|
| 68 |
+
|
| 69 |
+
# Configure RGB camera (CAM_A)
|
| 70 |
+
if config.enable_color and dai.CameraBoardSocket.CAM_A in sockets:
|
| 71 |
+
self.cam_rgb = self.pipeline.create(dai.node.Camera)
|
| 72 |
+
cam_socket = dai.CameraBoardSocket.CAM_A
|
| 73 |
+
self.cam_rgb = self.cam_rgb.build(cam_socket)
|
| 74 |
+
# Create RGB output queue
|
| 75 |
+
self.output_queues["color"] = self.cam_rgb.requestOutput(
|
| 76 |
+
config.color_image_dim,
|
| 77 |
+
fps=config.fps,
|
| 78 |
+
).createOutputQueue()
|
| 79 |
+
print("Enabled CAM_A (RGB)")
|
| 80 |
+
|
| 81 |
+
# Configure Monochrome cameras (CAM_B & CAM_C)
|
| 82 |
+
if config.enable_mono_cameras:
|
| 83 |
+
if dai.CameraBoardSocket.CAM_B in sockets:
|
| 84 |
+
self.cam_mono_left = self.pipeline.create(dai.node.Camera)
|
| 85 |
+
cam_socket = dai.CameraBoardSocket.CAM_B
|
| 86 |
+
self.cam_mono_left = self.cam_mono_left.build(cam_socket)
|
| 87 |
+
# Create mono left output queue
|
| 88 |
+
self.output_queues["mono_left"] = self.cam_mono_left.requestOutput(
|
| 89 |
+
config.monochrome_image_dim,
|
| 90 |
+
fps=config.fps,
|
| 91 |
+
).createOutputQueue()
|
| 92 |
+
print("Enabled CAM_B (Monochrome Left)")
|
| 93 |
+
|
| 94 |
+
if dai.CameraBoardSocket.CAM_C in sockets:
|
| 95 |
+
self.cam_mono_right = self.pipeline.create(dai.node.Camera)
|
| 96 |
+
cam_socket = dai.CameraBoardSocket.CAM_C
|
| 97 |
+
self.cam_mono_right = self.cam_mono_right.build(cam_socket)
|
| 98 |
+
# Create mono right output queue
|
| 99 |
+
self.output_queues["mono_right"] = self.cam_mono_right.requestOutput(
|
| 100 |
+
config.monochrome_image_dim,
|
| 101 |
+
fps=config.fps,
|
| 102 |
+
).createOutputQueue()
|
| 103 |
+
print("Enabled CAM_C (Monochrome Right)")
|
| 104 |
+
|
| 105 |
+
assert len(self.output_queues) > 0, "No output queues enabled"
|
| 106 |
+
# auto exposure compensation, for CoRL demo
|
| 107 |
+
# cam_q_in = self.cam_rgb.inputControl.createInputQueue()
|
| 108 |
+
# ctrl = dai.CameraControl()
|
| 109 |
+
# ctrl.setAutoExposureEnable()
|
| 110 |
+
# ctrl.setAutoExposureCompensation(-2)
|
| 111 |
+
# cam_q_in.send(ctrl)
|
| 112 |
+
|
| 113 |
+
# Start pipeline on device
|
| 114 |
+
self.pipeline.start()
|
| 115 |
+
|
| 116 |
+
if run_as_server:
|
| 117 |
+
self.start_server(port)
|
| 118 |
+
|
| 119 |
+
def read(self) -> Optional[Dict[str, Any]]:
|
| 120 |
+
"""Read images from the camera."""
|
| 121 |
+
if not self.pipeline.isRunning():
|
| 122 |
+
print(f"[ERROR] OAK pipeline stopped for {self.mount_position}")
|
| 123 |
+
return None
|
| 124 |
+
|
| 125 |
+
# Check if device is still connected
|
| 126 |
+
if not self.device.isPipelineRunning():
|
| 127 |
+
print(f"[ERROR] OAK device disconnected for {self.mount_position}")
|
| 128 |
+
return None
|
| 129 |
+
|
| 130 |
+
timestamps = {}
|
| 131 |
+
images = {}
|
| 132 |
+
rgb_frame_time = None
|
| 133 |
+
|
| 134 |
+
# Get color frame if enabled
|
| 135 |
+
if "color" in self.output_queues:
|
| 136 |
+
try:
|
| 137 |
+
rgb_frame = self.output_queues["color"].get()
|
| 138 |
+
rgb_frame_time = rgb_frame.getTimestamp()
|
| 139 |
+
if rgb_frame is not None:
|
| 140 |
+
images[self.mount_position] = rgb_frame.getCvFrame()[..., ::-1] # BGR to RGB
|
| 141 |
+
timestamps[self.mount_position] = (
|
| 142 |
+
rgb_frame_time - dai.Clock.now()
|
| 143 |
+
).total_seconds() + time.time()
|
| 144 |
+
except Exception as e:
|
| 145 |
+
print(f"[ERROR] Failed to read color frame from {self.mount_position}: {e}")
|
| 146 |
+
return None
|
| 147 |
+
|
| 148 |
+
# Get mono frames if enabled
|
| 149 |
+
if "mono_left" in self.output_queues:
|
| 150 |
+
try:
|
| 151 |
+
mono_left_frame = self.output_queues["mono_left"].get()
|
| 152 |
+
mono_left_frame_time = mono_left_frame.getTimestamp()
|
| 153 |
+
if mono_left_frame is not None:
|
| 154 |
+
key = f"{self.mount_position}_left_mono"
|
| 155 |
+
images[key] = mono_left_frame.getCvFrame()
|
| 156 |
+
timestamps[key] = (
|
| 157 |
+
mono_left_frame_time - dai.Clock.now()
|
| 158 |
+
).total_seconds() + time.time()
|
| 159 |
+
except Exception as e:
|
| 160 |
+
print(f"[ERROR] Failed to read mono_left frame from {self.mount_position}: {e}")
|
| 161 |
+
return None
|
| 162 |
+
|
| 163 |
+
if "mono_right" in self.output_queues:
|
| 164 |
+
try:
|
| 165 |
+
mono_right_frame = self.output_queues["mono_right"].get()
|
| 166 |
+
mono_right_frame_time = mono_right_frame.getTimestamp()
|
| 167 |
+
if mono_right_frame is not None:
|
| 168 |
+
key = f"{self.mount_position}_right_mono"
|
| 169 |
+
images[key] = mono_right_frame.getCvFrame()
|
| 170 |
+
timestamps[key] = (
|
| 171 |
+
mono_right_frame_time - dai.Clock.now()
|
| 172 |
+
).total_seconds() + time.time()
|
| 173 |
+
except Exception as e:
|
| 174 |
+
print(f"[ERROR] Failed to read mono_right frame from {self.mount_position}: {e}")
|
| 175 |
+
return None
|
| 176 |
+
|
| 177 |
+
if (
|
| 178 |
+
rgb_frame_time is not None
|
| 179 |
+
and (rgb_frame_time - dai.Clock.now()).total_seconds() <= -0.2
|
| 180 |
+
):
|
| 181 |
+
print(
|
| 182 |
+
f"[{self.mount_position}] OAK latency too large: "
|
| 183 |
+
f"{(dai.Clock.now() - rgb_frame_time).total_seconds() * 1000}ms"
|
| 184 |
+
)
|
| 185 |
+
|
| 186 |
+
return {
|
| 187 |
+
"timestamps": timestamps,
|
| 188 |
+
"images": images,
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
def serialize(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
| 192 |
+
"""Serialize data using ImageMessageSchema."""
|
| 193 |
+
serialized_msg = ImageMessageSchema(timestamps=data["timestamps"], images=data["images"])
|
| 194 |
+
return serialized_msg.serialize()
|
| 195 |
+
|
| 196 |
+
def observation_space(self) -> gym.Space:
|
| 197 |
+
spaces = {}
|
| 198 |
+
|
| 199 |
+
if self.config.enable_color:
|
| 200 |
+
spaces["color_image"] = gym.spaces.Box(
|
| 201 |
+
low=0,
|
| 202 |
+
high=255,
|
| 203 |
+
shape=(self.config.color_image_dim[1], self.config.color_image_dim[0], 3),
|
| 204 |
+
dtype=np.uint8,
|
| 205 |
+
)
|
| 206 |
+
|
| 207 |
+
if self.config.enable_mono_cameras:
|
| 208 |
+
spaces["mono_left_image"] = gym.spaces.Box(
|
| 209 |
+
low=0,
|
| 210 |
+
high=255,
|
| 211 |
+
shape=(self.config.monochrome_image_dim[1], self.config.monochrome_image_dim[0]),
|
| 212 |
+
dtype=np.uint8,
|
| 213 |
+
)
|
| 214 |
+
spaces["mono_right_image"] = gym.spaces.Box(
|
| 215 |
+
low=0,
|
| 216 |
+
high=255,
|
| 217 |
+
shape=(self.config.monochrome_image_dim[1], self.config.monochrome_image_dim[0]),
|
| 218 |
+
dtype=np.uint8,
|
| 219 |
+
)
|
| 220 |
+
|
| 221 |
+
return gym.spaces.Dict(spaces)
|
| 222 |
+
|
| 223 |
+
def close(self):
|
| 224 |
+
"""Close the camera connection."""
|
| 225 |
+
if self._run_as_server:
|
| 226 |
+
self.stop_server()
|
| 227 |
+
if hasattr(self, "pipeline") and self.pipeline.isRunning():
|
| 228 |
+
self.pipeline.stop()
|
| 229 |
+
self.device.close()
|
| 230 |
+
|
| 231 |
+
def run_server(self):
|
| 232 |
+
"""Run the server."""
|
| 233 |
+
if not self._run_as_server:
|
| 234 |
+
raise ValueError("This function is only available when run_as_server is True")
|
| 235 |
+
|
| 236 |
+
while True:
|
| 237 |
+
frame = self.read()
|
| 238 |
+
if frame is None:
|
| 239 |
+
continue
|
| 240 |
+
|
| 241 |
+
msg = self.serialize(frame)
|
| 242 |
+
self.send_message({self.mount_position: msg})
|
| 243 |
+
|
| 244 |
+
def __del__(self):
|
| 245 |
+
self.close()
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
if __name__ == "__main__":
|
| 249 |
+
"""Test function for OAK camera."""
|
| 250 |
+
|
| 251 |
+
import argparse
|
| 252 |
+
|
| 253 |
+
parser = argparse.ArgumentParser()
|
| 254 |
+
parser.add_argument("--server", action="store_true", help="Run as server")
|
| 255 |
+
parser.add_argument("--client", action="store_true", help="Run as client")
|
| 256 |
+
parser.add_argument("--host", type=str, default="localhost", help="Server IP address")
|
| 257 |
+
parser.add_argument("--port", type=int, default=5555, help="Port number")
|
| 258 |
+
parser.add_argument("--device-id", type=str, default=None, help="Specific device ID")
|
| 259 |
+
parser.add_argument(
|
| 260 |
+
"--enable-mono", action="store_true", help="Enable monochrome cameras (CAM_B & CAM_C)"
|
| 261 |
+
)
|
| 262 |
+
parser.add_argument("--mount-position", type=str, default="ego_view", help="Mount position")
|
| 263 |
+
parser.add_argument("--show-image", action="store_true", help="Display images")
|
| 264 |
+
args = parser.parse_args()
|
| 265 |
+
|
| 266 |
+
oak_config = OAKConfig()
|
| 267 |
+
if args.enable_mono:
|
| 268 |
+
oak_config.enable_mono_cameras = True
|
| 269 |
+
|
| 270 |
+
if args.server:
|
| 271 |
+
# Run as server
|
| 272 |
+
oak = OAKSensor(
|
| 273 |
+
run_as_server=True,
|
| 274 |
+
port=args.port,
|
| 275 |
+
config=oak_config,
|
| 276 |
+
device_id=args.device_id,
|
| 277 |
+
mount_position=args.mount_position,
|
| 278 |
+
)
|
| 279 |
+
print(f"Starting OAK server on port {args.port}")
|
| 280 |
+
oak.run_server()
|
| 281 |
+
|
| 282 |
+
else:
|
| 283 |
+
# Run standalone
|
| 284 |
+
oak = OAKSensor(run_as_server=False, config=oak_config, device_id=args.device_id)
|
| 285 |
+
print("Running OAK camera in standalone mode")
|
| 286 |
+
|
| 287 |
+
while True:
|
| 288 |
+
frame = oak.read()
|
| 289 |
+
if frame is None:
|
| 290 |
+
print("Waiting for frame...")
|
| 291 |
+
time.sleep(0.5)
|
| 292 |
+
continue
|
| 293 |
+
|
| 294 |
+
if "color_image" in frame:
|
| 295 |
+
print(f"Color image shape: {frame['color_image'].shape}")
|
| 296 |
+
if "mono_left_image" in frame:
|
| 297 |
+
print(f"Mono left image shape: {frame['mono_left_image'].shape}")
|
| 298 |
+
if "mono_right_image" in frame:
|
| 299 |
+
print(f"Mono right image shape: {frame['mono_right_image'].shape}")
|
| 300 |
+
if "depth_image" in frame:
|
| 301 |
+
print(f"Depth image shape: {frame['depth_image'].shape}")
|
| 302 |
+
|
| 303 |
+
if args.show_image:
|
| 304 |
+
if "color_image" in frame:
|
| 305 |
+
cv2.imshow("Color Image", frame["color_image"])
|
| 306 |
+
|
| 307 |
+
if "mono_left_image" in frame:
|
| 308 |
+
cv2.imshow("Mono Left", frame["mono_left_image"])
|
| 309 |
+
if "mono_right_image" in frame:
|
| 310 |
+
cv2.imshow("Mono Right", frame["mono_right_image"])
|
| 311 |
+
|
| 312 |
+
if "depth_image" in frame:
|
| 313 |
+
depth_colormap = cv2.applyColorMap(
|
| 314 |
+
cv2.convertScaleAbs(frame["depth_image"], alpha=0.03), cv2.COLORMAP_JET
|
| 315 |
+
)
|
| 316 |
+
cv2.imshow("Depth Image", depth_colormap)
|
| 317 |
+
|
| 318 |
+
if cv2.waitKey(1) == ord("q"):
|
| 319 |
+
break
|
| 320 |
+
|
| 321 |
+
time.sleep(0.01)
|
| 322 |
+
|
| 323 |
+
cv2.destroyAllWindows()
|
| 324 |
+
oak.close()
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/sensor/sensor_server.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import base64
|
| 2 |
+
from dataclasses import dataclass
|
| 3 |
+
from enum import Enum
|
| 4 |
+
from typing import Any, Dict
|
| 5 |
+
|
| 6 |
+
import cv2
|
| 7 |
+
import msgpack
|
| 8 |
+
import msgpack_numpy as m
|
| 9 |
+
import numpy as np
|
| 10 |
+
import zmq
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
@dataclass
|
| 14 |
+
class ImageMessageSchema:
|
| 15 |
+
"""
|
| 16 |
+
This is a standardized message schema for image data.
|
| 17 |
+
Any camera should use this schema to serialize (send to queue) and
|
| 18 |
+
deserialize (receive from queue) the image data.
|
| 19 |
+
|
| 20 |
+
"""
|
| 21 |
+
|
| 22 |
+
timestamps: Dict[str, float]
|
| 23 |
+
"""Dictionary of timestamps, keyed by image identifier (e.g., {"ego_view": 123.45})"""
|
| 24 |
+
images: Dict[str, np.ndarray]
|
| 25 |
+
"""Dictionary of images, keyed by image identifier (e.g., {"ego_view": array, "ego_view_left_mono": array})"""
|
| 26 |
+
|
| 27 |
+
def serialize(self) -> Dict[str, Any]:
|
| 28 |
+
"""Serialize the message for transmission."""
|
| 29 |
+
serialized_msg = {"timestamps": self.timestamps, "images": {}}
|
| 30 |
+
for key, image in self.images.items():
|
| 31 |
+
serialized_msg["images"][key] = ImageUtils.encode_image(image)
|
| 32 |
+
return serialized_msg
|
| 33 |
+
|
| 34 |
+
@staticmethod
|
| 35 |
+
def deserialize(data: Dict[str, Any]) -> "ImageMessageSchema":
|
| 36 |
+
"""Deserialize received message data."""
|
| 37 |
+
timestamps = data.get("timestamps", {})
|
| 38 |
+
images = {}
|
| 39 |
+
for key, value in data.get("images", {}).items():
|
| 40 |
+
if isinstance(value, str):
|
| 41 |
+
images[key] = ImageUtils.decode_image(value)
|
| 42 |
+
else:
|
| 43 |
+
images[key] = value
|
| 44 |
+
return ImageMessageSchema(timestamps=timestamps, images=images)
|
| 45 |
+
|
| 46 |
+
def asdict(self) -> Dict[str, Any]:
|
| 47 |
+
"""Convert to dictionary format."""
|
| 48 |
+
return {"timestamps": self.timestamps, "images": self.images}
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class SensorServer:
|
| 52 |
+
def start_server(self, port: int):
|
| 53 |
+
self.context = zmq.Context()
|
| 54 |
+
self.socket = self.context.socket(zmq.PUB)
|
| 55 |
+
self.socket.setsockopt(zmq.SNDHWM, 20) # high water mark
|
| 56 |
+
self.socket.setsockopt(zmq.LINGER, 0)
|
| 57 |
+
self.socket.bind(f"tcp://*:{port}")
|
| 58 |
+
print(f"Sensor server running at tcp://*:{port}")
|
| 59 |
+
|
| 60 |
+
self.message_sent = 0
|
| 61 |
+
self.message_dropped = 0
|
| 62 |
+
|
| 63 |
+
def stop_server(self):
|
| 64 |
+
self.socket.close()
|
| 65 |
+
self.context.term()
|
| 66 |
+
|
| 67 |
+
def send_message(self, data: Dict[str, Any]):
|
| 68 |
+
try:
|
| 69 |
+
packed = msgpack.packb(data, use_bin_type=True)
|
| 70 |
+
self.socket.send(packed, flags=zmq.NOBLOCK)
|
| 71 |
+
except zmq.Again:
|
| 72 |
+
self.message_dropped += 1
|
| 73 |
+
print(f"[Warning] message dropped: {self.message_dropped}")
|
| 74 |
+
self.message_sent += 1
|
| 75 |
+
|
| 76 |
+
if self.message_sent % 100 == 0:
|
| 77 |
+
print(
|
| 78 |
+
f"[Sensor server] Message sent: {self.message_sent}, message dropped: {self.message_dropped}"
|
| 79 |
+
)
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
class SensorClient:
|
| 83 |
+
def start_client(self, server_ip: str, port: int):
|
| 84 |
+
self.context = zmq.Context()
|
| 85 |
+
self.socket = self.context.socket(zmq.SUB)
|
| 86 |
+
self.socket.setsockopt_string(zmq.SUBSCRIBE, "")
|
| 87 |
+
self.socket.setsockopt(zmq.CONFLATE, True) # last msg only.
|
| 88 |
+
self.socket.setsockopt(zmq.RCVHWM, 3) # queue size 3 for receive buffer
|
| 89 |
+
self.socket.connect(f"tcp://{server_ip}:{port}")
|
| 90 |
+
|
| 91 |
+
def stop_client(self):
|
| 92 |
+
self.socket.close()
|
| 93 |
+
self.context.term()
|
| 94 |
+
|
| 95 |
+
def receive_message(self):
|
| 96 |
+
packed = self.socket.recv()
|
| 97 |
+
return msgpack.unpackb(packed, object_hook=m.decode)
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
class CameraMountPosition(Enum):
|
| 101 |
+
EGO_VIEW = "ego_view"
|
| 102 |
+
HEAD = "head"
|
| 103 |
+
LEFT_WRIST = "left_wrist"
|
| 104 |
+
RIGHT_WRIST = "right_wrist"
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
class ImageUtils:
|
| 108 |
+
@staticmethod
|
| 109 |
+
def encode_image(image: np.ndarray) -> str:
|
| 110 |
+
_, color_buffer = cv2.imencode(".jpg", image, [int(cv2.IMWRITE_JPEG_QUALITY), 80])
|
| 111 |
+
return base64.b64encode(color_buffer).decode("utf-8")
|
| 112 |
+
|
| 113 |
+
@staticmethod
|
| 114 |
+
def encode_depth_image(image: np.ndarray) -> str:
|
| 115 |
+
depth_compressed = cv2.imencode(".png", image)[1].tobytes()
|
| 116 |
+
return base64.b64encode(depth_compressed).decode("utf-8")
|
| 117 |
+
|
| 118 |
+
@staticmethod
|
| 119 |
+
def decode_image(image: str) -> np.ndarray:
|
| 120 |
+
color_data = base64.b64decode(image)
|
| 121 |
+
color_array = np.frombuffer(color_data, dtype=np.uint8)
|
| 122 |
+
return cv2.imdecode(color_array, cv2.IMREAD_COLOR)
|
| 123 |
+
|
| 124 |
+
@staticmethod
|
| 125 |
+
def decode_depth_image(image: str) -> np.ndarray:
|
| 126 |
+
depth_data = base64.b64decode(image)
|
| 127 |
+
depth_array = np.frombuffer(depth_data, dtype=np.uint8)
|
| 128 |
+
return cv2.imdecode(depth_array, cv2.IMREAD_UNCHANGED)
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/ClientLogging.hpp
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef __CLIENT_LOGGING_HPP__
|
| 2 |
+
#define __CLIENT_LOGGING_HPP__
|
| 3 |
+
#include <iomanip>
|
| 4 |
+
#include <iostream>
|
| 5 |
+
#include <ostream>
|
| 6 |
+
#include <sstream>
|
| 7 |
+
|
| 8 |
+
namespace ManusSDK
|
| 9 |
+
{
|
| 10 |
+
class ClientLog
|
| 11 |
+
{
|
| 12 |
+
public:
|
| 13 |
+
//Simple
|
| 14 |
+
static void debug(const char* p_String)
|
| 15 |
+
{
|
| 16 |
+
std::cout << "DEBUG: " << p_String << std::endl;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
static void info(const char* p_String)
|
| 20 |
+
{
|
| 21 |
+
std::cout << "INFO: " << p_String << std::endl;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
static void warn(const char* p_String)
|
| 25 |
+
{
|
| 26 |
+
std::cout << "WARN: " << p_String << std::endl;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
static void error(const char* p_String)
|
| 30 |
+
{
|
| 31 |
+
std::cout << "ERROR: " << p_String << std::endl;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
static void print(const char* p_String)
|
| 35 |
+
{
|
| 36 |
+
std::cout << p_String << std::endl;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
//Templated
|
| 40 |
+
template<typename... Args>
|
| 41 |
+
static void debug(const char* p_Format, Args &&...p_Args)
|
| 42 |
+
{
|
| 43 |
+
std::string formatted_string = p_Format;
|
| 44 |
+
replacePlaceholders(formatted_string, std::forward<Args>(p_Args)...);
|
| 45 |
+
std::cout << "DEBUG: " << formatted_string << std::endl;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
template<typename... Args>
|
| 49 |
+
static void info(const char* p_Format, Args &&...p_Args)
|
| 50 |
+
{
|
| 51 |
+
std::string formatted_string = p_Format;
|
| 52 |
+
replacePlaceholders(formatted_string, std::forward<Args>(p_Args)...);
|
| 53 |
+
std::cout << "INFO: " << formatted_string << std::endl;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
template<typename... Args>
|
| 57 |
+
static void warn(const char* p_Format, Args &&...p_Args)
|
| 58 |
+
{
|
| 59 |
+
std::string formatted_string = p_Format;
|
| 60 |
+
replacePlaceholders(formatted_string, std::forward<Args>(p_Args)...);
|
| 61 |
+
std::cout << "WARN: " << formatted_string << std::endl;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
template<typename... Args>
|
| 65 |
+
static void error(const char* p_Format, Args &&...p_Args)
|
| 66 |
+
{
|
| 67 |
+
std::string formatted_string = p_Format;
|
| 68 |
+
replacePlaceholders(formatted_string, std::forward<Args>(p_Args)...);
|
| 69 |
+
std::cout << "ERROR: " << formatted_string << std::endl;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
template<typename... Args>
|
| 73 |
+
static void print(const char* p_Format, Args &&...p_Args)
|
| 74 |
+
{
|
| 75 |
+
std::string formatted_string = p_Format;
|
| 76 |
+
replacePlaceholders(formatted_string, std::forward<Args>(p_Args)...);
|
| 77 |
+
std::cout << formatted_string << std::endl;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
template<typename... Args>
|
| 81 |
+
static void printWithPadding(const char* p_Format, int p_Padding, Args &&...p_Args)
|
| 82 |
+
{
|
| 83 |
+
std::string formatted_string = p_Format;
|
| 84 |
+
replacePlaceholdersWithPadding(formatted_string, p_Padding, std::forward<Args>(p_Args)...);
|
| 85 |
+
std::cout << formatted_string << std::endl;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
private:
|
| 89 |
+
// Base case for recursion: no arguments left
|
| 90 |
+
static void replacePlaceholders(std::string&) {
|
| 91 |
+
// No more arguments, so nothing to replace
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
// Replace placeholders {} with actual values (only supports empty curly brackets, no formatting)
|
| 95 |
+
template<typename T, typename... Args>
|
| 96 |
+
static void replacePlaceholders(std::string& p_Format, T&& p_Value, Args&&... p_Args) {
|
| 97 |
+
size_t pos = p_Format.find("{}");
|
| 98 |
+
if (pos != std::string::npos) {
|
| 99 |
+
p_Format.replace(pos, 2, to_string(std::forward<T>(p_Value)));
|
| 100 |
+
replacePlaceholders(p_Format, std::forward<Args>(p_Args)...);
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
// Base case for recursion: no arguments left
|
| 105 |
+
static void replacePlaceholdersWithPadding(std::string&, int p_Padding) {
|
| 106 |
+
// No more arguments, so nothing to replace
|
| 107 |
+
}
|
| 108 |
+
// Replace placeholders {} with actual values (only supports empty curly brackets, no formatting)
|
| 109 |
+
template<typename T, typename... Args>
|
| 110 |
+
static void replacePlaceholdersWithPadding(std::string& p_Format, int p_Padding, T&& p_Value, Args&&... p_Args) {
|
| 111 |
+
size_t pos = p_Format.find("{}");
|
| 112 |
+
if (pos != std::string::npos) {
|
| 113 |
+
std::ostringstream oss;
|
| 114 |
+
oss << std::setw(p_Padding) << to_string(std::forward<T>(p_Value));
|
| 115 |
+
p_Format.replace(pos, 2, oss.str());
|
| 116 |
+
replacePlaceholdersWithPadding(p_Format, p_Padding, std::forward<Args>(p_Args)...);
|
| 117 |
+
}
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
// Utility to convert various types to string
|
| 121 |
+
template<typename T>
|
| 122 |
+
static std::string to_string(const T& p_Value) {
|
| 123 |
+
std::ostringstream oss;
|
| 124 |
+
oss << p_Value;
|
| 125 |
+
return oss.str();
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
// Specialization for uint8_t
|
| 129 |
+
static std::string to_string(const uint8_t& p_Value) {
|
| 130 |
+
std::ostringstream oss;
|
| 131 |
+
oss << static_cast<int>(p_Value);
|
| 132 |
+
return oss.str();
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
// Specialization for uint16_t
|
| 136 |
+
static std::string to_string(const uint16_t& p_Value) {
|
| 137 |
+
std::ostringstream oss;
|
| 138 |
+
oss << static_cast<int>(p_Value);
|
| 139 |
+
return oss.str();
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
// Specialization for uint32_t
|
| 143 |
+
static std::string to_string(const uint32_t& p_Value) {
|
| 144 |
+
std::ostringstream oss;
|
| 145 |
+
oss << std::hex << p_Value;
|
| 146 |
+
return oss.str();
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
// Specialization for bool
|
| 150 |
+
static std::string to_string(const bool& p_Value) {
|
| 151 |
+
std::ostringstream oss;
|
| 152 |
+
oss << std::setw(5) << (p_Value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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#include "ClientPlatformSpecific.hpp"
|
| 2 |
+
|
| 3 |
+
// signal types
|
| 4 |
+
#include <csignal>
|
| 5 |
+
// std::filesystem
|
| 6 |
+
#include <filesystem>
|
| 7 |
+
// std::*fstream
|
| 8 |
+
#include <fstream>
|
| 9 |
+
// CoreSdk_ShutDown
|
| 10 |
+
#include "ManusSDK.h"
|
| 11 |
+
// std::map
|
| 12 |
+
#include <map>
|
| 13 |
+
// Ncurses terminal functions.
|
| 14 |
+
#include <ncursesw/ncurses.h>
|
| 15 |
+
// Termios terminal functions.
|
| 16 |
+
#include <termios.h>
|
| 17 |
+
#include <cstring>
|
| 18 |
+
#include <unistd.h>
|
| 19 |
+
// spdlog replacement
|
| 20 |
+
#include "ClientLogging.hpp"
|
| 21 |
+
|
| 22 |
+
using namespace ManusSDK;
|
| 23 |
+
|
| 24 |
+
/// @brief Reset a signal handler to its default, and then call it.
|
| 25 |
+
/// For signal types and explanation, see:
|
| 26 |
+
/// https://www.gnu.org/software/libc/manual/html_node/Standard-Signals.html
|
| 27 |
+
#define CALL_DEFAULT_SIGNAL_HANDLER(p_SignalType) \
|
| 28 |
+
/* Reset the handler for this signal to the default. */ \
|
| 29 |
+
signal(p_SignalType, SIG_DFL); \
|
| 30 |
+
/* Re-raise this signal, causing the normal handler to run. */ \
|
| 31 |
+
raise(p_SignalType);
|
| 32 |
+
|
| 33 |
+
const std::string SDKClientPlatformSpecific::s_SlashForFilesystemPath = "/";
|
| 34 |
+
|
| 35 |
+
/// @brief Handle a signal telling the SDK client to quit.
|
| 36 |
+
/// A generic signal used to "politely ask a program to terminate".
|
| 37 |
+
/// On Linux, this can be sent by using the Gnome System Monitor and telling
|
| 38 |
+
/// the SDK client process to end.
|
| 39 |
+
static void HandleTerminationSignal(int p_Parameter)
|
| 40 |
+
{
|
| 41 |
+
ClientLog::error(
|
| 42 |
+
"Termination signal sent with parameter {}.",
|
| 43 |
+
p_Parameter);
|
| 44 |
+
|
| 45 |
+
CoreSdk_ShutDown();
|
| 46 |
+
|
| 47 |
+
CALL_DEFAULT_SIGNAL_HANDLER(SIGTERM);
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
/// @brief Handle an interrupt signal.
|
| 51 |
+
/// Called when the INTR character is typed - usually ctrl + c.
|
| 52 |
+
static void HandleInterruptSignal(int p_Parameter)
|
| 53 |
+
{
|
| 54 |
+
ClientLog::error(
|
| 55 |
+
"Interrupt signal sent with parameter {}.",
|
| 56 |
+
p_Parameter);
|
| 57 |
+
|
| 58 |
+
CoreSdk_ShutDown();
|
| 59 |
+
|
| 60 |
+
CALL_DEFAULT_SIGNAL_HANDLER(SIGINT);
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
/// @brief Handle a quit signal.
|
| 64 |
+
/// Called when the QUIT character is typed - usually ctrl + \.
|
| 65 |
+
static void HandleQuitSignal(int p_Parameter)
|
| 66 |
+
{
|
| 67 |
+
ClientLog::error(
|
| 68 |
+
"Quit signal sent with parameter {}.",
|
| 69 |
+
p_Parameter);
|
| 70 |
+
|
| 71 |
+
CoreSdk_ShutDown();
|
| 72 |
+
|
| 73 |
+
CALL_DEFAULT_SIGNAL_HANDLER(SIGQUIT);
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
/// @brief Handle a hangup signal.
|
| 77 |
+
/// Called to report that the user's terminal has disconnected.
|
| 78 |
+
/// This can happen when connecting over the network, for example.
|
| 79 |
+
/// It also happens if the terminal window is closed while debugging.
|
| 80 |
+
static void HandleHangupSignal(int p_Parameter)
|
| 81 |
+
{
|
| 82 |
+
ClientLog::error(
|
| 83 |
+
"Hang-up signal sent with parameter {}.",
|
| 84 |
+
p_Parameter);
|
| 85 |
+
|
| 86 |
+
CoreSdk_ShutDown();
|
| 87 |
+
|
| 88 |
+
CALL_DEFAULT_SIGNAL_HANDLER(SIGHUP);
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
/// @brief Initialise Ncurses so that we can check for input.
|
| 92 |
+
static bool InitializeNcurses(void)
|
| 93 |
+
{
|
| 94 |
+
const WINDOW* const t_Window = initscr();
|
| 95 |
+
if (!t_Window)
|
| 96 |
+
{
|
| 97 |
+
ClientLog::error("Failed to initialise the screen.");
|
| 98 |
+
|
| 99 |
+
return false;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
// Don't buffer input until a newline or carriage return is typed.
|
| 103 |
+
if (cbreak() != OK)
|
| 104 |
+
{
|
| 105 |
+
ClientLog::error("Failed to make input unbuffered.");
|
| 106 |
+
|
| 107 |
+
return false;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
// Don't echo input.
|
| 111 |
+
if (noecho() != OK)
|
| 112 |
+
{
|
| 113 |
+
ClientLog::error("Failed to disable input echoing.");
|
| 114 |
+
|
| 115 |
+
return false;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
// Don't make newlines when the return key is pressed.
|
| 119 |
+
if (nonl() != OK)
|
| 120 |
+
{
|
| 121 |
+
ClientLog::error("Failed to disable newlines.");
|
| 122 |
+
|
| 123 |
+
return false;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
// Do not flush the screen when interrupt/break/quit is pressed.
|
| 127 |
+
if (intrflush(stdscr, FALSE) != OK)
|
| 128 |
+
{
|
| 129 |
+
ClientLog::error("Failed to disable screen flushing.");
|
| 130 |
+
|
| 131 |
+
return false;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
// Make getch non-blocking.
|
| 135 |
+
if (nodelay(stdscr, TRUE) != OK)
|
| 136 |
+
{
|
| 137 |
+
ClientLog::error("Failed to make nodelay non-blocking.");
|
| 138 |
+
|
| 139 |
+
return false;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
// Enable handling the keypad ("function keys" like the arrow keys).
|
| 143 |
+
if (keypad(stdscr, TRUE) != OK)
|
| 144 |
+
{
|
| 145 |
+
ClientLog::error("Failed to enable keypad input.");
|
| 146 |
+
|
| 147 |
+
return false;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
return true;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
/// @brief Initialise Termios so that terminal output is correct.
|
| 154 |
+
static bool InitializeTermios(void)
|
| 155 |
+
{
|
| 156 |
+
// For some reason, printf and spdlog strings require a carriage return
|
| 157 |
+
// in addition to a newline after running initscr().
|
| 158 |
+
// This code sets the "output modes" flag to treat newline characters
|
| 159 |
+
// as newline+carriage-return characters.
|
| 160 |
+
// https://arstechnica.com/civis/viewtopic.php?t=70699
|
| 161 |
+
termios t_Settings;
|
| 162 |
+
if (tcgetattr(STDIN_FILENO, &t_Settings) != 0)
|
| 163 |
+
{
|
| 164 |
+
ClientLog::error("Failed to get Termios settings.");
|
| 165 |
+
|
| 166 |
+
return false;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
t_Settings.c_oflag |= ONLCR;
|
| 170 |
+
if (tcsetattr(0, TCSANOW, &t_Settings) != 0)
|
| 171 |
+
{
|
| 172 |
+
ClientLog::error("Failed to set Termios settings.");
|
| 173 |
+
|
| 174 |
+
return false;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
return true;
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
/// @brief Register our signal handling functions.
|
| 181 |
+
static bool SetUpSignalHandlers(void)
|
| 182 |
+
{
|
| 183 |
+
{
|
| 184 |
+
const __sighandler_t t_OldTerminationHandler = signal(
|
| 185 |
+
SIGTERM,
|
| 186 |
+
HandleTerminationSignal);
|
| 187 |
+
if (t_OldTerminationHandler == SIG_ERR)
|
| 188 |
+
{
|
| 189 |
+
ClientLog::error("Failed to set termination signal handler.");
|
| 190 |
+
return false;
|
| 191 |
+
}
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
{
|
| 195 |
+
const __sighandler_t t_OldInterruptHandler = signal(
|
| 196 |
+
SIGINT,
|
| 197 |
+
HandleInterruptSignal);
|
| 198 |
+
if (t_OldInterruptHandler == SIG_ERR)
|
| 199 |
+
{
|
| 200 |
+
ClientLog::error("Failed to set interrupt signal handler.");
|
| 201 |
+
return false;
|
| 202 |
+
}
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
{
|
| 206 |
+
const __sighandler_t t_OldQuitHandler = signal(
|
| 207 |
+
SIGQUIT,
|
| 208 |
+
HandleQuitSignal);
|
| 209 |
+
if (t_OldQuitHandler == SIG_ERR)
|
| 210 |
+
{
|
| 211 |
+
ClientLog::error("Failed to set quit signal handler.");
|
| 212 |
+
return false;
|
| 213 |
+
}
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
{
|
| 217 |
+
const __sighandler_t t_OldHangupHandler = signal(
|
| 218 |
+
SIGHUP,
|
| 219 |
+
HandleHangupSignal);
|
| 220 |
+
if (t_OldHangupHandler == SIG_ERR)
|
| 221 |
+
{
|
| 222 |
+
ClientLog::error("Failed to set hang-up signal handler.");
|
| 223 |
+
return false;
|
| 224 |
+
}
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
return true;
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
/// @brief Handles keyboard input.
|
| 231 |
+
/// Requires things to be set up with Ncurses and Termios.
|
| 232 |
+
class ClientInput
|
| 233 |
+
{
|
| 234 |
+
public:
|
| 235 |
+
/// @brief Update the state of the keyboard.
|
| 236 |
+
void Update(void)
|
| 237 |
+
{
|
| 238 |
+
// Reset the state of the last update.
|
| 239 |
+
for (
|
| 240 |
+
InputMap_t::iterator t_Key = m_PressedLastUpdate.begin();
|
| 241 |
+
t_Key != m_PressedLastUpdate.end();
|
| 242 |
+
t_Key++)
|
| 243 |
+
{
|
| 244 |
+
t_Key->second = false;
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
// Copy the current state to the last update's state, and clear the
|
| 248 |
+
// current state.
|
| 249 |
+
for (
|
| 250 |
+
InputMap_t::iterator t_Key = m_CurrentlyPressed.begin();
|
| 251 |
+
t_Key != m_CurrentlyPressed.end();
|
| 252 |
+
t_Key++)
|
| 253 |
+
{
|
| 254 |
+
m_PressedLastUpdate[t_Key->first] =
|
| 255 |
+
t_Key->second;
|
| 256 |
+
t_Key->second = false;
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
// Get the new state.
|
| 260 |
+
int t_Ch = getch();
|
| 261 |
+
while (t_Ch != ERR)
|
| 262 |
+
{
|
| 263 |
+
if (t_Ch >= 'a' && t_Ch <= 'z')
|
| 264 |
+
{
|
| 265 |
+
// Unlike with Windows' GetAsyncKeyState(), upper case and
|
| 266 |
+
// lower case characters have different key numbers with
|
| 267 |
+
// getch().
|
| 268 |
+
// Since all WasKeyPressed calls (as of writing this) use
|
| 269 |
+
// upper case, lower case keys need to be converted to work
|
| 270 |
+
// on Linux.
|
| 271 |
+
// Note that this does break the ability to check for lower
|
| 272 |
+
// case key presses.
|
| 273 |
+
t_Ch = toupper(t_Ch);
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
m_CurrentlyPressed[t_Ch] = true;
|
| 277 |
+
|
| 278 |
+
t_Ch = getch();
|
| 279 |
+
}
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
/// @brief Get the key's current state.
|
| 283 |
+
/// Note that unlike IsPressed(), this also stores the result for use in
|
| 284 |
+
/// the next key state check.
|
| 285 |
+
bool GetKey(const int p_Key)
|
| 286 |
+
{
|
| 287 |
+
bool t_IsPressed = IsPressed(p_Key);
|
| 288 |
+
m_PreviousKeyState[p_Key] = t_IsPressed;
|
| 289 |
+
|
| 290 |
+
return t_IsPressed;
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
/// @brief Was this key pressed since the last check?
|
| 294 |
+
/// Note that unlike WasJustPressed(), this checks if the key was pressed
|
| 295 |
+
/// since the last time a GetKey* function was called.
|
| 296 |
+
bool GetKeyDown(const int p_Key)
|
| 297 |
+
{
|
| 298 |
+
const bool t_IsPressed = IsPressed(p_Key);
|
| 299 |
+
|
| 300 |
+
const auto t_PreviousState = m_PreviousKeyState.find(p_Key);
|
| 301 |
+
const bool t_PreviousValue =
|
| 302 |
+
t_PreviousState == m_PreviousKeyState.end()
|
| 303 |
+
? false
|
| 304 |
+
: t_PreviousState->second;
|
| 305 |
+
|
| 306 |
+
const bool t_Down = t_IsPressed && !t_PreviousValue;
|
| 307 |
+
m_PreviousKeyState[p_Key] = t_Down;
|
| 308 |
+
|
| 309 |
+
return t_Down;
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
/// @brief Was this key released since the last check?
|
| 313 |
+
/// Note that unlike WasJustReleased(), this checks if the key was released
|
| 314 |
+
/// since the last time a GetKey* function was called.
|
| 315 |
+
bool GetKeyUp(const int p_Key)
|
| 316 |
+
{
|
| 317 |
+
const bool t_IsPressed = IsPressed(p_Key);
|
| 318 |
+
|
| 319 |
+
const auto t_PreviousState = m_PreviousKeyState.find(p_Key);
|
| 320 |
+
const bool t_PreviousValue =
|
| 321 |
+
t_PreviousState == m_PreviousKeyState.end()
|
| 322 |
+
? false
|
| 323 |
+
: t_PreviousState->second;
|
| 324 |
+
|
| 325 |
+
const bool t_Up = !t_IsPressed && t_PreviousValue;
|
| 326 |
+
m_PreviousKeyState[p_Key] = t_Up;
|
| 327 |
+
|
| 328 |
+
return t_Up;
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
private:
|
| 332 |
+
/// @brief Get the key's current state.
|
| 333 |
+
/// Note that unlike GetKey(), this does not store the result for use in
|
| 334 |
+
/// the next key state check.
|
| 335 |
+
bool IsPressed(const int p_Key) const
|
| 336 |
+
{
|
| 337 |
+
auto t_CurrentlyPressed = m_CurrentlyPressed.find(p_Key);
|
| 338 |
+
if (t_CurrentlyPressed == m_CurrentlyPressed.end())
|
| 339 |
+
{
|
| 340 |
+
return false;
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
return t_CurrentlyPressed->second;
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
/// @brief Was this key pressed since the last input update?
|
| 347 |
+
/// Note that unlike GetKeyDown(), this function will return the same value
|
| 348 |
+
/// until the next keyboard state update.
|
| 349 |
+
bool WasJustPressed(const int p_Key) const
|
| 350 |
+
{
|
| 351 |
+
return !WasPressedLastUpdate(p_Key) && IsPressed(p_Key);
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
/// @brief Was this key released since the last input update?
|
| 355 |
+
/// Note that unlike GetKeyUp(), this function will return the same value
|
| 356 |
+
/// until the next keyboard state update.
|
| 357 |
+
bool WasJustReleased(const int p_Key) const
|
| 358 |
+
{
|
| 359 |
+
return WasPressedLastUpdate(p_Key) && !IsPressed(p_Key);
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
/// @brief Was this key pressed the previous input update?
|
| 363 |
+
bool WasPressedLastUpdate(const int p_Key) const
|
| 364 |
+
{
|
| 365 |
+
auto t_StateLastUpdate = m_PressedLastUpdate.find(p_Key);
|
| 366 |
+
if (t_StateLastUpdate == m_PressedLastUpdate.end())
|
| 367 |
+
{
|
| 368 |
+
return false;
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
return t_StateLastUpdate->second;
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
typedef std::map<int, bool> InputMap_t;
|
| 375 |
+
InputMap_t m_CurrentlyPressed;
|
| 376 |
+
InputMap_t m_PressedLastUpdate;
|
| 377 |
+
// The Windows GetKey* functions only update the key state when a GetKey*
|
| 378 |
+
// function gets called. To make the Linux input work the same way, this
|
| 379 |
+
// map is used.
|
| 380 |
+
InputMap_t m_PreviousKeyState;
|
| 381 |
+
};
|
| 382 |
+
|
| 383 |
+
static ClientInput g_Input;
|
| 384 |
+
|
| 385 |
+
bool SDKClientPlatformSpecific::PlatformSpecificInitialization(void)
|
| 386 |
+
{
|
| 387 |
+
const bool t_NcursesResult = InitializeNcurses();
|
| 388 |
+
const bool t_TermiosResult = InitializeTermios();
|
| 389 |
+
const bool t_SignalResult = SetUpSignalHandlers();
|
| 390 |
+
|
| 391 |
+
return t_NcursesResult && t_TermiosResult && t_SignalResult;
|
| 392 |
+
}
|
| 393 |
+
|
| 394 |
+
bool SDKClientPlatformSpecific::PlatformSpecificShutdown(void)
|
| 395 |
+
{
|
| 396 |
+
// Ncurses.
|
| 397 |
+
endwin();
|
| 398 |
+
|
| 399 |
+
return true;
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
void SDKClientPlatformSpecific::UpdateInput(void)
|
| 403 |
+
{
|
| 404 |
+
g_Input.Update();
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
/*static*/ bool SDKClientPlatformSpecific::CopyString(
|
| 408 |
+
char* const p_Target,
|
| 409 |
+
const size_t p_MaxLengthThatWillFitInTarget,
|
| 410 |
+
const std::string& p_Source)
|
| 411 |
+
{
|
| 412 |
+
if (!p_Target)
|
| 413 |
+
{
|
| 414 |
+
ClientLog::error(
|
| 415 |
+
"Tried to copy a string, but the target was null. The string was \"{}\".",
|
| 416 |
+
p_Source.c_str());
|
| 417 |
+
|
| 418 |
+
return false;
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
if (p_MaxLengthThatWillFitInTarget == 0)
|
| 422 |
+
{
|
| 423 |
+
ClientLog::error(
|
| 424 |
+
"Tried to copy a string, but the target's size is zero. The string was \"{}\".",
|
| 425 |
+
p_Source.c_str());
|
| 426 |
+
|
| 427 |
+
return false;
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
if (p_MaxLengthThatWillFitInTarget <= p_Source.length())
|
| 431 |
+
{
|
| 432 |
+
ClientLog::error(
|
| 433 |
+
"Tried to copy a string that was longer than {} characters, which makes it too big for its target buffer. The string was \"{}\".",
|
| 434 |
+
p_MaxLengthThatWillFitInTarget,
|
| 435 |
+
p_Source.c_str());
|
| 436 |
+
|
| 437 |
+
return false;
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
strcpy(p_Target, p_Source.c_str());
|
| 441 |
+
|
| 442 |
+
return true;
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
bool SDKClientPlatformSpecific::ResizeWindow(
|
| 446 |
+
const short int p_ConsoleWidth,
|
| 447 |
+
const short int p_ConsoleHeight,
|
| 448 |
+
const short int p_ConsoleScrollback)
|
| 449 |
+
{
|
| 450 |
+
// https://apple.stackexchange.com/questions/33736/can-a-terminal-window-be-resized-with-a-terminal-command/47841#47841
|
| 451 |
+
// Use a control sequence to resize the window.
|
| 452 |
+
// Seems to be supported by the default terminal used in Gnome, as well
|
| 453 |
+
// as Mac OS.
|
| 454 |
+
// \\e[ -> ASCII ESC character (number 27, or 0x1B)
|
| 455 |
+
// -> control sequence introducer
|
| 456 |
+
// 8; -> resize the window
|
| 457 |
+
// y;xt -> The first number is the height, the second the width.
|
| 458 |
+
// Scrollback can't and doesn't need to be set here for Linux.
|
| 459 |
+
printf("\e[8;%d;%dt", p_ConsoleHeight, p_ConsoleWidth);
|
| 460 |
+
|
| 461 |
+
ClearConsole();
|
| 462 |
+
|
| 463 |
+
// None of the ncurses functions for resizing the terminal actually
|
| 464 |
+
// seem to do anything.
|
| 465 |
+
/*if (resizeterm(180, 180) != OK)
|
| 466 |
+
{
|
| 467 |
+
return false;
|
| 468 |
+
}*/
|
| 469 |
+
|
| 470 |
+
return true;
|
| 471 |
+
}
|
| 472 |
+
|
| 473 |
+
void SDKClientPlatformSpecific::ApplyConsolePosition(
|
| 474 |
+
const int p_ConsoleCurrentOffset)
|
| 475 |
+
{
|
| 476 |
+
printf("\e[%d;1H", p_ConsoleCurrentOffset);
|
| 477 |
+
}
|
| 478 |
+
|
| 479 |
+
/*static*/ void SDKClientPlatformSpecific::ClearConsole(void)
|
| 480 |
+
{
|
| 481 |
+
// https://stackoverflow.com/questions/4062045/clearing-terminal-in-linux-with-c-code
|
| 482 |
+
// Use a control sequence to clear the terminal and move the cursor.
|
| 483 |
+
// Seems to be supported by the default terminal used in Gnome,
|
| 484 |
+
// as well as Mac OS.
|
| 485 |
+
// \\e[ -> ASCII ESC character (number 27, or 0x1B) -> control sequence introducer
|
| 486 |
+
// 2 -> the entire screen
|
| 487 |
+
// J -> clear the screen
|
| 488 |
+
//printf("\e[2J\n");
|
| 489 |
+
|
| 490 |
+
// Move the cursor to row 1 column 1.
|
| 491 |
+
//printf("\e[1;1H\n");
|
| 492 |
+
|
| 493 |
+
if (clear() != OK)
|
| 494 |
+
{
|
| 495 |
+
ClientLog::error("Failed to clear the screen.");
|
| 496 |
+
}
|
| 497 |
+
|
| 498 |
+
refresh();
|
| 499 |
+
}
|
| 500 |
+
|
| 501 |
+
bool SDKClientPlatformSpecific::GetKey(const int p_Key)
|
| 502 |
+
{
|
| 503 |
+
return g_Input.GetKey(p_Key);
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
bool SDKClientPlatformSpecific::GetKeyDown(const int p_Key)
|
| 507 |
+
{
|
| 508 |
+
return g_Input.GetKeyDown(p_Key);
|
| 509 |
+
}
|
| 510 |
+
|
| 511 |
+
bool SDKClientPlatformSpecific::GetKeyUp(const int p_Key)
|
| 512 |
+
{
|
| 513 |
+
return g_Input.GetKeyUp(p_Key);
|
| 514 |
+
}
|
| 515 |
+
|
| 516 |
+
std::string SDKClientPlatformSpecific::GetDocumentsDirectoryPath_UTF8(void)
|
| 517 |
+
{
|
| 518 |
+
const char* const t_Xdg = getenv("XDG_DOCUMENTS_DIR");
|
| 519 |
+
|
| 520 |
+
// Backup - the documents folder is usually going to be in $HOME/Documents.
|
| 521 |
+
const char* const t_Home = getenv("HOME");
|
| 522 |
+
if (!t_Xdg && !t_Home)
|
| 523 |
+
{
|
| 524 |
+
return std::string("");
|
| 525 |
+
}
|
| 526 |
+
|
| 527 |
+
const std::string t_DocumentsDir =
|
| 528 |
+
(!t_Xdg || strlen(t_Xdg) == 0)
|
| 529 |
+
? std::string(t_Home) + std::string("/Documents")
|
| 530 |
+
: std::string(t_Xdg);
|
| 531 |
+
|
| 532 |
+
return t_DocumentsDir;
|
| 533 |
+
}
|
| 534 |
+
|
| 535 |
+
std::ifstream SDKClientPlatformSpecific::GetInputFileStream(
|
| 536 |
+
std::string p_Path_UTF8)
|
| 537 |
+
{
|
| 538 |
+
return std::ifstream(p_Path_UTF8, std::ifstream::binary);
|
| 539 |
+
}
|
| 540 |
+
|
| 541 |
+
std::ofstream SDKClientPlatformSpecific::GetOutputFileStream(
|
| 542 |
+
std::string p_Path_UTF8)
|
| 543 |
+
{
|
| 544 |
+
return std::ofstream(p_Path_UTF8, std::ofstream::binary);
|
| 545 |
+
}
|
| 546 |
+
|
| 547 |
+
bool SDKClientPlatformSpecific::DoesFolderOrFileExist(std::string p_Path_UTF8)
|
| 548 |
+
{
|
| 549 |
+
return std::filesystem::exists(p_Path_UTF8);
|
| 550 |
+
}
|
| 551 |
+
|
| 552 |
+
void SDKClientPlatformSpecific::CreateFolderIfItDoesNotExist(
|
| 553 |
+
std::string p_Path_UTF8)
|
| 554 |
+
{
|
| 555 |
+
if (!DoesFolderOrFileExist(p_Path_UTF8))
|
| 556 |
+
{
|
| 557 |
+
std::filesystem::create_directory(p_Path_UTF8);
|
| 558 |
+
}
|
| 559 |
+
}
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/ClientPlatformSpecific.hpp
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef _CLIENT_PLATFORM_SPECIFIC_HPP_
|
| 2 |
+
#define _CLIENT_PLATFORM_SPECIFIC_HPP_
|
| 3 |
+
|
| 4 |
+
#include "ClientPlatformSpecificTypes.hpp"
|
| 5 |
+
|
| 6 |
+
// size_t
|
| 7 |
+
#include <cstddef>
|
| 8 |
+
// std::string
|
| 9 |
+
#include <string>
|
| 10 |
+
|
| 11 |
+
// Set up a Doxygen group.
|
| 12 |
+
/** @addtogroup SDKClient
|
| 13 |
+
* @{
|
| 14 |
+
*/
|
| 15 |
+
|
| 16 |
+
class SDKClientPlatformSpecific
|
| 17 |
+
{
|
| 18 |
+
protected:
|
| 19 |
+
/// @brief Initialise things only needed for this platform.
|
| 20 |
+
bool PlatformSpecificInitialization(void);
|
| 21 |
+
|
| 22 |
+
/// @brief Shut down things only needed for this platform.
|
| 23 |
+
bool PlatformSpecificShutdown(void);
|
| 24 |
+
|
| 25 |
+
/// @brief Update the current keyboard state.
|
| 26 |
+
void UpdateInput(void);
|
| 27 |
+
|
| 28 |
+
/// @brief Copy the given string into the given target.
|
| 29 |
+
static bool CopyString(
|
| 30 |
+
char* const p_Target,
|
| 31 |
+
const size_t p_MaxLengthThatWillFitInTarget,
|
| 32 |
+
const std::string& p_Source);
|
| 33 |
+
|
| 34 |
+
/// @brief Resize the window, so the log messages will fit.
|
| 35 |
+
/// Make sure not to enter illegal sizes in here or SetConsoleWindowInfo
|
| 36 |
+
/// and SetConsoleScreenBufferSize can generate an error.
|
| 37 |
+
/// This is not code directly needed for the SDK to function, but its handy
|
| 38 |
+
/// for a quick and simple output for this client.
|
| 39 |
+
bool ResizeWindow(
|
| 40 |
+
const short int p_ConsoleWidth,
|
| 41 |
+
const short int p_ConsoleHeight,
|
| 42 |
+
const short int p_ConsoleScrollback);
|
| 43 |
+
|
| 44 |
+
/// @brief Set the current console position.
|
| 45 |
+
/// This handles the platform-specific part of advancing the console
|
| 46 |
+
/// position.
|
| 47 |
+
void ApplyConsolePosition(
|
| 48 |
+
const int p_ConsoleCurrentOffset);
|
| 49 |
+
|
| 50 |
+
/// @brief Clear the console window.
|
| 51 |
+
static void ClearConsole(void);
|
| 52 |
+
|
| 53 |
+
/// @brief Gets key's current state.
|
| 54 |
+
/// True is pressed false is not pressed.
|
| 55 |
+
bool GetKey(const int p_Key);
|
| 56 |
+
|
| 57 |
+
/// @brief Returns true first time it is called when key is pressed.
|
| 58 |
+
bool GetKeyDown(const int p_Key);
|
| 59 |
+
|
| 60 |
+
/// @brief Returns true first time it is called when key is released.
|
| 61 |
+
bool GetKeyUp(const int p_Key);
|
| 62 |
+
|
| 63 |
+
/// @brief Get the path to the user's Documents folder.
|
| 64 |
+
/// The string should be in UTF-8 format.
|
| 65 |
+
std::string GetDocumentsDirectoryPath_UTF8(void);
|
| 66 |
+
|
| 67 |
+
/// @brief Get an input stream for the given file.
|
| 68 |
+
/// The file's path should be in UTF-8 format.
|
| 69 |
+
std::ifstream GetInputFileStream(std::string p_Path_UTF8);
|
| 70 |
+
|
| 71 |
+
/// @brief Get an output stream for the given file.
|
| 72 |
+
/// The file's path should be in UTF-8 format.
|
| 73 |
+
std::ofstream GetOutputFileStream(std::string p_Path_UTF8);
|
| 74 |
+
|
| 75 |
+
/// @brief Check if the given folder or file exists.
|
| 76 |
+
/// The folder path given should be in UTF-8 format.
|
| 77 |
+
bool DoesFolderOrFileExist(std::string p_Path_UTF8);
|
| 78 |
+
|
| 79 |
+
/// @brief Create the given folder if it does not exist.
|
| 80 |
+
/// The folder path given should be in UTF-8 format.
|
| 81 |
+
void CreateFolderIfItDoesNotExist(std::string p_Path_UTF8);
|
| 82 |
+
|
| 83 |
+
/// @brief The slash character that is used in the filesystem.
|
| 84 |
+
static const std::string s_SlashForFilesystemPath;
|
| 85 |
+
};
|
| 86 |
+
|
| 87 |
+
// Close the Doxygen group.
|
| 88 |
+
/** @} */
|
| 89 |
+
|
| 90 |
+
#endif
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/ClientPlatformSpecificTypes.hpp
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef _CLIENT_PLATFORM_SPECIFIC_TYPES_HPP_
|
| 2 |
+
#define _CLIENT_PLATFORM_SPECIFIC_TYPES_HPP_
|
| 3 |
+
|
| 4 |
+
#include <climits>
|
| 5 |
+
|
| 6 |
+
// Set up a Doxygen group.
|
| 7 |
+
/** @addtogroup SDKClient
|
| 8 |
+
* @{
|
| 9 |
+
*/
|
| 10 |
+
|
| 11 |
+
// Virtual key code characters for WasKeyPressed().
|
| 12 |
+
// Based on key codes used with GetAsyncKeyState().
|
| 13 |
+
// Manually checked what values getch() returns for these keys.
|
| 14 |
+
// https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
|
| 15 |
+
enum MicrosoftVirtualKeyCodes
|
| 16 |
+
{
|
| 17 |
+
VK_TAB = 9, // ASCII tab character value
|
| 18 |
+
VK_RETURN = 13, // ASCII carriage return character value
|
| 19 |
+
VK_ESCAPE = 27, // ASCII ESC character value
|
| 20 |
+
VK_DOWN = 258,
|
| 21 |
+
VK_UP = 259,
|
| 22 |
+
VK_LEFT = 260,
|
| 23 |
+
VK_RIGHT = 261,
|
| 24 |
+
VK_HOME = 262,
|
| 25 |
+
VK_BACK = 263,
|
| 26 |
+
VK_F1 = 265,
|
| 27 |
+
VK_F2 = 266,
|
| 28 |
+
VK_F3 = 267,
|
| 29 |
+
VK_F4 = 268,
|
| 30 |
+
VK_F5 = 269,
|
| 31 |
+
VK_F6 = 270,
|
| 32 |
+
VK_F7 = 271,
|
| 33 |
+
VK_F8 = 272,
|
| 34 |
+
VK_F9 = 273,
|
| 35 |
+
VK_F10 = 274,
|
| 36 |
+
VK_F11 = 275,
|
| 37 |
+
VK_F12 = 276,
|
| 38 |
+
VK_DELETE = 330,
|
| 39 |
+
VK_INSERT = 331,
|
| 40 |
+
VK_NEXT = 338,
|
| 41 |
+
VK_PRIOR = 339,
|
| 42 |
+
VK_END = 360
|
| 43 |
+
};
|
| 44 |
+
|
| 45 |
+
// Close the Doxygen group.
|
| 46 |
+
/** @} */
|
| 47 |
+
|
| 48 |
+
#endif
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/Dockerfile
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2018 gRPC authors.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.#
|
| 14 |
+
#
|
| 15 |
+
# Based on https://hub.docker.com/r/grpc/cxx.
|
| 16 |
+
|
| 17 |
+
# To build
|
| 18 |
+
# docker build -f ./Dockerfile -t manus-linux .
|
| 19 |
+
|
| 20 |
+
# To Run (Linux)
|
| 21 |
+
# docker run --net==host --privileged -v /dev:/dev -v /run/udev:/run/udev -i -t manus-linux /bin/bash
|
| 22 |
+
|
| 23 |
+
# To Run (Windows)
|
| 24 |
+
# docker run -p 5000:5000 -i -t manus-linux /bin/bash
|
| 25 |
+
|
| 26 |
+
# FROM ubuntu:jammy as build
|
| 27 |
+
FROM ubuntu:focal as build
|
| 28 |
+
LABEL description="Visual Studio Manus SDK Build container"
|
| 29 |
+
|
| 30 |
+
ENV TZ=Europe/Amsterdam
|
| 31 |
+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
| 32 |
+
|
| 33 |
+
RUN apt-get update && apt-get install -y \
|
| 34 |
+
build-essential \
|
| 35 |
+
# Required to install GRPC
|
| 36 |
+
git \
|
| 37 |
+
libtool \
|
| 38 |
+
libzmq3-dev \
|
| 39 |
+
# Required for core integrated
|
| 40 |
+
libusb-1.0-0-dev \
|
| 41 |
+
libudev-dev \
|
| 42 |
+
# Only required for building the minimal client
|
| 43 |
+
libncurses5-dev \
|
| 44 |
+
# Only required for visual studio debugging
|
| 45 |
+
gdb \
|
| 46 |
+
&& apt-get clean
|
| 47 |
+
|
| 48 |
+
ENV GRPC_RELEASE_TAG="v1.28.1"
|
| 49 |
+
|
| 50 |
+
RUN git clone -b ${GRPC_RELEASE_TAG} https://github.com/grpc/grpc /var/local/git/grpc && \
|
| 51 |
+
cd /var/local/git/grpc && \
|
| 52 |
+
git submodule update --init --recursive
|
| 53 |
+
|
| 54 |
+
RUN echo "-- installing protobuf" && \
|
| 55 |
+
cd /var/local/git/grpc/third_party/protobuf && \
|
| 56 |
+
./autogen.sh && ./configure --enable-shared && \
|
| 57 |
+
make -j$(nproc) && make -j$(nproc) check && make install && make clean && ldconfig
|
| 58 |
+
|
| 59 |
+
RUN echo "-- installing grpc" && \
|
| 60 |
+
cd /var/local/git/grpc && \
|
| 61 |
+
make -j$(nproc) && make install && make clean && ldconfig
|
| 62 |
+
|
| 63 |
+
# configure SSH for communication with Visual Studio
|
| 64 |
+
RUN apt-get update && apt-get install -y openssh-server
|
| 65 |
+
RUN mkdir -p /var/run/sshd
|
| 66 |
+
RUN echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config && \
|
| 67 |
+
ssh-keygen -A
|
| 68 |
+
|
| 69 |
+
# please make sure to change the password
|
| 70 |
+
RUN id -u manus >/dev/null 2>&1 || useradd -m -d /home/manus -s /bin/bash -G sudo manus && \
|
| 71 |
+
echo "manus:password" | chpasswd
|
| 72 |
+
|
| 73 |
+
# copy dependencies to ~/ManusSDK/ directory
|
| 74 |
+
COPY ManusSDK /home/manus/ManusSDK
|
| 75 |
+
|
| 76 |
+
# Add read/write permissions for manus devices
|
| 77 |
+
RUN apt-get update && apt-get install -y udev
|
| 78 |
+
RUN echo "# HIDAPI/libusb" > /etc/udev/rules.d/99-manus.rules && \
|
| 79 |
+
echo "SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"3325\", MODE:=\"0666\"" >> /etc/udev/rules.d/99-manus.rules && \
|
| 80 |
+
echo "# HIDAPI/hidraw" >> /etc/udev/rules.d/99-manus.rules && \
|
| 81 |
+
echo "KERNEL==\"hidraw*\", ATTRS{idVendor}==\"3325\", MODE:=\"0666\"" >> /etc/udev/rules.d/99-manus.rules
|
| 82 |
+
|
| 83 |
+
# change default SSH port to 5000 to not conflict with system ssh in host mode
|
| 84 |
+
RUN echo "Port 5000" >> /etc/ssh/sshd_config
|
| 85 |
+
|
| 86 |
+
ENTRYPOINT service ssh start && service udev start && bin/bash
|
| 87 |
+
|
| 88 |
+
EXPOSE 5000
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/Dockerfile.Integrated
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2018 gRPC authors.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.#
|
| 14 |
+
#
|
| 15 |
+
# Based on https://hub.docker.com/r/grpc/cxx.
|
| 16 |
+
|
| 17 |
+
# To build
|
| 18 |
+
# docker build -f ./Dockerfile.Integrated -t manus-linux-integrated .
|
| 19 |
+
|
| 20 |
+
# To Run (Linux)
|
| 21 |
+
# docker run -p 5000:5000 --privileged -v /dev:/dev -v /run/udev:/run/udev -i -t manus-linux-integrated /bin/bash
|
| 22 |
+
|
| 23 |
+
# To Run (Windows)
|
| 24 |
+
# docker run -p 5000:5000 -i -t manus-linux-integrated /bin/bash
|
| 25 |
+
|
| 26 |
+
# FROM ubuntu:jammy as build
|
| 27 |
+
FROM ubuntu:focal as build
|
| 28 |
+
LABEL description="Visual Studio Manus SDK Build container"
|
| 29 |
+
|
| 30 |
+
ENV TZ=Europe/Amsterdam
|
| 31 |
+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
| 32 |
+
|
| 33 |
+
RUN apt-get update && apt-get install -y \
|
| 34 |
+
build-essential \
|
| 35 |
+
# Required for core integrated
|
| 36 |
+
libusb-1.0-0-dev \
|
| 37 |
+
libudev-dev \
|
| 38 |
+
# Only required for building the minimal client
|
| 39 |
+
libncurses5-dev \
|
| 40 |
+
# Only required for visual studio debugging
|
| 41 |
+
gdb \
|
| 42 |
+
&& apt-get clean
|
| 43 |
+
|
| 44 |
+
# configure SSH for communication with Visual Studio
|
| 45 |
+
RUN apt-get update && apt-get install -y openssh-server
|
| 46 |
+
RUN mkdir -p /var/run/sshd
|
| 47 |
+
RUN echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config && \
|
| 48 |
+
ssh-keygen -A
|
| 49 |
+
|
| 50 |
+
# please make sure to change the password
|
| 51 |
+
RUN id -u manus >/dev/null 2>&1 || useradd -m -d /home/manus -s /bin/bash -G sudo manus && \
|
| 52 |
+
echo "manus:password" | chpasswd
|
| 53 |
+
|
| 54 |
+
# copy dependencies to ~/ManusSDK/ directory
|
| 55 |
+
COPY ManusSDK /home/manus/ManusSDK
|
| 56 |
+
|
| 57 |
+
# Add read/write permissions for manus devices
|
| 58 |
+
RUN apt-get update && apt-get install -y udev
|
| 59 |
+
RUN echo "# HIDAPI/libusb" > /etc/udev/rules.d/99-manus.rules && \
|
| 60 |
+
echo "SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"3325\", MODE:=\"0666\"" >> /etc/udev/rules.d/99-manus.rules && \
|
| 61 |
+
echo "# HIDAPI/hidraw" >> /etc/udev/rules.d/99-manus.rules && \
|
| 62 |
+
echo "KERNEL==\"hidraw*\", ATTRS{idVendor}==\"3325\", MODE:=\"0666\"" >> /etc/udev/rules.d/99-manus.rules
|
| 63 |
+
|
| 64 |
+
# change default SSH port to 5000 to not conflict with system ssh in host mode
|
| 65 |
+
RUN echo "Port 5000" >> /etc/ssh/sshd_config
|
| 66 |
+
|
| 67 |
+
ENTRYPOINT service ssh start && service udev start && bin/bash
|
| 68 |
+
|
| 69 |
+
EXPOSE 5000
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/Main.cpp
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Set up a Doxygen group.
|
| 2 |
+
/** @addtogroup Main
|
| 3 |
+
* @{
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
#include "ClientLogging.hpp"
|
| 7 |
+
#include "SDKClient.hpp"
|
| 8 |
+
#include <pybind11/pybind11.h>
|
| 9 |
+
#include <map>
|
| 10 |
+
#include <vector>
|
| 11 |
+
#include <thread>
|
| 12 |
+
#include <chrono>
|
| 13 |
+
#include <cstdio>
|
| 14 |
+
|
| 15 |
+
namespace py = pybind11;
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
ClientReturnCode t_Result;
|
| 19 |
+
SDKClient t_SDKClient;
|
| 20 |
+
|
| 21 |
+
int init() {
|
| 22 |
+
t_SDKClient.Initialize();
|
| 23 |
+
t_SDKClient.Run();
|
| 24 |
+
while (output_map.size() == 0){
|
| 25 |
+
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
| 26 |
+
}
|
| 27 |
+
return 0;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
py::dict get_latest_state() {
|
| 31 |
+
py::dict py_dict;
|
| 32 |
+
for (const auto& pair : output_map) {
|
| 33 |
+
py::list py_list; // Initialize a py::list for each vector
|
| 34 |
+
for (double value : pair.second) {
|
| 35 |
+
py_list.append(value); // Append each value from the vector to the py::list
|
| 36 |
+
}
|
| 37 |
+
py_dict[py::str(pair.first)] = py_list; // Assign the list to the dict with the string key
|
| 38 |
+
}
|
| 39 |
+
return py_dict;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
int shutdown() {
|
| 43 |
+
t_SDKClient.ShutDown();
|
| 44 |
+
std::cout<<"Manus shutdown\n";
|
| 45 |
+
return 0;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
PYBIND11_MODULE(ManusServer, m) {
|
| 49 |
+
m.def("init", &init);
|
| 50 |
+
m.def("get_latest_state", &get_latest_state);
|
| 51 |
+
m.def("shutdown", &shutdown);
|
| 52 |
+
}
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/Makefile
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
CXX := g++
|
| 2 |
+
|
| 3 |
+
#CXXFLAGS := -pedantic-errors -Wall -Wextra -Werror -g --std=c++17
|
| 4 |
+
# CXXFLAGS := -g --std=c++17
|
| 5 |
+
|
| 6 |
+
PYBIND11_INCLUDES := $(shell python3 -m pybind11 --includes)
|
| 7 |
+
PYBIND11_SUFFIX := $(shell python3-config --extension-suffix)
|
| 8 |
+
CXXFLAGS := -shared -g --std=c++17 -fPIC ${PYBIND11_INCLUDES}
|
| 9 |
+
|
| 10 |
+
LDFLAGS := -L./ManusSDK/lib -lManusSDK -lncurses -lpthread -Wl,-rpath=./ManusSDK/lib
|
| 11 |
+
BUILD := ./
|
| 12 |
+
OBJ_DIR := $(BUILD)/objects
|
| 13 |
+
APP_DIR := $(BUILD)
|
| 14 |
+
|
| 15 |
+
# TARGET := SDKClient_Linux.out
|
| 16 |
+
TARGET := ManusServer$(PYBIND11_SUFFIX)
|
| 17 |
+
|
| 18 |
+
INCLUDE := -I./ManusSDK/include
|
| 19 |
+
SRC := \
|
| 20 |
+
$(wildcard *.cpp)
|
| 21 |
+
|
| 22 |
+
OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.o)
|
| 23 |
+
DEPENDENCIES \
|
| 24 |
+
:= $(OBJECTS:.o=.d)
|
| 25 |
+
|
| 26 |
+
all: build $(APP_DIR)/$(TARGET)
|
| 27 |
+
|
| 28 |
+
$(OBJ_DIR)/%.o: %.cpp
|
| 29 |
+
@mkdir -p $(@D)
|
| 30 |
+
$(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -MMD -o $@
|
| 31 |
+
|
| 32 |
+
$(APP_DIR)/$(TARGET): $(OBJECTS)
|
| 33 |
+
@mkdir -p $(@D)
|
| 34 |
+
$(CXX) $(CXXFLAGS) -o $(APP_DIR)/$(TARGET) $^ $(LDFLAGS)
|
| 35 |
+
|
| 36 |
+
-include $(DEPENDENCIES)
|
| 37 |
+
|
| 38 |
+
.PHONY: all build clean debug release info
|
| 39 |
+
|
| 40 |
+
build:
|
| 41 |
+
@mkdir -p $(APP_DIR)
|
| 42 |
+
@mkdir -p $(OBJ_DIR)
|
| 43 |
+
|
| 44 |
+
debug: CXXFLAGS += -DDEBUG -g
|
| 45 |
+
debug: all
|
| 46 |
+
|
| 47 |
+
release: CXXFLAGS += -g
|
| 48 |
+
release: all
|
| 49 |
+
|
| 50 |
+
clean:
|
| 51 |
+
-@rm $(TARGET)
|
| 52 |
+
-@rm -rvf $(OBJ_DIR)/*
|
| 53 |
+
|
| 54 |
+
info:
|
| 55 |
+
@echo "[*] Application dir: ${APP_DIR} "
|
| 56 |
+
@echo "[*] Object dir: ${OBJ_DIR} "
|
| 57 |
+
@echo "[*] Sources: ${SRC} "
|
| 58 |
+
@echo "[*] Objects: ${OBJECTS} "
|
| 59 |
+
@echo "[*] Dependencies: ${DEPENDENCIES}"
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/ManusSDK/include/ManusSDK.h
ADDED
|
@@ -0,0 +1,1058 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef __MANUS_SDK_H__
|
| 2 |
+
#define __MANUS_SDK_H__
|
| 3 |
+
|
| 4 |
+
// Set up a Doxygen group.
|
| 5 |
+
/** @addtogroup ManusSDK
|
| 6 |
+
* @{
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
#ifdef __cplusplus
|
| 10 |
+
extern "C"
|
| 11 |
+
{
|
| 12 |
+
#endif
|
| 13 |
+
|
| 14 |
+
#include "ManusSDKTypes.h"
|
| 15 |
+
#include "ManusSDKTypeInitializers.h"
|
| 16 |
+
|
| 17 |
+
#include <stdint.h>
|
| 18 |
+
|
| 19 |
+
#ifdef MANUS_SDK_STATIC
|
| 20 |
+
#define CORESDK_API
|
| 21 |
+
#else
|
| 22 |
+
#ifdef _WIN32
|
| 23 |
+
// MANUS_SDK_EXPORTS defines if the functions are exported to or
|
| 24 |
+
// imported from a DLL.
|
| 25 |
+
#ifdef MANUS_SDK_EXPORTS
|
| 26 |
+
#define CORESDK_API __declspec(dllexport)
|
| 27 |
+
#else
|
| 28 |
+
#define CORESDK_API __declspec(dllimport)
|
| 29 |
+
#endif
|
| 30 |
+
#elif defined(__linux__)
|
| 31 |
+
#define CORESDK_API
|
| 32 |
+
#else
|
| 33 |
+
#error Unrecognized platform.
|
| 34 |
+
#endif
|
| 35 |
+
#endif
|
| 36 |
+
|
| 37 |
+
/******************************************************************************
|
| 38 |
+
* Wrapper startup and shutdown.
|
| 39 |
+
*****************************************************************************/
|
| 40 |
+
|
| 41 |
+
/// @brief Initialize the wrapper.
|
| 42 |
+
/// Call this before using the wrapper.
|
| 43 |
+
/// @param p_TypeOfSession
|
| 44 |
+
/// @param p_Remote If set to true, this is essentially the same as calling the old CoreSdk_Initialize
|
| 45 |
+
/// @return SDKReturnCode_Success if successful,
|
| 46 |
+
/// SDKReturnCode_FunctionCalledAtWrongTime if the function was not intended to be called at this time.
|
| 47 |
+
CORESDK_API SDKReturnCode CoreSdk_Initialize(SessionType p_TypeOfSession, bool p_Remote);
|
| 48 |
+
|
| 49 |
+
/// @brief Shut down the wrapper.
|
| 50 |
+
/// This needs to be called last.
|
| 51 |
+
/// @return SDKReturnCode_Success if successful,
|
| 52 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available.
|
| 53 |
+
CORESDK_API SDKReturnCode CoreSdk_ShutDown();
|
| 54 |
+
|
| 55 |
+
/******************************************************************************
|
| 56 |
+
* Utility functions.
|
| 57 |
+
*****************************************************************************/
|
| 58 |
+
|
| 59 |
+
/// @brief Check if the wrapper DLL was built in the debug configuration.
|
| 60 |
+
/// @param p_WasBuiltInDebugConfiguration
|
| 61 |
+
/// @return SDKReturnCode_Success if successful.
|
| 62 |
+
CORESDK_API SDKReturnCode CoreSdk_WasDllBuiltInDebugConfiguration(bool* p_WasBuiltInDebugConfiguration);
|
| 63 |
+
|
| 64 |
+
/// @brief Gets the timestamp info (more readable form of timestamp).
|
| 65 |
+
/// @param p_Timestamp Timestamp to get info from
|
| 66 |
+
/// @param p_Info Info of the timestamp
|
| 67 |
+
/// @return SDKReturnCode_Success if successful.
|
| 68 |
+
CORESDK_API SDKReturnCode CoreSdk_GetTimestampInfo(ManusTimestamp p_Timestamp, ManusTimestampInfo* p_Info);
|
| 69 |
+
|
| 70 |
+
/// @brief Sets the timestamp according to the info (more readable form of timestamp).
|
| 71 |
+
/// @param p_Timestamp the Timestamp to set info of
|
| 72 |
+
/// @param p_Info Info to get info from
|
| 73 |
+
/// @return SDKReturnCode_Success if successful.
|
| 74 |
+
CORESDK_API SDKReturnCode CoreSdk_SetTimestampInfo(ManusTimestamp* p_Timestamp, ManusTimestampInfo p_Info);
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
/******************************************************************************
|
| 78 |
+
* Connection handling.
|
| 79 |
+
*****************************************************************************/
|
| 80 |
+
|
| 81 |
+
/// @brief Start a background task that looks for hosts running Manus Core.
|
| 82 |
+
/// Call this first when looking for hosts to connect to.
|
| 83 |
+
/// Underlying function will sleep for p_WaitSeconds to allow servers to reply.
|
| 84 |
+
/// @param p_WaitSeconds defines the time the function will sleep for to allow servers to reply,
|
| 85 |
+
/// @param p_LoopbackOnly if true it looks for hosts only locally, if false it looks for hosts anywhere in the network,
|
| 86 |
+
/// @return SDKReturnCode_Success if successful,
|
| 87 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 88 |
+
/// SDKReturnCode_FunctionCalledAtWrongTime if the function was not intended to be called at this time.
|
| 89 |
+
CORESDK_API SDKReturnCode CoreSdk_LookForHosts(uint32_t p_WaitSeconds = 1, bool p_LoopbackOnly = false);
|
| 90 |
+
|
| 91 |
+
/// @brief Get the number of hosts running Manus Core that were found.
|
| 92 |
+
/// This is the second function to call when looking for hosts to connect to.
|
| 93 |
+
/// @param p_NumberOfAvailableHostsFound
|
| 94 |
+
/// @return SDKReturnCode_Success if successful,
|
| 95 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 96 |
+
/// SDKReturnCode_FunctionCalledAtWrongTime if the function was not intended to be called at this time.
|
| 97 |
+
CORESDK_API SDKReturnCode CoreSdk_GetNumberOfAvailableHostsFound(uint32_t* p_NumberOfAvailableHostsFound);
|
| 98 |
+
|
| 99 |
+
/// @brief Fill the given array with information on the hosts that were found.
|
| 100 |
+
/// This is the third and final function to call when looking for hosts to
|
| 101 |
+
/// connect to.
|
| 102 |
+
/// @param p_AvailableHostsFound
|
| 103 |
+
/// @param p_NumberOfHostsThatFitInArray
|
| 104 |
+
/// @return SDKReturnCode_Success if successful,
|
| 105 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 106 |
+
/// SDKReturnCode_FunctionCalledAtWrongTime if the function was not intended to be called at this time
|
| 107 |
+
/// SDKReturnCode_ArgumentSizeMismatch if p_NumberOfHostsThatFitInArray does not match the number of available hosts found in the network,
|
| 108 |
+
/// SDKReturnCode_InvalidArgument if the provided p_AvailableHostsFound is a null pointer,
|
| 109 |
+
/// SDKReturnCode_InternalError if the number of available hosts found is higher than the defined MAX_NUMBER_OF_HOSTS,
|
| 110 |
+
/// SDKReturnCode_UnsupportedStringSizeEncountered if the name of a host is higher than the defined MAX_NUM_CHARS_IN_HOST_NAME,
|
| 111 |
+
/// SDKReturnCode_Error if copying the string representing the host name was not successful,
|
| 112 |
+
/// SDKReturnCode_NullPointer if invalid host data was found.
|
| 113 |
+
CORESDK_API SDKReturnCode CoreSdk_GetAvailableHostsFound(ManusHost* p_AvailableHostsFound, const uint32_t p_NumberOfHostsThatFitInArray);
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
/// @brief Check if the wrapper is connected to ManusCore.
|
| 117 |
+
/// @param p_ConnectedToCore
|
| 118 |
+
/// @return SDKReturnCode_Success if successful,
|
| 119 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 120 |
+
/// SDKReturnCode_NotConnected if there is no connection to core.
|
| 121 |
+
CORESDK_API SDKReturnCode CoreSdk_GetIsConnectedToCore(bool* p_ConnectedToCore);
|
| 122 |
+
|
| 123 |
+
/// @brief Connect to the preset GRPC address.
|
| 124 |
+
/// @return SDKReturnCode_Success
|
| 125 |
+
/// SDKReturnCode_NotConnected if there is no connection to core.
|
| 126 |
+
CORESDK_API SDKReturnCode CoreSdk_ConnectGRPC();
|
| 127 |
+
|
| 128 |
+
/// @brief Disconnects from the current host
|
| 129 |
+
/// @return SDKReturnCode_Success
|
| 130 |
+
/// SDKReturnCode_NotConnected if there is no connection to core.
|
| 131 |
+
CORESDK_API SDKReturnCode CoreSdk_Disconnect();
|
| 132 |
+
|
| 133 |
+
/// @brief Connect to a host using the given host information.
|
| 134 |
+
/// @param p_Host
|
| 135 |
+
/// @return SDKReturnCode_Success if successful,
|
| 136 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 137 |
+
/// SDKReturnCode_SdkIsTerminating if the sdk is being terminated,
|
| 138 |
+
/// SDKReturnCode_FunctionCalledAtWrongTime if the function was not intended to be called at this time,
|
| 139 |
+
/// SDKReturnCode_NoCoordinateSystemSet if the user tried to connect without first setting up the coordinate system settings.
|
| 140 |
+
CORESDK_API SDKReturnCode CoreSdk_ConnectToHost(ManusHost p_Host);
|
| 141 |
+
|
| 142 |
+
/// @brief Initialize a coordinate system of type CoordinateSystemVUH. (View Up Handedness)
|
| 143 |
+
/// This has to be called before a connection is made.
|
| 144 |
+
/// @param p_CoordinateSystem
|
| 145 |
+
/// @param p_UseWorldCoordinates if true all data will be defined with respect to a world coordinate system,
|
| 146 |
+
/// if false all data will be defined with respect to a local one,
|
| 147 |
+
/// @return SDKReturnCode_Success if successful,
|
| 148 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available.
|
| 149 |
+
CORESDK_API SDKReturnCode CoreSdk_InitializeCoordinateSystemWithVUH(CoordinateSystemVUH p_CoordinateSystem, bool p_UseWorldCoordinates);
|
| 150 |
+
|
| 151 |
+
/// @brief Initialize a coordinate system of type CoordinateSystemDirection.
|
| 152 |
+
/// This has to be called before a connection is made.
|
| 153 |
+
/// @param p_CoordinateSystem
|
| 154 |
+
/// @param p_UseWorldCoordinates if true all data will be defined with respect to a world coordinate system,
|
| 155 |
+
/// if false all data will be defined with respect to a local one,
|
| 156 |
+
/// @return SDKReturnCode_Success if successful,
|
| 157 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available.
|
| 158 |
+
CORESDK_API SDKReturnCode CoreSdk_InitializeCoordinateSystemWithDirection(CoordinateSystemDirection p_CoordinateSystem, bool p_UseWorldCoordinates);
|
| 159 |
+
|
| 160 |
+
/// @brief Get the SDK and Core version used and check if they are compatible with each other.
|
| 161 |
+
/// @param p_SdkVersion
|
| 162 |
+
/// @param p_CoreVersion
|
| 163 |
+
/// @param p_AreVersionsCompatible
|
| 164 |
+
/// @return SDKReturnCode_Success if successful,
|
| 165 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 166 |
+
/// SDKReturnCode_NotConnected if there is no connection to core.
|
| 167 |
+
CORESDK_API SDKReturnCode CoreSdk_GetVersionsAndCheckCompatibility(ManusVersion* p_SdkVersion, ManusVersion* p_CoreVersion, bool* p_AreVersionsCompatible);
|
| 168 |
+
|
| 169 |
+
/// @brief Get the current session Id.
|
| 170 |
+
/// @param p_SessionId
|
| 171 |
+
/// @return SDKReturnCode_Success if successful,
|
| 172 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 173 |
+
/// SDKReturnCode_InvalidID if the session id is zero, which means it was not correctly assigned.
|
| 174 |
+
CORESDK_API SDKReturnCode CoreSdk_GetSessionId(uint32_t* p_SessionId);
|
| 175 |
+
|
| 176 |
+
/// @brief Register the callback function that is called when manus core gets connected to the sdk.
|
| 177 |
+
/// @param p_ConnectedCallback
|
| 178 |
+
/// @return SDKReturnCode_Success if successful,
|
| 179 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available.
|
| 180 |
+
CORESDK_API SDKReturnCode CoreSdk_RegisterCallbackForOnConnect(ConnectedToCoreCallback_t p_ConnectedCallback);
|
| 181 |
+
|
| 182 |
+
/// @brief Register the callback function that is called when manus core gets disconnected from the sdk.
|
| 183 |
+
/// @param p_DisconnectedCallback
|
| 184 |
+
/// @return SDKReturnCode_Success if successful,
|
| 185 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available.
|
| 186 |
+
CORESDK_API SDKReturnCode CoreSdk_RegisterCallbackForOnDisconnect(DisconnectedFromCoreCallback_t p_DisconnectedCallback);
|
| 187 |
+
|
| 188 |
+
/// @brief Register the callback function that is called when something is logged in the SDK.
|
| 189 |
+
/// @param p_LoggingCallback
|
| 190 |
+
/// @return SDKReturnCode_Success if successful,
|
| 191 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available.
|
| 192 |
+
CORESDK_API SDKReturnCode CoreSdk_RegisterCallbackForOnLog(LoggingCallback_t p_LoggingCallback);
|
| 193 |
+
|
| 194 |
+
/// @brief Register the callback function that is called when skeleton data comes in.
|
| 195 |
+
/// @param p_SkeletonStreamCallback
|
| 196 |
+
/// @return SDKReturnCode_Success if successful,
|
| 197 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available.
|
| 198 |
+
CORESDK_API SDKReturnCode CoreSdk_RegisterCallbackForSkeletonStream(SkeletonStreamCallback_t p_SkeletonStreamCallback);
|
| 199 |
+
|
| 200 |
+
/// @brief Register the callback function that is called when tracker data comes in.
|
| 201 |
+
/// @param p_TrackerStreamCallback
|
| 202 |
+
/// @return SDKReturnCode_Success if successful,
|
| 203 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available.
|
| 204 |
+
CORESDK_API SDKReturnCode CoreSdk_RegisterCallbackForTrackerStream(TrackerStreamCallback_t p_TrackerStreamCallback);
|
| 205 |
+
|
| 206 |
+
/// @brief Register the callback function that is called when the landscape data comes in.
|
| 207 |
+
/// @param p_LandscapeStreamCallback
|
| 208 |
+
/// @return SDKReturnCode_Success if successful,
|
| 209 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available.
|
| 210 |
+
CORESDK_API SDKReturnCode CoreSdk_RegisterCallbackForLandscapeStream(LandscapeStreamCallback_t p_LandscapeStreamCallback);
|
| 211 |
+
|
| 212 |
+
/// @brief Register the callback function that is called when core system related data comes in.
|
| 213 |
+
/// @param p_SystemStreamCallback
|
| 214 |
+
/// @return SDKReturnCode_Success if successful,
|
| 215 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available.
|
| 216 |
+
CORESDK_API SDKReturnCode CoreSdk_RegisterCallbackForSystemStream(SystemStreamCallback_t p_SystemStreamCallback);
|
| 217 |
+
|
| 218 |
+
/// @brief Register the callback function that is called when ergonomics data comes in.
|
| 219 |
+
/// @param p_ErgonomicsStreamCallback
|
| 220 |
+
/// @return SDKReturnCode_Success if successful,
|
| 221 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available.
|
| 222 |
+
CORESDK_API SDKReturnCode CoreSdk_RegisterCallbackForErgonomicsStream(ErgonomicsStreamCallback_t p_ErgonomicsStreamCallback);
|
| 223 |
+
|
| 224 |
+
/// @brief Register the callback function that is called when skeleton data comes in.
|
| 225 |
+
/// @param p_SkeletonStreamCallback
|
| 226 |
+
/// @return SDKReturnCode_Success if successful,
|
| 227 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available.
|
| 228 |
+
CORESDK_API SDKReturnCode CoreSdk_RegisterCallbackForRawSkeletonStream(RawSkeletonStreamCallback_t p_RawSkeletonStreamCallback);
|
| 229 |
+
|
| 230 |
+
/// @brief Register the callback function that is called when gesture data comes in.
|
| 231 |
+
/// @param p_GestureStreamCallback
|
| 232 |
+
/// @return SDKReturnCode_Success if successful,
|
| 233 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available.
|
| 234 |
+
CORESDK_API SDKReturnCode CoreSdk_RegisterCallbackForGestureStream(GestureStreamCallback_t p_GestureStreamCallback);
|
| 235 |
+
|
| 236 |
+
/******************************************************************************
|
| 237 |
+
* Basic glove interaction.
|
| 238 |
+
*****************************************************************************/
|
| 239 |
+
|
| 240 |
+
/// @brief Try to pair a glove to a dongle
|
| 241 |
+
/// @param p_GloveID
|
| 242 |
+
/// @return SDKReturnCode_Success if successful,
|
| 243 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available.
|
| 244 |
+
CORESDK_API SDKReturnCode CoreSdk_PairGlove(uint32_t p_GloveID, bool* p_Result);
|
| 245 |
+
|
| 246 |
+
/// @brief Try to unpair a glove to a dongle
|
| 247 |
+
/// @param p_GloveID
|
| 248 |
+
/// @return SDKReturnCode_Success if successful,
|
| 249 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available.
|
| 250 |
+
CORESDK_API SDKReturnCode CoreSdk_UnpairGlove(uint32_t p_GloveID, bool* p_Result);
|
| 251 |
+
|
| 252 |
+
/// @brief Vibrate the motor on the given fingers of a haptic glove.
|
| 253 |
+
/// The order of the fingers is Thumb, Index, Middle, Ring, Pinky.
|
| 254 |
+
/// @param p_DongleId
|
| 255 |
+
/// @param p_HandType
|
| 256 |
+
/// @param p_Powers strength of the vibration, should be an array of 5 values
|
| 257 |
+
/// @return SDKReturnCode_Success if successful,
|
| 258 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 259 |
+
/// SDKReturnCode_NotConnected if there is no connection to core.
|
| 260 |
+
/// @deprecated Use CoreSdk_VibrateFingersForGlove or CoreSdk_VibrateFingersForSkeleton instead
|
| 261 |
+
[[deprecated("Use CoreSdk_VibrateFingersForGlove or CoreSdk_VibrateFingersForSkeleton instead")]]
|
| 262 |
+
CORESDK_API SDKReturnCode CoreSdk_VibrateFingers(uint32_t p_DongleId, Side p_HandType, const float* p_Powers);
|
| 263 |
+
|
| 264 |
+
/// @brief Vibrate the motor on the given fingers of a haptic glove.
|
| 265 |
+
/// The order of the fingers is Thumb, Index, Middle, Ring, Pinky.
|
| 266 |
+
/// @param p_GloveId
|
| 267 |
+
/// @param p_Powers strength of the vibration, should be an array of 5 values
|
| 268 |
+
/// @return SDKReturnCode_Success if successful,
|
| 269 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 270 |
+
/// SDKReturnCode_NotConnected if there is no connection to core.
|
| 271 |
+
CORESDK_API SDKReturnCode CoreSdk_VibrateFingersForGlove(uint32_t p_GloveId, const float* p_Powers);
|
| 272 |
+
|
| 273 |
+
/// @brief Vibrate the motor on the fingers of a haptic glove associated to skeleton with given id.
|
| 274 |
+
/// The order of the fingers is Thumb, Index, Middle, Ring, Pinky.
|
| 275 |
+
/// @param p_SkeletonId
|
| 276 |
+
/// @param p_HandType
|
| 277 |
+
/// @param p_Powers strength of the vibration, should be an array of 5 values
|
| 278 |
+
/// @return SDKReturnCode_Success if successful,
|
| 279 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 280 |
+
/// SDKReturnCode_NotConnected if there is no connection to core.
|
| 281 |
+
CORESDK_API SDKReturnCode CoreSdk_VibrateFingersForSkeleton(uint32_t p_SkeletonId, Side p_HandType, const float* p_Powers);
|
| 282 |
+
|
| 283 |
+
/// @brief Get a glove ID for the given hand of the given user identified by its Id.
|
| 284 |
+
/// @param p_UserId
|
| 285 |
+
/// @param p_HandType
|
| 286 |
+
/// @param p_GloveId
|
| 287 |
+
/// @return SDKReturnCode_Success if successful,
|
| 288 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 289 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 290 |
+
/// SDKReturnCode_InvalidArgument if the provided p_HandType was neither left nor right,
|
| 291 |
+
/// SDKReturnCode_InvalidID if no user with the provided p_UserId was found in the landscape.
|
| 292 |
+
CORESDK_API SDKReturnCode CoreSdk_GetGloveIdOfUser_UsingUserId(uint32_t p_UserId, Side p_HandType, uint32_t* p_GloveId);
|
| 293 |
+
|
| 294 |
+
/// @brief Get the number of gloves that are available.
|
| 295 |
+
/// @param p_NumberOfAvailableGloves
|
| 296 |
+
/// @return SDKReturnCode_Success if successful,
|
| 297 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 298 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 299 |
+
/// SDKReturnCode_InternalError if the number of available gloves found is higher than the defined MAX_NUMBER_OF_GLOVES.
|
| 300 |
+
CORESDK_API SDKReturnCode CoreSdk_GetNumberOfAvailableGloves(uint32_t* p_NumberOfAvailableGloves);
|
| 301 |
+
|
| 302 |
+
/// @brief Fill the given array with the IDs of all available gloves.
|
| 303 |
+
/// The size of the given array must match the number of available gloves.
|
| 304 |
+
/// Note that the number of available gloves can change at any time.
|
| 305 |
+
/// @param p_IdsOfAvailableGloves
|
| 306 |
+
/// @param p_NumberOfIdsThatFitInArray
|
| 307 |
+
/// @return SDKReturnCode_Success if successful,
|
| 308 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 309 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 310 |
+
/// SDKReturnCode_ArgumentSizeMismatch if p_NumberOfIdsThatFitInArray does not match with the number of available gloves found,
|
| 311 |
+
/// SDKReturnCode_InvalidArgument if p_NumberOfIdsThatFitInArray is zero or is higher than the defined MAX_NUMBER_OF_GLOVES.
|
| 312 |
+
CORESDK_API SDKReturnCode CoreSdk_GetIdsOfAvailableGloves(uint32_t* p_IdsOfAvailableGloves, uint32_t p_NumberOfIdsThatFitInArray);
|
| 313 |
+
|
| 314 |
+
/// @brief Get glove id's for given dongle id.
|
| 315 |
+
/// @param p_DongleId
|
| 316 |
+
/// @param p_LeftGloveId
|
| 317 |
+
/// @param p_RightGloveId
|
| 318 |
+
/// @return SDKReturnCode_Success if successful,
|
| 319 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 320 |
+
/// SDKReturnCode_NotConnected if there is no connection to core.
|
| 321 |
+
/// @deprecated Get this through the Landscape instead
|
| 322 |
+
[[deprecated("Get this through the Landscape instead")]]
|
| 323 |
+
CORESDK_API SDKReturnCode CoreSdk_GetGlovesForDongle(uint32_t p_DongleId, uint32_t* p_LeftGloveId, uint32_t* p_RightGloveId);
|
| 324 |
+
|
| 325 |
+
/// @brief Get data for the glove with the given glove ID.
|
| 326 |
+
/// @param p_GloveId
|
| 327 |
+
/// @param p_GloveData
|
| 328 |
+
/// @return SDKReturnCode_Success if successful,
|
| 329 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 330 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 331 |
+
/// SDKReturnCode_DataNotAvailable if no glove with the provided p_GloveId was found in the landscape.
|
| 332 |
+
/// @deprecated Get this through the Landscape instead
|
| 333 |
+
[[deprecated("Get this through the Landscape instead")]]
|
| 334 |
+
CORESDK_API SDKReturnCode CoreSdk_GetDataForGlove_UsingGloveId(uint32_t p_GloveId, GloveLandscapeData* p_GloveData);
|
| 335 |
+
|
| 336 |
+
/// @brief Gets the data for a dongle with the given id.
|
| 337 |
+
/// @param p_DongleId
|
| 338 |
+
/// @param p_DongleData
|
| 339 |
+
/// @return SDKReturnCode_Success if successful,
|
| 340 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 341 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 342 |
+
/// SDKReturnCode_DataNotAvailable if no dongle with the provided p_DongleId was found in the landscape.
|
| 343 |
+
CORESDK_API SDKReturnCode CoreSdk_GetDataForDongle(uint32_t p_DongleId, DongleLandscapeData* p_DongleData);
|
| 344 |
+
|
| 345 |
+
/// @brief Get the number of available dongles.
|
| 346 |
+
/// @param p_NumberOfDongles
|
| 347 |
+
/// @return SDKReturnCode_Success if successful,
|
| 348 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 349 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 350 |
+
/// SDKReturnCode_InternalError if the number of dongles found is higher than the defined MAX_NUMBER_OF_DONGLES.
|
| 351 |
+
/// @deprecated Get this through the Landscape instead
|
| 352 |
+
[[deprecated("Get this through the Landscape instead")]]
|
| 353 |
+
CORESDK_API SDKReturnCode CoreSdk_GetNumberOfDongles(uint32_t* p_NumberOfDongles);
|
| 354 |
+
|
| 355 |
+
/// @brief Fill the given array with the IDs of all available dongles.
|
| 356 |
+
/// The size of the given array must match the number of available dongles.
|
| 357 |
+
/// Note that the number of available dongles can change at any time.
|
| 358 |
+
/// @param p_DongleIds
|
| 359 |
+
/// @param p_NumberOfIdsThatFitInArray
|
| 360 |
+
/// @return SDKReturnCode_Success if successful,
|
| 361 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 362 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 363 |
+
/// SDKReturnCode_ArgumentSizeMismatch if p_NumberOfIdsThatFitInArray does not match with the number of dongles found,
|
| 364 |
+
/// SDKReturnCode_InvalidArgument if p_NumberOfIdsThatFitInArray is zero or higher than the defined MAX_NUMBER_OF_HAPTICS_DONGLES.
|
| 365 |
+
/// @deprecated Get this through the Landscape instead
|
| 366 |
+
[[deprecated("Get this through the Landscape instead")]]
|
| 367 |
+
CORESDK_API SDKReturnCode CoreSdk_GetDongleIds(uint32_t* p_DongleIds, uint32_t p_NumberOfIdsThatFitInArray);
|
| 368 |
+
|
| 369 |
+
/******************************************************************************
|
| 370 |
+
* Haptics module.
|
| 371 |
+
*****************************************************************************/
|
| 372 |
+
|
| 373 |
+
/// @brief Get the number of available haptics dongles.
|
| 374 |
+
/// @param p_NumberOfHapticsDongles
|
| 375 |
+
/// @return SDKReturnCode_Success if successful,
|
| 376 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 377 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 378 |
+
/// SDKReturnCode_InternalError if the number of haptic dongles found is higher than the defined MAX_NUMBER_OF_HAPTICS_DONGLES.
|
| 379 |
+
/// @deprecated Get this through the Landscape instead
|
| 380 |
+
[[deprecated("Get this through the Landscape instead")]]
|
| 381 |
+
CORESDK_API SDKReturnCode CoreSdk_GetNumberOfHapticsDongles(uint32_t* p_NumberOfHapticsDongles);
|
| 382 |
+
|
| 383 |
+
/// @brief Fill the given array with the IDs of all available haptics dongles.
|
| 384 |
+
/// The size of the given array must match the number of available haptics dongles.
|
| 385 |
+
/// Note that the number of available haptics dongles can change at any time.
|
| 386 |
+
/// @param p_HapticsDongleIds
|
| 387 |
+
/// @param p_NumberOfIdsThatFitInArray
|
| 388 |
+
/// @return SDKReturnCode_Success if successful,
|
| 389 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 390 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 391 |
+
/// SDKReturnCode_ArgumentSizeMismatch if p_NumberOfIdsThatFitInArray does not match with the number of haptic dongles found,
|
| 392 |
+
/// SDKReturnCode_InvalidArgument if p_NumberOfIdsThatFitInArray is zero or higher than the defined MAX_NUMBER_OF_HAPTICS_DONGLES.
|
| 393 |
+
/// @deprecated Get this through the Landscape instead
|
| 394 |
+
[[deprecated("Get this through the Landscape instead")]]
|
| 395 |
+
CORESDK_API SDKReturnCode CoreSdk_GetHapticsDongleIds(uint32_t* p_HapticsDongleIds, uint32_t p_NumberOfIdsThatFitInArray);
|
| 396 |
+
|
| 397 |
+
/******************************************************************************
|
| 398 |
+
* Users.
|
| 399 |
+
*****************************************************************************/
|
| 400 |
+
|
| 401 |
+
/// @brief Get the number of available users.
|
| 402 |
+
/// Note that this is reliant on the landscape, and the first second after connecting the client to the core it will not yet have landscape
|
| 403 |
+
/// data, so the number of users wil be 0. Since there will always be a default users, just wait until the count is above 0 and then proceed.
|
| 404 |
+
/// @param p_NumberOfAvailableUsers
|
| 405 |
+
/// @return SDKReturnCode_Success if successful,
|
| 406 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 407 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 408 |
+
/// SDKReturnCode_InternalError if the number of available users found is higher than the defined MAX_NUMBER_OF_USERS.
|
| 409 |
+
CORESDK_API SDKReturnCode CoreSdk_GetNumberOfAvailableUsers(uint32_t* p_NumberOfAvailableUsers);
|
| 410 |
+
|
| 411 |
+
/// @brief Fill the given array with the IDs of all available users.
|
| 412 |
+
/// The size of the given array must match the number of available users.
|
| 413 |
+
/// Note that the number of available users can change at any time depending on the landscape.
|
| 414 |
+
/// @param p_IdsOfAvailableUsers, The array of ids that will get filled
|
| 415 |
+
/// @param p_NumberOfIdsThatFitInArray
|
| 416 |
+
/// @return SDKReturnCode_Success if successful,
|
| 417 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 418 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 419 |
+
/// SDKReturnCode_InvalidArgument if p_NumberOfIdsThatFitInArray is null or higher than the defined MAX_NUMBER_OF_USERS, or
|
| 420 |
+
/// if p_IdsOfAvailableUsers is a null array.
|
| 421 |
+
/// SDKReturnCode_ArgumentSizeMismatch if p_NumberOfIdsThatFitInArray does not match with number of available users found.
|
| 422 |
+
CORESDK_API SDKReturnCode CoreSdk_GetIdsOfAvailableUsers(uint32_t* p_IdsOfAvailableUsers, uint32_t p_NumberOfIdsThatFitInArray);
|
| 423 |
+
|
| 424 |
+
/******************************************************************************
|
| 425 |
+
* Tracking.
|
| 426 |
+
*****************************************************************************/
|
| 427 |
+
|
| 428 |
+
/// @brief Get data for a tracker at a given index in the TrackerStream callback.
|
| 429 |
+
/// @param p_TrackerIndex
|
| 430 |
+
/// @param p_TrackerData
|
| 431 |
+
/// @return SDKReturnCode_Success if successful,
|
| 432 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 433 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 434 |
+
/// SDKReturnCode_ArgumentSizeMismatch if p_TrackerIndex is higher than the total number of trackers received from the tracker stream.
|
| 435 |
+
CORESDK_API SDKReturnCode CoreSdk_GetTrackerData(uint32_t p_TrackerIndex, TrackerData* p_TrackerData);
|
| 436 |
+
|
| 437 |
+
/// @brief Get the number of available trackers.
|
| 438 |
+
/// @param p_NumberOfAvailableTrackers
|
| 439 |
+
/// @return SDKReturnCode_Success if successful,
|
| 440 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 441 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 442 |
+
/// SDKReturnCode_InternalError if the number of trackers found is higher than the defined MAX_NUMBER_OF_TRACKERS.
|
| 443 |
+
CORESDK_API SDKReturnCode CoreSdk_GetNumberOfAvailableTrackers(uint32_t* p_NumberOfAvailableTrackers);
|
| 444 |
+
|
| 445 |
+
/// @brief Fill the given array with the IDs of available trackers.
|
| 446 |
+
/// The size of the given array must match the number of available trackers.
|
| 447 |
+
/// Note that the number of available trackers can change at any time.
|
| 448 |
+
/// @param p_IdsOfAvailableTrackers
|
| 449 |
+
/// @param p_NumberOfIdsThatFitInArray
|
| 450 |
+
/// @return SDKReturnCode_Success if successful,
|
| 451 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 452 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 453 |
+
/// SDKReturnCode_InvalidArgument if p_NumberOfIdsThatFitInArray is zero or higher than the defined MAX_NUMBER_OF_TRACKERS, or
|
| 454 |
+
/// if p_IdsOfAvailableTrackers is a null array.
|
| 455 |
+
/// SDKReturnCode_ArgumentSizeMismatch if p_NumberOfIdsThatFitInArray does not match with the number of available trackers found.
|
| 456 |
+
CORESDK_API SDKReturnCode CoreSdk_GetIdsOfAvailableTrackers(TrackerId* p_IdsOfAvailableTrackers, uint32_t p_NumberOfIdsThatFitInArray);
|
| 457 |
+
|
| 458 |
+
/// @brief Get the number of available trackers for a user with given Id.
|
| 459 |
+
/// @param p_NumberOfAvailableTrackers
|
| 460 |
+
/// @param p_UserId
|
| 461 |
+
/// @return SDKReturnCode_Success if successful,
|
| 462 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 463 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 464 |
+
/// SDKReturnCode_InternalError if the number of trackers found is higher than the defined MAX_NUMBER_OF_TRACKERS.
|
| 465 |
+
CORESDK_API SDKReturnCode CoreSdk_GetNumberOfAvailableTrackersForUserId(uint32_t* p_NumberOfAvailableTrackers, uint32_t p_UserId);
|
| 466 |
+
|
| 467 |
+
/// @brief Fill the given array with the IDs of available trackers for a user with given Id.
|
| 468 |
+
/// The size of the given array must match the number of available trackers.
|
| 469 |
+
/// Note that the number of available trackers can change at any time.
|
| 470 |
+
/// @param p_IdsOfAvailableTrackers
|
| 471 |
+
/// @param p_UserId
|
| 472 |
+
/// @param p_NumberOfIdsThatFitInArray
|
| 473 |
+
/// @return SDKReturnCode_Success if successful,
|
| 474 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 475 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 476 |
+
/// SDKReturnCode_InvalidArgument if p_NumberOfIdsThatFitInArray is zero or higher than the defined MAX_NUMBER_OF_TRACKERS, or
|
| 477 |
+
/// if p_IdsOfAvailableTrackers is a null array.
|
| 478 |
+
/// SDKReturnCode_ArgumentSizeMismatch if p_NumberOfIdsThatFitInArray does not match with the number of available trackers found.
|
| 479 |
+
CORESDK_API SDKReturnCode CoreSdk_GetIdsOfAvailableTrackersForUserId(TrackerId* p_IdsOfAvailableTrackers, uint32_t p_UserId, uint32_t p_NumberOfIdsThatFitInArray);
|
| 480 |
+
|
| 481 |
+
/// @brief Get the number of available trackers for a user with given Id.
|
| 482 |
+
/// @param p_NumberOfAvailableTrackers
|
| 483 |
+
/// @param p_UserIndex
|
| 484 |
+
/// @return SDKReturnCode_Success if successful,
|
| 485 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 486 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 487 |
+
/// SDKReturnCode_InternalError if the number of trackers found is higher than the defined MAX_NUMBER_OF_TRACKERS.
|
| 488 |
+
CORESDK_API SDKReturnCode CoreSdk_GetNumberOfAvailableTrackersForUserIndex(uint32_t* p_NumberOfAvailableTrackers, uint32_t p_UserIndex);
|
| 489 |
+
|
| 490 |
+
/// @brief Fill the given array with the IDs of available trackers for a user with given Id.
|
| 491 |
+
/// The size of the given array must match the number of available trackers.
|
| 492 |
+
/// Note that the number of available trackers can change at any time.
|
| 493 |
+
/// @param p_IdsOfAvailableTrackers
|
| 494 |
+
/// @param p_UserIndex
|
| 495 |
+
/// @param p_NumberOfIdsThatFitInArray
|
| 496 |
+
/// @return SDKReturnCode_Success if successful,
|
| 497 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 498 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 499 |
+
/// SDKReturnCode_InvalidArgument if p_NumberOfIdsThatFitInArray is zero or higher than the defined MAX_NUMBER_OF_TRACKERS, or
|
| 500 |
+
/// if p_IdsOfAvailableTrackers is a null array.
|
| 501 |
+
/// SDKReturnCode_ArgumentSizeMismatch if p_NumberOfIdsThatFitInArray does not match with the number of available trackers found.
|
| 502 |
+
CORESDK_API SDKReturnCode CoreSdk_GetIdsOfAvailableTrackersForUserIndex(TrackerId* p_IdsOfAvailableTrackers, uint32_t p_UserIndex, uint32_t p_NumberOfIdsThatFitInArray);
|
| 503 |
+
|
| 504 |
+
|
| 505 |
+
|
| 506 |
+
/// @brief Get data for the tracker with the given tracker Id.
|
| 507 |
+
/// @param p_TrackerId
|
| 508 |
+
/// @param p_TrackerData
|
| 509 |
+
/// @return SDKReturnCode_Success if successful,
|
| 510 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 511 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 512 |
+
/// SDKReturnCode_DataNotAvailable if no tracker with the given p_TrackerId was found in the landscape.
|
| 513 |
+
CORESDK_API SDKReturnCode CoreSdk_GetDataForTracker_UsingTrackerId(TrackerId p_TrackerId, TrackerData* p_TrackerData);
|
| 514 |
+
|
| 515 |
+
/// @brief Get data for the tracker with the given user id and type.
|
| 516 |
+
/// @param p_UserId
|
| 517 |
+
/// @param p_TrackerType
|
| 518 |
+
/// @param p_TrackerData
|
| 519 |
+
/// @return SDKReturnCode_Success if successful,
|
| 520 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 521 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 522 |
+
/// SDKReturnCode_DataNotAvailable if no tracker with the given p_TrackerId and the given p_TrackerType was found in the landscape.
|
| 523 |
+
CORESDK_API SDKReturnCode CoreSdk_GetDataForTracker_UsingIdAndType(uint32_t p_UserId, uint32_t p_TrackerType, TrackerData* p_TrackerData);
|
| 524 |
+
|
| 525 |
+
/// @brief Send data to Core for a tracker.
|
| 526 |
+
/// @param p_TrackerData
|
| 527 |
+
/// @param p_NumberOfTrackers amount of trackers for which we send the information
|
| 528 |
+
/// @return SDKReturnCode_Success if successful,
|
| 529 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 530 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 531 |
+
/// SDKReturnCode_StubNullPointer if the stub has been reset but someone is trying to use it anyway. This usually happens after a shutdown of the SDK,
|
| 532 |
+
/// SDKReturnCode_NullPointer if the provided p_TrackerData is a null pointer,
|
| 533 |
+
/// SDKReturnCode_InvalidArgument if p_NumberOfTrackers is null or higher than the defined MAX_NUMBER_OF_TRACKERS.
|
| 534 |
+
CORESDK_API SDKReturnCode CoreSdk_SendDataForTrackers(const TrackerData* p_TrackerData, uint32_t p_NumberOfTrackers);
|
| 535 |
+
|
| 536 |
+
/// @brief Sets the offset of a tracker for a specified user
|
| 537 |
+
/// @param p_UserId
|
| 538 |
+
/// @param p_TrackerOffset
|
| 539 |
+
/// @return SDKReturnCode_Success if successful,
|
| 540 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 541 |
+
/// SDKReturnCode_StubNullPointer if the stub has been reset but someone is trying to use it anyway. This usually happens after a shutdown of the SDK,
|
| 542 |
+
/// SDKReturnCode_NotConnected if there is no connection to core.
|
| 543 |
+
CORESDK_API SDKReturnCode CoreSdk_SetTrackerOffset(uint32_t p_UserId, const TrackerOffset* p_TrackerOffset);
|
| 544 |
+
|
| 545 |
+
/******************************************************************************
|
| 546 |
+
* Gestures.
|
| 547 |
+
*****************************************************************************/
|
| 548 |
+
|
| 549 |
+
/// @brief Get the landscape data for all the gestures in the latest landscape.
|
| 550 |
+
/// @param p_LandscapeDataArray
|
| 551 |
+
/// @param p_ArraySize
|
| 552 |
+
/// @return SDKReturnCode_Success if successful,
|
| 553 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 554 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 555 |
+
/// SDKReturnCode_ArgumentSizeMismatch if p_ArraySize is higher than the total number of gestures in the landscape stream.
|
| 556 |
+
CORESDK_API SDKReturnCode CoreSdk_GetGestureLandscapeData(GestureLandscapeData* p_LandscapeDataArray, uint32_t p_ArraySize);
|
| 557 |
+
|
| 558 |
+
/// @brief The start data index allows you to get more data if there are more than MAX_GESTURE_DATA_CHUNK_SIZE gestures.
|
| 559 |
+
/// @param p_GestureStreamDataIndex
|
| 560 |
+
/// @param p_StartDataIndex
|
| 561 |
+
/// @param p_GestureProbabilitiesCollection
|
| 562 |
+
/// @return SDKReturnCode_Success if successful, or if there is no more data to get
|
| 563 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 564 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 565 |
+
/// SDKReturnCode_ArgumentSizeMismatch if p_ArraySize is higher than the total number of gestures in the landscape stream.
|
| 566 |
+
CORESDK_API SDKReturnCode CoreSdk_GetGestureStreamData(uint32_t p_GestureStreamDataIndex, uint32_t p_StartDataIndex, GestureProbabilities* p_GestureProbabilitiesCollection);
|
| 567 |
+
|
| 568 |
+
/******************************************************************************
|
| 569 |
+
* Glove Calibration.
|
| 570 |
+
*****************************************************************************/
|
| 571 |
+
|
| 572 |
+
/// @brief Start the calibration for a glove with the id that is specified in the arguments.
|
| 573 |
+
/// @param p_CalibrationArgs
|
| 574 |
+
/// @param p_Result
|
| 575 |
+
/// @return SDKReturnCode_Success if successful,
|
| 576 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 577 |
+
/// SDKReturnCode_NotConnected if there is no connection to core
|
| 578 |
+
CORESDK_API SDKReturnCode CoreSdk_GloveCalibrationStart(GloveCalibrationArgs p_CalibrationArgs, bool* p_Result);
|
| 579 |
+
|
| 580 |
+
/// @brief Stop the calibration for a glove with the id that is specified in the arguments.
|
| 581 |
+
/// @param p_CalibrationArgs
|
| 582 |
+
/// @param p_Result
|
| 583 |
+
/// @return SDKReturnCode_Success if successful,
|
| 584 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 585 |
+
/// SDKReturnCode_NotConnected if there is no connection to core
|
| 586 |
+
CORESDK_API SDKReturnCode CoreSdk_GloveCalibrationStop(GloveCalibrationArgs p_CalibrationArgs, bool* p_Result);
|
| 587 |
+
|
| 588 |
+
/// @brief Finish the calibration for a glove with the id that is specified in the arguments.
|
| 589 |
+
/// @param p_CalibrationArgs
|
| 590 |
+
/// @param p_Result
|
| 591 |
+
/// @return SDKReturnCode_Success if successful,
|
| 592 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 593 |
+
/// SDKReturnCode_NotConnected if there is no connection to core
|
| 594 |
+
CORESDK_API SDKReturnCode CoreSdk_GloveCalibrationFinish(GloveCalibrationArgs p_CalibrationArgs, bool* p_Result);
|
| 595 |
+
|
| 596 |
+
|
| 597 |
+
/// @brief Get the number of steps in a glove calibration sequence.
|
| 598 |
+
/// @param p_CalibrationArgs
|
| 599 |
+
/// @param p_NumberOfSteps
|
| 600 |
+
/// @return SDKReturnCode_Success if successful,
|
| 601 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 602 |
+
/// SDKReturnCode_NotConnected if there is no connection to core
|
| 603 |
+
CORESDK_API SDKReturnCode CoreSdk_GloveCalibrationGetNumberOfSteps(GloveCalibrationArgs p_CalibrationArgs, uint32_t* p_NumberOfSteps);
|
| 604 |
+
|
| 605 |
+
/// @brief Get information data about a specific calibration step for a glove.
|
| 606 |
+
/// @param p_CalibrationStepArgs
|
| 607 |
+
/// @param p_Data
|
| 608 |
+
/// @return SDKReturnCode_Success if successful,
|
| 609 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 610 |
+
/// SDKReturnCode_NotConnected if there is no connection to core
|
| 611 |
+
CORESDK_API SDKReturnCode CoreSdk_GloveCalibrationGetStepData(GloveCalibrationStepArgs p_CalibrationStepArgs, GloveCalibrationStepData* p_Data);
|
| 612 |
+
|
| 613 |
+
/// @brief Start a specific calibration step for a glove.
|
| 614 |
+
/// @param p_CalibrationStepArgs
|
| 615 |
+
/// @param p_Result
|
| 616 |
+
/// @return SDKReturnCode_Success if successful,
|
| 617 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 618 |
+
/// SDKReturnCode_NotConnected if there is no connection to core
|
| 619 |
+
CORESDK_API SDKReturnCode CoreSdk_GloveCalibrationStartStep(GloveCalibrationStepArgs p_CalibrationStepArgs, bool* p_Result);
|
| 620 |
+
|
| 621 |
+
|
| 622 |
+
CORESDK_API SDKReturnCode CoreSdk_GetGloveCalibrationSize(uint32_t p_GloveId, uint32_t* p_Size);
|
| 623 |
+
|
| 624 |
+
CORESDK_API SDKReturnCode CoreSdk_GetGloveCalibration(unsigned char* p_CalibrationBytes, uint32_t p_BytesLength);
|
| 625 |
+
|
| 626 |
+
CORESDK_API SDKReturnCode CoreSdk_SetGloveCalibration(uint32_t p_GloveId, unsigned char* p_CalibrationBytes, SetGloveCalibrationReturnCode* p_Result);
|
| 627 |
+
|
| 628 |
+
/******************************************************************************
|
| 629 |
+
* Skeletal System.
|
| 630 |
+
*****************************************************************************/
|
| 631 |
+
|
| 632 |
+
/// @brief Get information about the final animated skeleton with given index.
|
| 633 |
+
/// @param p_SkeletonIndex
|
| 634 |
+
/// @param p_Info
|
| 635 |
+
/// @return SDKReturnCode_Success if successful,
|
| 636 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 637 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 638 |
+
/// SDKReturnCode_ArgumentSizeMismatch if p_SkeletonIndex is higher than the total number of skeletons received from the skeleton stream.
|
| 639 |
+
CORESDK_API SDKReturnCode CoreSdk_GetSkeletonInfo(uint32_t p_SkeletonIndex, SkeletonInfo* p_Info);
|
| 640 |
+
|
| 641 |
+
/// @brief Get data for the final animated skeleton with given index.
|
| 642 |
+
/// The size of the given array must match the nodes count.
|
| 643 |
+
/// Note that the nodes count can change at any time.
|
| 644 |
+
/// @param p_SkeletonIndex
|
| 645 |
+
/// @param p_Nodes
|
| 646 |
+
/// @param p_NodeCount
|
| 647 |
+
/// @return SDKReturnCode_Success if successful,
|
| 648 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 649 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 650 |
+
/// SDKReturnCode_ArgumentSizeMismatch if p_SkeletonIndex is higher than the total number of skeletons received from the skeleton stream or
|
| 651 |
+
/// if the provided p_NodeCount is different from the node count of that skeleton.
|
| 652 |
+
CORESDK_API SDKReturnCode CoreSdk_GetSkeletonData(uint32_t p_SkeletonIndex, SkeletonNode* p_Nodes, uint32_t p_NodeCount);
|
| 653 |
+
|
| 654 |
+
/// @brief Determine how the raw data should be moving
|
| 655 |
+
/// @param p_HandMotion
|
| 656 |
+
/// @return SDKReturnCode_Success if successful,
|
| 657 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 658 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 659 |
+
CORESDK_API SDKReturnCode CoreSdk_SetRawSkeletonHandMotion(HandMotion p_HandMotion);
|
| 660 |
+
|
| 661 |
+
/// @brief Get the raw skeleton hand motion type
|
| 662 |
+
/// @param p_HandMotion
|
| 663 |
+
/// @return SDKReturnCode_Success if successful,
|
| 664 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 665 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 666 |
+
CORESDK_API SDKReturnCode CoreSdk_GetRawSkeletonHandMotion(HandMotion* p_HandMotion);
|
| 667 |
+
|
| 668 |
+
/// @brief Get information about the raw skeleton data with given index.
|
| 669 |
+
/// @param p_SkeletonIndex
|
| 670 |
+
/// @param p_Info
|
| 671 |
+
/// @return SDKReturnCode_Success if successful,
|
| 672 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 673 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 674 |
+
/// SDKReturnCode_ArgumentSizeMismatch if p_SkeletonIndex is higher than the total number of skeletons received from the skeleton stream.
|
| 675 |
+
CORESDK_API SDKReturnCode CoreSdk_GetRawSkeletonInfo(uint32_t p_SkeletonIndex, RawSkeletonInfo* p_Info);
|
| 676 |
+
|
| 677 |
+
/// @brief Get data for the raw skeleton with given index.
|
| 678 |
+
/// The size of the given array must match the nodes count.
|
| 679 |
+
/// Note that the nodes count can change at any time.
|
| 680 |
+
/// @param p_SkeletonIndex
|
| 681 |
+
/// @param p_Nodes
|
| 682 |
+
/// @param p_NodeCount
|
| 683 |
+
/// @return SDKReturnCode_Success if successful,
|
| 684 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 685 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 686 |
+
/// SDKReturnCode_ArgumentSizeMismatch if p_SkeletonIndex is higher than the total number of skeletons received from the skeleton stream or
|
| 687 |
+
/// if the provided p_NodeCount is different from the node count of that skeleton.
|
| 688 |
+
CORESDK_API SDKReturnCode CoreSdk_GetRawSkeletonData(uint32_t p_SkeletonIndex, SkeletonNode* p_Nodes, uint32_t p_NodeCount);
|
| 689 |
+
|
| 690 |
+
/// @brief Identifies if the glove associated to the skeleton with given id and side is a haptic one.
|
| 691 |
+
/// @param p_SkeletonId
|
| 692 |
+
/// @param p_HandType
|
| 693 |
+
/// @param p_IsHaptics
|
| 694 |
+
/// @return SDKReturnCode_Success if successful,
|
| 695 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 696 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 697 |
+
/// SDKReturnCode_DataNotAvailable if the requested glove is not found or if the skeleton does not have any user associated to it,
|
| 698 |
+
/// SDKReturnCode_InvalidArgument if the provided p_HandType is neither Left nor Right.
|
| 699 |
+
CORESDK_API SDKReturnCode CoreSdk_DoesSkeletonGloveSupportHaptics(uint32_t p_SkeletonId, Side p_HandType, bool* p_IsHaptics);
|
| 700 |
+
/******************************************************************************
|
| 701 |
+
* Skeletal System Setup.
|
| 702 |
+
*****************************************************************************/
|
| 703 |
+
|
| 704 |
+
/// @brief Create a new SkeletonSetup with the given information and returns the index on which it is saved.
|
| 705 |
+
/// @param p_Skeleton The SkeletonSetup information used by this skeleton.
|
| 706 |
+
/// @param p_SkeletonSetupIndex The index which is used by this SkeletonSetup.
|
| 707 |
+
/// @return SDKReturnCode_Success if successful,
|
| 708 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 709 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 710 |
+
/// SDKReturnCode_ArgumentSizeMismatch if the maximum number of temporary skeletons per session has been reached,
|
| 711 |
+
/// when this happens the user can either load or clear a temporary skeleton in order to create a new skeleton setup.
|
| 712 |
+
CORESDK_API SDKReturnCode CoreSdk_CreateSkeletonSetup(SkeletonSetupInfo p_Skeleton, uint32_t* p_SkeletonSetupIndex);
|
| 713 |
+
|
| 714 |
+
/// @brief Add a node to a SkeletonSetup at a given index.
|
| 715 |
+
/// @param p_SkeletonSetupIndex
|
| 716 |
+
/// @param p_Node
|
| 717 |
+
/// @return SDKReturnCode_Success if successful,
|
| 718 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 719 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 720 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 721 |
+
CORESDK_API SDKReturnCode CoreSdk_AddNodeToSkeletonSetup(uint32_t p_SkeletonSetupIndex, NodeSetup p_Node);
|
| 722 |
+
|
| 723 |
+
/// @brief Add a chain to a SkeletonSetup at a given index.
|
| 724 |
+
/// @param p_SkeletonSetupIndex
|
| 725 |
+
/// @param p_Chain
|
| 726 |
+
/// @return SDKReturnCode_Success if successful,
|
| 727 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 728 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 729 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 730 |
+
CORESDK_API SDKReturnCode CoreSdk_AddChainToSkeletonSetup(uint32_t p_SkeletonSetupIndex, ChainSetup p_Chain);
|
| 731 |
+
|
| 732 |
+
/// @brief Add a collider to a SkeletonSetup at a given index.
|
| 733 |
+
/// @param p_SkeletonSetupIndex
|
| 734 |
+
/// @param p_Collider
|
| 735 |
+
/// @return SDKReturnCode_Success if successful,
|
| 736 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 737 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 738 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 739 |
+
CORESDK_API SDKReturnCode CoreSdk_AddColliderToSkeletonSetup(uint32_t p_SkeletonSetupIndex, ColliderSetup p_Collider);
|
| 740 |
+
|
| 741 |
+
/// @brief Add a mesh setup to a SkeletonSetup at a given index.
|
| 742 |
+
/// @param p_SkeletonSetupIndex
|
| 743 |
+
/// @param p_NodeID
|
| 744 |
+
/// @param p_MeshSetupIndex
|
| 745 |
+
/// @return SDKReturnCode_Success if successful,
|
| 746 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 747 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 748 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 749 |
+
CORESDK_API SDKReturnCode CoreSdk_AddMeshSetupToSkeletonSetup(uint32_t p_SkeletonSetupIndex, uint32_t p_NodeID, uint32_t* p_MeshSetupIndex);
|
| 750 |
+
|
| 751 |
+
/// @brief Add a Vertex to a mesh setup at a given index.
|
| 752 |
+
/// @param p_SkeletonSetupIndex
|
| 753 |
+
/// @param p_MeshSetupIndex
|
| 754 |
+
/// @param p_Vertex
|
| 755 |
+
/// @return SDKReturnCode_Success if successful,
|
| 756 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 757 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 758 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 759 |
+
CORESDK_API SDKReturnCode CoreSdk_AddVertexToMeshSetup(uint32_t p_SkeletonSetupIndex, uint32_t p_MeshSetupIndex, Vertex p_Vertex);
|
| 760 |
+
|
| 761 |
+
|
| 762 |
+
/// @brief Add a Triangle to a mesh setup at a given index.
|
| 763 |
+
/// @param p_SkeletonSetupIndex
|
| 764 |
+
/// @param p_MeshSetupIndex
|
| 765 |
+
/// @param p_Triangle
|
| 766 |
+
/// @return SDKReturnCode_Success if successful,
|
| 767 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 768 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 769 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 770 |
+
CORESDK_API SDKReturnCode CoreSdk_AddTriangleToMeshSetup(uint32_t p_SkeletonSetupIndex, uint32_t p_MeshSetupIndex, Triangle p_Triangle);
|
| 771 |
+
|
| 772 |
+
/// @brief Overwrite an existing SkeletonSetup at a given index.
|
| 773 |
+
/// This will remove all chains and nodes from the current skeleton at this index.
|
| 774 |
+
/// @param p_SkeletonSetupIndex
|
| 775 |
+
/// @param p_SkeletonSetup
|
| 776 |
+
/// @return SDKReturnCode_Success if successful,
|
| 777 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 778 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 779 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup,
|
| 780 |
+
/// SDKReturnCode_NullPointer if the skeleton setup was not correctly saved, thus the new skeleton setup is a null pointer.
|
| 781 |
+
CORESDK_API SDKReturnCode CoreSdk_OverwriteSkeletonSetup(uint32_t p_SkeletonSetupIndex, SkeletonSetupInfo p_SkeletonSetup);
|
| 782 |
+
|
| 783 |
+
/// @brief Overwrite a chain in a SkeletonSetup, the chain to be overwritten is idenfified by p_Chain.id.
|
| 784 |
+
/// @param p_SkeletonSetupIndex The SkeletonSetup's index, not to be confused by the Chain's ID.
|
| 785 |
+
/// @param p_Chain The chain to replace the matching (via id) chain with.
|
| 786 |
+
/// @return SDKReturnCode_Success if successful,
|
| 787 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 788 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 789 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 790 |
+
CORESDK_API SDKReturnCode CoreSdk_OverwriteChainToSkeletonSetup(uint32_t p_SkeletonSetupIndex, ChainSetup p_Chain);
|
| 791 |
+
|
| 792 |
+
/// @brief Overwrite a node in a SkeletonSetup, the node to be overwritten is identified by p_Node.id.
|
| 793 |
+
/// @param p_SkeletonSetupIndex The SkeletonSetup's index, not to be confused by the Chain's ID.
|
| 794 |
+
/// @param p_Node The node to replace the matching (via id) node with.
|
| 795 |
+
/// @return SDKReturnCode_Success if successful,
|
| 796 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 797 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 798 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 799 |
+
CORESDK_API SDKReturnCode CoreSdk_OverwriteNodeToSkeletonSetup(uint32_t p_SkeletonSetupIndex, NodeSetup p_Node);
|
| 800 |
+
|
| 801 |
+
/// @brief Get the skeleton info (number of nodes and chains) for a SkeletonSetup at a given index.
|
| 802 |
+
/// @param p_SkeletonSetupIndex
|
| 803 |
+
/// @param p_SkeletonInfo
|
| 804 |
+
/// @return SDKReturnCode_Success if successful,
|
| 805 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 806 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 807 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 808 |
+
CORESDK_API SDKReturnCode CoreSdk_GetSkeletonSetupArraySizes(uint32_t p_SkeletonSetupIndex, SkeletonSetupArraySizes* p_SkeletonInfo);
|
| 809 |
+
|
| 810 |
+
/// @brief Allocate chains for a SkeletonSetup at a given index.
|
| 811 |
+
/// @param p_SkeletonSetupIndex
|
| 812 |
+
/// @return SDKReturnCode_Success if successful,
|
| 813 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 814 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 815 |
+
/// SDKReturnCode_StubNullPointer if the stub has been reset but someone is trying to use it anyway. This usually happens after a shutdown of the SDK,
|
| 816 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 817 |
+
CORESDK_API SDKReturnCode CoreSdk_AllocateChainsForSkeletonSetup(uint32_t p_SkeletonSetupIndex);
|
| 818 |
+
CORESDK_API SDKReturnCode CoreSdk_PrepareSkeletonSetup(uint32_t p_SkeletonSetupIndex);
|
| 819 |
+
|
| 820 |
+
/// @brief Get setup info for a SkeletonSetup at a given index.
|
| 821 |
+
/// @param p_SkeletonSetupIndex
|
| 822 |
+
/// @param p_SDK
|
| 823 |
+
/// @return SDKReturnCode_Success if successful,
|
| 824 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 825 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 826 |
+
/// /// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 827 |
+
CORESDK_API SDKReturnCode CoreSdk_GetSkeletonSetupInfo(uint32_t p_SkeletonSetupIndex, SkeletonSetupInfo* p_SDK);
|
| 828 |
+
|
| 829 |
+
/// @brief Get setup chains for a SkeletonSetup at a given index.
|
| 830 |
+
/// The size of the given array must match the chains count.
|
| 831 |
+
/// Note that the chains count can change at any time.
|
| 832 |
+
/// @param p_SkeletonSetupIndex
|
| 833 |
+
/// @param p_SDK
|
| 834 |
+
/// @return SDKReturnCode_Success if successful,
|
| 835 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 836 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 837 |
+
/// SDKReturnCode_NullPointer if the provided p_SDK (used to store the setup chains) is a null pointer, it should be initialized to
|
| 838 |
+
/// an array with size equal to the chains count,
|
| 839 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 840 |
+
/// @deprecated Use GetSkeletonSetupChainsArray() instead
|
| 841 |
+
[[deprecated ("Use GetSkeletonSetupChainsArray() instead")]]
|
| 842 |
+
CORESDK_API SDKReturnCode CoreSdk_GetSkeletonSetupChains(uint32_t p_SkeletonSetupIndex, ChainSetup* p_SDK);
|
| 843 |
+
|
| 844 |
+
/// @brief Get setup chains for a SkeletonSetup at a given index.
|
| 845 |
+
/// The size of the given array must match the chains count.
|
| 846 |
+
/// Note that the chains count can change at any time.
|
| 847 |
+
/// @param p_SkeletonSetupIndex
|
| 848 |
+
/// @param p_ChainSetupArray
|
| 849 |
+
/// @param p_ArraySize
|
| 850 |
+
/// @return SDKReturnCode_Success if successful,
|
| 851 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 852 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 853 |
+
/// SDKReturnCode_NullPointer if the provided p_ChainSetupArray (used to store the setup chains) is a null pointer, it should be initialized to
|
| 854 |
+
/// an array with size equal to the chains count,
|
| 855 |
+
/// SDKReturnCode_ArgumentSizeMismatch if the provided p_ArraySize is not equal to the chains count,
|
| 856 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 857 |
+
CORESDK_API SDKReturnCode CoreSdk_GetSkeletonSetupChainsArray(uint32_t p_SkeletonSetupIndex, ChainSetup* p_ChainSetupArray, uint32_t p_ArraySize);
|
| 858 |
+
|
| 859 |
+
/// @brief Get setup nodes for a SkeletonSetup at a given index.
|
| 860 |
+
/// The size of the given array must match the nodes count.
|
| 861 |
+
/// Note that the nodes count can change at any time.
|
| 862 |
+
/// @param p_SkeletonSetupIndex
|
| 863 |
+
/// @param p_SDK
|
| 864 |
+
/// @return SDKReturnCode_Success if successful,
|
| 865 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 866 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 867 |
+
/// SDKReturnCode_NullPointer if the provided p_SDK (used to store the setup nodes) is a null pointer, it should be initialized to
|
| 868 |
+
/// an array with size equal to the nodes count,
|
| 869 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 870 |
+
/// @deprecated Use GetSkeletonSetupNodesArray() instead
|
| 871 |
+
[[deprecated ("Use GetSkeletonSetupNodesArray() instead")]]
|
| 872 |
+
CORESDK_API SDKReturnCode CoreSdk_GetSkeletonSetupNodes(uint32_t p_SkeletonSetupIndex, NodeSetup* p_SDK);
|
| 873 |
+
|
| 874 |
+
/// @brief Get setup nodes for a SkeletonSetup at a given index.
|
| 875 |
+
/// The size of the given array must match the nodes count.
|
| 876 |
+
/// Note that the nodes count can change at any time.
|
| 877 |
+
/// @param p_SkeletonSetupIndex
|
| 878 |
+
/// @param p_NodeSetupArray
|
| 879 |
+
/// @param p_ArraySize
|
| 880 |
+
/// @return SDKReturnCode_Success if successful,
|
| 881 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 882 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 883 |
+
/// SDKReturnCode_NullPointer if the provided p_SDK (used to store the setup nodes) is a null pointer, it should be initialized to
|
| 884 |
+
/// an array with size equal to the nodes count,
|
| 885 |
+
/// SDKReturnCode_ArgumentSizeMismatch if the provided p_ArraySize is not equal to the nodes count,
|
| 886 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 887 |
+
CORESDK_API SDKReturnCode CoreSdk_GetSkeletonSetupNodesArray(uint32_t p_SkeletonSetupIndex, NodeSetup* p_NodeSetupArray, uint32_t p_ArraySize);
|
| 888 |
+
|
| 889 |
+
/// @brief Get setup colliders for a SkeletonSetup at a given index.
|
| 890 |
+
/// The size of the given array must match the colliders count.
|
| 891 |
+
/// Note that the colliders count can change at any time.
|
| 892 |
+
/// @param p_SkeletonSetupIndex
|
| 893 |
+
/// @param p_SDK
|
| 894 |
+
/// @return SDKReturnCode_Success if successful,
|
| 895 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 896 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 897 |
+
/// SDKReturnCode_NullPointer if the provided p_SDK (used to store the setup colliders) is a null pointer, it should be initialized to
|
| 898 |
+
/// an array with size equal to the colliders count,
|
| 899 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 900 |
+
/// @deprecated
|
| 901 |
+
[[deprecated]]
|
| 902 |
+
CORESDK_API SDKReturnCode CoreSdk_GetSkeletonSetupColliders(uint32_t p_SkeletonSetupIndex, ColliderSetup* p_SDK);
|
| 903 |
+
|
| 904 |
+
/// @brief Get the amount of nodes for the raw skeleton with given id
|
| 905 |
+
/// @param p_GloveId
|
| 906 |
+
/// @param p_NodeCount
|
| 907 |
+
/// @return SDKReturnCode_Success if successful,
|
| 908 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 909 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 910 |
+
/// SDKReturnCode_InvalidID if the provided glove id does not match any skeleton in core
|
| 911 |
+
CORESDK_API SDKReturnCode CoreSdk_GetRawSkeletonNodeCount(uint32_t p_GloveId, uint32_t& p_NodeCount);
|
| 912 |
+
|
| 913 |
+
/// @brief Get the information for nodes of the raw skeleton with given id
|
| 914 |
+
/// The size of the given array p_NodeInfo must match the node count retrieved from CoreSdk_GetRawSkeletonNodeCount.
|
| 915 |
+
/// @param p_GloveId
|
| 916 |
+
/// @param p_NodeInfo
|
| 917 |
+
/// @return SDKReturnCode_Success if successful,
|
| 918 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 919 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 920 |
+
/// SDKReturnCode_InvalidID if the provided glove id does not match any skeleton in core
|
| 921 |
+
/// @deprecated Use CoreSdk_GetRawSkeletonNodeInfoArray instead
|
| 922 |
+
[[deprecated("Use CoreSdk_GetRawSkeletonNodeInfoArray instead")]]
|
| 923 |
+
CORESDK_API SDKReturnCode CoreSdk_GetRawSkeletonNodeInfo(uint32_t p_GloveId, NodeInfo* p_NodeInfo);
|
| 924 |
+
|
| 925 |
+
|
| 926 |
+
/// @brief Get the information for nodes of the raw skeleton with given id
|
| 927 |
+
/// The size of the given array p_NodeInfo and p_NodeCount must match the node count retrieved from CoreSdk_GetRawSkeletonNodeCount.
|
| 928 |
+
/// @param p_GloveId
|
| 929 |
+
/// @param p_NodeInfoArray
|
| 930 |
+
/// @param p_ArraySize
|
| 931 |
+
/// @return SDKReturnCode_Success if successful,
|
| 932 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 933 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 934 |
+
/// SDKReturnCode_InvalidID if the provided glove id does not match any skeleton in core,
|
| 935 |
+
/// SDKReturnCode_ArgumentSizeMismatch if p_ArraySize does not match node count retrieved from CoreSdk_GetRawSkeletonNodeCount.
|
| 936 |
+
CORESDK_API SDKReturnCode CoreSdk_GetRawSkeletonNodeInfoArray(uint32_t p_GloveId, NodeInfo* p_NodeInfoArray, uint32_t p_ArraySize);
|
| 937 |
+
|
| 938 |
+
/// @brief Sends a skeleton setup to core to become a skeleton upon which data is applied.
|
| 939 |
+
/// Returns the skeleton ID of the loaded skeleton, this ID is used to identify the skeleton in the SkeletonStreamCallback.
|
| 940 |
+
/// Loading a skeleton into core for retargetting removes it from the temporary skeletons array, thus causing
|
| 941 |
+
/// the p_SkeletonSetupIndex to no longer be valid after this call.
|
| 942 |
+
/// @param p_SkeletonSetupIndex The SkeletonSetup's index, will become invalid after this function.
|
| 943 |
+
/// @param p_SkeletonId This is the ID of the loaded skeleton.
|
| 944 |
+
/// @return SDKReturnCode_Success if successful,
|
| 945 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 946 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 947 |
+
/// SDKReturnCode_StubNullPointer if the stub has been reset but someone is trying to use it anyway. This usually happens after a shutdown of the SDK,
|
| 948 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 949 |
+
CORESDK_API SDKReturnCode CoreSdk_LoadSkeleton(uint32_t p_SkeletonSetupIndex, uint32_t* p_SkeletonId);
|
| 950 |
+
|
| 951 |
+
/// @brief Unload a skeleton with a certain ID from Manus Core, so data will no longer be generated for it.
|
| 952 |
+
/// @param p_SkeletonId The Skeleton's ID which is assigned by Manus Core.
|
| 953 |
+
/// @return SDKReturnCode_Success if successful,
|
| 954 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 955 |
+
/// SDKReturnCode_StubNullPointer if the stub has been reset but someone is trying to use it anyway. This usually happens after a shutdown of the SDK,
|
| 956 |
+
/// SDKReturnCode_NotConnected if there is no connection to core.
|
| 957 |
+
CORESDK_API SDKReturnCode CoreSdk_UnloadSkeleton(uint32_t p_SkeletonId);
|
| 958 |
+
|
| 959 |
+
/// @brief Save a SkeletonSetup at a given index and sessionId into Manus Core for use in the Dev Tools.
|
| 960 |
+
/// p_IsSkeletonModified is intended to be used mainly by the Dev Tools, it is set to true after saving any modification to the skeleton,
|
| 961 |
+
/// this triggers the OnSyStemCallback which is used in the SDK to be notified about a change to its temporary skeletons.
|
| 962 |
+
/// @param p_SkeletonSetupIndex
|
| 963 |
+
/// @param p_SessionId
|
| 964 |
+
/// @param p_IsSkeletonModified
|
| 965 |
+
/// @return SDKReturnCode_Success if successful,
|
| 966 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 967 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 968 |
+
/// SDKReturnCode_StubNullPointer if the stub has been reset but someone is trying to use it anyway. This usually happens after a shutdown of the SDK,
|
| 969 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 970 |
+
CORESDK_API SDKReturnCode CoreSdk_SaveTemporarySkeleton(uint32_t p_SkeletonSetupIndex, uint32_t p_SessionId, bool p_IsSkeletonModified);
|
| 971 |
+
|
| 972 |
+
/// @brief Send a temporary skeleton to Core to compress it (convert it into an array of bytes) and then get the compressed data back in the SDK,
|
| 973 |
+
/// the skeleton compressed data are stored internally. It returns the length of the bytes array for correct memory allocation.
|
| 974 |
+
/// This function must be called before CoreSdk_GetCompressedTemporarySkeletonData.
|
| 975 |
+
/// @param p_SkeletonSetupIndex
|
| 976 |
+
/// @param p_SessionId
|
| 977 |
+
/// @param p_TemporarySkeletonLengthInBytes
|
| 978 |
+
/// @return
|
| 979 |
+
CORESDK_API SDKReturnCode CoreSdk_CompressTemporarySkeletonAndGetSize(uint32_t p_SkeletonSetupIndex, uint32_t p_SessionId, uint32_t* p_TemporarySkeletonLengthInBytes);
|
| 980 |
+
|
| 981 |
+
/// @brief Get the compressed temporary skeleton data which are stored internally when calling function CoreSdk_CompressTemporarySkeletonAndGetSize.
|
| 982 |
+
/// The size of p_TemporarySkeletonData must match with p_TemporarySkeletonLengthInBytes.
|
| 983 |
+
/// @param p_TemporarySkeletonData
|
| 984 |
+
/// @param p_TemporarySkeletonLengthInBytes
|
| 985 |
+
/// @return SDKReturnCode_Success if successful,
|
| 986 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 987 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 988 |
+
/// SDKReturnCode_StubNullPointer if the stub has been reset but someone is trying to use it anyway. This usually happens after a shutdown of the SDK,
|
| 989 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 990 |
+
CORESDK_API SDKReturnCode CoreSdk_GetCompressedTemporarySkeletonData(unsigned char* p_TemporarySkeletonData, uint32_t p_TemporarySkeletonLengthInBytes);
|
| 991 |
+
|
| 992 |
+
/// @brief Get a SkeletonSetup at a given index and sessionId from Manus Core.
|
| 993 |
+
/// This function does NOT return a loaded skeleton!
|
| 994 |
+
/// @param p_SkeletonSetupIndex
|
| 995 |
+
/// @param p_SessionId
|
| 996 |
+
/// @return SDKReturnCode_Success if successful,
|
| 997 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 998 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 999 |
+
/// SDKReturnCode_StubNullPointer if the stub has been reset but someone is trying to use it anyway. This usually happens after a shutdown of the SDK,
|
| 1000 |
+
CORESDK_API SDKReturnCode CoreSdk_GetTemporarySkeleton(uint32_t p_SkeletonSetupIndex, uint32_t p_SessionId);
|
| 1001 |
+
|
| 1002 |
+
/// @brief Send the compressed data (an array of bytes) retrieved from a file to Core to be decompressed and converted back into a temporary skeleton.
|
| 1003 |
+
/// The received temporary skeleton is saved internally with the given index and to the given session id.
|
| 1004 |
+
/// The size of p_TemporarySkeletonData must match with p_TemporarySkeletonLengthInBytes.
|
| 1005 |
+
/// @param p_SkeletonSetupIndex
|
| 1006 |
+
/// @param p_SessionId
|
| 1007 |
+
/// @param p_TemporarySkeletonData
|
| 1008 |
+
/// @param p_TemporarySkeletonLengthInBytes
|
| 1009 |
+
/// @return SDKReturnCode_Success if successful,
|
| 1010 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 1011 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 1012 |
+
/// SDKReturnCode_StubNullPointer if the stub has been reset but someone is trying to use it anyway. This usually happens after a shutdown of the SDK,
|
| 1013 |
+
CORESDK_API SDKReturnCode CoreSdk_GetTemporarySkeletonFromCompressedData(uint32_t p_SkeletonSetupIndex, uint32_t p_SessionId, unsigned char* p_TemporarySkeletonData, uint32_t p_TemporarySkeletonLengthInBytes);
|
| 1014 |
+
|
| 1015 |
+
/// @brief Clear a SkeletonSetup at a given index and sessionId in Manus Core and the SDK.
|
| 1016 |
+
/// The given setup index will no longer be valid after this call.
|
| 1017 |
+
/// @param p_SkeletonSetupIndex
|
| 1018 |
+
/// @param p_SessionId
|
| 1019 |
+
/// @return SDKReturnCode_Success if successful,
|
| 1020 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 1021 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 1022 |
+
/// SDKReturnCode_StubNullPointer if the stub has been reset but someone is trying to use it anyway. This usually happens after a shutdown of the SDK,
|
| 1023 |
+
/// SDKReturnCode_InvalidID if the provided p_SkeletonSetupIndex does not correspond to any skeleton setup.
|
| 1024 |
+
CORESDK_API SDKReturnCode CoreSdk_ClearTemporarySkeleton(uint32_t p_SkeletonSetupIndex, uint32_t p_SessionId);
|
| 1025 |
+
|
| 1026 |
+
/// @brief Clear all temporary skeletons associated to the current session both in the sdk and core.
|
| 1027 |
+
/// All skeleton setups will no longer be valid after this call.
|
| 1028 |
+
/// @return SDKReturnCode_Success if successful,
|
| 1029 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 1030 |
+
/// SDKReturnCode_NotConnected if there is no connection to core,
|
| 1031 |
+
/// SDKReturnCode_StubNullPointer if the stub has been reset but someone is trying to use it anyway. This usually happens after a shutdown of the SDK,
|
| 1032 |
+
CORESDK_API SDKReturnCode CoreSdk_ClearAllTemporarySkeletons();
|
| 1033 |
+
|
| 1034 |
+
/// @brief Get temporary skeleton counts for all sessions connected to Core.
|
| 1035 |
+
/// @param p_temporarySkeletonSessionsData
|
| 1036 |
+
/// @return SDKReturnCode_Success if successful,
|
| 1037 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 1038 |
+
/// SDKReturnCode_StubNullPointer if the stub has been reset but someone is trying to use it anyway. This usually happens after a shutdown of the SDK,
|
| 1039 |
+
/// SDKReturnCode_NotConnected if there is no connection to core.
|
| 1040 |
+
CORESDK_API SDKReturnCode CoreSdk_GetTemporarySkeletonCountForAllSessions(TemporarySkeletonCountForAllSessions* p_TemporarySkeletonCountForAllSessions);
|
| 1041 |
+
|
| 1042 |
+
/// @brief Get information (name and index) for the SkeletonSetups of the specified session.
|
| 1043 |
+
/// @param p_SessionId
|
| 1044 |
+
/// @param p_temporarySkeletonSessionsData
|
| 1045 |
+
/// @return SDKReturnCode_Success if successful,
|
| 1046 |
+
/// SDKReturnCode_SdkNotAvailable if the Core SDK is not available,
|
| 1047 |
+
/// SDKReturnCode_StubNullPointer if the stub has been reset but someone is trying to use it anyway. This usually happens after a shutdown of the SDK,
|
| 1048 |
+
/// SDKReturnCode_NotConnected if there is no connection to core.
|
| 1049 |
+
CORESDK_API SDKReturnCode CoreSdk_GetTemporarySkeletonsInfoForSession(uint32_t p_SessionId, TemporarySkeletonsInfoForSession* p_TemporarySkeletonsInfoForSession);
|
| 1050 |
+
|
| 1051 |
+
#ifdef __cplusplus
|
| 1052 |
+
} // extern "C"
|
| 1053 |
+
#endif
|
| 1054 |
+
|
| 1055 |
+
// Close the Doxygen group.
|
| 1056 |
+
/** @} */
|
| 1057 |
+
|
| 1058 |
+
#endif // #ifndef H_MANUS_SDK
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/ManusSDK/include/ManusSDKTypeInitializers.h
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
| 9 |
+
#ifdef __cplusplus
|
| 10 |
+
extern "C"
|
| 11 |
+
{
|
| 12 |
+
#endif
|
| 13 |
+
|
| 14 |
+
#include "ManusSDKTypes.h"
|
| 15 |
+
|
| 16 |
+
#include <stdint.h>
|
| 17 |
+
|
| 18 |
+
#ifdef MANUS_SDK_STATIC
|
| 19 |
+
#define CORESDK_API
|
| 20 |
+
#else
|
| 21 |
+
#ifdef _WIN32
|
| 22 |
+
// MANUS_SDK_EXPORTS defines if the functions are exported to or
|
| 23 |
+
// imported from a DLL.
|
| 24 |
+
#ifdef MANUS_SDK_EXPORTS
|
| 25 |
+
#define CORESDK_API __declspec(dllexport)
|
| 26 |
+
#else
|
| 27 |
+
#define CORESDK_API __declspec(dllimport)
|
| 28 |
+
#endif
|
| 29 |
+
#elif defined(__linux__)
|
| 30 |
+
#define CORESDK_API
|
| 31 |
+
#else
|
| 32 |
+
#error Unrecognized platform.
|
| 33 |
+
#endif
|
| 34 |
+
#endif
|
| 35 |
+
|
| 36 |
+
///@brief All these initializers take a preallocated instance of their related structure and set default values.
|
| 37 |
+
|
| 38 |
+
/// @brief Initializer for a ManusVec3 struct
|
| 39 |
+
/// @param p_Val
|
| 40 |
+
CORESDK_API void ManusVec3_Init(ManusVec3* p_Val);
|
| 41 |
+
|
| 42 |
+
/// @brief Initializer for a ManusVec2 struct
|
| 43 |
+
/// @param p_Val
|
| 44 |
+
CORESDK_API void ManusVec2_Init(ManusVec2* p_Val);
|
| 45 |
+
|
| 46 |
+
/// @brief Initializer for a ManusQuaternion struct
|
| 47 |
+
/// @param p_Val
|
| 48 |
+
CORESDK_API void ManusQuaternion_Init(ManusQuaternion* p_Val);
|
| 49 |
+
|
| 50 |
+
/// @brief Initializer for a ManusTransform struct
|
| 51 |
+
/// @param p_Val
|
| 52 |
+
CORESDK_API void ManusTransform_Init(ManusTransform* p_Val);
|
| 53 |
+
|
| 54 |
+
/// @brief Initializer for a Color struct
|
| 55 |
+
/// @param p_Val
|
| 56 |
+
CORESDK_API void Color_Init(Color* p_Val);
|
| 57 |
+
|
| 58 |
+
/// @brief Initializer for a ManusTimestampInfo struct
|
| 59 |
+
/// @param p_Val
|
| 60 |
+
CORESDK_API void ManusTimestampInfo_Init(ManusTimestampInfo* p_Val);
|
| 61 |
+
|
| 62 |
+
/// @brief Initializer for a ManusTimestamp struct
|
| 63 |
+
/// @param p_Val
|
| 64 |
+
CORESDK_API void ManusTimestamp_Init(ManusTimestamp* p_Val);
|
| 65 |
+
|
| 66 |
+
/// @brief Initializer for a IMUCalibrationInfo struct
|
| 67 |
+
/// @param p_Val
|
| 68 |
+
CORESDK_API void IMUCalibrationInfo_Init(IMUCalibrationInfo* p_Val);
|
| 69 |
+
|
| 70 |
+
/// @brief Initializer for a Version struct
|
| 71 |
+
/// @param p_Val
|
| 72 |
+
CORESDK_API void Version_Init(Version* p_Val);
|
| 73 |
+
|
| 74 |
+
/// @brief Initializer for a FirmwareVersion struct
|
| 75 |
+
/// @param p_Val
|
| 76 |
+
CORESDK_API void FirmwareVersion_Init(FirmwareVersion* p_Val);
|
| 77 |
+
|
| 78 |
+
/// @brief Initializer for a ManusVersion struct
|
| 79 |
+
/// @param p_Val
|
| 80 |
+
CORESDK_API void ManusVersion_Init(ManusVersion* p_Val);
|
| 81 |
+
|
| 82 |
+
/// @brief Initializer for a TrackerId struct
|
| 83 |
+
/// @param p_Val
|
| 84 |
+
CORESDK_API void TrackerId_Init(TrackerId* p_Val);
|
| 85 |
+
|
| 86 |
+
/// @brief Initializer for a TrackerData struct
|
| 87 |
+
/// @param p_Val
|
| 88 |
+
CORESDK_API void TrackerData_Init(TrackerData* p_Val);
|
| 89 |
+
|
| 90 |
+
/// @brief Initializer for a ManusHost struct
|
| 91 |
+
/// @param p_Val
|
| 92 |
+
CORESDK_API void ManusHost_Init(ManusHost* p_Val);
|
| 93 |
+
|
| 94 |
+
/// @brief Initializer for a SkeletonNode struct
|
| 95 |
+
/// @param p_Val
|
| 96 |
+
CORESDK_API void SkeletonNode_Init(SkeletonNode* p_Val);
|
| 97 |
+
|
| 98 |
+
/// @brief Initializer for a SkeletonInfo struct
|
| 99 |
+
/// @param p_Val
|
| 100 |
+
CORESDK_API void SkeletonInfo_Init(SkeletonInfo* p_Val);
|
| 101 |
+
|
| 102 |
+
/// @brief Initializer for a RawSkeletonInfo struct
|
| 103 |
+
/// @param p_Val
|
| 104 |
+
CORESDK_API void RawSkeletonInfo_Init(RawSkeletonInfo* p_Val);
|
| 105 |
+
|
| 106 |
+
/// @brief Initializer for a SkeletonStreamInfo struct
|
| 107 |
+
/// @param p_Val
|
| 108 |
+
CORESDK_API void SkeletonStreamInfo_Init(SkeletonStreamInfo* p_Val);
|
| 109 |
+
|
| 110 |
+
/// @brief Initializer for a ErgonomicsData struct
|
| 111 |
+
/// @param p_Val
|
| 112 |
+
CORESDK_API void ErgonomicsData_Init(ErgonomicsData* p_Val);
|
| 113 |
+
|
| 114 |
+
/// @brief Initializer for a ErgonomicsStream struct
|
| 115 |
+
/// @param p_Val
|
| 116 |
+
CORESDK_API void ErgonomicsStream_Init(ErgonomicsStream* p_Val);
|
| 117 |
+
|
| 118 |
+
/// @brief Initializer for a DongleLandscapeData struct
|
| 119 |
+
/// @param p_Val
|
| 120 |
+
CORESDK_API void DongleLandscapeData_Init(DongleLandscapeData* p_Val);
|
| 121 |
+
|
| 122 |
+
/// @brief Initializer for a GloveLandscapeData struct
|
| 123 |
+
/// @param p_Val
|
| 124 |
+
CORESDK_API void GloveLandscapeData_Init(GloveLandscapeData* p_Val);
|
| 125 |
+
|
| 126 |
+
/// @brief Initializer for a Measurement struct
|
| 127 |
+
/// @param p_Val
|
| 128 |
+
CORESDK_API void Measurement_Init(Measurement* p_Val);
|
| 129 |
+
|
| 130 |
+
/// @brief Initializer for a TrackerOffset struct
|
| 131 |
+
/// @param p_Val
|
| 132 |
+
CORESDK_API void TrackerOffset_Init(TrackerOffset* p_Val);
|
| 133 |
+
|
| 134 |
+
/// @brief Initializer for a ExtraTrackerOffset struct
|
| 135 |
+
/// @param p_Val
|
| 136 |
+
CORESDK_API void ExtraTrackerOffset_Init(ExtraTrackerOffset* p_Val);
|
| 137 |
+
|
| 138 |
+
/// @brief Initializer for a TrackerLandscapeData struct
|
| 139 |
+
/// @param p_Val
|
| 140 |
+
CORESDK_API void TrackerLandscapeData_Init(TrackerLandscapeData* p_Val);
|
| 141 |
+
|
| 142 |
+
/// @brief Initializer for a UserProfileLandscapeData struct
|
| 143 |
+
/// @param p_Val
|
| 144 |
+
CORESDK_API void UserProfileLandscapeData_Init(UserProfileLandscapeData* p_Val);
|
| 145 |
+
|
| 146 |
+
/// @brief Initializer for a UserLandscapeData struct
|
| 147 |
+
/// @param p_Val
|
| 148 |
+
CORESDK_API void UserLandscapeData_Init(UserLandscapeData* p_Val);
|
| 149 |
+
|
| 150 |
+
/// @brief Initializer for a SkeletonLandscapeData struct
|
| 151 |
+
/// @param p_Val
|
| 152 |
+
CORESDK_API void SkeletonLandscapeData_Init(SkeletonLandscapeData* p_Val);
|
| 153 |
+
|
| 154 |
+
/// @brief Initializer for a DeviceLandscape struct
|
| 155 |
+
/// @param p_Val
|
| 156 |
+
CORESDK_API void DeviceLandscape_Init(DeviceLandscape* p_Val);
|
| 157 |
+
|
| 158 |
+
/// @brief Initializer for a UserLandscape struct
|
| 159 |
+
/// @param p_Val
|
| 160 |
+
CORESDK_API void UserLandscape_Init(UserLandscape* p_Val);
|
| 161 |
+
|
| 162 |
+
/// @brief Initializer for a SkeletonLandscape struct
|
| 163 |
+
/// @param p_Val
|
| 164 |
+
CORESDK_API void SkeletonLandscape_Init(SkeletonLandscape* p_Val);
|
| 165 |
+
|
| 166 |
+
/// @brief Initializer for a TrackerLandscape struct
|
| 167 |
+
/// @param p_Val
|
| 168 |
+
CORESDK_API void TrackerLandscape_Init(TrackerLandscape* p_Val);
|
| 169 |
+
|
| 170 |
+
/// @brief Initializer for a LicenseInfo struct
|
| 171 |
+
/// @param p_Val
|
| 172 |
+
CORESDK_API void LicenseInfo_Init(LicenseInfo* p_Val);
|
| 173 |
+
|
| 174 |
+
/// @brief Initializer for a SettingsLandscape struct
|
| 175 |
+
/// @param p_Val
|
| 176 |
+
CORESDK_API void SettingsLandscape_Init(SettingsLandscape* p_Val);
|
| 177 |
+
|
| 178 |
+
/// @brief Initializer for a TimecodeInterface struct
|
| 179 |
+
/// @param p_Val
|
| 180 |
+
CORESDK_API void TimecodeInterface_Init(TimecodeInterface* p_Val);
|
| 181 |
+
|
| 182 |
+
/// @brief Initializer for a TimeLandscape struct
|
| 183 |
+
/// @param p_Val
|
| 184 |
+
CORESDK_API void TimeLandscape_Init(TimeLandscape* p_Val);
|
| 185 |
+
|
| 186 |
+
/// @brief Initializer for a GestureLandscapeData struct
|
| 187 |
+
/// @param p_Val
|
| 188 |
+
CORESDK_API void GestureLandscapeData_Init(GestureLandscapeData* p_Val);
|
| 189 |
+
|
| 190 |
+
/// @brief Initializer for a NetDeviceLandscapeData struct
|
| 191 |
+
/// @param p_Val
|
| 192 |
+
CORESDK_API void NetDeviceLandscapeData_Init(NetDeviceLandscapeData* p_Val);
|
| 193 |
+
|
| 194 |
+
/// @brief Initializer for a NetDevicesLandscape struct
|
| 195 |
+
/// @param p_Val
|
| 196 |
+
CORESDK_API void NetDevicesLandscape_Init(NetDevicesLandscape* p_Val);
|
| 197 |
+
|
| 198 |
+
/// @brief Initializer for a Landscape struct
|
| 199 |
+
/// @param p_Val
|
| 200 |
+
CORESDK_API void Landscape_Init(Landscape* p_Val);
|
| 201 |
+
|
| 202 |
+
/// @brief Initializer for a SkeletonSetupArraySizes struct
|
| 203 |
+
/// @param p_Val
|
| 204 |
+
CORESDK_API void SkeletonSetupArraySizes_Init(SkeletonSetupArraySizes* p_Val);
|
| 205 |
+
|
| 206 |
+
/// @brief Initializer for a NodeSettingsIK struct
|
| 207 |
+
/// @param p_Val
|
| 208 |
+
CORESDK_API void NodeSettingsIK_Init(NodeSettingsIK* p_Val);
|
| 209 |
+
|
| 210 |
+
/// @brief Initializer for a NodeSettingsFoot struct
|
| 211 |
+
/// @param p_Val
|
| 212 |
+
CORESDK_API void NodeSettingsFoot_Init(NodeSettingsFoot* p_Val);
|
| 213 |
+
|
| 214 |
+
/// @brief Initializer for a NodeSettingsRotationOffset struct
|
| 215 |
+
/// @param p_Val
|
| 216 |
+
CORESDK_API void NodeSettingsRotationOffset_Init(NodeSettingsRotationOffset* p_Val);
|
| 217 |
+
|
| 218 |
+
/// @brief Initializer for a NodeSettingsLeaf struct
|
| 219 |
+
/// @param p_Val
|
| 220 |
+
CORESDK_API void NodeSettingsLeaf_Init(NodeSettingsLeaf* p_Val);
|
| 221 |
+
|
| 222 |
+
/// @brief Initializer for a NodeSettings struct
|
| 223 |
+
/// @param p_Val
|
| 224 |
+
CORESDK_API void NodeSettings_Init(NodeSettings* p_Val);
|
| 225 |
+
|
| 226 |
+
/// @brief Initializer for a NodeSetup struct
|
| 227 |
+
/// @param p_Val
|
| 228 |
+
CORESDK_API void NodeSetup_Init(NodeSetup* p_Val);
|
| 229 |
+
|
| 230 |
+
/// @brief Initializer for a ChainSettingsPelvis struct
|
| 231 |
+
/// @param p_Val
|
| 232 |
+
CORESDK_API void ChainSettingsPelvis_Init(ChainSettingsPelvis* p_Val);
|
| 233 |
+
|
| 234 |
+
/// @brief Initializer for a ChainSettingsLeg struct
|
| 235 |
+
/// @param p_Val
|
| 236 |
+
CORESDK_API void ChainSettingsLeg_Init(ChainSettingsLeg* p_Val);
|
| 237 |
+
|
| 238 |
+
/// @brief Initializer for a ChainSettingsSpine struct
|
| 239 |
+
/// @param p_Val
|
| 240 |
+
CORESDK_API void ChainSettingsSpine_Init(ChainSettingsSpine* p_Val);
|
| 241 |
+
|
| 242 |
+
/// @brief Initializer for a ChainSettingsNeck struct
|
| 243 |
+
/// @param p_Val
|
| 244 |
+
CORESDK_API void ChainSettingsNeck_Init(ChainSettingsNeck* p_Val);
|
| 245 |
+
|
| 246 |
+
/// @brief Initializer for a ChainSettingsHead struct
|
| 247 |
+
/// @param p_Val
|
| 248 |
+
CORESDK_API void ChainSettingsHead_Init(ChainSettingsHead* p_Val);
|
| 249 |
+
|
| 250 |
+
/// @brief Initializer for a ChainSettingsArm struct
|
| 251 |
+
/// @param p_Val
|
| 252 |
+
CORESDK_API void ChainSettingsArm_Init(ChainSettingsArm* p_Val);
|
| 253 |
+
|
| 254 |
+
/// @brief Initializer for a ChainSettingsShoulder struct
|
| 255 |
+
/// @param p_Val
|
| 256 |
+
CORESDK_API void ChainSettingsShoulder_Init(ChainSettingsShoulder* p_Val);
|
| 257 |
+
|
| 258 |
+
/// @brief Initializer for a ChainSettingsFinger struct
|
| 259 |
+
/// @param p_Val
|
| 260 |
+
CORESDK_API void ChainSettingsFinger_Init(ChainSettingsFinger* p_Val);
|
| 261 |
+
|
| 262 |
+
/// @brief Initializer for a ChainSettingsHand struct
|
| 263 |
+
/// @param p_Val
|
| 264 |
+
CORESDK_API void ChainSettingsHand_Init(ChainSettingsHand* p_Val);
|
| 265 |
+
|
| 266 |
+
/// @brief Initializer for a ChainSettingsFoot struct
|
| 267 |
+
/// @param p_Val
|
| 268 |
+
CORESDK_API void ChainSettingsFoot_Init(ChainSettingsFoot* p_Val);
|
| 269 |
+
|
| 270 |
+
/// @brief Initializer for a ChainSettingsToe struct
|
| 271 |
+
/// @param p_Val
|
| 272 |
+
CORESDK_API void ChainSettingsToe_Init(ChainSettingsToe* p_Val);
|
| 273 |
+
|
| 274 |
+
/// @brief Initializer for a ChainSettings struct
|
| 275 |
+
/// @param p_Val
|
| 276 |
+
CORESDK_API void ChainSettings_Init(ChainSettings* p_Val);
|
| 277 |
+
|
| 278 |
+
/// @brief Initializer for a ChainSetup struct
|
| 279 |
+
/// @param p_Val
|
| 280 |
+
CORESDK_API void ChainSetup_Init(ChainSetup* p_Val);
|
| 281 |
+
|
| 282 |
+
/// @brief Initializer for a SphereColliderSetup struct
|
| 283 |
+
/// @param p_Val
|
| 284 |
+
CORESDK_API void SphereColliderSetup_Init(SphereColliderSetup* p_Val);
|
| 285 |
+
|
| 286 |
+
/// @brief Initializer for a CapsuleColliderSetup struct
|
| 287 |
+
/// @param p_Val
|
| 288 |
+
CORESDK_API void CapsuleColliderSetup_Init(CapsuleColliderSetup* p_Val);
|
| 289 |
+
|
| 290 |
+
/// @brief Initializer for a BoxColliderSetup struct
|
| 291 |
+
/// @param p_Val
|
| 292 |
+
CORESDK_API void BoxColliderSetup_Init(BoxColliderSetup* p_Val);
|
| 293 |
+
|
| 294 |
+
/// @brief Initializer for a ColliderSetup struct
|
| 295 |
+
/// @param p_Val
|
| 296 |
+
CORESDK_API void ColliderSetup_Init(ColliderSetup* p_Val);
|
| 297 |
+
|
| 298 |
+
/// @brief Initializer for a Vertex Weight struct
|
| 299 |
+
/// @param p_Val
|
| 300 |
+
CORESDK_API void Weight_Init(Weight* p_Val);
|
| 301 |
+
|
| 302 |
+
/// @brief Initializer for a Vertex struct
|
| 303 |
+
/// @param p_Val
|
| 304 |
+
CORESDK_API void Vertex_Init(Vertex* p_Val);
|
| 305 |
+
|
| 306 |
+
/// @brief Initializer for a Triangle struct
|
| 307 |
+
/// @param p_Val
|
| 308 |
+
CORESDK_API void Triangle_Init(Triangle* p_Val);
|
| 309 |
+
|
| 310 |
+
/// @brief Initializer for a SkeletonTargetUserData struct
|
| 311 |
+
/// @param p_Val
|
| 312 |
+
CORESDK_API void SkeletonTargetUserData_Init(SkeletonTargetUserData* p_Val);
|
| 313 |
+
|
| 314 |
+
/// @brief Initializer for a SkeletonTargetAnimationData struct
|
| 315 |
+
/// @param p_Val
|
| 316 |
+
CORESDK_API void SkeletonTargetAnimationData_Init(SkeletonTargetAnimationData* p_Val);
|
| 317 |
+
|
| 318 |
+
/// @brief Initializer for a SkeletonTargetGloveData struct
|
| 319 |
+
/// @param p_Val
|
| 320 |
+
CORESDK_API void SkeletonTargetGloveData_Init(SkeletonTargetGloveData* p_Val);
|
| 321 |
+
|
| 322 |
+
/// @brief Initializer for a SkeletonSettings struct
|
| 323 |
+
/// @param p_Val
|
| 324 |
+
CORESDK_API void SkeletonSettings_Init(SkeletonSettings* p_Val);
|
| 325 |
+
|
| 326 |
+
/// @brief Initializer for a SkeletonSetupInfo struct
|
| 327 |
+
/// @param p_Val
|
| 328 |
+
CORESDK_API void SkeletonSetupInfo_Init(SkeletonSetupInfo* p_Val);
|
| 329 |
+
|
| 330 |
+
/// @brief Initializer for a TemporarySkeletonInfo struct
|
| 331 |
+
/// @param p_Val
|
| 332 |
+
CORESDK_API void TemporarySkeletonInfo_Init(TemporarySkeletonInfo* p_Val);
|
| 333 |
+
|
| 334 |
+
/// @brief Initializer for a TemporarySkeletonsForSession struct
|
| 335 |
+
/// @param p_Val
|
| 336 |
+
CORESDK_API void TemporarySkeletonsInfoForSession_Init(TemporarySkeletonsInfoForSession* p_Val);
|
| 337 |
+
|
| 338 |
+
/// @brief Initializer for a TemporarySkeletonCountForSession struct
|
| 339 |
+
/// @param p_Val
|
| 340 |
+
CORESDK_API void TemporarySkeletonCountForSession_Init(TemporarySkeletonCountForSession* p_Val);
|
| 341 |
+
|
| 342 |
+
/// @brief Initializer for a TemporarySkeletonCountForAllSessions struct
|
| 343 |
+
/// @param p_Val
|
| 344 |
+
CORESDK_API void TemporarySkeletonCountForAllSessions_Init(TemporarySkeletonCountForAllSessions* p_Val);
|
| 345 |
+
|
| 346 |
+
/// @brief Initializer for a TemporarySkeletonSessionsData struct
|
| 347 |
+
/// @param p_Val
|
| 348 |
+
CORESDK_API void TemporarySkeletonSessionsData_Init(TemporarySkeletonSessionsData* p_Val);
|
| 349 |
+
|
| 350 |
+
/// @brief Initializer for a SystemMessage struct
|
| 351 |
+
/// @param p_Val
|
| 352 |
+
CORESDK_API void SystemMessage_Init(SystemMessage* p_Val);
|
| 353 |
+
|
| 354 |
+
/// @brief Initializer for a CoordinateSystemVUH struct
|
| 355 |
+
/// @param p_Val
|
| 356 |
+
CORESDK_API void CoordinateSystemVUH_Init(CoordinateSystemVUH* p_Val);
|
| 357 |
+
|
| 358 |
+
/// @brief Initializer for a CoordinateSystemDirection struct
|
| 359 |
+
/// @param p_Val
|
| 360 |
+
CORESDK_API void CoordinateSystemDirection_Init(CoordinateSystemDirection* p_Val);
|
| 361 |
+
|
| 362 |
+
/// @brief Initializer for a NodeInfo struct
|
| 363 |
+
/// @param p_Val
|
| 364 |
+
CORESDK_API void NodeInfo_Init(NodeInfo* p_Val);
|
| 365 |
+
|
| 366 |
+
/// @brief Initializer for a GestureStreamInfo struct
|
| 367 |
+
/// @param p_Val
|
| 368 |
+
CORESDK_API void GestureStreamInfo_Init(GestureStreamInfo* p_Val);
|
| 369 |
+
|
| 370 |
+
/// @brief Initializer for a GestureProbabilities struct
|
| 371 |
+
/// @param p_Val
|
| 372 |
+
CORESDK_API void GestureProbabilities_Init(GestureProbabilities* p_Val);
|
| 373 |
+
|
| 374 |
+
/// @brief Initializer for a GestureProbability struct
|
| 375 |
+
/// @param p_Val
|
| 376 |
+
CORESDK_API void GestureProbability_Init(GestureProbability* p_Val);
|
| 377 |
+
|
| 378 |
+
/// @brief Initializer for a GloveCalibrationArgs struct
|
| 379 |
+
/// @param p_Val
|
| 380 |
+
CORESDK_API void GloveCalibrationArgs_Init(GloveCalibrationArgs* p_Val);
|
| 381 |
+
|
| 382 |
+
/// @brief Initializer for a GloveCalibrationStepArgs struct
|
| 383 |
+
/// @param p_Val
|
| 384 |
+
CORESDK_API void GloveCalibrationStepArgs_Init(GloveCalibrationStepArgs* p_Val);
|
| 385 |
+
|
| 386 |
+
/// @brief Initializer for a GloveCalibrationStepData struct
|
| 387 |
+
/// @param p_Val
|
| 388 |
+
CORESDK_API void GloveCalibrationStepData_Init(GloveCalibrationStepData* p_Val);
|
| 389 |
+
|
| 390 |
+
#ifdef __cplusplus
|
| 391 |
+
} // extern "C"
|
| 392 |
+
#endif
|
| 393 |
+
|
| 394 |
+
// Close the Doxygen group.
|
| 395 |
+
/** @} */
|
| 396 |
+
|
| 397 |
+
#endif // #ifndef MANUS_SDK_TYPE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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef __MANUS_SDK_TYPES_H__
|
| 2 |
+
#define __MANUS_SDK_TYPES_H__
|
| 3 |
+
|
| 4 |
+
// Set up a Doxygen group.
|
| 5 |
+
/** @addtogroup ManusSdkTypes
|
| 6 |
+
* @{
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
#ifdef __cplusplus
|
| 10 |
+
extern "C"
|
| 11 |
+
{
|
| 12 |
+
#endif
|
| 13 |
+
|
| 14 |
+
#include <stdint.h>
|
| 15 |
+
|
| 16 |
+
/******************************************************************************
|
| 17 |
+
* Preprocessor defines.
|
| 18 |
+
*****************************************************************************/
|
| 19 |
+
|
| 20 |
+
/// @brief Used to descriptively refer to the number of fingers on a hand.
|
| 21 |
+
/// Used with arrays and loops to make them more descriptive than simply using
|
| 22 |
+
/// the number, and to make changing the number easier and safer.
|
| 23 |
+
#define NUM_FINGERS_ON_HAND 5
|
| 24 |
+
|
| 25 |
+
/// @brief Used to descriptively refer to the number of flex sensor segments.
|
| 26 |
+
/// Used with arrays and loops to make them more descriptive than simply using
|
| 27 |
+
/// the number, and to make changing the number easier and safer.
|
| 28 |
+
#define NUM_FLEX_SEGMENTS_PER_FINGER 2
|
| 29 |
+
|
| 30 |
+
/// @brief Used to descriptively refer to the maximum IMUs count on a glove.
|
| 31 |
+
/// Used with arrays and loops to make them more descriptive than simply using
|
| 32 |
+
/// the number, and to make changing the number easier and safer.
|
| 33 |
+
#define MAX_NUM_IMUS_ON_GLOVE (NUM_FINGERS_ON_HAND + 1)
|
| 34 |
+
|
| 35 |
+
/// @brief Used to descriptively refer to the maximum number of Polygon users.
|
| 36 |
+
/// Used with arrays and loops to make them more descriptive than simply using
|
| 37 |
+
/// the number, and to make changing the number easier and safer.
|
| 38 |
+
#define MAX_USERS 16 // we should never reach that
|
| 39 |
+
|
| 40 |
+
/// @brief Used to descriptively refer to the maximum user name length.
|
| 41 |
+
/// Used with arrays to make them more descriptive than simply using the
|
| 42 |
+
/// number, and to make changing the number easier and safer.
|
| 43 |
+
#define MAX_NUM_CHARS_IN_USERNAME 64
|
| 44 |
+
|
| 45 |
+
/// @brief Used to descriptively refer to the maximum body measurement name length.
|
| 46 |
+
/// Used with arrays to make them more descriptive than simply using the
|
| 47 |
+
/// number, and to make changing the number easier and safer.
|
| 48 |
+
#define MAX_NUM_CHARS_IN_MEASUREMENT 64
|
| 49 |
+
|
| 50 |
+
/// Host name length is based on a post made here:
|
| 51 |
+
/// https://community.cisco.com/t5/other-network-architecture/maximum-length-hostname/td-p/529327
|
| 52 |
+
/// Which in turn was based on: https://www.ietf.org/rfc/rfc1035.txt
|
| 53 |
+
/// @brief Used to descriptively refer to the maximum host name length.
|
| 54 |
+
/// Used with arrays to make them more descriptive than simply using the
|
| 55 |
+
/// number, and to make changing the number easier and safer.
|
| 56 |
+
#define MAX_NUM_CHARS_IN_HOST_NAME 256
|
| 57 |
+
|
| 58 |
+
/// @brief Used to descriptively refer to the maximum IP address length.
|
| 59 |
+
/// Used with arrays to make them more descriptive than simply using the
|
| 60 |
+
/// number, and to make changing the number easier and safer.
|
| 61 |
+
/// It is based on the length of an IPv6 address. Example:
|
| 62 |
+
/// "2001:0db8:0000:0000:0000:8a2e:0370:7334".
|
| 63 |
+
#define MAX_NUM_CHARS_IN_IP_ADDRESS 40
|
| 64 |
+
|
| 65 |
+
/// @brief Used to descriptively refer to the maximum tracker name length.
|
| 66 |
+
/// Used with arrays to make them more descriptive than simply using the
|
| 67 |
+
/// number, and to make changing the number easier and safer.
|
| 68 |
+
#define MAX_NUM_CHARS_IN_TRACKER_ID 32
|
| 69 |
+
|
| 70 |
+
/// @brief Used to descriptively refer to the maximum tracker manufacturer length.
|
| 71 |
+
/// Used with arrays to make them more descriptive than simply using the
|
| 72 |
+
/// number, and to make changing the number easier and safer.
|
| 73 |
+
#define MAX_NUM_CHARS_IN_TRACKER_MANUFACTURER 32
|
| 74 |
+
|
| 75 |
+
/// @brief Used to descriptively refer to the maximum tracker manufacturer length.
|
| 76 |
+
/// Used with arrays to make them more descriptive than simply using the
|
| 77 |
+
/// number, and to make changing the number easier and safer.
|
| 78 |
+
#define MAX_NUM_CHARS_IN_TRACKER_PRODUCTNAME 32
|
| 79 |
+
|
| 80 |
+
/// @brief Used to descriptively refer to the maximum target name length.
|
| 81 |
+
/// Used with arrays to make them more descriptive than simply using the
|
| 82 |
+
/// number, and to make changing the number easier and safer.
|
| 83 |
+
#define MAX_NUM_CHARS_IN_TARGET_ID 32
|
| 84 |
+
|
| 85 |
+
/// @brief Used to descriptively refer to the maximum version string length.
|
| 86 |
+
/// Used with arrays to make them more descriptive than simply using the
|
| 87 |
+
/// number, and to make changing the number easier and safer.
|
| 88 |
+
#define MAX_NUM_CHARS_IN_VERSION 16
|
| 89 |
+
|
| 90 |
+
/// @brief Used to descriptively refer to the value given to glove and dongle IDs when they are uninitialized.
|
| 91 |
+
#define UNINITIALIZED_ID 0
|
| 92 |
+
|
| 93 |
+
/// @brief Used to descriptively refer to the maximum number of hosts that we support when finding manus core.
|
| 94 |
+
#define MAX_NUMBER_OF_HOSTS 100
|
| 95 |
+
|
| 96 |
+
/// @brief Used to descriptively refer to the max number of supported dongles.
|
| 97 |
+
/// Used with arrays and loops to make them more descriptive than simply using
|
| 98 |
+
/// the number, and to make changing the number easier and safer.
|
| 99 |
+
#define MAX_NUMBER_OF_DONGLES 16 // we only have 35 radio channels available. if we got 16 dongles, expect wireless issues! and no 16 usb ports is also not likely.
|
| 100 |
+
|
| 101 |
+
/// @brief Used to descriptively refer to the maximum license type string length.
|
| 102 |
+
#define MAX_NUM_CHARS_IN_LICENSE_TYPE 64
|
| 103 |
+
|
| 104 |
+
/// @brief Used to descriptively refer to the maximum calibration step title length.
|
| 105 |
+
/// Used with arrays to make them more descriptive than simply using the
|
| 106 |
+
/// number, and to make changing the number easier and safer.
|
| 107 |
+
#define MAX_NUM_CHARS_IN_CALIBRATION_TITLE 64
|
| 108 |
+
|
| 109 |
+
/// @brief Used to descriptively refer to the maximum calibration step description length.
|
| 110 |
+
/// Used with arrays to make them more descriptive than simply using the
|
| 111 |
+
/// number, and to make changing the number easier and safer.
|
| 112 |
+
#define MAX_NUM_CHARS_IN_CALIBRATION_DESCRIPTION 256
|
| 113 |
+
|
| 114 |
+
#define MAX_NUM_CHARS_IN_CALIBRATION_FILE 65536
|
| 115 |
+
|
| 116 |
+
/// @brief Constants for the maximum number of devices considered plausible.
|
| 117 |
+
/// Used with arrays and loops to make them more descriptive than simply using
|
| 118 |
+
/// the number, and to make changing the number easier and safer.
|
| 119 |
+
#define MAX_NUMBER_OF_GLOVES (MAX_NUMBER_OF_DONGLES* 2)
|
| 120 |
+
#define MAX_NUMBER_OF_HAPTICS_DONGLES MAX_NUMBER_OF_DONGLES
|
| 121 |
+
|
| 122 |
+
/// @brief Constants for the maximum number of skeletons.
|
| 123 |
+
/// Used with arrays and loops to make them more descriptive than simply using
|
| 124 |
+
/// the number, and to make changing the number easier and safer.
|
| 125 |
+
#define MAX_NUMBER_OF_SKELETONS 32
|
| 126 |
+
|
| 127 |
+
/// @brief Constants for the maximum number of users.
|
| 128 |
+
/// Used with arrays and loops to make them more descriptive than simply using
|
| 129 |
+
/// the number, and to make changing the number easier and safer.
|
| 130 |
+
#define MAX_NUMBER_OF_USERS MAX_USERS
|
| 131 |
+
|
| 132 |
+
/// @brief Constants for the maximum number of trackers for each polygon skeleton.
|
| 133 |
+
/// Used with arrays and loops to make them more descriptive than simply using
|
| 134 |
+
/// the number, and to make changing the number easier and safer.
|
| 135 |
+
#define NUMBER_OF_TRACKERS_PER_POLYGON_SKELETON 8
|
| 136 |
+
|
| 137 |
+
/// @brief Constants for the maximum number of trackers.
|
| 138 |
+
/// Used with arrays and loops to make them more descriptive than simply using
|
| 139 |
+
/// the number, and to make changing the number easier and safer.
|
| 140 |
+
#define MAX_NUMBER_OF_TRACKERS (MAX_NUMBER_OF_USERS * NUMBER_OF_TRACKERS_PER_POLYGON_SKELETON)
|
| 141 |
+
|
| 142 |
+
/// @brief Used to descriptively refer to the maximum node name length.
|
| 143 |
+
/// Used with arrays to make them more descriptive than simply using the
|
| 144 |
+
/// number, and to make changing the number easier and safer.
|
| 145 |
+
#define MAX_NUM_CHARS_IN_NODE_NAME 256 // this is for a UTF8 string , NOT an ASCII CHAR array (same base type though)
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
/// @brief Used to descriptively refer to the max number of chain nodes.
|
| 149 |
+
/// Used with arrays and loops to make them more descriptive than simply using
|
| 150 |
+
/// the number, and to make changing the number easier and safer.
|
| 151 |
+
#define MAX_CHAIN_LENGTH 32
|
| 152 |
+
|
| 153 |
+
/// @brief Used to descriptively refer to the max number of fingers we support per hand in chains (not the same as a glove, as we can retarget alien hands with more or less fingers).
|
| 154 |
+
/// Used with arrays and loops to make them more descriptive than simply using
|
| 155 |
+
/// the number, and to make changing the number easier and safer.
|
| 156 |
+
#define MAX_NUM_FINGER_IDS 10
|
| 157 |
+
|
| 158 |
+
/// @brief Used to descriptively refer to the max number of toes we support per foot in chains ( we can retarget alien feet with more or less toes).
|
| 159 |
+
/// Used with arrays and loops to make them more descriptive than simply using
|
| 160 |
+
/// the number, and to make changing the number easier and safer.
|
| 161 |
+
#define MAX_NUM_TOE_IDS 10
|
| 162 |
+
|
| 163 |
+
/// @brief Used to descriptively refer to the max length of a system error message string.
|
| 164 |
+
/// Used with arrays to make them more descriptive than simply using
|
| 165 |
+
/// the number, and to make changing the number easier and safer.
|
| 166 |
+
#define MAX_NUM_CHARS_IN_SYSTEM_ERROR_MESSAGE 256
|
| 167 |
+
|
| 168 |
+
/// @brief Used to descriptively refer to the max length of a debugging id string.
|
| 169 |
+
/// Used with arrays to make them more descriptive than simply using
|
| 170 |
+
/// the number, and to make changing the number easier and safer.
|
| 171 |
+
#define MAX_NUM_CHAR_DEBUGGING_ID 64
|
| 172 |
+
|
| 173 |
+
/// @brief Used to descriptively refer to the max number of ergonomics data.
|
| 174 |
+
/// Used with arrays and loops to make them more descriptive than simply using
|
| 175 |
+
/// the number, and to make changing the number easier and safer.
|
| 176 |
+
#define MAX_NUMBER_OF_ERGONOMICS_DATA MAX_NUMBER_OF_GLOVES
|
| 177 |
+
|
| 178 |
+
/// @brief Used to descriptively refer to the max number of sessions connected to Core.
|
| 179 |
+
/// Used with arrays and loops to make them more descriptive than simply using
|
| 180 |
+
/// the number, and to make changing the number easier and safer.
|
| 181 |
+
#define MAX_NUMBER_OF_SESSIONS 8 // this is not the real limit for Core but just for the SDKClient to handle
|
| 182 |
+
|
| 183 |
+
/// @brief Used to descriptively refer to the max number of skeletons for each session.
|
| 184 |
+
/// Used with arrays and loops to make them more descriptive than simply using
|
| 185 |
+
/// the number, and to make changing the number easier and safer.
|
| 186 |
+
#define MAX_NUMBER_OF_SKELETONS_PER_SESSION 32
|
| 187 |
+
|
| 188 |
+
/// @brief Used to descriptively refer to the max length of a skeleton name string.
|
| 189 |
+
/// Used with arrays to make them more descriptive than simply using
|
| 190 |
+
/// the number, and to make changing the number easier and safer.
|
| 191 |
+
#define MAX_NUM_CHARS_IN_SKELETON_NAME 256 // we already encountered 34 char names in unreal, but its utf8 so enbiggen even more!
|
| 192 |
+
|
| 193 |
+
/// @brief Used to descriptively refer to the max length of a timecode interface string.
|
| 194 |
+
#define MAX_NUM_CHARS_IN_TIMECODE_INTERFACE_STRINGS 64
|
| 195 |
+
|
| 196 |
+
/// @brief Used to descriptively refer to the max amount of timecode interfaces.
|
| 197 |
+
#define MAX_NUMBER_OF_AUDIO_INTERFACES 32
|
| 198 |
+
|
| 199 |
+
/// @brief Used to descriptively refer to the maximum number of bone weights per vertex.
|
| 200 |
+
#define MAX_BONE_WEIGHTS_PER_VERTEX 4
|
| 201 |
+
|
| 202 |
+
/// @brief Used to descriptively refer to the maximum number of nodes per each estimation skeleton
|
| 203 |
+
#define MAX_NUMBER_OF_NODES_PER_ESTIMATION_SKELETON 40
|
| 204 |
+
|
| 205 |
+
/// @brief Used to define the max amount of gestures in one chunk
|
| 206 |
+
#define MAX_GESTURE_DATA_CHUNK_SIZE 64
|
| 207 |
+
|
| 208 |
+
#define MAX_NUM_CHARS_IN_OPENXR_FEATURE_STRING 64
|
| 209 |
+
|
| 210 |
+
/// @brief Used to define the max amount of net devices
|
| 211 |
+
#define MAX_NUMBER_OF_NETDEVICES MAX_NUMBER_OF_DONGLES
|
| 212 |
+
|
| 213 |
+
/// @brief Matchmaker requirements.
|
| 214 |
+
#define BROADCAST_ADDRESS "255.255.255.255"
|
| 215 |
+
#define BROADCAST_PORT "62687"
|
| 216 |
+
#define SECONDS_TO_FIND_HOSTS 2
|
| 217 |
+
#define SECONDS_TO_FIND_LOCAL_HOSTS 2
|
| 218 |
+
#define DEFAULT_BUFFER_SIZE 512
|
| 219 |
+
|
| 220 |
+
/******************************************************************************
|
| 221 |
+
* Enums.
|
| 222 |
+
*****************************************************************************/
|
| 223 |
+
|
| 224 |
+
/// @brief The return values that can be given by SDK wrapper functions.
|
| 225 |
+
typedef enum SDKReturnCode
|
| 226 |
+
{
|
| 227 |
+
/// No issues occurred.
|
| 228 |
+
SDKReturnCode_Success,
|
| 229 |
+
|
| 230 |
+
/// Something went wrong, but no specific reason can be given.
|
| 231 |
+
SDKReturnCode_Error,
|
| 232 |
+
|
| 233 |
+
/// One of the arguments given had an invalid value.
|
| 234 |
+
SDKReturnCode_InvalidArgument,
|
| 235 |
+
|
| 236 |
+
/// The size of an argument given (e.g. an array) does not match the size
|
| 237 |
+
/// of the data that it is intended to hold.
|
| 238 |
+
SDKReturnCode_ArgumentSizeMismatch,
|
| 239 |
+
|
| 240 |
+
/// A string of an unsupported size was encountered.
|
| 241 |
+
SDKReturnCode_UnsupportedStringSizeEncountered,
|
| 242 |
+
|
| 243 |
+
/// The Core SDK is not available.
|
| 244 |
+
SDKReturnCode_SdkNotAvailable,
|
| 245 |
+
|
| 246 |
+
/// The network host finder is not available.
|
| 247 |
+
SDKReturnCode_HostFinderNotAvailable,
|
| 248 |
+
|
| 249 |
+
/// The data requested is not available.
|
| 250 |
+
SDKReturnCode_DataNotAvailable,
|
| 251 |
+
|
| 252 |
+
/// Failed to allocate memory for something.
|
| 253 |
+
SDKReturnCode_MemoryError,
|
| 254 |
+
|
| 255 |
+
/// Something went wrong in the SDK internally.
|
| 256 |
+
SDKReturnCode_InternalError,
|
| 257 |
+
|
| 258 |
+
/// The function was not intended to be called at this time.
|
| 259 |
+
SDKReturnCode_FunctionCalledAtWrongTime,
|
| 260 |
+
|
| 261 |
+
/// No connection to Core was made.
|
| 262 |
+
SDKReturnCode_NotConnected,
|
| 263 |
+
|
| 264 |
+
/// The connection with Core timed out.
|
| 265 |
+
SDKReturnCode_ConnectionTimeout,
|
| 266 |
+
|
| 267 |
+
/// using an uninitialized ID is bad.
|
| 268 |
+
SDKReturnCode_InvalidID,
|
| 269 |
+
|
| 270 |
+
/// memory unallocated or just a null pointer passed where it wasn't supposed to be!
|
| 271 |
+
SDKReturnCode_NullPointer,
|
| 272 |
+
|
| 273 |
+
/// null sequence type for polygon calibration
|
| 274 |
+
SDKReturnCode_InvalidSequence,
|
| 275 |
+
|
| 276 |
+
/// don't forget to set the coordinate system type or there will be trouble
|
| 277 |
+
SDKReturnCode_NoCoordinateSystemSet,
|
| 278 |
+
|
| 279 |
+
/// if everything is being terminated. don't restart
|
| 280 |
+
SDKReturnCode_SdkIsTerminating,
|
| 281 |
+
|
| 282 |
+
/// the stub has been reset but someone is tryign to use it anyway. usually after a shutdown of the SDK.
|
| 283 |
+
SDKReturnCode_StubNullPointer,
|
| 284 |
+
|
| 285 |
+
/// Skeleton could not be loaded. usually when using more then the max skeletons per session (32).
|
| 286 |
+
SDKReturnCode_SkeletonNotLoaded,
|
| 287 |
+
|
| 288 |
+
/// Function not available for this version of the SDK
|
| 289 |
+
SDKReturnCode_FunctionNotAvailable,
|
| 290 |
+
|
| 291 |
+
SDKReturnCode_MAX_SIZE
|
| 292 |
+
} SDKReturnCode;
|
| 293 |
+
|
| 294 |
+
/// @brief Used to tell what severity the log is
|
| 295 |
+
typedef enum LogSeverity
|
| 296 |
+
{
|
| 297 |
+
LogSeverity_Debug,
|
| 298 |
+
LogSeverity_Info,
|
| 299 |
+
LogSeverity_Warn,
|
| 300 |
+
LogSeverity_Error
|
| 301 |
+
} LogSeverity;
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
/// @brief Used to tell what client is using the wrapper.
|
| 305 |
+
/// This makes the session easier to identify in the landscape.
|
| 306 |
+
typedef enum SessionType
|
| 307 |
+
{
|
| 308 |
+
SessionType_Unknown,
|
| 309 |
+
SessionType_UnityPlugin,
|
| 310 |
+
SessionType_UnrealPlugin,
|
| 311 |
+
SessionType_CoreSDK,
|
| 312 |
+
SessionType_Xsens,
|
| 313 |
+
SessionType_Optitrack,
|
| 314 |
+
SessionType_MotionBuilder,
|
| 315 |
+
SessionType_VRED,
|
| 316 |
+
SessionType_OpenXR,
|
| 317 |
+
SessionType_Qualisys,
|
| 318 |
+
SessionType_Vicon,
|
| 319 |
+
SessionType_Nokov,
|
| 320 |
+
SessionType_IcIdo,
|
| 321 |
+
SessionType_Siemens
|
| 322 |
+
} SessionType;
|
| 323 |
+
|
| 324 |
+
/// @brief Describes the different types of trackers that can be used.
|
| 325 |
+
typedef enum TrackerType
|
| 326 |
+
{
|
| 327 |
+
TrackerType_Unknown,
|
| 328 |
+
TrackerType_Head,
|
| 329 |
+
TrackerType_Waist,
|
| 330 |
+
TrackerType_LeftHand,
|
| 331 |
+
TrackerType_RightHand,
|
| 332 |
+
TrackerType_LeftFoot,
|
| 333 |
+
TrackerType_RightFoot,
|
| 334 |
+
TrackerType_LeftUpperArm,
|
| 335 |
+
TrackerType_RightUpperArm,
|
| 336 |
+
TrackerType_LeftUpperLeg,
|
| 337 |
+
TrackerType_RightUpperLeg,
|
| 338 |
+
TrackerType_Controller,
|
| 339 |
+
TrackerType_Camera,
|
| 340 |
+
|
| 341 |
+
TrackerType_MAX_SIZE
|
| 342 |
+
} TrackerType;
|
| 343 |
+
|
| 344 |
+
/// @brief Describes the tracking quality.
|
| 345 |
+
typedef enum TrackingQuality
|
| 346 |
+
{
|
| 347 |
+
TrackingQuality_Untrackable,
|
| 348 |
+
TrackingQuality_BadTracking,
|
| 349 |
+
TrackingQuality_Trackable,
|
| 350 |
+
} TrackerQuality;
|
| 351 |
+
|
| 352 |
+
/// @brief Describes the different types of tracker systems.
|
| 353 |
+
typedef enum TrackerSystemType
|
| 354 |
+
{
|
| 355 |
+
TrackerSystemType_Unknown,
|
| 356 |
+
TrackerSystemType_Antilatency,
|
| 357 |
+
TrackerSystemType_ART,
|
| 358 |
+
TrackerSystemType_OpenVR,
|
| 359 |
+
TrackerSystemType_Optitrack,
|
| 360 |
+
TrackerSystemType_Vicon,
|
| 361 |
+
TrackerSystemType_OpenXR,
|
| 362 |
+
} TrackerSystemType;
|
| 363 |
+
|
| 364 |
+
/// @brief Describes the paired state of the device.
|
| 365 |
+
typedef enum DevicePairedState
|
| 366 |
+
{
|
| 367 |
+
DevicePairedState_Unknown,
|
| 368 |
+
DevicePairedState_Paired,
|
| 369 |
+
DevicePairedState_Unpaired,
|
| 370 |
+
DevicePairedState_Pairing,
|
| 371 |
+
} DevicePairedState;
|
| 372 |
+
|
| 373 |
+
/// @brief Describes the different types of device classes.
|
| 374 |
+
typedef enum DeviceClassType
|
| 375 |
+
{
|
| 376 |
+
DeviceClassType_Unknown,
|
| 377 |
+
DeviceClassType_Dongle,
|
| 378 |
+
DeviceClassType_Glove,
|
| 379 |
+
DeviceClassType_Glongle
|
| 380 |
+
} DeviceClassType;
|
| 381 |
+
|
| 382 |
+
/// @brief Describes the different types of Manus devices.
|
| 383 |
+
typedef enum DeviceFamilyType
|
| 384 |
+
{
|
| 385 |
+
DeviceFamilyType_Unknown,
|
| 386 |
+
DeviceFamilyType_Prime1,
|
| 387 |
+
DeviceFamilyType_Prime2,
|
| 388 |
+
DeviceFamilyType_PrimeX, // TODO obsolete?
|
| 389 |
+
DeviceFamilyType_Metaglove,
|
| 390 |
+
DeviceFamilyType_Prime3,
|
| 391 |
+
DeviceFamilyType_Virtual,
|
| 392 |
+
DeviceFamilyType_MetaglovePro,
|
| 393 |
+
} DeviceFamilyType;
|
| 394 |
+
|
| 395 |
+
/// @brief Describes the different types of profile used during the calibration.
|
| 396 |
+
typedef enum ProfileType
|
| 397 |
+
{
|
| 398 |
+
ProfileType_Hands,
|
| 399 |
+
ProfileType_FullBody,
|
| 400 |
+
|
| 401 |
+
ProfileType_MAX_SIZE
|
| 402 |
+
} ProfileType;
|
| 403 |
+
|
| 404 |
+
/// @brief The different types of body measurements used for the polygon calibration.
|
| 405 |
+
typedef enum MeasurementType
|
| 406 |
+
{
|
| 407 |
+
MeasurementType_Unknown,
|
| 408 |
+
MeasurementType_PlayerHeight,
|
| 409 |
+
MeasurementType_SpineLength,
|
| 410 |
+
MeasurementType_NeckLength,
|
| 411 |
+
MeasurementType_UpperArmLength,
|
| 412 |
+
MeasurementType_LowerArmLength,
|
| 413 |
+
MeasurementType_ArmLength,
|
| 414 |
+
MeasurementType_ArmSpan,
|
| 415 |
+
MeasurementType_UpperLegLength,
|
| 416 |
+
MeasurementType_LowerLegLength,
|
| 417 |
+
MeasurementType_LegLength,
|
| 418 |
+
MeasurementType_HandLength,
|
| 419 |
+
MeasurementType_FootLength,
|
| 420 |
+
MeasurementType_HipWidth,
|
| 421 |
+
MeasurementType_ShoulderWidth,
|
| 422 |
+
MeasurementType_ShoulderHeight,
|
| 423 |
+
MeasurementType_HeadLength,
|
| 424 |
+
MeasurementType_Thickness,
|
| 425 |
+
MeasurementType_ArmRatio,
|
| 426 |
+
MeasurementType_LegRatio,
|
| 427 |
+
|
| 428 |
+
MeasurementType_MAX_SIZE // Warning, this value is used to define the UserProfile.Measurement[SIZE]
|
| 429 |
+
} MeasurementType;
|
| 430 |
+
|
| 431 |
+
/// @brief Describes the different types of tracker offsets.
|
| 432 |
+
typedef enum TrackerOffsetType
|
| 433 |
+
{
|
| 434 |
+
TrackerOffsetType_Unknown,
|
| 435 |
+
TrackerOffsetType_HeadTrackerToHead,
|
| 436 |
+
TrackerOffsetType_HeadTrackerToTopOfHead,
|
| 437 |
+
|
| 438 |
+
TrackerOffsetType_LeftHandTrackerToWrist,
|
| 439 |
+
TrackerOffsetType_RightHandTrackerToWrist,
|
| 440 |
+
TrackerOffsetType_LeftFootTrackerToAnkle,
|
| 441 |
+
TrackerOffsetType_RightFootTrackerToAnkle,
|
| 442 |
+
|
| 443 |
+
TrackerOffsetType_HipTrackerToHip,
|
| 444 |
+
TrackerOffsetType_HipTrackerToLeftLeg,
|
| 445 |
+
TrackerOffsetType_HipTrackerToRightLeg,
|
| 446 |
+
|
| 447 |
+
TrackerOffsetType_LeftUpperArmTrackerToElbow,
|
| 448 |
+
TrackerOffsetType_RightUpperArmTrackerToElbow,
|
| 449 |
+
TrackerOffsetType_LeftUpperArmTrackerToShoulder,
|
| 450 |
+
TrackerOffsetType_RightUpperArmTrackerToShoulder,
|
| 451 |
+
|
| 452 |
+
TrackerOffsetType_MAX_SIZE // Warning, this value is used to define the UserProfile.TrackerOffset[SIZE]
|
| 453 |
+
} TrackerOffsetType;
|
| 454 |
+
|
| 455 |
+
/// @brief Describes the different types of extra tracker offsets.
|
| 456 |
+
typedef enum ExtraTrackerOffsetType
|
| 457 |
+
{
|
| 458 |
+
ExtraTrackerOffsetType_Unknown,
|
| 459 |
+
ExtraTrackerOffsetType_HeadForward,
|
| 460 |
+
ExtraTrackerOffsetType_HipForward,
|
| 461 |
+
ExtraTrackerOffsetType_HipHeight,
|
| 462 |
+
ExtraTrackerOffsetType_MAX_SIZE // Warning, this value is used to define the UserProfile.TrackerOffset[SIZE]
|
| 463 |
+
} ExtraTrackerOffsetType;
|
| 464 |
+
|
| 465 |
+
/// @brief Describes the different types of body measurement units.
|
| 466 |
+
typedef enum MeasurementUnit
|
| 467 |
+
{
|
| 468 |
+
MeasurementUnit_Meters,
|
| 469 |
+
MeasurementUnit_Percentage,
|
| 470 |
+
} MeasurementUnit;
|
| 471 |
+
|
| 472 |
+
/// @brief Describes the different types of body measurement categories used for the polygon calibration.
|
| 473 |
+
typedef enum MeasurementCategory
|
| 474 |
+
{
|
| 475 |
+
MeasurementCategory_Misc,
|
| 476 |
+
MeasurementCategory_Generic,
|
| 477 |
+
MeasurementCategory_Arms,
|
| 478 |
+
MeasurementCategory_Legs,
|
| 479 |
+
MeasurementCategory_Body,
|
| 480 |
+
} MeasurementCategory;
|
| 481 |
+
|
| 482 |
+
/// @brief Describes the different possibilities for the update status.
|
| 483 |
+
typedef enum UpdateStatusEnum
|
| 484 |
+
{
|
| 485 |
+
UpdateStatusEnum_Unknown,
|
| 486 |
+
UpdateStatusEnum_NoUpdateAvailable,
|
| 487 |
+
UpdateStatusEnum_UpdateAvailable,
|
| 488 |
+
UpdateStatusEnum_MandatoryUpdateAvailable,
|
| 489 |
+
UpdateStatusEnum_Updating,
|
| 490 |
+
} UpdateStatusEnum;
|
| 491 |
+
|
| 492 |
+
/// @brief Describes the different skeleton types.
|
| 493 |
+
typedef enum SkeletonType
|
| 494 |
+
{
|
| 495 |
+
SkeletonType_Invalid,
|
| 496 |
+
SkeletonType_Hand,
|
| 497 |
+
SkeletonType_Body,
|
| 498 |
+
SkeletonType_Both
|
| 499 |
+
} SkeletonType;
|
| 500 |
+
|
| 501 |
+
/// @brief Describes the possible data that can be used for the skeleton animation.
|
| 502 |
+
typedef enum SkeletonTargetType
|
| 503 |
+
{
|
| 504 |
+
SkeletonTargetType_Invalid,
|
| 505 |
+
SkeletonTargetType_UserData,
|
| 506 |
+
SkeletonTargetType_UserIndexData,
|
| 507 |
+
SkeletonTargetType_AnimationData,
|
| 508 |
+
SkeletonTargetType_GloveData
|
| 509 |
+
} SkeletonTargetType;
|
| 510 |
+
|
| 511 |
+
/// @brief Describes the possible nodes types used when setting up the skeleton.
|
| 512 |
+
typedef enum NodeType
|
| 513 |
+
{
|
| 514 |
+
NodeType_Invalid,
|
| 515 |
+
NodeType_Joint,
|
| 516 |
+
NodeType_Mesh,
|
| 517 |
+
NodeType_Leaf,
|
| 518 |
+
NodeType_Collider
|
| 519 |
+
} NodeType;
|
| 520 |
+
|
| 521 |
+
/// @brief Describes the settings that can be applied to a node, it is defined as a flag so that more than one setting can be set.
|
| 522 |
+
typedef enum NodeSettingsFlag
|
| 523 |
+
{
|
| 524 |
+
NodeSettingsFlag_None = 0,
|
| 525 |
+
NodeSettingsFlag_IK = 1 << 0,
|
| 526 |
+
NodeSettingsFlag_Foot = 1 << 1,
|
| 527 |
+
NodeSettingsFlag_RotationOffset = 1 << 2,
|
| 528 |
+
NodeSettingsFlag_Leaf = 1 << 3,
|
| 529 |
+
} NodeSettingsFlag;
|
| 530 |
+
|
| 531 |
+
/// @brief Describes the possible chain types used when setting up the skeleton.
|
| 532 |
+
typedef enum ChainType
|
| 533 |
+
{
|
| 534 |
+
ChainType_Invalid,
|
| 535 |
+
ChainType_Arm,
|
| 536 |
+
ChainType_Leg,
|
| 537 |
+
ChainType_Neck,
|
| 538 |
+
ChainType_Spine,
|
| 539 |
+
ChainType_FingerThumb,
|
| 540 |
+
ChainType_FingerIndex,
|
| 541 |
+
ChainType_FingerMiddle,
|
| 542 |
+
ChainType_FingerRing,
|
| 543 |
+
ChainType_FingerPinky,
|
| 544 |
+
ChainType_Pelvis,
|
| 545 |
+
ChainType_Head,
|
| 546 |
+
ChainType_Shoulder,
|
| 547 |
+
ChainType_Hand,
|
| 548 |
+
ChainType_Foot,
|
| 549 |
+
ChainType_Toe
|
| 550 |
+
} ChainType;
|
| 551 |
+
|
| 552 |
+
/// @brief Describes the possible collider types.
|
| 553 |
+
typedef enum CollisionType
|
| 554 |
+
{
|
| 555 |
+
CollisionType_None,
|
| 556 |
+
CollisionType_Discrete,
|
| 557 |
+
CollisionType_Continuous,
|
| 558 |
+
} CollisionType;
|
| 559 |
+
|
| 560 |
+
/// @brief Describes the possible collider types.
|
| 561 |
+
typedef enum ColliderType
|
| 562 |
+
{
|
| 563 |
+
ColliderType_Invalid,
|
| 564 |
+
ColliderType_Sphere,
|
| 565 |
+
ColliderType_Capsule,
|
| 566 |
+
ColliderType_Box,
|
| 567 |
+
} ColliderType;
|
| 568 |
+
|
| 569 |
+
/// @brief Describes the possible chain side.
|
| 570 |
+
typedef enum Side
|
| 571 |
+
{
|
| 572 |
+
Side_Invalid,
|
| 573 |
+
Side_Left,
|
| 574 |
+
Side_Right,
|
| 575 |
+
Side_Center
|
| 576 |
+
} Side;
|
| 577 |
+
|
| 578 |
+
/// @brief Describes which sensor data the hand motion is based on.
|
| 579 |
+
typedef enum HandMotion
|
| 580 |
+
{
|
| 581 |
+
HandMotion_None,
|
| 582 |
+
HandMotion_IMU,
|
| 583 |
+
HandMotion_Tracker,
|
| 584 |
+
HandMotion_Tracker_RotationOnly,
|
| 585 |
+
HandMotion_Auto
|
| 586 |
+
} HandMotion;
|
| 587 |
+
|
| 588 |
+
/// @brief Describes the direction of the coordinate system axis in 3d space.
|
| 589 |
+
typedef enum AxisDirection
|
| 590 |
+
{
|
| 591 |
+
AxisDirection_Invalid,
|
| 592 |
+
AxisDirection_Backward,
|
| 593 |
+
AxisDirection_Left,
|
| 594 |
+
AxisDirection_Down,
|
| 595 |
+
AxisDirection_Up,
|
| 596 |
+
AxisDirection_Right,
|
| 597 |
+
AxisDirection_Forward
|
| 598 |
+
} AxisDirection;
|
| 599 |
+
|
| 600 |
+
/// @brief Describes the view of the coordinate system axis.
|
| 601 |
+
/// Consider yourself sitting in front of your computer screen.
|
| 602 |
+
/// From Viewer means it goes into the screen, so away from you.
|
| 603 |
+
/// To Viewer means the axis goes from the screen towards you.
|
| 604 |
+
typedef enum AxisView
|
| 605 |
+
{
|
| 606 |
+
AxisView_Invalid,
|
| 607 |
+
|
| 608 |
+
AxisView_ZFromViewer,
|
| 609 |
+
AxisView_YFromViewer,
|
| 610 |
+
AxisView_XFromViewer,
|
| 611 |
+
|
| 612 |
+
AxisView_XToViewer,
|
| 613 |
+
AxisView_YToViewer,
|
| 614 |
+
AxisView_ZToViewer
|
| 615 |
+
} AxisView;
|
| 616 |
+
|
| 617 |
+
/// @brief Describes the polarity of the coordinate system axis.
|
| 618 |
+
typedef enum AxisPolarity
|
| 619 |
+
{
|
| 620 |
+
AxisPolarity_Invalid,
|
| 621 |
+
|
| 622 |
+
AxisPolarity_NegativeZ,
|
| 623 |
+
AxisPolarity_NegativeY,
|
| 624 |
+
AxisPolarity_NegativeX,
|
| 625 |
+
|
| 626 |
+
AxisPolarity_PositiveX,
|
| 627 |
+
AxisPolarity_PositiveY,
|
| 628 |
+
AxisPolarity_PositiveZ
|
| 629 |
+
} AxisPolarity;
|
| 630 |
+
|
| 631 |
+
/// @brief Describes the possible types for system messages received from core.
|
| 632 |
+
typedef enum SystemMessageType
|
| 633 |
+
{
|
| 634 |
+
SystemMessageType_Unknown,
|
| 635 |
+
SystemMessageType_LibDebugReplugDongle,
|
| 636 |
+
SystemMessageType_LibDebugRxStall,
|
| 637 |
+
SystemMessageType_LibDebugTxStall,
|
| 638 |
+
|
| 639 |
+
SystemMessageType_TrackerError,
|
| 640 |
+
SystemMessageType_TrackerOk,
|
| 641 |
+
SystemMessageType_TrackerSystemOutOfDate,
|
| 642 |
+
|
| 643 |
+
SystemMessageType_GloveSanityErrorPSOCInit,
|
| 644 |
+
SystemMessageType_GloveSanityErrorQCBatV,
|
| 645 |
+
SystemMessageType_GloveSanityErrorQCLRACalib,
|
| 646 |
+
SystemMessageType_GloveSanityErrorQCFlexInit,
|
| 647 |
+
SystemMessageType_GloveSanityErrorQCIMUInit,
|
| 648 |
+
SystemMessageType_GloveSanityErrorQCIMUCalib,
|
| 649 |
+
SystemMessageType_GloveSanityErrorQCID,
|
| 650 |
+
SystemMessageType_GloveSanityErrorQCInterCPU,
|
| 651 |
+
|
| 652 |
+
SystemMessageType_SessionConnectionVersionMismatch,
|
| 653 |
+
|
| 654 |
+
SystemMessageType_TemporarySkeletonModified,
|
| 655 |
+
|
| 656 |
+
SystemMessageType_SessionRefusedDueToLicenseIssue,
|
| 657 |
+
|
| 658 |
+
SystemMessageType_LaunchDevTools
|
| 659 |
+
} SystemMessageType;
|
| 660 |
+
|
| 661 |
+
/// @brief Describes the possible types for the ergonomics data.
|
| 662 |
+
typedef enum ErgonomicsDataType
|
| 663 |
+
{
|
| 664 |
+
// ErgonomicsDataType_Invalid,
|
| 665 |
+
|
| 666 |
+
ErgonomicsDataType_LeftFingerThumbMCPSpread,
|
| 667 |
+
ErgonomicsDataType_LeftFingerThumbMCPStretch,
|
| 668 |
+
ErgonomicsDataType_LeftFingerThumbPIPStretch,
|
| 669 |
+
ErgonomicsDataType_LeftFingerThumbDIPStretch,
|
| 670 |
+
|
| 671 |
+
ErgonomicsDataType_LeftFingerIndexMCPSpread,
|
| 672 |
+
ErgonomicsDataType_LeftFingerIndexMCPStretch,
|
| 673 |
+
ErgonomicsDataType_LeftFingerIndexPIPStretch,
|
| 674 |
+
ErgonomicsDataType_LeftFingerIndexDIPStretch,
|
| 675 |
+
|
| 676 |
+
ErgonomicsDataType_LeftFingerMiddleMCPSpread,
|
| 677 |
+
ErgonomicsDataType_LeftFingerMiddleMCPStretch,
|
| 678 |
+
ErgonomicsDataType_LeftFingerMiddlePIPStretch,
|
| 679 |
+
ErgonomicsDataType_LeftFingerMiddleDIPStretch,
|
| 680 |
+
|
| 681 |
+
ErgonomicsDataType_LeftFingerRingMCPSpread,
|
| 682 |
+
ErgonomicsDataType_LeftFingerRingMCPStretch,
|
| 683 |
+
ErgonomicsDataType_LeftFingerRingPIPStretch,
|
| 684 |
+
ErgonomicsDataType_LeftFingerRingDIPStretch,
|
| 685 |
+
|
| 686 |
+
ErgonomicsDataType_LeftFingerPinkyMCPSpread,
|
| 687 |
+
ErgonomicsDataType_LeftFingerPinkyMCPStretch,
|
| 688 |
+
ErgonomicsDataType_LeftFingerPinkyPIPStretch,
|
| 689 |
+
ErgonomicsDataType_LeftFingerPinkyDIPStretch,
|
| 690 |
+
|
| 691 |
+
|
| 692 |
+
ErgonomicsDataType_RightFingerThumbMCPSpread,
|
| 693 |
+
ErgonomicsDataType_RightFingerThumbMCPStretch,
|
| 694 |
+
ErgonomicsDataType_RightFingerThumbPIPStretch,
|
| 695 |
+
ErgonomicsDataType_RightFingerThumbDIPStretch,
|
| 696 |
+
|
| 697 |
+
ErgonomicsDataType_RightFingerIndexMCPSpread,
|
| 698 |
+
ErgonomicsDataType_RightFingerIndexMCPStretch,
|
| 699 |
+
ErgonomicsDataType_RightFingerIndexPIPStretch,
|
| 700 |
+
ErgonomicsDataType_RightFingerIndexDIPStretch,
|
| 701 |
+
|
| 702 |
+
ErgonomicsDataType_RightFingerMiddleMCPSpread,
|
| 703 |
+
ErgonomicsDataType_RightFingerMiddleMCPStretch,
|
| 704 |
+
ErgonomicsDataType_RightFingerMiddlePIPStretch,
|
| 705 |
+
ErgonomicsDataType_RightFingerMiddleDIPStretch,
|
| 706 |
+
|
| 707 |
+
ErgonomicsDataType_RightFingerRingMCPSpread,
|
| 708 |
+
ErgonomicsDataType_RightFingerRingMCPStretch,
|
| 709 |
+
ErgonomicsDataType_RightFingerRingPIPStretch,
|
| 710 |
+
ErgonomicsDataType_RightFingerRingDIPStretch,
|
| 711 |
+
|
| 712 |
+
ErgonomicsDataType_RightFingerPinkyMCPSpread,
|
| 713 |
+
ErgonomicsDataType_RightFingerPinkyMCPStretch,
|
| 714 |
+
ErgonomicsDataType_RightFingerPinkyPIPStretch,
|
| 715 |
+
ErgonomicsDataType_RightFingerPinkyDIPStretch,
|
| 716 |
+
|
| 717 |
+
ErgonomicsDataType_MAX_SIZE
|
| 718 |
+
} ErgonomicsDataType;
|
| 719 |
+
|
| 720 |
+
/// @brief Describes the possible Manus license types.
|
| 721 |
+
typedef enum LicenseType
|
| 722 |
+
{
|
| 723 |
+
LicenseType_Undefined,
|
| 724 |
+
LicenseType_Polygon,
|
| 725 |
+
LicenseType_CoreXO,
|
| 726 |
+
LicenseType_CorePro,
|
| 727 |
+
LicenseType_CoreXOPro,
|
| 728 |
+
|
| 729 |
+
LicenseType_CoreX,
|
| 730 |
+
LicenseType_CoreO,
|
| 731 |
+
LicenseType_CoreQ,
|
| 732 |
+
LicenseType_CoreXPro,
|
| 733 |
+
LicenseType_CoreOPro,
|
| 734 |
+
LicenseType_CoreQPro,
|
| 735 |
+
LicenseType_CoreXOQPro,
|
| 736 |
+
LicenseType_CoreXR,
|
| 737 |
+
LicenseType_CorePrimeThree,
|
| 738 |
+
LicenseType_Feature,
|
| 739 |
+
|
| 740 |
+
} LicenseType;
|
| 741 |
+
|
| 742 |
+
/// @brief The possible FPS rates
|
| 743 |
+
typedef enum TimecodeFPS
|
| 744 |
+
{
|
| 745 |
+
TimecodeFPS_Undefined,
|
| 746 |
+
TimecodeFPS_23_976,
|
| 747 |
+
TimecodeFPS_24,
|
| 748 |
+
TimecodeFPS_25,
|
| 749 |
+
TimecodeFPS_29_97,
|
| 750 |
+
TimecodeFPS_30,
|
| 751 |
+
TimecodeFPS_48,
|
| 752 |
+
TimecodeFPS_50,
|
| 753 |
+
TimecodeFPS_59_94,
|
| 754 |
+
TimecodeFPS_60,
|
| 755 |
+
TimecodeFPS_29_97DF,
|
| 756 |
+
TimecodeFPS_59_94DF,
|
| 757 |
+
} TimecodeFPS;
|
| 758 |
+
|
| 759 |
+
typedef enum FingerJointType
|
| 760 |
+
{
|
| 761 |
+
FingerJointType_Invalid,
|
| 762 |
+
FingerJointType_Metacarpal,
|
| 763 |
+
FingerJointType_Proximal,
|
| 764 |
+
FingerJointType_Intermediate,
|
| 765 |
+
FingerJointType_Distal, //thumb doesn't have it
|
| 766 |
+
FingerJointType_Tip
|
| 767 |
+
}FingerJointType;
|
| 768 |
+
|
| 769 |
+
typedef enum SetGloveCalibrationReturnCode
|
| 770 |
+
{
|
| 771 |
+
SetGloveCalibrationReturnCode_Error,
|
| 772 |
+
SetGloveCalibrationReturnCode_Success,
|
| 773 |
+
SetGloveCalibrationReturnCode_VersionError,
|
| 774 |
+
SetGloveCalibrationReturnCode_WrongSideError,
|
| 775 |
+
SetGloveCalibrationReturnCode_GloveNotFoundError,
|
| 776 |
+
SetGloveCalibrationReturnCode_UserServiceError,
|
| 777 |
+
SetGloveCalibrationReturnCode_DeserializationError,
|
| 778 |
+
|
| 779 |
+
SetGloveCalibrationReturnCode_MAX_SIZE
|
| 780 |
+
} SetGloveCalibrationReturnCode;
|
| 781 |
+
|
| 782 |
+
/******************************************************************************
|
| 783 |
+
* Structs.
|
| 784 |
+
*****************************************************************************/
|
| 785 |
+
|
| 786 |
+
/// @brief A 3D vector, used for translations.
|
| 787 |
+
typedef struct ManusVec3
|
| 788 |
+
{
|
| 789 |
+
float x; //default = 0.0f;
|
| 790 |
+
float y; //default = 0.0f;
|
| 791 |
+
float z; //default = 0.0f;
|
| 792 |
+
} ManusVec3;
|
| 793 |
+
|
| 794 |
+
/// @brief A 2D vector, used for translations.
|
| 795 |
+
typedef struct ManusVec2
|
| 796 |
+
{
|
| 797 |
+
float x; //default = 0.0f;
|
| 798 |
+
float y; //default = 0.0f;
|
| 799 |
+
} ManusVec2;
|
| 800 |
+
|
| 801 |
+
/// @brief A quaternion, used for rotations.
|
| 802 |
+
typedef struct ManusQuaternion
|
| 803 |
+
{
|
| 804 |
+
float w; //default = 1.0f;
|
| 805 |
+
float x; //default = 0.0f;
|
| 806 |
+
float y; //default = 0.0f;
|
| 807 |
+
float z; //default = 0.0f;
|
| 808 |
+
} ManusQuaternion;
|
| 809 |
+
|
| 810 |
+
/// @brief Transform containing position, rotation and scaling.
|
| 811 |
+
typedef struct ManusTransform
|
| 812 |
+
{
|
| 813 |
+
ManusVec3 position;
|
| 814 |
+
ManusQuaternion rotation;
|
| 815 |
+
ManusVec3 scale;
|
| 816 |
+
} ManusTransform;
|
| 817 |
+
|
| 818 |
+
/// @brief Color containing red, green, blue and alpha.
|
| 819 |
+
typedef struct Color
|
| 820 |
+
{
|
| 821 |
+
float r; //default = 0.0f;
|
| 822 |
+
float g; //default = 0.0f;
|
| 823 |
+
float b; //default = 0.0f;
|
| 824 |
+
float a; //default = 0.0f;
|
| 825 |
+
}Color;
|
| 826 |
+
|
| 827 |
+
/// @brief A Timestamp
|
| 828 |
+
typedef struct ManusTimestampInfo
|
| 829 |
+
{
|
| 830 |
+
uint16_t fraction; //is either frame in timecode or miliseconds in non timecode
|
| 831 |
+
uint8_t second;
|
| 832 |
+
uint8_t minute;
|
| 833 |
+
uint8_t hour;
|
| 834 |
+
uint8_t day; //is 0 in timecode
|
| 835 |
+
uint8_t month; //is 0 in timecode
|
| 836 |
+
uint32_t year; //is 0 in timecode
|
| 837 |
+
bool timecode;
|
| 838 |
+
} ManusTimestampInfo;
|
| 839 |
+
|
| 840 |
+
/// @brief A compressed timestamp
|
| 841 |
+
typedef struct ManusTimestamp
|
| 842 |
+
{
|
| 843 |
+
uint64_t time;
|
| 844 |
+
} ManusTimestamp;
|
| 845 |
+
|
| 846 |
+
/// @brief Information regarding IMU sensors used for calibration
|
| 847 |
+
typedef struct IMUCalibrationInfo
|
| 848 |
+
{
|
| 849 |
+
uint32_t mag; // Magnometer calibration level 0-3
|
| 850 |
+
uint32_t acc; // Accelerometer caibraton level 0-3
|
| 851 |
+
uint32_t gyr; // Gyroscope calibration level 0-3
|
| 852 |
+
uint32_t sys; // System accuracy
|
| 853 |
+
} IMUCalibrationInfo;
|
| 854 |
+
|
| 855 |
+
/// @brief Used to describe hardware, firmware or ManusCore version.
|
| 856 |
+
typedef struct Version
|
| 857 |
+
{
|
| 858 |
+
uint32_t major;
|
| 859 |
+
uint32_t minor;
|
| 860 |
+
uint32_t patch;
|
| 861 |
+
char label[MAX_NUM_CHARS_IN_VERSION];
|
| 862 |
+
char sha[MAX_NUM_CHARS_IN_VERSION];
|
| 863 |
+
char tag[MAX_NUM_CHARS_IN_VERSION];
|
| 864 |
+
} Version;
|
| 865 |
+
|
| 866 |
+
typedef struct FirmwareVersion
|
| 867 |
+
{
|
| 868 |
+
int32_t version;
|
| 869 |
+
ManusTimestamp timestamp;
|
| 870 |
+
} FirmwareVersion;
|
| 871 |
+
|
| 872 |
+
/// @brief Stores a single version string.
|
| 873 |
+
typedef struct ManusVersion
|
| 874 |
+
{
|
| 875 |
+
char versionInfo[MAX_NUM_CHARS_IN_VERSION];
|
| 876 |
+
} ManusVersion;
|
| 877 |
+
|
| 878 |
+
/// @brief Contains information for connecting to a host running Manus Core.
|
| 879 |
+
/// Note that if one of these values is blank, the other will be used when
|
| 880 |
+
/// connecting.
|
| 881 |
+
typedef struct ManusHost
|
| 882 |
+
{
|
| 883 |
+
char hostName[MAX_NUM_CHARS_IN_HOST_NAME]; // TODO utf8 compliant?
|
| 884 |
+
char ipAddress[MAX_NUM_CHARS_IN_IP_ADDRESS];
|
| 885 |
+
Version manusCoreVersion;
|
| 886 |
+
} ManusHost;
|
| 887 |
+
|
| 888 |
+
/******************************************************************************
|
| 889 |
+
* Tracking
|
| 890 |
+
*****************************************************************************/
|
| 891 |
+
|
| 892 |
+
|
| 893 |
+
|
| 894 |
+
/// @brief Stores the name of a tracker.
|
| 895 |
+
typedef struct TrackerId
|
| 896 |
+
{
|
| 897 |
+
char id[MAX_NUM_CHARS_IN_TRACKER_ID]; // todo. make this UTF8 compliant ?
|
| 898 |
+
} TrackerId;
|
| 899 |
+
|
| 900 |
+
/// @brief Stores all the tracker data that can be sent or received.
|
| 901 |
+
typedef struct TrackerData
|
| 902 |
+
{
|
| 903 |
+
ManusTimestamp lastUpdateTime; //default = 0;
|
| 904 |
+
|
| 905 |
+
TrackerId trackerId;
|
| 906 |
+
|
| 907 |
+
uint32_t userId; //default = 0;
|
| 908 |
+
|
| 909 |
+
bool isHmd; //default = false;
|
| 910 |
+
TrackerType trackerType; //default = TrackerType::TrackerType_Unknown;
|
| 911 |
+
|
| 912 |
+
ManusQuaternion rotation;
|
| 913 |
+
ManusVec3 position;
|
| 914 |
+
|
| 915 |
+
TrackingQuality quality; //default = TrackingQuality::TrackingQuality_Untrackable;
|
| 916 |
+
} TrackerData;
|
| 917 |
+
|
| 918 |
+
|
| 919 |
+
/// @brief Stores the information sent by the tracker stream.
|
| 920 |
+
typedef struct TrackerStreamInfo
|
| 921 |
+
{
|
| 922 |
+
ManusTimestamp publishTime; //default = 0; // DateTime.UtcNow.
|
| 923 |
+
uint32_t trackerCount; //default = 0;
|
| 924 |
+
} TrackerStreamInfo;
|
| 925 |
+
|
| 926 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 927 |
+
// end of Tracking
|
| 928 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 929 |
+
|
| 930 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 931 |
+
// Gesture Stream
|
| 932 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 933 |
+
|
| 934 |
+
typedef struct GestureProbability
|
| 935 |
+
{
|
| 936 |
+
uint32_t id;
|
| 937 |
+
float percent;
|
| 938 |
+
} GestureProbability;
|
| 939 |
+
|
| 940 |
+
typedef struct GestureProbabilities
|
| 941 |
+
{
|
| 942 |
+
uint32_t id; //default = 0;
|
| 943 |
+
bool isUserID; //default = false;
|
| 944 |
+
uint32_t totalGestureCount; //default = 0;
|
| 945 |
+
GestureProbability gestureData[MAX_GESTURE_DATA_CHUNK_SIZE]; //default = { 0 };
|
| 946 |
+
uint32_t gestureCount; //default = 0;
|
| 947 |
+
} GestureProbabilities;
|
| 948 |
+
|
| 949 |
+
typedef struct GestureStreamInfo
|
| 950 |
+
{
|
| 951 |
+
ManusTimestamp publishTime; //default = 0; // DateTime.UtcNow.
|
| 952 |
+
uint32_t gestureProbabilitiesCount; //default = 0;
|
| 953 |
+
} GestureStreamInfo;
|
| 954 |
+
|
| 955 |
+
|
| 956 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 957 |
+
// end of Gesture Stream
|
| 958 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 959 |
+
|
| 960 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 961 |
+
// Skeleton Stream
|
| 962 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 963 |
+
|
| 964 |
+
/// @brief Stores the information regarding each skeleton node.
|
| 965 |
+
/// The transform is defined as a local or global transform depending on the coordinate system set when initializing the SDK.
|
| 966 |
+
/// See functions CoreSdk_InitializeCoordinateSystemWithVUH and CoreSdk_InitializeCoordinateSystemWithDirection.
|
| 967 |
+
typedef struct SkeletonNode
|
| 968 |
+
{
|
| 969 |
+
uint32_t id;
|
| 970 |
+
ManusTransform transform;
|
| 971 |
+
} SkeletonNode;
|
| 972 |
+
|
| 973 |
+
/// @brief Stores the information regarding the skeletons that have been added to Manus Core.
|
| 974 |
+
typedef struct SkeletonInfo
|
| 975 |
+
{
|
| 976 |
+
uint32_t id; //default = 0;
|
| 977 |
+
uint32_t nodesCount; //default = 0;
|
| 978 |
+
ManusTimestamp publishTime; //default = 0; // DateTime.UtcNow.
|
| 979 |
+
} SkeletonInfo;
|
| 980 |
+
|
| 981 |
+
/// @brief Stores the information regarding the skeletons coming from the estimation system in core
|
| 982 |
+
typedef struct RawSkeletonInfo
|
| 983 |
+
{
|
| 984 |
+
uint32_t gloveId; //default = 0;
|
| 985 |
+
uint32_t nodesCount; //default = 0;
|
| 986 |
+
ManusTimestamp publishTime; //default = 0; // DateTime.UtcNow.
|
| 987 |
+
} RawSkeletonInfo;
|
| 988 |
+
|
| 989 |
+
/// @brief Stores the information sent by the skeleton stream.
|
| 990 |
+
typedef struct SkeletonStreamInfo
|
| 991 |
+
{
|
| 992 |
+
ManusTimestamp publishTime; //default = 0; // DateTime.UtcNow.
|
| 993 |
+
uint32_t skeletonsCount; //default = 0;
|
| 994 |
+
} SkeletonStreamInfo;
|
| 995 |
+
|
| 996 |
+
|
| 997 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 998 |
+
// end of Skeleton Stream
|
| 999 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1000 |
+
|
| 1001 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1002 |
+
// Ergonomics
|
| 1003 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1004 |
+
|
| 1005 |
+
/// @brief Stores the received ergonomics data.
|
| 1006 |
+
typedef struct ErgonomicsData
|
| 1007 |
+
{
|
| 1008 |
+
uint32_t id; //default = 0;
|
| 1009 |
+
bool isUserID; //default = false;
|
| 1010 |
+
float data[ErgonomicsDataType_MAX_SIZE]; //default = { 0 };
|
| 1011 |
+
} ErgonomicsData;
|
| 1012 |
+
|
| 1013 |
+
/// @brief Stores the information sent by the ergonomics stream.
|
| 1014 |
+
typedef struct ErgonomicsStream
|
| 1015 |
+
{
|
| 1016 |
+
ManusTimestamp publishTime; //default = 0;
|
| 1017 |
+
ErgonomicsData data[MAX_NUMBER_OF_ERGONOMICS_DATA];
|
| 1018 |
+
uint32_t dataCount; //default = 0;
|
| 1019 |
+
} ErgonomicsStream;
|
| 1020 |
+
|
| 1021 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1022 |
+
// end of Ergonomics
|
| 1023 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1024 |
+
|
| 1025 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1026 |
+
// Landscape
|
| 1027 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1028 |
+
|
| 1029 |
+
/// @brief Stores all the received dongle data.
|
| 1030 |
+
typedef struct DongleLandscapeData
|
| 1031 |
+
{
|
| 1032 |
+
uint32_t id;
|
| 1033 |
+
DeviceClassType classType;
|
| 1034 |
+
DeviceFamilyType familyType;
|
| 1035 |
+
bool isHaptics;
|
| 1036 |
+
|
| 1037 |
+
Version hardwareVersion;
|
| 1038 |
+
Version firmwareVersion;
|
| 1039 |
+
ManusTimestamp firmwareTimestamp;
|
| 1040 |
+
|
| 1041 |
+
uint32_t chargingState;
|
| 1042 |
+
|
| 1043 |
+
int32_t channel;
|
| 1044 |
+
|
| 1045 |
+
UpdateStatusEnum updateStatus;
|
| 1046 |
+
|
| 1047 |
+
char licenseType[MAX_NUM_CHARS_IN_LICENSE_TYPE];
|
| 1048 |
+
|
| 1049 |
+
ManusTimestamp lastSeen; // this may be used in playback/recording TBD
|
| 1050 |
+
|
| 1051 |
+
uint32_t leftGloveID;
|
| 1052 |
+
uint32_t rightGloveID;
|
| 1053 |
+
|
| 1054 |
+
LicenseType licenseLevel; //default = LicenseType::LicenseType_Undefined;
|
| 1055 |
+
ManusTimestamp licenseExpiration;
|
| 1056 |
+
|
| 1057 |
+
uint32_t netDeviceID;
|
| 1058 |
+
} DongleLandscapeData;
|
| 1059 |
+
|
| 1060 |
+
/// @brief Stores all the received glove data.
|
| 1061 |
+
typedef struct GloveLandscapeData
|
| 1062 |
+
{
|
| 1063 |
+
uint32_t id;
|
| 1064 |
+
DeviceClassType classType;
|
| 1065 |
+
DeviceFamilyType familyType;
|
| 1066 |
+
Side side;
|
| 1067 |
+
bool isHaptics;
|
| 1068 |
+
|
| 1069 |
+
DevicePairedState pairedState;
|
| 1070 |
+
uint32_t dongleID;
|
| 1071 |
+
|
| 1072 |
+
Version hardwareVersion;
|
| 1073 |
+
Version firmwareVersion;
|
| 1074 |
+
ManusTimestamp firmwareTimestamp;
|
| 1075 |
+
|
| 1076 |
+
UpdateStatusEnum updateStatus;
|
| 1077 |
+
|
| 1078 |
+
uint32_t batteryPercentage;
|
| 1079 |
+
int32_t transmissionStrength;
|
| 1080 |
+
|
| 1081 |
+
IMUCalibrationInfo iMUCalibrationInfo[MAX_NUM_IMUS_ON_GLOVE];
|
| 1082 |
+
|
| 1083 |
+
ManusTimestamp lastSeen; // this may be used in playback/recording TBD
|
| 1084 |
+
bool excluded;
|
| 1085 |
+
|
| 1086 |
+
uint32_t netDeviceID;
|
| 1087 |
+
} GloveLandscapeData;
|
| 1088 |
+
|
| 1089 |
+
/// @brief Stores informations regarding the lengths of different parts of the body.
|
| 1090 |
+
typedef struct Measurement
|
| 1091 |
+
{
|
| 1092 |
+
MeasurementType entryType; //default = MeasurementType::MeasurementType_Unknown;
|
| 1093 |
+
float value; //default = 0.0f;
|
| 1094 |
+
|
| 1095 |
+
MeasurementUnit unit; //default = MeasurementUnit_Meters;
|
| 1096 |
+
MeasurementCategory category; //default = MeasurementCategory_Misc;
|
| 1097 |
+
char displayName[MAX_NUM_CHARS_IN_MEASUREMENT];
|
| 1098 |
+
} Measurement;
|
| 1099 |
+
|
| 1100 |
+
/// @brief Stores the local offsets to the trackers.
|
| 1101 |
+
typedef struct TrackerOffset
|
| 1102 |
+
{
|
| 1103 |
+
TrackerOffsetType entryType;
|
| 1104 |
+
ManusVec3 translation;
|
| 1105 |
+
ManusQuaternion rotation;
|
| 1106 |
+
} TrackerOffset;
|
| 1107 |
+
|
| 1108 |
+
/// @brief Stores possible extra offsets to the trackers.
|
| 1109 |
+
typedef struct ExtraTrackerOffset
|
| 1110 |
+
{
|
| 1111 |
+
ExtraTrackerOffsetType entryType; //default = ExtraTrackerOffsetType::ExtraTrackerOffsetType_Unknown;
|
| 1112 |
+
float value; //default = 0.0f;
|
| 1113 |
+
} ExtraTrackerOffset;
|
| 1114 |
+
|
| 1115 |
+
/// @brief Stores all the received tracker data.
|
| 1116 |
+
typedef struct TrackerLandscapeData
|
| 1117 |
+
{
|
| 1118 |
+
char id[MAX_NUM_CHARS_IN_TRACKER_ID];
|
| 1119 |
+
TrackerType type; //default = TrackerType::TrackerType_Unknown;
|
| 1120 |
+
TrackerSystemType systemType; //default = TrackerSystemType::TrackerSystemType_Unknown;
|
| 1121 |
+
uint32_t user; //default = 0;
|
| 1122 |
+
bool isHMD; //default = false;
|
| 1123 |
+
char manufacturer[MAX_NUM_CHARS_IN_TRACKER_MANUFACTURER]; // default = "Unknown"
|
| 1124 |
+
char productName[MAX_NUM_CHARS_IN_TRACKER_PRODUCTNAME]; // default = "Unknown"
|
| 1125 |
+
} TrackerLandscapeData;
|
| 1126 |
+
|
| 1127 |
+
/// @brief Stores all the received user profile data.
|
| 1128 |
+
typedef struct UserProfileLandscapeData
|
| 1129 |
+
{
|
| 1130 |
+
ProfileType profileType; //default = ProfileType::ProfileType_Hands;
|
| 1131 |
+
Measurement measurements[MeasurementType_MAX_SIZE];
|
| 1132 |
+
TrackerOffset trackerOffsets[TrackerOffsetType_MAX_SIZE];
|
| 1133 |
+
ExtraTrackerOffset extraTrackerOffsets[ExtraTrackerOffsetType_MAX_SIZE];
|
| 1134 |
+
} UserProfileLandscapeData;
|
| 1135 |
+
|
| 1136 |
+
/// @brief Stores all the received user data.
|
| 1137 |
+
typedef struct UserLandscapeData
|
| 1138 |
+
{
|
| 1139 |
+
uint32_t id; //default = 0;
|
| 1140 |
+
char name[MAX_NUM_CHARS_IN_USERNAME];
|
| 1141 |
+
Color color;
|
| 1142 |
+
uint32_t dongleID; //default = 0;
|
| 1143 |
+
uint32_t leftGloveID; //default = 0;
|
| 1144 |
+
uint32_t rightGloveID; //default = 0;
|
| 1145 |
+
UserProfileLandscapeData profile;
|
| 1146 |
+
uint32_t userIndex; //default = 0;
|
| 1147 |
+
} UserLandscapeData;
|
| 1148 |
+
|
| 1149 |
+
/// @brief Stores all the received skeleton data.
|
| 1150 |
+
typedef struct SkeletonLandscapeData
|
| 1151 |
+
{
|
| 1152 |
+
uint32_t id; //default = 0;
|
| 1153 |
+
char session[MAX_NUM_CHARS_IN_HOST_NAME];
|
| 1154 |
+
uint32_t userId; //default = 0;
|
| 1155 |
+
SkeletonType type; //default = SkeletonType::SkeletonType_Invalid;
|
| 1156 |
+
char rootBoneName[MAX_NUM_CHARS_IN_NODE_NAME];
|
| 1157 |
+
bool scaled; //default = false;
|
| 1158 |
+
} SkeletonLandscapeData;
|
| 1159 |
+
|
| 1160 |
+
/// @brief Stores all the information related to the devices present in the landscape.
|
| 1161 |
+
typedef struct DeviceLandscape
|
| 1162 |
+
{
|
| 1163 |
+
DongleLandscapeData dongles[MAX_NUMBER_OF_DONGLES];
|
| 1164 |
+
uint32_t dongleCount; //default = 0;
|
| 1165 |
+
GloveLandscapeData gloves[MAX_NUMBER_OF_GLOVES];
|
| 1166 |
+
uint32_t gloveCount; //default = 0;
|
| 1167 |
+
} DeviceLandscape;
|
| 1168 |
+
|
| 1169 |
+
/// @brief Stores all the information related to the users present in the landscape.
|
| 1170 |
+
typedef struct UserLandscape
|
| 1171 |
+
{
|
| 1172 |
+
UserLandscapeData users[MAX_USERS];
|
| 1173 |
+
uint32_t userCount; //default = 0;
|
| 1174 |
+
} UserLandscape;
|
| 1175 |
+
|
| 1176 |
+
/// @brief Stores all the information related to the skeletons present in the landscape.
|
| 1177 |
+
typedef struct SkeletonLandscape
|
| 1178 |
+
{
|
| 1179 |
+
SkeletonLandscapeData skeletons[MAX_NUMBER_OF_SKELETONS];
|
| 1180 |
+
uint32_t skeletonCount; //default = 0;
|
| 1181 |
+
} SkeletonLandscape;
|
| 1182 |
+
|
| 1183 |
+
/// @brief Stores all the information related to the trackers present in the landscape.
|
| 1184 |
+
typedef struct TrackerLandscape
|
| 1185 |
+
{
|
| 1186 |
+
TrackerLandscapeData trackers[MAX_NUMBER_OF_TRACKERS];
|
| 1187 |
+
uint32_t trackerCount; //default = 0;
|
| 1188 |
+
} TrackerLandscape;
|
| 1189 |
+
|
| 1190 |
+
/// @brief Stores the license information.
|
| 1191 |
+
typedef struct LicenseInfo
|
| 1192 |
+
{
|
| 1193 |
+
bool recording; //default = false;
|
| 1194 |
+
bool exporting; //default = false;
|
| 1195 |
+
bool advancedExporting; //default = false;
|
| 1196 |
+
bool unitySession; //default = false;
|
| 1197 |
+
bool unrealSession; //default = false;
|
| 1198 |
+
bool openXRSession; //default = false;
|
| 1199 |
+
bool sdk; //default = false;
|
| 1200 |
+
bool raw; //default = false;
|
| 1201 |
+
bool mobuSession; //default = false;
|
| 1202 |
+
bool xsensSession; //default = false;
|
| 1203 |
+
bool optitrackSession; //default = false;
|
| 1204 |
+
bool qualisysSession; //default = false;
|
| 1205 |
+
bool viconSession; //default = false;
|
| 1206 |
+
bool nokovSession; //default = false;
|
| 1207 |
+
bool icidoSession; //default = false;
|
| 1208 |
+
bool siemensSession; //default = false;
|
| 1209 |
+
bool vredSession; //default = false;
|
| 1210 |
+
|
| 1211 |
+
} LicenseInfo;
|
| 1212 |
+
|
| 1213 |
+
/// @brief Stores the landscape settings.
|
| 1214 |
+
typedef struct SettingsLandscape
|
| 1215 |
+
{
|
| 1216 |
+
Version manusCoreVersion;
|
| 1217 |
+
LicenseInfo license;
|
| 1218 |
+
bool playbackMode; //default = false;
|
| 1219 |
+
bool ignoreSessionTimeOuts; //default = false;
|
| 1220 |
+
FirmwareVersion firmwareOne;
|
| 1221 |
+
FirmwareVersion firmwareTwo;
|
| 1222 |
+
bool recordingMode; //default = false;
|
| 1223 |
+
bool isNetDevice; // default = false;
|
| 1224 |
+
bool isConnectedAsNetDevice; // default = false;
|
| 1225 |
+
}SettingsLandscape;
|
| 1226 |
+
|
| 1227 |
+
typedef struct TimecodeInterface
|
| 1228 |
+
{
|
| 1229 |
+
char name[MAX_NUM_CHARS_IN_TIMECODE_INTERFACE_STRINGS];
|
| 1230 |
+
char api[MAX_NUM_CHARS_IN_TIMECODE_INTERFACE_STRINGS];
|
| 1231 |
+
int index; //default = -1;
|
| 1232 |
+
} TimecodeInterface;
|
| 1233 |
+
|
| 1234 |
+
typedef struct TimeLandscape
|
| 1235 |
+
{
|
| 1236 |
+
TimecodeInterface interfaces[MAX_NUMBER_OF_AUDIO_INTERFACES];
|
| 1237 |
+
uint32_t interfaceCount; //default = 0;
|
| 1238 |
+
TimecodeInterface currentInterface;
|
| 1239 |
+
TimecodeFPS fps; //default = Undefined;
|
| 1240 |
+
bool fakeTimecode; //default = false;
|
| 1241 |
+
bool useSyncPulse; //default = false;
|
| 1242 |
+
bool deviceKeepAlive; //default = false;
|
| 1243 |
+
bool syncStatus; //default = false;
|
| 1244 |
+
bool timecodeStatus; //default = false;
|
| 1245 |
+
int32_t ltcChannel; //default = -1;
|
| 1246 |
+
} TimeLandscape;
|
| 1247 |
+
|
| 1248 |
+
/// @brief Contains information about a gesture
|
| 1249 |
+
typedef struct GestureLandscapeData
|
| 1250 |
+
{
|
| 1251 |
+
uint32_t id; //default = 0;
|
| 1252 |
+
char name[MAX_NUM_CHARS_IN_USERNAME];
|
| 1253 |
+
} GestureLandscapeData;
|
| 1254 |
+
|
| 1255 |
+
/// @brief Contains information about a net devices
|
| 1256 |
+
typedef struct NetDeviceLandscapeData
|
| 1257 |
+
{
|
| 1258 |
+
uint32_t netDeviceID;
|
| 1259 |
+
char hostname[MAX_NUM_CHARS_IN_HOST_NAME];
|
| 1260 |
+
char ip[MAX_NUM_CHARS_IN_IP_ADDRESS];
|
| 1261 |
+
} NetDeviceLandscapeData;
|
| 1262 |
+
|
| 1263 |
+
/// @brief Contains information about a single net device
|
| 1264 |
+
typedef struct NetDevicesLandscape
|
| 1265 |
+
{
|
| 1266 |
+
uint32_t numberOfNetDevices; // default = 0;
|
| 1267 |
+
NetDeviceLandscapeData netDevices[MAX_NUMBER_OF_NETDEVICES];
|
| 1268 |
+
} NetDeviceLandscape;
|
| 1269 |
+
|
| 1270 |
+
/// @brief Stores the landscape data.
|
| 1271 |
+
typedef struct Landscape
|
| 1272 |
+
{
|
| 1273 |
+
DeviceLandscape gloveDevices;
|
| 1274 |
+
UserLandscape users;
|
| 1275 |
+
SkeletonLandscape skeletons;
|
| 1276 |
+
TrackerLandscape trackers;
|
| 1277 |
+
SettingsLandscape settings;
|
| 1278 |
+
NetDevicesLandscape netDevices;
|
| 1279 |
+
TimeLandscape time;
|
| 1280 |
+
uint32_t gestureCount; //default = 0;
|
| 1281 |
+
} Landscape;
|
| 1282 |
+
|
| 1283 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1284 |
+
// end of Landscape
|
| 1285 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1286 |
+
|
| 1287 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1288 |
+
// Skeleton
|
| 1289 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1290 |
+
/// @brief Stores the inverse kinematics settings of a node, the ikAim is used to control the IK solve, 1 is default, -1 is inversed.
|
| 1291 |
+
typedef struct NodeSettingsIK
|
| 1292 |
+
{
|
| 1293 |
+
float ikAim;
|
| 1294 |
+
} NodeSettingsIK;
|
| 1295 |
+
|
| 1296 |
+
/// @brief Stores the settings for a node of type foot, heightFromGround is used to set the height of the 3d model ankle from ground.
|
| 1297 |
+
typedef struct NodeSettingsFoot
|
| 1298 |
+
{
|
| 1299 |
+
float heightFromGround;
|
| 1300 |
+
} NodeSettingsFoot;
|
| 1301 |
+
|
| 1302 |
+
/// @brief Stores the rotation offset of a node, this is used internally for building the skeleton.
|
| 1303 |
+
typedef struct NodeSettingsRotationOffset
|
| 1304 |
+
{
|
| 1305 |
+
ManusQuaternion value;
|
| 1306 |
+
} NodeSettingsRotationOffset;
|
| 1307 |
+
|
| 1308 |
+
/// @brief Stores the settings of a node of type leaf, the direction vector is defined with respect to the previous node in the chain.
|
| 1309 |
+
typedef struct NodeSettingsLeaf
|
| 1310 |
+
{
|
| 1311 |
+
ManusVec3 direction;
|
| 1312 |
+
float length;
|
| 1313 |
+
} NodeSettingsLeaf;
|
| 1314 |
+
|
| 1315 |
+
/// @brief Stores all the node settings.
|
| 1316 |
+
typedef struct NodeSettings
|
| 1317 |
+
{
|
| 1318 |
+
NodeSettingsFlag usedSettings;
|
| 1319 |
+
NodeSettingsIK ik;
|
| 1320 |
+
NodeSettingsFoot foot;
|
| 1321 |
+
NodeSettingsRotationOffset rotationOffset;
|
| 1322 |
+
NodeSettingsLeaf leaf;
|
| 1323 |
+
} NodeSettings;
|
| 1324 |
+
|
| 1325 |
+
/// @brief Stores the node setup information. Each node represents a segment of the skeleton that can be animated, nodes combine together to form chains.
|
| 1326 |
+
/// the parentID is used to identify the node with respect to which the current one will move.
|
| 1327 |
+
typedef struct NodeSetup
|
| 1328 |
+
{
|
| 1329 |
+
uint32_t id; //default = 0;
|
| 1330 |
+
char name[MAX_NUM_CHARS_IN_NODE_NAME]; // this is a UTF8 string , NOT an ASCII CHAR array (same base type though)
|
| 1331 |
+
NodeType type; //default = NodeType::NodeType_Invalid;
|
| 1332 |
+
ManusTransform transform;
|
| 1333 |
+
uint32_t parentID; //default = 0;
|
| 1334 |
+
NodeSettings settings;
|
| 1335 |
+
} NodeSetup;
|
| 1336 |
+
|
| 1337 |
+
/// @brief Stores all the settings of a chain of type pelvis.
|
| 1338 |
+
typedef struct ChainSettingsPelvis
|
| 1339 |
+
{
|
| 1340 |
+
float hipHeight; //default = 0.0f;
|
| 1341 |
+
float hipBendOffset; //default = 0.0f;
|
| 1342 |
+
float thicknessMultiplier; //default = 1.0f;
|
| 1343 |
+
} ChainSettingsPelvis;
|
| 1344 |
+
|
| 1345 |
+
/// @brief Stores all the settings of a chain of type leg.
|
| 1346 |
+
typedef struct ChainSettingsLeg
|
| 1347 |
+
{
|
| 1348 |
+
bool reverseKneeDirection; //default = false;
|
| 1349 |
+
float kneeRotationOffset; //default = 0.0f;
|
| 1350 |
+
float footForwardOffset; //default = 0.0f;
|
| 1351 |
+
float footSideOffset; //default = 0.0f;
|
| 1352 |
+
} ChainSettingsLeg;
|
| 1353 |
+
|
| 1354 |
+
/// @brief Stores all the settings of a chain of type spine.
|
| 1355 |
+
typedef struct ChainSettingsSpine
|
| 1356 |
+
{
|
| 1357 |
+
float spineBendOffset; //default = 0.0f;
|
| 1358 |
+
} ChainSettingsSpine;
|
| 1359 |
+
|
| 1360 |
+
/// @brief Stores all the settings of a chain of type neck.
|
| 1361 |
+
typedef struct ChainSettingsNeck
|
| 1362 |
+
{
|
| 1363 |
+
float neckBendOffset; //default = 0.0f;
|
| 1364 |
+
} ChainSettingsNeck;
|
| 1365 |
+
|
| 1366 |
+
/// @brief Stores all the settings of a chain of type head.
|
| 1367 |
+
typedef struct ChainSettingsHead
|
| 1368 |
+
{
|
| 1369 |
+
float headPitchOffset; //default = 0.0f;
|
| 1370 |
+
float headYawOffset; //default = 0.0f;
|
| 1371 |
+
float headTiltOffset; //default = 0.0f;
|
| 1372 |
+
bool useLeafAtEnd; //default = false;
|
| 1373 |
+
} ChainSettingsHead;
|
| 1374 |
+
|
| 1375 |
+
/// @brief Stores all the settings of a chain of type arm.
|
| 1376 |
+
typedef struct ChainSettingsArm
|
| 1377 |
+
{
|
| 1378 |
+
float armLengthMultiplier; //default = 0.0f;
|
| 1379 |
+
float elbowRotationOffset; //default = 0.0f;
|
| 1380 |
+
|
| 1381 |
+
ManusVec3 armRotationOffset;
|
| 1382 |
+
|
| 1383 |
+
ManusVec3 positionMultiplier;
|
| 1384 |
+
ManusVec3 positionOffset;
|
| 1385 |
+
} ChainSettingsArm;
|
| 1386 |
+
|
| 1387 |
+
/// @brief Stores all the settings of a chain of type shoulder.
|
| 1388 |
+
typedef struct ChainSettingsShoulder
|
| 1389 |
+
{
|
| 1390 |
+
float forwardOffset; //default = 0.0f;
|
| 1391 |
+
float shrugOffset; //default = 0.0f;
|
| 1392 |
+
|
| 1393 |
+
float forwardMultiplier; //default = 0.0f;
|
| 1394 |
+
float shrugMultiplier; //default = 0.0f;
|
| 1395 |
+
} ChainSettingsShoulder;
|
| 1396 |
+
|
| 1397 |
+
/// @brief Stores all the settings of a chain of type finger.
|
| 1398 |
+
typedef struct ChainSettingsFinger
|
| 1399 |
+
{
|
| 1400 |
+
bool useLeafAtEnd; //default = false;
|
| 1401 |
+
int32_t metacarpalBoneId; //default = 0;
|
| 1402 |
+
int32_t handChainId; //default = 0;
|
| 1403 |
+
float fingerWidth; //default = 0;
|
| 1404 |
+
} ChainSettingsFinger;
|
| 1405 |
+
|
| 1406 |
+
/// @brief Stores all the settings of a chain of type hand.
|
| 1407 |
+
typedef struct ChainSettingsHand
|
| 1408 |
+
{
|
| 1409 |
+
int32_t fingerChainIds[MAX_NUM_FINGER_IDS];
|
| 1410 |
+
int32_t fingerChainIdsUsed; //default = 0;
|
| 1411 |
+
HandMotion handMotion; //default = HandMotion::HandMotion_None;
|
| 1412 |
+
} ChainSettingsHand;
|
| 1413 |
+
|
| 1414 |
+
/// @brief Stores all the settings of a chain of type foot.
|
| 1415 |
+
typedef struct ChainSettingsFoot
|
| 1416 |
+
{
|
| 1417 |
+
int32_t toeChainIds[MAX_NUM_TOE_IDS];
|
| 1418 |
+
int32_t toeChainIdsUsed; //default = 0;
|
| 1419 |
+
} ChainSettingsFoot;
|
| 1420 |
+
|
| 1421 |
+
/// @brief Stores all the settings of a chain of type toe.
|
| 1422 |
+
typedef struct ChainSettingsToe
|
| 1423 |
+
{
|
| 1424 |
+
int32_t footChainId; //default = 0;
|
| 1425 |
+
bool useLeafAtEnd; //default = false;
|
| 1426 |
+
} ChainSettingsToe;
|
| 1427 |
+
|
| 1428 |
+
/// @brief Stores all chain settings.
|
| 1429 |
+
typedef struct ChainSettings
|
| 1430 |
+
{
|
| 1431 |
+
ChainType usedSettings;
|
| 1432 |
+
ChainSettingsPelvis pelvis;
|
| 1433 |
+
ChainSettingsLeg leg;
|
| 1434 |
+
ChainSettingsSpine spine;
|
| 1435 |
+
ChainSettingsNeck neck;
|
| 1436 |
+
ChainSettingsHead head;
|
| 1437 |
+
ChainSettingsArm arm;
|
| 1438 |
+
ChainSettingsShoulder shoulder;
|
| 1439 |
+
ChainSettingsFinger finger;
|
| 1440 |
+
ChainSettingsHand hand;
|
| 1441 |
+
ChainSettingsFoot foot;
|
| 1442 |
+
ChainSettingsToe toe;
|
| 1443 |
+
} ChainSettings;
|
| 1444 |
+
|
| 1445 |
+
/// @brief Stores the chain setup information.
|
| 1446 |
+
typedef struct ChainSetup
|
| 1447 |
+
{
|
| 1448 |
+
uint32_t id; //default = 0;
|
| 1449 |
+
ChainType type; //default = ChainType::ChainType_Invalid;
|
| 1450 |
+
ChainType dataType; //default = ChainType::ChainType_Invalid;
|
| 1451 |
+
uint32_t dataIndex; //default = 0;
|
| 1452 |
+
uint32_t nodeIdCount; //default = 0;
|
| 1453 |
+
uint32_t nodeIds[MAX_CHAIN_LENGTH];
|
| 1454 |
+
ChainSettings settings;
|
| 1455 |
+
Side side; //default = Side::Side_Invalid;
|
| 1456 |
+
} ChainSetup;
|
| 1457 |
+
|
| 1458 |
+
/// @brief Stores all the settings of a collider of type sphere.
|
| 1459 |
+
typedef struct SphereColliderSetup
|
| 1460 |
+
{
|
| 1461 |
+
float radius; //default = 0;
|
| 1462 |
+
} SphereColliderSetup;
|
| 1463 |
+
|
| 1464 |
+
/// @brief Stores all the settings of a collider of type capsule.
|
| 1465 |
+
typedef struct CapsuleColliderSetup
|
| 1466 |
+
{
|
| 1467 |
+
float radius; //default = 0;
|
| 1468 |
+
float length; //default = 0;
|
| 1469 |
+
} CapsuleColliderSetup;
|
| 1470 |
+
|
| 1471 |
+
/// @brief Stores all the settings of a collider of type box.
|
| 1472 |
+
typedef struct BoxColliderSetup
|
| 1473 |
+
{
|
| 1474 |
+
ManusVec3 size; //default = 0,0,0;
|
| 1475 |
+
} BoxColliderSetup;
|
| 1476 |
+
|
| 1477 |
+
/// @brief Stores the collider setup information.
|
| 1478 |
+
typedef struct ColliderSetup
|
| 1479 |
+
{
|
| 1480 |
+
uint32_t nodeID; //default = 0;
|
| 1481 |
+
ManusVec3 localPosition; // default 0,0,0
|
| 1482 |
+
ManusVec3 localRotation; // default 0,0,0
|
| 1483 |
+
|
| 1484 |
+
ColliderType type;//default = ColliderType::ColliderType_Invalid
|
| 1485 |
+
SphereColliderSetup sphere;
|
| 1486 |
+
CapsuleColliderSetup capsule;
|
| 1487 |
+
BoxColliderSetup box;
|
| 1488 |
+
} ColliderSetup;
|
| 1489 |
+
|
| 1490 |
+
/// @brief Stores the vertex weight information.
|
| 1491 |
+
typedef struct Weight
|
| 1492 |
+
{
|
| 1493 |
+
uint32_t nodeID;
|
| 1494 |
+
float weightValue;
|
| 1495 |
+
} Weight;
|
| 1496 |
+
|
| 1497 |
+
/// @brief Stores the vertex information.
|
| 1498 |
+
typedef struct Vertex
|
| 1499 |
+
{
|
| 1500 |
+
ManusVec3 position; // default 0,0,0
|
| 1501 |
+
uint32_t weightsCount; //default = 0;
|
| 1502 |
+
Weight weights[MAX_BONE_WEIGHTS_PER_VERTEX];
|
| 1503 |
+
} Vertex;
|
| 1504 |
+
|
| 1505 |
+
/// @brief Stores the triangle information.
|
| 1506 |
+
typedef struct Triangle
|
| 1507 |
+
{
|
| 1508 |
+
int32_t vertexIndex1;
|
| 1509 |
+
int32_t vertexIndex2;
|
| 1510 |
+
int32_t vertexIndex3;
|
| 1511 |
+
} Triangle;
|
| 1512 |
+
|
| 1513 |
+
/// @brief Stores the information regarding the user data used to animate the skeleton.
|
| 1514 |
+
typedef struct SkeletonTargetUserData
|
| 1515 |
+
{
|
| 1516 |
+
uint32_t userID; //default = 0;
|
| 1517 |
+
} SkeletonTargetUserData;
|
| 1518 |
+
|
| 1519 |
+
/// @brief Stores the information regarding the user index data used to animate the skeleton.
|
| 1520 |
+
typedef struct SkeletonTargetUserIndexData
|
| 1521 |
+
{
|
| 1522 |
+
uint32_t userIndex; //default = 0;
|
| 1523 |
+
} SkeletonTargetUserIndexData;
|
| 1524 |
+
|
| 1525 |
+
/// @brief Stores the information regarding the animation data used to animate the skeleton.
|
| 1526 |
+
typedef struct SkeletonTargetAnimationData
|
| 1527 |
+
{
|
| 1528 |
+
char id[MAX_NUM_CHARS_IN_TARGET_ID];
|
| 1529 |
+
} SkeletonTargetAnimationData;
|
| 1530 |
+
|
| 1531 |
+
/// @brief Stores the information regarding the glove data used to animate the skeleton.
|
| 1532 |
+
typedef struct SkeletonTargetGloveData
|
| 1533 |
+
{
|
| 1534 |
+
uint32_t gloveID; //default = 0;
|
| 1535 |
+
} SkeletonTargetGloveData;
|
| 1536 |
+
|
| 1537 |
+
/// @brief Stores all the possible skeleton settings.
|
| 1538 |
+
typedef struct SkeletonSettings
|
| 1539 |
+
{
|
| 1540 |
+
bool scaleToTarget; //default = false;
|
| 1541 |
+
bool useEndPointApproximations; //default = false;
|
| 1542 |
+
CollisionType collisionType; //default = CollisionType::CollisionType_None
|
| 1543 |
+
|
| 1544 |
+
SkeletonTargetType targetType;
|
| 1545 |
+
SkeletonTargetUserData skeletonTargetUserData;
|
| 1546 |
+
SkeletonTargetUserIndexData skeletonTargetUserIndexData;
|
| 1547 |
+
SkeletonTargetAnimationData skeletonTargetAnimationData;
|
| 1548 |
+
SkeletonTargetGloveData skeletonGloveData;
|
| 1549 |
+
} SkeletonSettings;
|
| 1550 |
+
|
| 1551 |
+
/// @brief Stores the skeleton setup information.
|
| 1552 |
+
typedef struct SkeletonSetupInfo
|
| 1553 |
+
{
|
| 1554 |
+
uint32_t id; //default = 0;
|
| 1555 |
+
SkeletonType type; //default = SkeletonType::SkeletonType_Invalid;
|
| 1556 |
+
SkeletonSettings settings;
|
| 1557 |
+
char name[MAX_NUM_CHARS_IN_SKELETON_NAME]; // this is a UTF8 string , NOT an ASCII CHAR array (same base type though)
|
| 1558 |
+
} SkeletonSetupInfo;
|
| 1559 |
+
|
| 1560 |
+
|
| 1561 |
+
/// @brief Stores the amount of nodes and chains in the skeleton setup.
|
| 1562 |
+
typedef struct SkeletonSetupArraySizes
|
| 1563 |
+
{
|
| 1564 |
+
uint32_t nodesCount; //default = 0;
|
| 1565 |
+
uint32_t chainsCount; //default = 0;
|
| 1566 |
+
uint32_t collidersCount; //default = 0;
|
| 1567 |
+
uint32_t meshCount; //default = 0;
|
| 1568 |
+
} SkeletonSetupArraySizes;
|
| 1569 |
+
|
| 1570 |
+
/// @brief Stores the temporary skeleton information.
|
| 1571 |
+
typedef struct TemporarySkeletonInfo
|
| 1572 |
+
{
|
| 1573 |
+
char name[MAX_NUM_CHARS_IN_SKELETON_NAME]; // this is a UTF8 string , NOT an ASCII CHAR array (same base type though)
|
| 1574 |
+
uint32_t index; //default = UINT32_MAX;
|
| 1575 |
+
} TemporarySkeletonInfo;
|
| 1576 |
+
|
| 1577 |
+
/// @brief Stores the temporary skeletons available for a specific session.
|
| 1578 |
+
typedef struct TemporarySkeletonsInfoForSession
|
| 1579 |
+
{
|
| 1580 |
+
uint32_t sessionId; //default = 0;
|
| 1581 |
+
char sessionName[MAX_NUM_CHARS_IN_HOST_NAME];
|
| 1582 |
+
uint32_t skeletonCount; //default = 0;
|
| 1583 |
+
TemporarySkeletonInfo skeletonInfo[MAX_NUMBER_OF_SKELETONS_PER_SESSION];
|
| 1584 |
+
} TemporarySkeletonsInfoForSession;
|
| 1585 |
+
|
| 1586 |
+
/// @brief Stores the temporary skeletons available for a specific session.
|
| 1587 |
+
typedef struct TemporarySkeletonCountForSession
|
| 1588 |
+
{
|
| 1589 |
+
uint32_t sessionId; //default = 0;
|
| 1590 |
+
char sessionName[MAX_NUM_CHARS_IN_HOST_NAME];
|
| 1591 |
+
uint32_t skeletonCount; //default = 0;
|
| 1592 |
+
} TemporarySkeletonCountForSession;
|
| 1593 |
+
|
| 1594 |
+
/// @brief Stores the temporary skeleton available for all sessions connected to Core.
|
| 1595 |
+
typedef struct TemporarySkeletonCountForAllSessions
|
| 1596 |
+
{
|
| 1597 |
+
uint32_t sessionsCount; //default = 0;
|
| 1598 |
+
TemporarySkeletonCountForSession temporarySkeletonCountForSessions[MAX_NUMBER_OF_SESSIONS];
|
| 1599 |
+
} TemporarySkeletonCountForAllSessions;
|
| 1600 |
+
|
| 1601 |
+
/// @brief ONLY USED INTERNALLY
|
| 1602 |
+
/// @brief Stores the temporary skeleton available for all sessions connected to Core.
|
| 1603 |
+
typedef struct TemporarySkeletonSessionsData
|
| 1604 |
+
{
|
| 1605 |
+
uint32_t sessionsCount; //default = 0;
|
| 1606 |
+
TemporarySkeletonsInfoForSession temporarySkeletonsSessions[MAX_NUMBER_OF_SESSIONS];
|
| 1607 |
+
} TemporarySkeletonSessionsData;
|
| 1608 |
+
|
| 1609 |
+
/// @brief Stores the data associated to System messages received from Core.
|
| 1610 |
+
typedef struct SystemMessage
|
| 1611 |
+
{
|
| 1612 |
+
SystemMessageType type;
|
| 1613 |
+
char infoString[MAX_NUM_CHARS_IN_SYSTEM_ERROR_MESSAGE];
|
| 1614 |
+
uint32_t infoUInt;
|
| 1615 |
+
} SystemMessage;
|
| 1616 |
+
|
| 1617 |
+
typedef struct NodeInfo
|
| 1618 |
+
{
|
| 1619 |
+
uint32_t nodeId; //default = 0;
|
| 1620 |
+
uint32_t parentId; //default = 0;
|
| 1621 |
+
ChainType chainType;
|
| 1622 |
+
Side side;
|
| 1623 |
+
FingerJointType fingerJointType;
|
| 1624 |
+
}NodeInfo;
|
| 1625 |
+
|
| 1626 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1627 |
+
// end of Skeleton
|
| 1628 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1629 |
+
|
| 1630 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1631 |
+
// Glove calibration
|
| 1632 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1633 |
+
|
| 1634 |
+
typedef struct GloveCalibrationArgs {
|
| 1635 |
+
uint32_t gloveId; //default = 0;
|
| 1636 |
+
} GloveCalibrationArgs;
|
| 1637 |
+
|
| 1638 |
+
typedef struct GloveCalibrationStepArgs {
|
| 1639 |
+
uint32_t gloveId; //default = 0;
|
| 1640 |
+
uint32_t stepIndex; //default = 0;
|
| 1641 |
+
} GloveCalibrationStepArgs;
|
| 1642 |
+
|
| 1643 |
+
/// @brief Stores the data associated to a single calibration step for a specific glove.
|
| 1644 |
+
/// if the time value is negative, it means that its a continuous step and the value is estimated
|
| 1645 |
+
typedef struct GloveCalibrationStepData {
|
| 1646 |
+
uint32_t index; //default = 0;
|
| 1647 |
+
char title[MAX_NUM_CHARS_IN_CALIBRATION_TITLE];
|
| 1648 |
+
char description[MAX_NUM_CHARS_IN_CALIBRATION_DESCRIPTION];
|
| 1649 |
+
float time; //default = 0
|
| 1650 |
+
} GloveCalibrationStepData;
|
| 1651 |
+
|
| 1652 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1653 |
+
// end of Glove calibration
|
| 1654 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1655 |
+
|
| 1656 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1657 |
+
// Coordinate system settings
|
| 1658 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1659 |
+
|
| 1660 |
+
/// @brief Stores the information regarding the coordinate system used by the client, defined as VUH (view, up, handedness).
|
| 1661 |
+
typedef struct CoordinateSystemVUH
|
| 1662 |
+
{
|
| 1663 |
+
AxisView view;
|
| 1664 |
+
AxisPolarity up;
|
| 1665 |
+
Side handedness;
|
| 1666 |
+
float unitScale; // in meters
|
| 1667 |
+
} CoordinateSystemVUH;
|
| 1668 |
+
|
| 1669 |
+
/// @brief Stores the information regarding the coordinate system used by the client, defined by each axis direction.
|
| 1670 |
+
typedef struct CoordinateSystemDirection
|
| 1671 |
+
{
|
| 1672 |
+
AxisDirection x;
|
| 1673 |
+
AxisDirection y;
|
| 1674 |
+
AxisDirection z;
|
| 1675 |
+
float unitScale; // in meters
|
| 1676 |
+
} CoordinateSystemDirection;
|
| 1677 |
+
|
| 1678 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1679 |
+
// end of Coordinate system settings
|
| 1680 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1681 |
+
|
| 1682 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1683 |
+
// Callbacks
|
| 1684 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1685 |
+
|
| 1686 |
+
/// @brief Describes the ConnectedToCoreCallback function type
|
| 1687 |
+
typedef void(*ConnectedToCoreCallback_t)(const ManusHost* const p_Host);
|
| 1688 |
+
/// @brief Describes the DisconnectedToCoreCallback function type
|
| 1689 |
+
typedef void(*DisconnectedFromCoreCallback_t)(const ManusHost* const p_Host);
|
| 1690 |
+
/// @brief Describes the LoggingCallback function type
|
| 1691 |
+
typedef void(*LoggingCallback_t)(LogSeverity p_Severity, const char* const p_Log, uint32_t p_Length);
|
| 1692 |
+
/// @brief Describes the SkeletonStreamCallback function type
|
| 1693 |
+
typedef void(*SkeletonStreamCallback_t)(const SkeletonStreamInfo* const p_SkeletonInfo);
|
| 1694 |
+
/// @brief Describes the LandscapeStreamCallback function type
|
| 1695 |
+
typedef void(*LandscapeStreamCallback_t)(const Landscape* const p_Landscape);
|
| 1696 |
+
/// @brief Describes the TrackerStreamCallback function type
|
| 1697 |
+
typedef void(*TrackerStreamCallback_t)(const TrackerStreamInfo* const p_TrackerStreamInfo);
|
| 1698 |
+
/// @brief Describes the ErgonomicsStreamCallback type
|
| 1699 |
+
typedef void(*ErgonomicsStreamCallback_t)(const ErgonomicsStream* const p_Ergonomics);
|
| 1700 |
+
/// @brief Describes the SystemStreamCallback function type
|
| 1701 |
+
typedef void(*SystemStreamCallback_t)(const SystemMessage* const p_SystemMessage);
|
| 1702 |
+
/// @brief Describes the RawSkeletonStreamCallback function type
|
| 1703 |
+
typedef void(*RawSkeletonStreamCallback_t)(const SkeletonStreamInfo* const p_SkeletonInfo);
|
| 1704 |
+
/// @brief Describes the GestureStreamCallback function type
|
| 1705 |
+
typedef void(*GestureStreamCallback_t)(const GestureStreamInfo* const p_GestureStream);
|
| 1706 |
+
|
| 1707 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1708 |
+
// end of Callbacks
|
| 1709 |
+
// ------------------------------------------------------------------------------------------------------------------------------
|
| 1710 |
+
#ifdef __cplusplus
|
| 1711 |
+
} // extern "C"
|
| 1712 |
+
#endif
|
| 1713 |
+
|
| 1714 |
+
// Close the Doxygen group.
|
| 1715 |
+
/** @} */
|
| 1716 |
+
|
| 1717 |
+
#endif // #ifndef H_CORESDKWRAPPERTYPES
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/Readme.md
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MANUS SDK Client - Linux
|
| 2 |
+
The MANUS SDK Client is an example client that demonstrates the most functionality of the MANUS SDK. It handles setting up a connection to the gloves (be it directly or via a MANUS Core instance). And implements all major features available in the MANUS SDK.
|
| 3 |
+
|
| 4 |
+
For a full guide on how to get started please refer to the guide on our knowledge center: https://docs.manus-meta.com/latest/Plugins/SDK/Windows/SDK%20Client/
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/SDKClient.cpp
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/SDKClient.hpp
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef _SDK_CLIENT_HPP_
|
| 2 |
+
#define _SDK_CLIENT_HPP_
|
| 3 |
+
|
| 4 |
+
// Set up a Doxygen group.
|
| 5 |
+
/** @addtogroup SDKClient
|
| 6 |
+
* @{
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
#include <chrono> // Used for haptic commands.
|
| 10 |
+
#include <cmath> // Used for rounding float values.
|
| 11 |
+
#include <iomanip> // Used for printing glove data, and converting glove IDs to strings.
|
| 12 |
+
#include <memory> // Used for smart pointers.
|
| 13 |
+
#include <sstream>
|
| 14 |
+
#include <functional>
|
| 15 |
+
#include <mutex>
|
| 16 |
+
#include <map>
|
| 17 |
+
#include <vector>
|
| 18 |
+
|
| 19 |
+
#include "ClientPlatformSpecific.hpp"
|
| 20 |
+
#include "ManusSDK.h"
|
| 21 |
+
|
| 22 |
+
extern std::map<std::string, std::vector<double>> output_map;
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
/// @brief Constant expression: number of hands supported by demo.
|
| 26 |
+
constexpr unsigned int NUMBER_OF_HANDS_SUPPORTED = 2;
|
| 27 |
+
|
| 28 |
+
/// @brief Constant expression used to define the time between two possible haptics commands sent
|
| 29 |
+
constexpr unsigned long long int MINIMUM_MILLISECONDS_BETWEEN_HAPTICS_COMMANDS = 20;
|
| 30 |
+
|
| 31 |
+
/// @brief Constant expression used to define the time between two updates of the temporary skeleton count printing
|
| 32 |
+
constexpr unsigned long long int MILLISECONDS_BETWEEN_TEMPORARY_SKELETONS_UPDATE = 1000;
|
| 33 |
+
|
| 34 |
+
/// @brief The type of connection to core.
|
| 35 |
+
enum class ConnectionType : int
|
| 36 |
+
{
|
| 37 |
+
ConnectionType_Invalid = 0,
|
| 38 |
+
ConnectionType_Integrated,
|
| 39 |
+
ConnectionType_Local,
|
| 40 |
+
ConnectionType_Remote,
|
| 41 |
+
ClientState_MAX_CLIENT_STATE_SIZE
|
| 42 |
+
};
|
| 43 |
+
|
| 44 |
+
/// @brief The current state of the client.
|
| 45 |
+
enum class ClientState : int
|
| 46 |
+
{
|
| 47 |
+
ClientState_Starting = 0,
|
| 48 |
+
ClientState_LookingForHosts,
|
| 49 |
+
ClientState_NoHostsFound,
|
| 50 |
+
ClientState_PickingHost,
|
| 51 |
+
ClientState_ConnectingToCore,
|
| 52 |
+
ClientState_DisplayingData,
|
| 53 |
+
ClientState_Disconnected,
|
| 54 |
+
|
| 55 |
+
ClientState_MAX_CLIENT_STATE_SIZE
|
| 56 |
+
};
|
| 57 |
+
|
| 58 |
+
/// @brief Values that can be returned by this application.
|
| 59 |
+
enum class ClientReturnCode : int
|
| 60 |
+
{
|
| 61 |
+
ClientReturnCode_Success = 0,
|
| 62 |
+
ClientReturnCode_FailedPlatformSpecificInitialization,
|
| 63 |
+
ClientReturnCode_FailedToResizeWindow,
|
| 64 |
+
ClientReturnCode_FailedToInitialize,
|
| 65 |
+
ClientReturnCode_FailedToFindHosts,
|
| 66 |
+
ClientReturnCode_FailedToConnect,
|
| 67 |
+
ClientReturnCode_UnrecognizedStateEncountered,
|
| 68 |
+
ClientReturnCode_FailedToShutDownSDK,
|
| 69 |
+
ClientReturnCode_FailedPlatformSpecificShutdown,
|
| 70 |
+
ClientReturnCode_FailedToRestart,
|
| 71 |
+
ClientReturnCode_FailedWrongTimeToGetData,
|
| 72 |
+
|
| 73 |
+
ClientReturnCode_MAX_CLIENT_RETURN_CODE_SIZE
|
| 74 |
+
};
|
| 75 |
+
|
| 76 |
+
struct SDKLog
|
| 77 |
+
{
|
| 78 |
+
LogSeverity severity;
|
| 79 |
+
std::string string;
|
| 80 |
+
};
|
| 81 |
+
|
| 82 |
+
/// @brief Haptic settings for a single glove.
|
| 83 |
+
///
|
| 84 |
+
/// This is used to store if a specific motor on the glove should be enabled or not.
|
| 85 |
+
struct ClientHapticSettings
|
| 86 |
+
{
|
| 87 |
+
bool shouldHapticFinger[NUM_FINGERS_ON_HAND];
|
| 88 |
+
};
|
| 89 |
+
|
| 90 |
+
/// @brief Used to store the information about the final animated skeletons.
|
| 91 |
+
class ClientSkeleton
|
| 92 |
+
{
|
| 93 |
+
public:
|
| 94 |
+
SkeletonInfo info;
|
| 95 |
+
std::vector<SkeletonNode> nodes;
|
| 96 |
+
};
|
| 97 |
+
|
| 98 |
+
/// @brief Used to store all the final animated skeletons received from Core.
|
| 99 |
+
class ClientSkeletonCollection
|
| 100 |
+
{
|
| 101 |
+
public:
|
| 102 |
+
std::vector<ClientSkeleton> skeletons;
|
| 103 |
+
};
|
| 104 |
+
|
| 105 |
+
/// @brief Used to store the information about the skeleton data coming from the estimation system in Core.
|
| 106 |
+
class ClientRawSkeleton
|
| 107 |
+
{
|
| 108 |
+
public:
|
| 109 |
+
RawSkeletonInfo info;
|
| 110 |
+
std::vector<SkeletonNode> nodes;
|
| 111 |
+
};
|
| 112 |
+
|
| 113 |
+
/// @brief Used to store all the skeleton data coming from the estimation system in Core.
|
| 114 |
+
class ClientRawSkeletonCollection
|
| 115 |
+
{
|
| 116 |
+
public:
|
| 117 |
+
std::vector<ClientRawSkeleton> skeletons;
|
| 118 |
+
};
|
| 119 |
+
|
| 120 |
+
/// @brief Used to store all the tracker data coming from Core.
|
| 121 |
+
class TrackerDataCollection
|
| 122 |
+
{
|
| 123 |
+
public:
|
| 124 |
+
std::vector<TrackerData> trackerData;
|
| 125 |
+
};
|
| 126 |
+
|
| 127 |
+
/// @brief Used to store the information about the final animated skeletons.
|
| 128 |
+
class ClientGestures
|
| 129 |
+
{
|
| 130 |
+
public:
|
| 131 |
+
GestureProbabilities info;
|
| 132 |
+
std::vector<GestureProbability> probabilities;
|
| 133 |
+
};
|
| 134 |
+
|
| 135 |
+
class SDKClient : public SDKClientPlatformSpecific
|
| 136 |
+
{
|
| 137 |
+
public:
|
| 138 |
+
SDKClient();
|
| 139 |
+
~SDKClient();
|
| 140 |
+
|
| 141 |
+
ClientReturnCode Initialize();
|
| 142 |
+
ClientReturnCode Run();
|
| 143 |
+
ClientReturnCode ShutDown();
|
| 144 |
+
|
| 145 |
+
//Callbacks
|
| 146 |
+
static void OnConnectedCallback(const ManusHost* const p_Host);
|
| 147 |
+
static void OnDisconnectedCallback(const ManusHost* const p_Host);
|
| 148 |
+
static void OnLogCallback(LogSeverity p_Severity, const char* const p_Log, uint32_t p_Length);
|
| 149 |
+
static void OnSkeletonStreamCallback(const SkeletonStreamInfo* const p_Skeleton);
|
| 150 |
+
static void OnLandscapeCallback(const Landscape* const p_Landscape);
|
| 151 |
+
static void OnSystemCallback(const SystemMessage* const p_SystemMessage);
|
| 152 |
+
static void OnErgonomicsCallback(const ErgonomicsStream* const p_Ergo);
|
| 153 |
+
static void OnRawSkeletonStreamCallback(const SkeletonStreamInfo* const p_RawSkeletonStreamInfo);
|
| 154 |
+
static void OnTrackerStreamCallback(const TrackerStreamInfo* const p_TrackerStreamInfo);
|
| 155 |
+
static void OnGestureStreamCallback(const GestureStreamInfo* const p_GestureStream);
|
| 156 |
+
|
| 157 |
+
float RoundFloatValue(float p_Value, int p_NumDecimalsToKeep);
|
| 158 |
+
void AdvanceConsolePosition(short int p_Y);
|
| 159 |
+
|
| 160 |
+
protected:
|
| 161 |
+
virtual ClientReturnCode InitializeSDK();
|
| 162 |
+
virtual ClientReturnCode RestartSDK();
|
| 163 |
+
virtual ClientReturnCode RegisterAllCallbacks();
|
| 164 |
+
|
| 165 |
+
virtual ClientReturnCode LookingForHosts();
|
| 166 |
+
virtual ClientReturnCode NoHostsFound();
|
| 167 |
+
virtual ClientReturnCode PickingHost();
|
| 168 |
+
virtual ClientReturnCode ConnectingToCore();
|
| 169 |
+
|
| 170 |
+
virtual ClientReturnCode UpdateBeforeDisplayingData();
|
| 171 |
+
|
| 172 |
+
virtual ClientReturnCode DisplayingData();
|
| 173 |
+
virtual ClientReturnCode DisplayingDataGlove();
|
| 174 |
+
virtual ClientReturnCode DisplayingDataSkeleton();
|
| 175 |
+
virtual ClientReturnCode DisplayingDataTracker();
|
| 176 |
+
virtual ClientReturnCode DisplayingDataTemporarySkeleton();
|
| 177 |
+
virtual ClientReturnCode DisplayingLandscapeTimeData();
|
| 178 |
+
virtual ClientReturnCode DisplayingDataGestures();
|
| 179 |
+
virtual ClientReturnCode DisplayingGloveCalibration();
|
| 180 |
+
virtual ClientReturnCode DisplayingPairing();
|
| 181 |
+
|
| 182 |
+
virtual ClientReturnCode DisconnectedFromCore();
|
| 183 |
+
virtual ClientReturnCode ReconnectingToCore(int32_t p_ReconnectionTime = 0, int32_t p_ReconnectionAttempts = 0);
|
| 184 |
+
|
| 185 |
+
void PrintHandErgoData(ErgonomicsData& p_ErgoData, bool p_Left);
|
| 186 |
+
void PrintErgonomicsData();
|
| 187 |
+
void PrintDongleData();
|
| 188 |
+
void PrintSystemMessage();
|
| 189 |
+
void PrintSkeletonData();
|
| 190 |
+
void PrintRawSkeletonData();
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
void PrintTrackerData();
|
| 194 |
+
void PrintTrackerDataGlobal();
|
| 195 |
+
void PrintTrackerDataPerUser();
|
| 196 |
+
|
| 197 |
+
void PrintLandscapeTimeData();
|
| 198 |
+
|
| 199 |
+
void PrintGestureData();
|
| 200 |
+
void PrintGloveCalibrationData();
|
| 201 |
+
|
| 202 |
+
void PrintSkeletonInfo();
|
| 203 |
+
void PrintTemporarySkeletonInfo();
|
| 204 |
+
void HandlePairingCommands();
|
| 205 |
+
void GetTemporarySkeletonIfModified();
|
| 206 |
+
|
| 207 |
+
void HandleHapticCommands();
|
| 208 |
+
|
| 209 |
+
void HandleSkeletonCommands();
|
| 210 |
+
void HandleSkeletonHapticCommands();
|
| 211 |
+
void HandleTemporarySkeletonCommands();
|
| 212 |
+
void HandleTrackerCommands();
|
| 213 |
+
void SetTrackerOffset();
|
| 214 |
+
void HandleGesturesCommands();
|
| 215 |
+
void HandleGloveCalibrationCommands();
|
| 216 |
+
|
| 217 |
+
static NodeSetup CreateNodeSetup(uint32_t p_Id, uint32_t p_ParentId, float p_PosX, float p_PosY, float p_PosZ, std::string p_Name);
|
| 218 |
+
bool SetupHandNodes(uint32_t p_SklIndex, Side p_Side);
|
| 219 |
+
bool SetupHandChains(uint32_t p_SklIndex, Side p_Side);
|
| 220 |
+
|
| 221 |
+
void LoadTestSkeleton(Side p_Side);
|
| 222 |
+
void UnloadTestSkeleton();
|
| 223 |
+
void SendLoadedSkeleton(uint32_t p_SklIndex);
|
| 224 |
+
|
| 225 |
+
void AllocateChains();
|
| 226 |
+
|
| 227 |
+
void BuildTemporarySkeleton();
|
| 228 |
+
void ClearTemporarySkeleton();
|
| 229 |
+
void ClearAllTemporarySkeletons();
|
| 230 |
+
void SaveTemporarySkeletonToFile();
|
| 231 |
+
void GetTemporarySkeletonFromFile();
|
| 232 |
+
|
| 233 |
+
void TestTimestamp();
|
| 234 |
+
|
| 235 |
+
void RemoveIndexFromTemporarySkeletonList(uint32_t p_Idx);
|
| 236 |
+
void PairGlove();
|
| 237 |
+
void UnpairGlove();
|
| 238 |
+
static ManusVec3 CreateManusVec3(float p_X, float p_Y, float p_Z);
|
| 239 |
+
|
| 240 |
+
void ExecuteGloveCalibrationStep(GloveCalibrationStepArgs p_Args);
|
| 241 |
+
|
| 242 |
+
void PrintLogs();
|
| 243 |
+
|
| 244 |
+
protected:
|
| 245 |
+
static SDKClient* s_Instance;
|
| 246 |
+
|
| 247 |
+
bool m_RequestedExit = false;
|
| 248 |
+
ConnectionType m_ConnectionType = ConnectionType::ConnectionType_Invalid;
|
| 249 |
+
|
| 250 |
+
//Console
|
| 251 |
+
uint32_t m_ConsoleClearTickCount = 0;
|
| 252 |
+
const short int m_ConsoleWidth = 220;
|
| 253 |
+
const short int m_ConsoleHeight = 55;
|
| 254 |
+
const short int m_ConsoleScrollback = 500;
|
| 255 |
+
int m_ConsoleCurrentOffset = 0;
|
| 256 |
+
|
| 257 |
+
SessionType m_ClientType = SessionType::SessionType_CoreSDK;
|
| 258 |
+
|
| 259 |
+
ClientState m_State = ClientState::ClientState_Starting;
|
| 260 |
+
ClientState m_PreviousState = m_State;
|
| 261 |
+
|
| 262 |
+
std::function<ClientReturnCode()> m_CurrentInteraction = nullptr;
|
| 263 |
+
|
| 264 |
+
uint32_t m_HostToConnectTo = 0;
|
| 265 |
+
uint32_t m_NumberOfHostsFound = 0;
|
| 266 |
+
uint32_t m_SecondsToFindHosts = 2;
|
| 267 |
+
|
| 268 |
+
int32_t m_SecondsToAttemptReconnecting = 60;
|
| 269 |
+
int32_t m_MaxReconnectionAttempts = 10;
|
| 270 |
+
uint32_t m_SleepBetweenReconnectingAttemptsInMs = 100;
|
| 271 |
+
|
| 272 |
+
std::unique_ptr<ManusHost[]> m_AvailableHosts = nullptr;
|
| 273 |
+
std::unique_ptr<ManusHost> m_Host;
|
| 274 |
+
|
| 275 |
+
//Data
|
| 276 |
+
uint32_t m_SessionId = 0;
|
| 277 |
+
|
| 278 |
+
bool m_RumblingWrist[NUMBER_OF_HANDS_SUPPORTED] = { false, false };
|
| 279 |
+
|
| 280 |
+
std::vector<uint32_t> m_LoadedSkeletons;
|
| 281 |
+
std::vector<uint32_t> m_TemporarySkeletons;
|
| 282 |
+
|
| 283 |
+
std::mutex m_SkeletonMutex;
|
| 284 |
+
std::mutex m_RawSkeletonMutex;
|
| 285 |
+
|
| 286 |
+
ClientSkeletonCollection* m_NextSkeleton = nullptr;
|
| 287 |
+
ClientSkeletonCollection* m_Skeleton = nullptr;
|
| 288 |
+
|
| 289 |
+
ClientRawSkeletonCollection* m_NextRawSkeleton = nullptr;
|
| 290 |
+
ClientRawSkeletonCollection* m_RawSkeleton = nullptr;
|
| 291 |
+
|
| 292 |
+
std::mutex m_TrackerMutex;
|
| 293 |
+
|
| 294 |
+
TrackerDataCollection* m_NextTrackerData = nullptr;
|
| 295 |
+
TrackerDataCollection* m_TrackerData = nullptr;
|
| 296 |
+
|
| 297 |
+
std::chrono::time_point<std::chrono::high_resolution_clock> m_TimeSinceLastDisconnect;
|
| 298 |
+
std::chrono::time_point<std::chrono::high_resolution_clock> m_LastTemporarySkeletonUpdate = std::chrono::high_resolution_clock::now();
|
| 299 |
+
|
| 300 |
+
std::mutex m_SystemMessageMutex;
|
| 301 |
+
std::string m_SystemMessage = "";
|
| 302 |
+
SystemMessageType m_SystemMessageCode = SystemMessageType::SystemMessageType_Unknown;
|
| 303 |
+
uint32_t m_ModifiedSkeletonIndex = UINT_MAX;
|
| 304 |
+
|
| 305 |
+
ManusTimestampInfo m_ErgoTimestampInfo;
|
| 306 |
+
ErgonomicsData m_LeftGloveErgoData;
|
| 307 |
+
ErgonomicsData m_RightGloveErgoData;
|
| 308 |
+
|
| 309 |
+
ChainType m_ChainType = ChainType::ChainType_Invalid;
|
| 310 |
+
|
| 311 |
+
bool m_TrackerTest = false;
|
| 312 |
+
bool m_TrackerDataDisplayPerUser = false;
|
| 313 |
+
float m_TrackerOffset = 0.0f;
|
| 314 |
+
|
| 315 |
+
std::mutex m_LandscapeMutex;
|
| 316 |
+
Landscape* m_NewLandscape = nullptr;
|
| 317 |
+
Landscape* m_Landscape = nullptr;
|
| 318 |
+
std::vector<GestureLandscapeData> m_NewGestureLandscapeData;
|
| 319 |
+
std::vector<GestureLandscapeData> m_GestureLandscapeData;
|
| 320 |
+
|
| 321 |
+
uint32_t m_FirstLeftGloveID = 0;
|
| 322 |
+
uint32_t m_FirstRightGloveID = 0;
|
| 323 |
+
|
| 324 |
+
std::mutex m_GestureMutex;
|
| 325 |
+
ClientGestures* m_NewFirstLeftGloveGestures = nullptr;
|
| 326 |
+
ClientGestures* m_FirstLeftGloveGestures = nullptr;
|
| 327 |
+
|
| 328 |
+
ClientGestures* m_NewFirstRightGloveGestures = nullptr;
|
| 329 |
+
ClientGestures* m_FirstRightGloveGestures = nullptr;
|
| 330 |
+
|
| 331 |
+
bool m_ShowLeftGestures = true;
|
| 332 |
+
|
| 333 |
+
bool m_CalibrateLeftHand = true;
|
| 334 |
+
uint32_t m_CalibrationStep = 0;
|
| 335 |
+
uint32_t m_CalibrationGloveId = 0;
|
| 336 |
+
uint32_t m_NumberOfCalibrationSteps = 0;
|
| 337 |
+
bool m_ValidStepData = false;
|
| 338 |
+
GloveCalibrationStepData m_StepData;
|
| 339 |
+
bool m_IsCalibrationInProgress = false;
|
| 340 |
+
std::string m_CalibrationMessage = "";
|
| 341 |
+
bool m_SendToDevTools = false;
|
| 342 |
+
|
| 343 |
+
std::mutex m_LogMutex;
|
| 344 |
+
std::vector<SDKLog*> m_Logs;
|
| 345 |
+
};
|
| 346 |
+
|
| 347 |
+
// Close the Doxygen group.
|
| 348 |
+
/** @} */
|
| 349 |
+
#endif
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/SDKClient_Linux.vcxproj
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
| 2 |
+
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
| 3 |
+
<ItemGroup Label="ProjectConfigurations">
|
| 4 |
+
<ProjectConfiguration Include="Debug|ARM">
|
| 5 |
+
<Configuration>Debug</Configuration>
|
| 6 |
+
<Platform>ARM</Platform>
|
| 7 |
+
</ProjectConfiguration>
|
| 8 |
+
<ProjectConfiguration Include="Release|ARM">
|
| 9 |
+
<Configuration>Release</Configuration>
|
| 10 |
+
<Platform>ARM</Platform>
|
| 11 |
+
</ProjectConfiguration>
|
| 12 |
+
<ProjectConfiguration Include="Debug|ARM64">
|
| 13 |
+
<Configuration>Debug</Configuration>
|
| 14 |
+
<Platform>ARM64</Platform>
|
| 15 |
+
</ProjectConfiguration>
|
| 16 |
+
<ProjectConfiguration Include="Release|ARM64">
|
| 17 |
+
<Configuration>Release</Configuration>
|
| 18 |
+
<Platform>ARM64</Platform>
|
| 19 |
+
</ProjectConfiguration>
|
| 20 |
+
<ProjectConfiguration Include="Debug|x64">
|
| 21 |
+
<Configuration>Debug</Configuration>
|
| 22 |
+
<Platform>x64</Platform>
|
| 23 |
+
</ProjectConfiguration>
|
| 24 |
+
<ProjectConfiguration Include="Release|x64">
|
| 25 |
+
<Configuration>Release</Configuration>
|
| 26 |
+
<Platform>x64</Platform>
|
| 27 |
+
</ProjectConfiguration>
|
| 28 |
+
</ItemGroup>
|
| 29 |
+
<ItemGroup>
|
| 30 |
+
<ClCompile Include="ClientPlatformSpecific.cpp" />
|
| 31 |
+
<ClCompile Include="SDKClient.cpp" />
|
| 32 |
+
<ClCompile Include="Main.cpp" />
|
| 33 |
+
</ItemGroup>
|
| 34 |
+
<ItemGroup>
|
| 35 |
+
<ClInclude Include="ClientLogging.hpp" />
|
| 36 |
+
<ClInclude Include="ClientPlatformSpecific.hpp" />
|
| 37 |
+
<ClInclude Include="ClientPlatformSpecificTypes.hpp" />
|
| 38 |
+
<ClInclude Include="SDKClient.hpp" />
|
| 39 |
+
</ItemGroup>
|
| 40 |
+
<PropertyGroup Label="Globals">
|
| 41 |
+
<ProjectGuid>{DADD0545-4F93-41DE-B0B7-C28B8497D16B}</ProjectGuid>
|
| 42 |
+
<Keyword>Linux</Keyword>
|
| 43 |
+
<RootNamespace>SDKClient_Linux</RootNamespace>
|
| 44 |
+
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
|
| 45 |
+
<ApplicationType>Linux</ApplicationType>
|
| 46 |
+
<ApplicationTypeRevision>1.0</ApplicationTypeRevision>
|
| 47 |
+
<TargetLinuxPlatform>Generic</TargetLinuxPlatform>
|
| 48 |
+
<LinuxProjectType>{D51BCBC9-82E9-4017-911E-C93873C4EA2B}</LinuxProjectType>
|
| 49 |
+
</PropertyGroup>
|
| 50 |
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
| 51 |
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
|
| 52 |
+
<UseDebugLibraries>true</UseDebugLibraries>
|
| 53 |
+
<PlatformToolset>Remote_Clang_1_0</PlatformToolset>
|
| 54 |
+
</PropertyGroup>
|
| 55 |
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
|
| 56 |
+
<UseDebugLibraries>false</UseDebugLibraries>
|
| 57 |
+
<PlatformToolset>Remote_Clang_1_0</PlatformToolset>
|
| 58 |
+
</PropertyGroup>
|
| 59 |
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
| 60 |
+
<UseDebugLibraries>true</UseDebugLibraries>
|
| 61 |
+
<PlatformToolset>Remote_GCC_1_0</PlatformToolset>
|
| 62 |
+
</PropertyGroup>
|
| 63 |
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
| 64 |
+
<UseDebugLibraries>false</UseDebugLibraries>
|
| 65 |
+
<PlatformToolset>Remote_GCC_1_0</PlatformToolset>
|
| 66 |
+
</PropertyGroup>
|
| 67 |
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
|
| 68 |
+
<UseDebugLibraries>false</UseDebugLibraries>
|
| 69 |
+
<PlatformToolset>Remote_Clang_1_0</PlatformToolset>
|
| 70 |
+
</PropertyGroup>
|
| 71 |
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
|
| 72 |
+
<UseDebugLibraries>true</UseDebugLibraries>
|
| 73 |
+
<PlatformToolset>Remote_Clang_1_0</PlatformToolset>
|
| 74 |
+
</PropertyGroup>
|
| 75 |
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
| 76 |
+
<ImportGroup Label="ExtensionSettings" />
|
| 77 |
+
<ImportGroup Label="Shared" />
|
| 78 |
+
<ImportGroup Label="PropertySheets" />
|
| 79 |
+
<PropertyGroup Label="UserMacros" />
|
| 80 |
+
<PropertyGroup>
|
| 81 |
+
<RemoteDebuggerCommand>$(RemoteRootDir)/$(RemoteOutRelDir)/$(TargetName)$(TargetExt)</RemoteDebuggerCommand>
|
| 82 |
+
</PropertyGroup>
|
| 83 |
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
| 84 |
+
<OutDir>$(SolutionDir)Output\$(Platform)\$(Configuration)\</OutDir>
|
| 85 |
+
<IntDir>$(SolutionDir)Temp\$(ProjectGuid)\$(Platform)\$(Configuration)\</IntDir>
|
| 86 |
+
<MultiProcNumber>8</MultiProcNumber>
|
| 87 |
+
</PropertyGroup>
|
| 88 |
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
| 89 |
+
<OutDir>$(SolutionDir)Output\$(Platform)\$(Configuration)\</OutDir>
|
| 90 |
+
<IntDir>$(SolutionDir)Temp\$(ProjectGuid)\$(Platform)\$(Configuration)\</IntDir>
|
| 91 |
+
<MultiProcNumber>8</MultiProcNumber>
|
| 92 |
+
</PropertyGroup>
|
| 93 |
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
| 94 |
+
<OutDir>$(SolutionDir)Output\$(Platform)\$(Configuration)\</OutDir>
|
| 95 |
+
<IntDir>$(SolutionDir)Temp\$(ProjectGuid)\$(Platform)\$(Configuration)\</IntDir>
|
| 96 |
+
<MultiProcNumber>8</MultiProcNumber>
|
| 97 |
+
</PropertyGroup>
|
| 98 |
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
| 99 |
+
<OutDir>$(SolutionDir)Output\$(Platform)\$(Configuration)\</OutDir>
|
| 100 |
+
<IntDir>$(SolutionDir)Temp\$(ProjectGuid)\$(Platform)\$(Configuration)\</IntDir>
|
| 101 |
+
<MultiProcNumber>8</MultiProcNumber>
|
| 102 |
+
</PropertyGroup>
|
| 103 |
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
| 104 |
+
<OutDir>$(SolutionDir)Output\$(Platform)\$(Configuration)\</OutDir>
|
| 105 |
+
<IntDir>$(SolutionDir)Temp\$(ProjectGuid)\$(Platform)\$(Configuration)\</IntDir>
|
| 106 |
+
<MultiProcNumber>8</MultiProcNumber>
|
| 107 |
+
</PropertyGroup>
|
| 108 |
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
| 109 |
+
<OutDir>$(SolutionDir)Output\$(Platform)\$(Configuration)\</OutDir>
|
| 110 |
+
<IntDir>$(SolutionDir)Temp\$(ProjectGuid)\$(Platform)\$(Configuration)\</IntDir>
|
| 111 |
+
<MultiProcNumber>8</MultiProcNumber>
|
| 112 |
+
</PropertyGroup>
|
| 113 |
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
| 114 |
+
<ClCompile>
|
| 115 |
+
<AdditionalIncludeDirectories>~/ManusSDK/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
| 116 |
+
<CppLanguageStandard>c++17</CppLanguageStandard>
|
| 117 |
+
</ClCompile>
|
| 118 |
+
<Link>
|
| 119 |
+
<AdditionalDependencies>~/ManusSDK/lib/libManusSDK.so;%(AdditionalDependencies)</AdditionalDependencies>
|
| 120 |
+
<LibraryDependencies>ncurses</LibraryDependencies>
|
| 121 |
+
<AdditionalOptions>-pthread</AdditionalOptions>
|
| 122 |
+
</Link>
|
| 123 |
+
<PreBuildEvent>
|
| 124 |
+
<Command>rem Copy SDK client base files
|
| 125 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\Main.cpp" "$(ProjectDir)\Main.cpp"
|
| 126 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\SDKClient.hpp" "$(ProjectDir)\SDKClient.hpp"
|
| 127 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\SDKClient.cpp" "$(ProjectDir)\SDKClient.cpp"
|
| 128 |
+
|
| 129 |
+
rem Copy platform specific files
|
| 130 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\PlatformSpecific\ClientPlatformSpecific.hpp" "$(ProjectDir)\ClientPlatformSpecific.hpp"
|
| 131 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\PlatformSpecific\Linux\ClientPlatformSpecific.cpp" "$(ProjectDir)\ClientPlatformSpecific.cpp"
|
| 132 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\PlatformSpecific\Linux\ClientPlatformSpecificTypes.hpp" "$(ProjectDir)\ClientPlatformSpecificTypes.hpp"</Command>
|
| 133 |
+
</PreBuildEvent>
|
| 134 |
+
</ItemDefinitionGroup>
|
| 135 |
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
| 136 |
+
<ClCompile>
|
| 137 |
+
<AdditionalIncludeDirectories>~/ManusSDK/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
| 138 |
+
<CppLanguageStandard>c++17</CppLanguageStandard>
|
| 139 |
+
</ClCompile>
|
| 140 |
+
<Link>
|
| 141 |
+
<AdditionalDependencies>~/ManusSDK/lib/libManusSDK.so;%(AdditionalDependencies)</AdditionalDependencies>
|
| 142 |
+
<LibraryDependencies>ncurses</LibraryDependencies>
|
| 143 |
+
<AdditionalOptions>-pthread</AdditionalOptions>
|
| 144 |
+
</Link>
|
| 145 |
+
<PreBuildEvent>
|
| 146 |
+
<Command>rem Copy SDK client base files
|
| 147 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\Main.cpp" "$(ProjectDir)\Main.cpp"
|
| 148 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\SDKClient.hpp" "$(ProjectDir)\SDKClient.hpp"
|
| 149 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\SDKClient.cpp" "$(ProjectDir)\SDKClient.cpp"
|
| 150 |
+
|
| 151 |
+
rem Copy platform specific files
|
| 152 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\PlatformSpecific\ClientPlatformSpecific.hpp" "$(ProjectDir)\ClientPlatformSpecific.hpp"
|
| 153 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\PlatformSpecific\Linux\ClientPlatformSpecific.cpp" "$(ProjectDir)\ClientPlatformSpecific.cpp"
|
| 154 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\PlatformSpecific\Linux\ClientPlatformSpecificTypes.hpp" "$(ProjectDir)\ClientPlatformSpecificTypes.hpp"</Command>
|
| 155 |
+
</PreBuildEvent>
|
| 156 |
+
</ItemDefinitionGroup>
|
| 157 |
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
| 158 |
+
<ClCompile>
|
| 159 |
+
<AdditionalIncludeDirectories>~/ManusSDK/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
| 160 |
+
<CppLanguageStandard>c++17</CppLanguageStandard>
|
| 161 |
+
</ClCompile>
|
| 162 |
+
<Link>
|
| 163 |
+
<AdditionalDependencies>~/ManusSDK/lib/libManusSDK.so;%(AdditionalDependencies)</AdditionalDependencies>
|
| 164 |
+
<LibraryDependencies>ncurses</LibraryDependencies>
|
| 165 |
+
<AdditionalOptions>-pthread</AdditionalOptions>
|
| 166 |
+
</Link>
|
| 167 |
+
<PreBuildEvent>
|
| 168 |
+
<Command>rem Copy SDK client base files
|
| 169 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\Main.cpp" "$(ProjectDir)\Main.cpp"
|
| 170 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\SDKClient.hpp" "$(ProjectDir)\SDKClient.hpp"
|
| 171 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\SDKClient.cpp" "$(ProjectDir)\SDKClient.cpp"
|
| 172 |
+
|
| 173 |
+
rem Copy platform specific files
|
| 174 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\PlatformSpecific\ClientPlatformSpecific.hpp" "$(ProjectDir)\ClientPlatformSpecific.hpp"
|
| 175 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\PlatformSpecific\Linux\ClientPlatformSpecific.cpp" "$(ProjectDir)\ClientPlatformSpecific.cpp"
|
| 176 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\PlatformSpecific\Linux\ClientPlatformSpecificTypes.hpp" "$(ProjectDir)\ClientPlatformSpecificTypes.hpp"</Command>
|
| 177 |
+
</PreBuildEvent>
|
| 178 |
+
</ItemDefinitionGroup>
|
| 179 |
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
| 180 |
+
<ClCompile>
|
| 181 |
+
<AdditionalIncludeDirectories>~/ManusSDK/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
| 182 |
+
<CppLanguageStandard>c++17</CppLanguageStandard>
|
| 183 |
+
</ClCompile>
|
| 184 |
+
<Link>
|
| 185 |
+
<AdditionalDependencies>~/ManusSDK/lib/libManusSDK.so;%(AdditionalDependencies)</AdditionalDependencies>
|
| 186 |
+
<LibraryDependencies>ncurses</LibraryDependencies>
|
| 187 |
+
<AdditionalOptions>-pthread</AdditionalOptions>
|
| 188 |
+
</Link>
|
| 189 |
+
<PreBuildEvent>
|
| 190 |
+
<Command>rem Copy SDK client base files
|
| 191 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\Main.cpp" "$(ProjectDir)\Main.cpp"
|
| 192 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\SDKClient.hpp" "$(ProjectDir)\SDKClient.hpp"
|
| 193 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\SDKClient.cpp" "$(ProjectDir)\SDKClient.cpp"
|
| 194 |
+
|
| 195 |
+
rem Copy platform specific files
|
| 196 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\PlatformSpecific\ClientPlatformSpecific.hpp" "$(ProjectDir)\ClientPlatformSpecific.hpp"
|
| 197 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\PlatformSpecific\Linux\ClientPlatformSpecific.cpp" "$(ProjectDir)\ClientPlatformSpecific.cpp"
|
| 198 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\PlatformSpecific\Linux\ClientPlatformSpecificTypes.hpp" "$(ProjectDir)\ClientPlatformSpecificTypes.hpp"</Command>
|
| 199 |
+
</PreBuildEvent>
|
| 200 |
+
</ItemDefinitionGroup>
|
| 201 |
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
| 202 |
+
<ClCompile>
|
| 203 |
+
<AdditionalIncludeDirectories>~/ManusSDK/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
| 204 |
+
<CppLanguageStandard>c++17</CppLanguageStandard>
|
| 205 |
+
<PreprocessorDefinitions>FMT_HEADER_ONLY;DEBUG;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
| 206 |
+
</ClCompile>
|
| 207 |
+
<Link>
|
| 208 |
+
<AdditionalDependencies>~/ManusSDK/lib/libManusSDK.so;%(AdditionalDependencies)</AdditionalDependencies>
|
| 209 |
+
<LibraryDependencies>ncurses</LibraryDependencies>
|
| 210 |
+
<AdditionalOptions>-pthread</AdditionalOptions>
|
| 211 |
+
</Link>
|
| 212 |
+
<PreBuildEvent>
|
| 213 |
+
<Command>rem Copy SDK client base files
|
| 214 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\Main.cpp" "$(ProjectDir)\Main.cpp"
|
| 215 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\SDKClient.hpp" "$(ProjectDir)\SDKClient.hpp"
|
| 216 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\SDKClient.cpp" "$(ProjectDir)\SDKClient.cpp"
|
| 217 |
+
|
| 218 |
+
rem Copy platform specific files
|
| 219 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\PlatformSpecific\ClientPlatformSpecific.hpp" "$(ProjectDir)\ClientPlatformSpecific.hpp"
|
| 220 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\PlatformSpecific\Linux\ClientPlatformSpecific.cpp" "$(ProjectDir)\ClientPlatformSpecific.cpp"
|
| 221 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\PlatformSpecific\Linux\ClientPlatformSpecificTypes.hpp" "$(ProjectDir)\ClientPlatformSpecificTypes.hpp"</Command>
|
| 222 |
+
</PreBuildEvent>
|
| 223 |
+
</ItemDefinitionGroup>
|
| 224 |
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
| 225 |
+
<ClCompile>
|
| 226 |
+
<AdditionalIncludeDirectories>~/ManusSDK/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
| 227 |
+
<CppLanguageStandard>c++17</CppLanguageStandard>
|
| 228 |
+
<PreprocessorDefinitions>FMT_HEADER_ONLY;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
| 229 |
+
</ClCompile>
|
| 230 |
+
<Link>
|
| 231 |
+
<AdditionalDependencies>~/ManusSDK/lib/libManusSDK.so;%(AdditionalDependencies)</AdditionalDependencies>
|
| 232 |
+
<LibraryDependencies>ncurses</LibraryDependencies>
|
| 233 |
+
<AdditionalOptions>-pthread</AdditionalOptions>
|
| 234 |
+
</Link>
|
| 235 |
+
<PreBuildEvent>
|
| 236 |
+
<Command>rem Copy SDK client base files
|
| 237 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\Main.cpp" "$(ProjectDir)\Main.cpp"
|
| 238 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\SDKClient.hpp" "$(ProjectDir)\SDKClient.hpp"
|
| 239 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\SDKClient.cpp" "$(ProjectDir)\SDKClient.cpp"
|
| 240 |
+
|
| 241 |
+
rem Copy platform specific files
|
| 242 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\PlatformSpecific\ClientPlatformSpecific.hpp" "$(ProjectDir)\ClientPlatformSpecific.hpp"
|
| 243 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\PlatformSpecific\Linux\ClientPlatformSpecific.cpp" "$(ProjectDir)\ClientPlatformSpecific.cpp"
|
| 244 |
+
copy /Y "$(SolutionDir)SDKClient_Windows\PlatformSpecific\Linux\ClientPlatformSpecificTypes.hpp" "$(ProjectDir)\ClientPlatformSpecificTypes.hpp"</Command>
|
| 245 |
+
</PreBuildEvent>
|
| 246 |
+
</ItemDefinitionGroup>
|
| 247 |
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
| 248 |
+
<ImportGroup Label="ExtensionTargets" />
|
| 249 |
+
</Project>
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/SDKClient_Linux.vcxproj.filters
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
| 2 |
+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
| 3 |
+
<ItemGroup>
|
| 4 |
+
<Filter Include="Platform Specific">
|
| 5 |
+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
| 6 |
+
</Filter>
|
| 7 |
+
</ItemGroup>
|
| 8 |
+
<ItemGroup>
|
| 9 |
+
<ClCompile Include="SDKClient.cpp" />
|
| 10 |
+
<ClCompile Include="ClientPlatformSpecific.cpp">
|
| 11 |
+
<Filter>Platform Specific</Filter>
|
| 12 |
+
</ClCompile>
|
| 13 |
+
<ClCompile Include="Main.cpp" />
|
| 14 |
+
</ItemGroup>
|
| 15 |
+
<ItemGroup>
|
| 16 |
+
<ClInclude Include="SDKClient.hpp" />
|
| 17 |
+
<ClInclude Include="ClientPlatformSpecific.hpp">
|
| 18 |
+
<Filter>Platform Specific</Filter>
|
| 19 |
+
</ClInclude>
|
| 20 |
+
<ClInclude Include="ClientPlatformSpecificTypes.hpp">
|
| 21 |
+
<Filter>Platform Specific</Filter>
|
| 22 |
+
</ClInclude>
|
| 23 |
+
<ClInclude Include="ClientLogging.hpp" />
|
| 24 |
+
</ItemGroup>
|
| 25 |
+
</Project>
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/objects/ClientPlatformSpecific.d
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
objects/ClientPlatformSpecific.o: ClientPlatformSpecific.cpp \
|
| 2 |
+
ClientPlatformSpecific.hpp ClientPlatformSpecificTypes.hpp \
|
| 3 |
+
ManusSDK/include/ManusSDK.h ManusSDK/include/ManusSDKTypes.h \
|
| 4 |
+
ManusSDK/include/ManusSDKTypeInitializers.h ClientLogging.hpp
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/objects/ClientPlatformSpecific.o
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e770aa6327cd78246c0fd084025e7824f3ffa13a76b1a183f927905179b7db02
|
| 3 |
+
size 562984
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/objects/Main.d
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
objects/Main.o: Main.cpp ClientLogging.hpp SDKClient.hpp \
|
| 2 |
+
ClientPlatformSpecific.hpp ClientPlatformSpecificTypes.hpp \
|
| 3 |
+
ManusSDK/include/ManusSDK.h ManusSDK/include/ManusSDKTypes.h \
|
| 4 |
+
ManusSDK/include/ManusSDKTypeInitializers.h \
|
| 5 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h \
|
| 6 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/detail/class.h \
|
| 7 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/attr.h \
|
| 8 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/detail/common.h \
|
| 9 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/Python.h \
|
| 10 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/patchlevel.h \
|
| 11 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/pyconfig.h \
|
| 12 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/pymacconfig.h \
|
| 13 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/pyport.h \
|
| 14 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/exports.h \
|
| 15 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/pymacro.h \
|
| 16 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/pymath.h \
|
| 17 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/pymem.h \
|
| 18 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/pymem.h \
|
| 19 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/object.h \
|
| 20 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/object.h \
|
| 21 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/objimpl.h \
|
| 22 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/objimpl.h \
|
| 23 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/typeslots.h \
|
| 24 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/pyhash.h \
|
| 25 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/pydebug.h \
|
| 26 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/bytearrayobject.h \
|
| 27 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/bytearrayobject.h \
|
| 28 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/bytesobject.h \
|
| 29 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/bytesobject.h \
|
| 30 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/unicodeobject.h \
|
| 31 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/unicodeobject.h \
|
| 32 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/longobject.h \
|
| 33 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/longintrepr.h \
|
| 34 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/boolobject.h \
|
| 35 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/floatobject.h \
|
| 36 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/complexobject.h \
|
| 37 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/rangeobject.h \
|
| 38 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/memoryobject.h \
|
| 39 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/tupleobject.h \
|
| 40 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/tupleobject.h \
|
| 41 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/listobject.h \
|
| 42 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/listobject.h \
|
| 43 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/dictobject.h \
|
| 44 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/dictobject.h \
|
| 45 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/odictobject.h \
|
| 46 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/enumobject.h \
|
| 47 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/setobject.h \
|
| 48 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/methodobject.h \
|
| 49 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/methodobject.h \
|
| 50 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/moduleobject.h \
|
| 51 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/funcobject.h \
|
| 52 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/classobject.h \
|
| 53 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/fileobject.h \
|
| 54 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/fileobject.h \
|
| 55 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/pycapsule.h \
|
| 56 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/code.h \
|
| 57 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/code.h \
|
| 58 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/pyframe.h \
|
| 59 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/traceback.h \
|
| 60 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/traceback.h \
|
| 61 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/sliceobject.h \
|
| 62 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cellobject.h \
|
| 63 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/iterobject.h \
|
| 64 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/initconfig.h \
|
| 65 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/genobject.h \
|
| 66 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/pystate.h \
|
| 67 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/pystate.h \
|
| 68 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/abstract.h \
|
| 69 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/abstract.h \
|
| 70 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/descrobject.h \
|
| 71 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/genericaliasobject.h \
|
| 72 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/warnings.h \
|
| 73 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/weakrefobject.h \
|
| 74 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/structseq.h \
|
| 75 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/namespaceobject.h \
|
| 76 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/picklebufobject.h \
|
| 77 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/pytime.h \
|
| 78 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/codecs.h \
|
| 79 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/pyerrors.h \
|
| 80 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/pyerrors.h \
|
| 81 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/pythread.h \
|
| 82 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/context.h \
|
| 83 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/modsupport.h \
|
| 84 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/compile.h \
|
| 85 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/compile.h \
|
| 86 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/pythonrun.h \
|
| 87 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/pythonrun.h \
|
| 88 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/pylifecycle.h \
|
| 89 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/pylifecycle.h \
|
| 90 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/ceval.h \
|
| 91 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/ceval.h \
|
| 92 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/sysmodule.h \
|
| 93 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/sysmodule.h \
|
| 94 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/osmodule.h \
|
| 95 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/intrcheck.h \
|
| 96 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/import.h \
|
| 97 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/import.h \
|
| 98 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/bltinmodule.h \
|
| 99 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/eval.h \
|
| 100 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/pyctype.h \
|
| 101 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/pystrtod.h \
|
| 102 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/pystrcmp.h \
|
| 103 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/fileutils.h \
|
| 104 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/fileutils.h \
|
| 105 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/pyfpe.h \
|
| 106 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/tracemalloc.h \
|
| 107 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/frameobject.h \
|
| 108 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/cpython/frameobject.h \
|
| 109 |
+
/home/gear/miniconda3/envs/decoupled_wbc/include/python3.10/pythread.h \
|
| 110 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/cast.h \
|
| 111 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/detail/descr.h \
|
| 112 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/detail/type_caster_base.h \
|
| 113 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/pytypes.h \
|
| 114 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/buffer_info.h \
|
| 115 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/detail/cpp_conduit.h \
|
| 116 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/detail/internals.h \
|
| 117 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/detail/typeid.h \
|
| 118 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/detail/value_and_holder.h \
|
| 119 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/options.h \
|
| 120 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/detail/exception_translation.h \
|
| 121 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/detail/init.h \
|
| 122 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/gil.h \
|
| 123 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/gil_safe_call_once.h \
|
| 124 |
+
/home/gear/miniconda3/envs/decoupled_wbc/lib/python3.10/site-packages/pybind11/include/pybind11/typing.h
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/objects/Main.o
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b8f44a3df601dbb2e65d517c903677d028f6c8e17778703f38dcc17b4696e3f6
|
| 3 |
+
size 3823648
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/objects/SDKClient.d
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
objects/SDKClient.o: SDKClient.cpp SDKClient.hpp \
|
| 2 |
+
ClientPlatformSpecific.hpp ClientPlatformSpecificTypes.hpp \
|
| 3 |
+
ManusSDK/include/ManusSDK.h ManusSDK/include/ManusSDKTypes.h \
|
| 4 |
+
ManusSDK/include/ManusSDKTypeInitializers.h \
|
| 5 |
+
ManusSDK/include/ManusSDKTypes.h ClientLogging.hpp
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/objects/SDKClient.o
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0cbc7585f9762dfe77ff4ef4a78ad2cf8df9f5b5103b197f4bb2cab2152c59a8
|
| 3 |
+
size 1904960
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/SDKClient_Linux/test.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
|
| 3 |
+
import ManusServer
|
| 4 |
+
|
| 5 |
+
ManusServer.init()
|
| 6 |
+
|
| 7 |
+
for i in range(10):
|
| 8 |
+
time.sleep(1)
|
| 9 |
+
output = ManusServer.get_latest_state()
|
| 10 |
+
# print(output.keys())
|
| 11 |
+
# if(output['3762867141_angle']!=[] and output['3822396207_angle']!=[]):
|
| 12 |
+
# print(output['3762867141_angle'])
|
| 13 |
+
|
| 14 |
+
ManusServer.shutdown()
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/iphone/iphone.py
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import threading
|
| 3 |
+
|
| 4 |
+
from flask import Flask
|
| 5 |
+
import socketio
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class IPhoneDevice:
|
| 9 |
+
"""
|
| 10 |
+
Returns the absolute pose of the iPhone device relative to the world frame.
|
| 11 |
+
The coordinate system is defined when ARKit is initialized.
|
| 12 |
+
|
| 13 |
+
Absolute pose coordinate system (at ARKit start):
|
| 14 |
+
|
| 15 |
+
y (out of screen)
|
| 16 |
+
⊙---> x
|
| 17 |
+
|
|
| 18 |
+
|
|
| 19 |
+
↓ z
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
If you compute the relative pose (T_0_inv @ T_now), the coordinate system becomes:
|
| 23 |
+
|
| 24 |
+
z (out of screen)
|
| 25 |
+
⊙---> y
|
| 26 |
+
|
|
| 27 |
+
|
|
| 28 |
+
↓ x
|
| 29 |
+
|
| 30 |
+
"""
|
| 31 |
+
|
| 32 |
+
def __init__(self, port: int = 5557, silent: bool = True):
|
| 33 |
+
self._silent = silent
|
| 34 |
+
self._port = port
|
| 35 |
+
self._latest_transform: dict = {}
|
| 36 |
+
self._latest_speed: dict = {}
|
| 37 |
+
self._commands: list[str] = []
|
| 38 |
+
|
| 39 |
+
# Use threading mode for socketio
|
| 40 |
+
self._sio = socketio.Server(async_mode="threading", cors_allowed_origins="*")
|
| 41 |
+
self._app = Flask(__name__)
|
| 42 |
+
self._app.wsgi_app = socketio.WSGIApp(self._sio, self._app.wsgi_app)
|
| 43 |
+
|
| 44 |
+
# Set up the event handler for updates
|
| 45 |
+
@self._sio.event
|
| 46 |
+
def connect(sid, environ):
|
| 47 |
+
if not self._silent:
|
| 48 |
+
print(f"===============>Client connected: {sid}")
|
| 49 |
+
|
| 50 |
+
@self._sio.event
|
| 51 |
+
def disconnect(sid):
|
| 52 |
+
if not self._silent:
|
| 53 |
+
print(f"===============>Client disconnected: {sid}")
|
| 54 |
+
|
| 55 |
+
@self._sio.event
|
| 56 |
+
def update(sid, data):
|
| 57 |
+
try:
|
| 58 |
+
data = json.loads(data)
|
| 59 |
+
self._latest_transform = data
|
| 60 |
+
self._sio.emit("commands", json.dumps(self._commands), to=sid)
|
| 61 |
+
except Exception as e:
|
| 62 |
+
if not self._silent:
|
| 63 |
+
print(f"Update failed: {e}")
|
| 64 |
+
|
| 65 |
+
def _run_server(self):
|
| 66 |
+
"""Run the Flask server with threading."""
|
| 67 |
+
self._app.run(host="0.0.0.0", port=self._port, threaded=True)
|
| 68 |
+
|
| 69 |
+
def start(self):
|
| 70 |
+
"""Start the server in a background thread."""
|
| 71 |
+
server_thread = threading.Thread(target=self._run_server, daemon=True)
|
| 72 |
+
server_thread.start()
|
| 73 |
+
if not self._silent:
|
| 74 |
+
print(f"IPhone Device running at http://0.0.0.0:{self._port}")
|
| 75 |
+
|
| 76 |
+
def stop(self):
|
| 77 |
+
if not self._silent:
|
| 78 |
+
print("IPhone Device stopped.")
|
| 79 |
+
|
| 80 |
+
def get_cmd(self) -> dict:
|
| 81 |
+
return self._latest_transform
|
| 82 |
+
|
| 83 |
+
def send_cmd(self, enable: bool) -> None:
|
| 84 |
+
self._commands = ["start_haptics" if enable else "stop_haptics"]
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
if __name__ == "__main__":
|
| 88 |
+
import time
|
| 89 |
+
|
| 90 |
+
device = IPhoneDevice()
|
| 91 |
+
device.start()
|
| 92 |
+
|
| 93 |
+
# or _ in range(100):
|
| 94 |
+
try:
|
| 95 |
+
while True:
|
| 96 |
+
data = device.get_cmd()
|
| 97 |
+
print("Latest data:", data)
|
| 98 |
+
time.sleep(1.0)
|
| 99 |
+
except KeyboardInterrupt:
|
| 100 |
+
print("Stopping device...")
|
| 101 |
+
finally:
|
| 102 |
+
device.stop()
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/device/manus.py
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from contextlib import contextmanager
|
| 2 |
+
import pickle
|
| 3 |
+
import time
|
| 4 |
+
|
| 5 |
+
import click
|
| 6 |
+
import numpy as np
|
| 7 |
+
from scipy.spatial.transform import Rotation as R
|
| 8 |
+
import zmq
|
| 9 |
+
|
| 10 |
+
from decoupled_wbc.control.teleop.device.SDKClient_Linux import ManusServer
|
| 11 |
+
|
| 12 |
+
manus_idx = {
|
| 13 |
+
"left": ["3822396207", "3998055887", "432908014"],
|
| 14 |
+
"right": ["3762867141", "831307785", "3585023564"],
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class Manus:
|
| 19 |
+
def __init__(self, port=5556):
|
| 20 |
+
# Storage for the latest finger data
|
| 21 |
+
self.latest_finger_data = {
|
| 22 |
+
"left_fingers": {"angle": np.zeros([40]), "position": np.zeros([25, 4, 4])},
|
| 23 |
+
"right_fingers": {"angle": np.zeros([40]), "position": np.zeros([25, 4, 4])},
|
| 24 |
+
}
|
| 25 |
+
self.manus_server = None
|
| 26 |
+
self.port = port
|
| 27 |
+
|
| 28 |
+
def process_finger_pose(self, raw_position, raw_orientation, dir):
|
| 29 |
+
raw_position = np.asarray(raw_position).reshape([-1, 3])
|
| 30 |
+
raw_orientation = np.asarray(raw_orientation).reshape([-1, 4])
|
| 31 |
+
|
| 32 |
+
def reorder(data):
|
| 33 |
+
return np.concatenate(
|
| 34 |
+
[
|
| 35 |
+
data[0:1], # root
|
| 36 |
+
data[21:25], # thumb
|
| 37 |
+
data[1:6], # index
|
| 38 |
+
data[6:11], # middle
|
| 39 |
+
data[16:21], # ring
|
| 40 |
+
data[11:16], # pinky
|
| 41 |
+
]
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
raw_position = reorder(raw_position)
|
| 45 |
+
raw_orientation = reorder(raw_orientation)
|
| 46 |
+
|
| 47 |
+
transformation_matrix = np.zeros([25, 4, 4])
|
| 48 |
+
rot_matrix = R.from_quat(raw_orientation[0][[1, 2, 3, 0]]).as_matrix()
|
| 49 |
+
transformation_matrix[:, :3, :3] = rot_matrix
|
| 50 |
+
transformation_matrix[:, :3, 3] = raw_position
|
| 51 |
+
transformation_matrix[:, 3, 3] = 1.0
|
| 52 |
+
|
| 53 |
+
T_root = transformation_matrix[0]
|
| 54 |
+
T_root_inv = np.linalg.inv(T_root)
|
| 55 |
+
transformation_matrix = np.matmul(T_root_inv[None], transformation_matrix)
|
| 56 |
+
|
| 57 |
+
T_manus2avp = np.identity(4)
|
| 58 |
+
if dir == "right":
|
| 59 |
+
T_manus2avp[:3, :3] = R.from_euler("zx", [180, -90], degrees=True).as_matrix()
|
| 60 |
+
else:
|
| 61 |
+
T_manus2avp[:3, :3] = R.from_euler("x", [90], degrees=True).as_matrix()
|
| 62 |
+
transformation_matrix = np.matmul(T_manus2avp[None], transformation_matrix)
|
| 63 |
+
|
| 64 |
+
return transformation_matrix
|
| 65 |
+
|
| 66 |
+
def process_finger_angle(self, raw_finger_data, dir):
|
| 67 |
+
if dir == "right":
|
| 68 |
+
non_zero_data = [value for value in raw_finger_data if value != 0.0]
|
| 69 |
+
trailing_zeros_count = len(raw_finger_data) - len(non_zero_data)
|
| 70 |
+
raw_finger_data = non_zero_data + [0.0] * trailing_zeros_count
|
| 71 |
+
|
| 72 |
+
return raw_finger_data
|
| 73 |
+
|
| 74 |
+
def request_finger_data(self):
|
| 75 |
+
output = ManusServer.get_latest_state()
|
| 76 |
+
for dir, val in manus_idx.items():
|
| 77 |
+
for id in val:
|
| 78 |
+
angle_name = f"{id}_angle"
|
| 79 |
+
if angle_name in output and len(output[angle_name]) > 0:
|
| 80 |
+
self.latest_finger_data[f"{dir}_fingers"]["angle"] = self.process_finger_angle(
|
| 81 |
+
np.asarray(output[angle_name]), dir
|
| 82 |
+
)
|
| 83 |
+
|
| 84 |
+
position_name = f"{id}_position"
|
| 85 |
+
orientation_name = f"{id}_orientation"
|
| 86 |
+
if (
|
| 87 |
+
position_name in output
|
| 88 |
+
and orientation_name in output
|
| 89 |
+
and len(output[position_name]) > 0
|
| 90 |
+
and len(output[orientation_name]) > 0
|
| 91 |
+
):
|
| 92 |
+
self.latest_finger_data[f"{dir}_fingers"]["position"] = (
|
| 93 |
+
self.process_finger_pose(
|
| 94 |
+
output[position_name], output[orientation_name], dir
|
| 95 |
+
)
|
| 96 |
+
)
|
| 97 |
+
|
| 98 |
+
return self.latest_finger_data
|
| 99 |
+
|
| 100 |
+
@contextmanager
|
| 101 |
+
def activate(self):
|
| 102 |
+
try:
|
| 103 |
+
ManusServer.init()
|
| 104 |
+
self.context = zmq.Context()
|
| 105 |
+
self.socket = self.context.socket(zmq.REP)
|
| 106 |
+
self.socket.bind(f"tcp://*:{self.port}")
|
| 107 |
+
yield self
|
| 108 |
+
finally:
|
| 109 |
+
ManusServer.shutdown()
|
| 110 |
+
|
| 111 |
+
def run(self):
|
| 112 |
+
while True:
|
| 113 |
+
# Wait for a request from the client
|
| 114 |
+
_ = self.socket.recv()
|
| 115 |
+
# Process finger data
|
| 116 |
+
data = self.request_finger_data()
|
| 117 |
+
data["timestamp"] = time.time()
|
| 118 |
+
|
| 119 |
+
# Serialize the data to send back
|
| 120 |
+
serialized_data = pickle.dumps(data)
|
| 121 |
+
|
| 122 |
+
# Send the serialized data back to the client
|
| 123 |
+
self.socket.send(serialized_data)
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
@click.command()
|
| 127 |
+
@click.option("--port", type=int, default=5556)
|
| 128 |
+
def main(port):
|
| 129 |
+
print("... starting manus server ... at port", port, flush=True)
|
| 130 |
+
manus = Manus(port=port)
|
| 131 |
+
print("... manus server activating ...")
|
| 132 |
+
with manus.activate():
|
| 133 |
+
print("==> Manus server is running at port", port, flush=True)
|
| 134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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
import xrobotoolkit_sdk as xrt
|
| 3 |
+
|
| 4 |
+
# xrt interface is defined in
|
| 5 |
+
# https://github.com/XR-Robotics/XRoboToolkit-PC-Service-Pybind/blob/main/bindings/py_bindings.cpp
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class XrClient:
|
| 9 |
+
"""Client for the XrClient SDK to interact with XR devices."""
|
| 10 |
+
|
| 11 |
+
def __init__(self):
|
| 12 |
+
"""Initializes the XrClient and the SDK."""
|
| 13 |
+
xrt.init()
|
| 14 |
+
print("XRoboToolkit SDK initialized.")
|
| 15 |
+
|
| 16 |
+
def get_pose_by_name(self, name: str) -> np.ndarray:
|
| 17 |
+
"""Returns the pose of the specified device by name.
|
| 18 |
+
Valid names: "left_controller", "right_controller", "headset".
|
| 19 |
+
Pose is [x, y, z, qx, qy, qz, qw]."""
|
| 20 |
+
if name == "left_controller":
|
| 21 |
+
return xrt.get_left_controller_pose()
|
| 22 |
+
elif name == "right_controller":
|
| 23 |
+
return xrt.get_right_controller_pose()
|
| 24 |
+
elif name == "headset":
|
| 25 |
+
return xrt.get_headset_pose()
|
| 26 |
+
else:
|
| 27 |
+
raise ValueError(
|
| 28 |
+
f"Invalid name: {name}. Valid names are: 'left_controller', 'right_controller', 'headset'."
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
def get_key_value_by_name(self, name: str) -> float:
|
| 32 |
+
"""Returns the trigger/grip value by name (float).
|
| 33 |
+
Valid names: "left_trigger", "right_trigger", "left_grip", "right_grip".
|
| 34 |
+
"""
|
| 35 |
+
if name == "left_trigger":
|
| 36 |
+
return xrt.get_left_trigger()
|
| 37 |
+
elif name == "right_trigger":
|
| 38 |
+
return xrt.get_right_trigger()
|
| 39 |
+
elif name == "left_grip":
|
| 40 |
+
return xrt.get_left_grip()
|
| 41 |
+
elif name == "right_grip":
|
| 42 |
+
return xrt.get_right_grip()
|
| 43 |
+
else:
|
| 44 |
+
raise ValueError(
|
| 45 |
+
f"Invalid name: {name}. Valid names are: \
|
| 46 |
+
'left_trigger', 'right_trigger', 'left_grip', 'right_grip'."
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
def get_button_state_by_name(self, name: str) -> bool:
|
| 50 |
+
"""Returns the button state by name (bool).
|
| 51 |
+
Valid names: "A", "B", "X", "Y",
|
| 52 |
+
"left_menu_button", "right_menu_button",
|
| 53 |
+
"left_axis_click", "right_axis_click"
|
| 54 |
+
"""
|
| 55 |
+
if name == "A":
|
| 56 |
+
return xrt.get_A_button()
|
| 57 |
+
elif name == "B":
|
| 58 |
+
return xrt.get_B_button()
|
| 59 |
+
elif name == "X":
|
| 60 |
+
return xrt.get_X_button()
|
| 61 |
+
elif name == "Y":
|
| 62 |
+
return xrt.get_Y_button()
|
| 63 |
+
elif name == "left_menu_button":
|
| 64 |
+
return xrt.get_left_menu_button()
|
| 65 |
+
elif name == "right_menu_button":
|
| 66 |
+
return xrt.get_right_menu_button()
|
| 67 |
+
elif name == "left_axis_click":
|
| 68 |
+
return xrt.get_left_axis_click()
|
| 69 |
+
elif name == "right_axis_click":
|
| 70 |
+
return xrt.get_right_axis_click()
|
| 71 |
+
else:
|
| 72 |
+
raise ValueError(
|
| 73 |
+
f"Invalid name: {name}. Valid names are: 'A', 'B', 'X', 'Y', "
|
| 74 |
+
"'left_menu_button', 'right_menu_button', 'left_axis_click', 'right_axis_click'."
|
| 75 |
+
)
|
| 76 |
+
|
| 77 |
+
def get_timestamp_ns(self) -> int:
|
| 78 |
+
"""Returns the current timestamp in nanoseconds (int)."""
|
| 79 |
+
return xrt.get_time_stamp_ns()
|
| 80 |
+
|
| 81 |
+
def get_hand_tracking_state(self, hand: str) -> np.ndarray | None:
|
| 82 |
+
"""Returns the hand tracking state for the specified hand.
|
| 83 |
+
Valid hands: "left", "right".
|
| 84 |
+
State is a 27 x 7 numpy array, where each row is [x, y, z, qx, qy, qz, qw] for each joint.
|
| 85 |
+
Returns None if hand tracking is inactive (low quality).
|
| 86 |
+
"""
|
| 87 |
+
if hand.lower() == "left":
|
| 88 |
+
if not xrt.get_left_hand_is_active():
|
| 89 |
+
return None
|
| 90 |
+
return xrt.get_left_hand_tracking_state()
|
| 91 |
+
elif hand.lower() == "right":
|
| 92 |
+
if not xrt.get_right_hand_is_active():
|
| 93 |
+
return None
|
| 94 |
+
return xrt.get_right_hand_tracking_state()
|
| 95 |
+
else:
|
| 96 |
+
raise ValueError(f"Invalid hand: {hand}. Valid hands are: 'left', 'right'.")
|
| 97 |
+
|
| 98 |
+
def get_joystick_state(self, controller: str) -> list[float]:
|
| 99 |
+
"""Returns the joystick state for the specified controller.
|
| 100 |
+
Valid controllers: "left", "right".
|
| 101 |
+
State is a list with shape (2) representing [x, y] for each joystick.
|
| 102 |
+
"""
|
| 103 |
+
if controller.lower() == "left":
|
| 104 |
+
return xrt.get_left_axis()
|
| 105 |
+
elif controller.lower() == "right":
|
| 106 |
+
return xrt.get_right_axis()
|
| 107 |
+
else:
|
| 108 |
+
raise ValueError(
|
| 109 |
+
f"Invalid controller: {controller}. Valid controllers are: 'left', 'right'."
|
| 110 |
+
)
|
| 111 |
+
|
| 112 |
+
def get_motion_tracker_data(self) -> dict:
|
| 113 |
+
"""Returns a dictionary of motion tracker data, where the keys are the tracker serial numbers.
|
| 114 |
+
Each value is a dictionary containing the pose, velocity, and acceleration of the tracker.
|
| 115 |
+
"""
|
| 116 |
+
num_motion_data = xrt.num_motion_data_available()
|
| 117 |
+
if num_motion_data == 0:
|
| 118 |
+
return {}
|
| 119 |
+
|
| 120 |
+
poses = xrt.get_motion_tracker_pose()
|
| 121 |
+
velocities = xrt.get_motion_tracker_velocity()
|
| 122 |
+
accelerations = xrt.get_motion_tracker_acceleration()
|
| 123 |
+
serial_numbers = xrt.get_motion_tracker_serial_numbers()
|
| 124 |
+
|
| 125 |
+
tracker_data = {}
|
| 126 |
+
for i in range(num_motion_data):
|
| 127 |
+
serial = serial_numbers[i]
|
| 128 |
+
tracker_data[serial] = {
|
| 129 |
+
"pose": poses[i],
|
| 130 |
+
"velocity": velocities[i],
|
| 131 |
+
"acceleration": accelerations[i],
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
return tracker_data
|
| 135 |
+
|
| 136 |
+
def get_body_tracking_data(self) -> dict | None:
|
| 137 |
+
"""Returns complete body tracking data or None if unavailable.
|
| 138 |
+
|
| 139 |
+
Returns:
|
| 140 |
+
Dict with keys: 'poses', 'velocities', 'accelerations', 'imu_timestamps', 'body_timestamp'
|
| 141 |
+
- poses: (24, 7) array [x,y,z,qx,qy,qz,qw] for each joint
|
| 142 |
+
- velocities: (24, 6) array [vx,vy,vz,wx,wy,wz] for each joint
|
| 143 |
+
- accelerations: (24, 6) array [ax,ay,az,wax,way,waz] for each joint
|
| 144 |
+
"""
|
| 145 |
+
if not xrt.is_body_data_available():
|
| 146 |
+
return None
|
| 147 |
+
|
| 148 |
+
return {
|
| 149 |
+
"poses": xrt.get_body_joints_pose(),
|
| 150 |
+
"velocities": xrt.get_body_joints_velocity(),
|
| 151 |
+
"accelerations": xrt.get_body_joints_acceleration(),
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
def close(self):
|
| 155 |
+
xrt.close()
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/gui/cli.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
|
| 3 |
+
import click
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
@click.command()
|
| 7 |
+
def teleop():
|
| 8 |
+
"""CLI for interacting with the osmo."""
|
| 9 |
+
subprocess.run(["python", "decoupled_wbc/control/teleop/gui/main.py"])
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
@click.group()
|
| 13 |
+
def cli():
|
| 14 |
+
"""CLI for interacting with the osmo."""
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
cli.add_command(teleop)
|
| 18 |
+
|
| 19 |
+
if __name__ == "__main__":
|
| 20 |
+
cli()
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/gui/core/events3d.py
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
|
| 4 |
+
"""
|
| 5 |
+
**Project Name:** MakeHuman
|
| 6 |
+
|
| 7 |
+
**Product Home Page:** http://www.makehumancommunity.org/
|
| 8 |
+
|
| 9 |
+
**Github Code Home Page:** https://github.com/makehumancommunity/
|
| 10 |
+
|
| 11 |
+
**Authors:** Marc Flerackers
|
| 12 |
+
|
| 13 |
+
**Copyright(c):** MakeHuman Team 2001-2020
|
| 14 |
+
|
| 15 |
+
**Licensing:** AGPL3
|
| 16 |
+
|
| 17 |
+
This file is part of MakeHuman Community (www.makehumancommunity.org).
|
| 18 |
+
|
| 19 |
+
This program is free software: you can redistribute it and/or modify
|
| 20 |
+
it under the terms of the GNU Affero General Public License as
|
| 21 |
+
published by the Free Software Foundation, either version 3 of the
|
| 22 |
+
License, or (at your option) any later version.
|
| 23 |
+
|
| 24 |
+
This program is distributed in the hope that it will be useful,
|
| 25 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 26 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 27 |
+
GNU Affero General Public License for more details.
|
| 28 |
+
|
| 29 |
+
You should have received a copy of the GNU Affero General Public License
|
| 30 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
Abstract
|
| 34 |
+
--------
|
| 35 |
+
|
| 36 |
+
This module contains classes to allow an object to handle events.
|
| 37 |
+
"""
|
| 38 |
+
import library.log as log
|
| 39 |
+
import library.profiler as profiler
|
| 40 |
+
from library.universal import G
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
class Event:
|
| 44 |
+
"""
|
| 45 |
+
Base class for all events, does not contain information.
|
| 46 |
+
"""
|
| 47 |
+
|
| 48 |
+
def __init__(self):
|
| 49 |
+
pass
|
| 50 |
+
|
| 51 |
+
def __repr__(self) -> str:
|
| 52 |
+
return "event:"
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
class MouseEvent(Event):
|
| 56 |
+
"""
|
| 57 |
+
Contains information about a mouse event.
|
| 58 |
+
|
| 59 |
+
:param button: the button that is pressed in case of a mousedown or mouseup event,
|
| 60 |
+
or button flags in case of a mousemove event.
|
| 61 |
+
:type button: int
|
| 62 |
+
:param x: the x position of the mouse in window coordinates.
|
| 63 |
+
:type x: int
|
| 64 |
+
:param y: the y position of the mouse in window coordinates.
|
| 65 |
+
:type y: int
|
| 66 |
+
:param dx: the difference in x position in case of a mousemove event.
|
| 67 |
+
:type dx: int
|
| 68 |
+
:param dy: the difference in y position in case of a mousemove event.
|
| 69 |
+
:type dy: int
|
| 70 |
+
"""
|
| 71 |
+
|
| 72 |
+
def __init__(self, button, x, y, dx=0, dy=0):
|
| 73 |
+
self.button = button
|
| 74 |
+
self.x = x
|
| 75 |
+
self.y = y
|
| 76 |
+
self.dx = dx
|
| 77 |
+
self.dy = dy
|
| 78 |
+
|
| 79 |
+
def __repr__(self):
|
| 80 |
+
return "MouseEvent(%d, %d, %d, %d, %d)" % (self.button, self.x, self.y, self.dx, self.dy)
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
class MouseWheelEvent(Event):
|
| 84 |
+
"""
|
| 85 |
+
Contains information about a mouse wheel event.
|
| 86 |
+
|
| 87 |
+
:param wheelDelta: the amount and direction that the wheel was scrolled.
|
| 88 |
+
:type wheelDelta: int
|
| 89 |
+
"""
|
| 90 |
+
|
| 91 |
+
def __init__(self, wheelDelta, x, y):
|
| 92 |
+
self.wheelDelta = wheelDelta
|
| 93 |
+
self.x = x
|
| 94 |
+
self.y = y
|
| 95 |
+
|
| 96 |
+
def __repr__(self):
|
| 97 |
+
return "MouseWheelEvent(%d)" % self.wheelDelta
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
class KeyEvent(Event):
|
| 101 |
+
"""
|
| 102 |
+
Contains information about a keyboard event.
|
| 103 |
+
|
| 104 |
+
:param key: the key code of the key that was pressed or released.
|
| 105 |
+
:type key: int
|
| 106 |
+
:param character: the unicode character if the key represents a character.
|
| 107 |
+
:type character: unicode
|
| 108 |
+
:param modifiers: the modifier keys that were down at the time of pressing the key.
|
| 109 |
+
:type modifiers: int
|
| 110 |
+
"""
|
| 111 |
+
|
| 112 |
+
def __init__(self, key, character, modifiers):
|
| 113 |
+
self.key = key
|
| 114 |
+
self.character = character
|
| 115 |
+
self.modifiers = modifiers
|
| 116 |
+
|
| 117 |
+
def __repr__(self):
|
| 118 |
+
return "KeyEvent(%d, %04x %s, %d)" % (
|
| 119 |
+
self.key,
|
| 120 |
+
ord(self.character),
|
| 121 |
+
self.character,
|
| 122 |
+
self.modifiers,
|
| 123 |
+
)
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
class FocusEvent(Event):
|
| 127 |
+
"""
|
| 128 |
+
Contains information about a view focus/blur event
|
| 129 |
+
|
| 130 |
+
:param blurred: the view that lost the focus.
|
| 131 |
+
:type blurred: guid3d.View
|
| 132 |
+
:param focused: the view that gained the focus.
|
| 133 |
+
:type focused: guid3d.View
|
| 134 |
+
"""
|
| 135 |
+
|
| 136 |
+
def __init__(self, blurred, focused):
|
| 137 |
+
self.blurred = blurred
|
| 138 |
+
self.focused = focused
|
| 139 |
+
|
| 140 |
+
def __repr__(self):
|
| 141 |
+
return "FocusEvent(%s, %s)" % (self.blurred, self.focused)
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
class ResizeEvent(Event):
|
| 145 |
+
"""
|
| 146 |
+
Contains information about a resize event
|
| 147 |
+
|
| 148 |
+
:param width: the new width of the window in pixels.
|
| 149 |
+
:type width: int
|
| 150 |
+
:param height: the new height of the window in pixels.
|
| 151 |
+
:type height: int
|
| 152 |
+
:param fullscreen: the new fullscreen state of the window.
|
| 153 |
+
:type fullscreen: Boolean
|
| 154 |
+
:param dx: the change in width of the window in pixels.
|
| 155 |
+
:type dx: int
|
| 156 |
+
:param dy: the change in height of the window in pixels.
|
| 157 |
+
:type dy: int
|
| 158 |
+
"""
|
| 159 |
+
|
| 160 |
+
def __init__(self, width, height, fullscreen):
|
| 161 |
+
self.width = width
|
| 162 |
+
self.height = height
|
| 163 |
+
self.fullscreen = fullscreen
|
| 164 |
+
|
| 165 |
+
def __repr__(self):
|
| 166 |
+
return "ResizeEvent(%d, %d, %s)" % (self.width, self.height, self.fullscreen)
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
class HumanEvent(Event):
|
| 170 |
+
def __init__(self, human, change):
|
| 171 |
+
self.human = human
|
| 172 |
+
self.change = change
|
| 173 |
+
|
| 174 |
+
def __repr__(self):
|
| 175 |
+
return "event: %s, %s" % (self.human, self.change)
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
class EventHandler(object):
|
| 179 |
+
"""
|
| 180 |
+
Base event handler class. Derive from this class if an object needs to be able to have events attached to it.
|
| 181 |
+
Currently only one event per event name can be attached. This is because we either allow a class method or
|
| 182 |
+
a custom method to be attached as event handling method. Since the custom method replaces the class method,
|
| 183 |
+
it is needed in some case to call the base class's method from the event handling method.
|
| 184 |
+
|
| 185 |
+
There are 2 ways to attach handlers:
|
| 186 |
+
|
| 187 |
+
1. Override the method. This is the most appropriate way when you want to add distinctive behaviour to many
|
| 188 |
+
EventHandlers.
|
| 189 |
+
|
| 190 |
+
::
|
| 191 |
+
|
| 192 |
+
class Widget(View):
|
| 193 |
+
|
| 194 |
+
def onMouseDown(self, event):
|
| 195 |
+
#Handle event
|
| 196 |
+
|
| 197 |
+
2. Use the event decorator. This is the most appropriate way when you want
|
| 198 |
+
to attach distinctive behaviour to one EventHandler.
|
| 199 |
+
|
| 200 |
+
::
|
| 201 |
+
|
| 202 |
+
widget = Widget()
|
| 203 |
+
|
| 204 |
+
@widget.mhEvent:
|
| 205 |
+
def onMouseDown(event):
|
| 206 |
+
#Handle event
|
| 207 |
+
|
| 208 |
+
Note that self is not passed to the handler in this case, which should not be a problem
|
| 209 |
+
as you can just use the variable since you are creating a closure.
|
| 210 |
+
"""
|
| 211 |
+
|
| 212 |
+
def __init__(self):
|
| 213 |
+
self.sortOrder = None
|
| 214 |
+
|
| 215 |
+
_logger = log.getLogger("mh.callEvent")
|
| 216 |
+
_depth = 0
|
| 217 |
+
|
| 218 |
+
def callEvent(self, eventType, event):
|
| 219 |
+
if not hasattr(self, eventType):
|
| 220 |
+
return False
|
| 221 |
+
topLevel = EventHandler._depth == 0
|
| 222 |
+
EventHandler._depth += 1
|
| 223 |
+
try:
|
| 224 |
+
self._logger.debug("callEvent[%d]: %s.%s(%s)", self._depth, self, eventType, event)
|
| 225 |
+
method = getattr(self, eventType)
|
| 226 |
+
if topLevel and profiler.active():
|
| 227 |
+
profiler.accum("method(event)", globals(), locals())
|
| 228 |
+
else:
|
| 229 |
+
method(event)
|
| 230 |
+
except Exception as _:
|
| 231 |
+
log.warning("Exception during event %s", eventType, exc_info=True)
|
| 232 |
+
self.eventFailed(EventHandler._depth)
|
| 233 |
+
EventHandler._depth -= 1
|
| 234 |
+
if topLevel:
|
| 235 |
+
self._logger.debug("callEvent: done")
|
| 236 |
+
if G.app:
|
| 237 |
+
G.app.redraw()
|
| 238 |
+
return True
|
| 239 |
+
return False
|
| 240 |
+
|
| 241 |
+
def eventFailed(self, level):
|
| 242 |
+
# Reset progress
|
| 243 |
+
if G.app:
|
| 244 |
+
G.app.progress(1)
|
| 245 |
+
|
| 246 |
+
def attachEvent(self, eventName, eventMethod):
|
| 247 |
+
setattr(self, eventName, eventMethod)
|
| 248 |
+
|
| 249 |
+
def detachEvent(self, eventName):
|
| 250 |
+
delattr(self, eventName)
|
| 251 |
+
|
| 252 |
+
def mhEvent(self, eventMethod):
|
| 253 |
+
self.attachEvent(eventMethod.__name__, eventMethod)
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/gui/core/gui3d.py
ADDED
|
@@ -0,0 +1,670 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
|
| 4 |
+
"""
|
| 5 |
+
**Project Name:** MakeHuman
|
| 6 |
+
|
| 7 |
+
**Product Home Page:** http://www.makehumancommunity.org/
|
| 8 |
+
|
| 9 |
+
**Github Code Home Page:** https://github.com/makehumancommunity/
|
| 10 |
+
|
| 11 |
+
**Authors:** Joel Palmius, Marc Flerackers
|
| 12 |
+
|
| 13 |
+
**Copyright(c):** MakeHuman Team 2001-2020
|
| 14 |
+
|
| 15 |
+
**Licensing:** AGPL3
|
| 16 |
+
|
| 17 |
+
This file is part of MakeHuman Community (www.makehumancommunity.org).
|
| 18 |
+
|
| 19 |
+
This program is free software: you can redistribute it and/or modify
|
| 20 |
+
it under the terms of the GNU Affero General Public License as
|
| 21 |
+
published by the Free Software Foundation, either version 3 of the
|
| 22 |
+
License, or (at your option) any later version.
|
| 23 |
+
|
| 24 |
+
This program is distributed in the hope that it will be useful,
|
| 25 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 26 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 27 |
+
GNU Affero General Public License for more details.
|
| 28 |
+
|
| 29 |
+
You should have received a copy of the GNU Affero General Public License
|
| 30 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
Abstract
|
| 34 |
+
--------
|
| 35 |
+
|
| 36 |
+
This module contains classes defined to implement widgets that provide utility functions
|
| 37 |
+
to the graphical user interface.
|
| 38 |
+
|
| 39 |
+
Importing this module loads OpenGL dependencies.
|
| 40 |
+
"""
|
| 41 |
+
|
| 42 |
+
import weakref
|
| 43 |
+
|
| 44 |
+
import events3d
|
| 45 |
+
import library.log as log
|
| 46 |
+
import mh
|
| 47 |
+
import module3d
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
class View(events3d.EventHandler):
|
| 51 |
+
"""
|
| 52 |
+
The base view from which all widgets are derived.
|
| 53 |
+
"""
|
| 54 |
+
|
| 55 |
+
def __init__(self):
|
| 56 |
+
|
| 57 |
+
self.children = []
|
| 58 |
+
self.objects = []
|
| 59 |
+
self._visible = False
|
| 60 |
+
self._totalVisibility = False
|
| 61 |
+
self._parent = None
|
| 62 |
+
self._attached = False
|
| 63 |
+
self.widgets = []
|
| 64 |
+
|
| 65 |
+
@property
|
| 66 |
+
def parent(self):
|
| 67 |
+
if self._parent:
|
| 68 |
+
return self._parent()
|
| 69 |
+
else:
|
| 70 |
+
return None
|
| 71 |
+
|
| 72 |
+
def _attach(self):
|
| 73 |
+
|
| 74 |
+
self._attached = True
|
| 75 |
+
|
| 76 |
+
for object in self.objects:
|
| 77 |
+
object._attach()
|
| 78 |
+
|
| 79 |
+
for child in self.children:
|
| 80 |
+
child._attach()
|
| 81 |
+
|
| 82 |
+
def _detach(self):
|
| 83 |
+
self._attached = False
|
| 84 |
+
|
| 85 |
+
for object in self.objects:
|
| 86 |
+
object._detach()
|
| 87 |
+
|
| 88 |
+
for child in self.children:
|
| 89 |
+
child._detach()
|
| 90 |
+
|
| 91 |
+
def addView(self, view):
|
| 92 |
+
"""
|
| 93 |
+
Adds the view to this view. If this view is attached to the app, the view will also be attached.
|
| 94 |
+
|
| 95 |
+
:param view: The view to be added.
|
| 96 |
+
:type view: gui3d.View
|
| 97 |
+
:return: The view, for convenience.
|
| 98 |
+
:rvalue: gui3d.View
|
| 99 |
+
"""
|
| 100 |
+
if view.parent:
|
| 101 |
+
raise RuntimeError("The view is already added to a view")
|
| 102 |
+
|
| 103 |
+
view._parent = weakref.ref(self)
|
| 104 |
+
view._updateVisibility()
|
| 105 |
+
if self._attached:
|
| 106 |
+
view._attach()
|
| 107 |
+
|
| 108 |
+
self.children.append(view)
|
| 109 |
+
|
| 110 |
+
return view
|
| 111 |
+
|
| 112 |
+
def removeView(self, view):
|
| 113 |
+
"""
|
| 114 |
+
Removes the view from this view. If this view is attached to the app, the view will be detached.
|
| 115 |
+
|
| 116 |
+
:param view: The view to be removed.
|
| 117 |
+
:type view: gui3d.View
|
| 118 |
+
"""
|
| 119 |
+
if view not in self.children:
|
| 120 |
+
raise RuntimeError("The view is not a child of this view")
|
| 121 |
+
|
| 122 |
+
view._parent = None
|
| 123 |
+
if self._attached:
|
| 124 |
+
view._detach()
|
| 125 |
+
|
| 126 |
+
self.children.remove(view)
|
| 127 |
+
|
| 128 |
+
def addObject(self, object):
|
| 129 |
+
"""
|
| 130 |
+
Adds the object to the view. If the view is attached to the app,
|
| 131 |
+
the object will also be attached and will get an OpenGL counterpart.
|
| 132 |
+
|
| 133 |
+
:param object: The object to be added.
|
| 134 |
+
:type object: gui3d.Object
|
| 135 |
+
:return: The object, for convenience.
|
| 136 |
+
:rvalue: gui3d.Object
|
| 137 |
+
"""
|
| 138 |
+
if object._view:
|
| 139 |
+
raise RuntimeError("The object is already added to a view")
|
| 140 |
+
|
| 141 |
+
object._view = weakref.ref(self)
|
| 142 |
+
if self._attached:
|
| 143 |
+
object._attach()
|
| 144 |
+
|
| 145 |
+
self.objects.append(object)
|
| 146 |
+
|
| 147 |
+
return object
|
| 148 |
+
|
| 149 |
+
def removeObject(self, object):
|
| 150 |
+
"""
|
| 151 |
+
Removes the object from the view. If the object was attached to the app,
|
| 152 |
+
its OpenGL counterpart will be removed as well.
|
| 153 |
+
|
| 154 |
+
:param object: The object to be removed.
|
| 155 |
+
:type object: gui3d.Object
|
| 156 |
+
"""
|
| 157 |
+
if object not in self.objects:
|
| 158 |
+
raise RuntimeError("The object is not a child of this view")
|
| 159 |
+
|
| 160 |
+
object._view = None
|
| 161 |
+
if self._attached:
|
| 162 |
+
object._detach()
|
| 163 |
+
|
| 164 |
+
self.objects.remove(object)
|
| 165 |
+
|
| 166 |
+
def show(self):
|
| 167 |
+
self._visible = True
|
| 168 |
+
self._updateVisibility()
|
| 169 |
+
|
| 170 |
+
def hide(self):
|
| 171 |
+
self._visible = False
|
| 172 |
+
self._updateVisibility()
|
| 173 |
+
|
| 174 |
+
def isShown(self):
|
| 175 |
+
return self._visible
|
| 176 |
+
|
| 177 |
+
def isVisible(self):
|
| 178 |
+
return self._totalVisibility
|
| 179 |
+
|
| 180 |
+
def _updateVisibility(self):
|
| 181 |
+
previousVisibility = self._totalVisibility
|
| 182 |
+
|
| 183 |
+
self._totalVisibility = self._visible and (not self.parent or self.parent.isVisible())
|
| 184 |
+
|
| 185 |
+
for o in self.objects:
|
| 186 |
+
o.setVisibility(self._totalVisibility)
|
| 187 |
+
|
| 188 |
+
for v in self.children:
|
| 189 |
+
v._updateVisibility()
|
| 190 |
+
|
| 191 |
+
if self._totalVisibility != previousVisibility:
|
| 192 |
+
if self._totalVisibility:
|
| 193 |
+
self.callEvent("onShow", None)
|
| 194 |
+
else:
|
| 195 |
+
self.callEvent("onHide", None)
|
| 196 |
+
|
| 197 |
+
def onShow(self, event):
|
| 198 |
+
self.show()
|
| 199 |
+
|
| 200 |
+
def onHide(self, event):
|
| 201 |
+
self.hide()
|
| 202 |
+
|
| 203 |
+
def onMouseDown(self, event):
|
| 204 |
+
self.parent.callEvent("onMouseDown", event)
|
| 205 |
+
|
| 206 |
+
def onMouseMoved(self, event):
|
| 207 |
+
self.parent.callEvent("onMouseMoved", event)
|
| 208 |
+
|
| 209 |
+
def onMouseDragged(self, event):
|
| 210 |
+
self.parent.callEvent("onMouseDragged", event)
|
| 211 |
+
|
| 212 |
+
def onMouseUp(self, event):
|
| 213 |
+
self.parent.callEvent("onMouseUp", event)
|
| 214 |
+
|
| 215 |
+
def onMouseEntered(self, event):
|
| 216 |
+
self.parent.callEvent("onMouseEntered", event)
|
| 217 |
+
|
| 218 |
+
def onMouseExited(self, event):
|
| 219 |
+
self.parent.callEvent("onMouseExited", event)
|
| 220 |
+
|
| 221 |
+
def onClicked(self, event):
|
| 222 |
+
self.parent.callEvent("onClicked", event)
|
| 223 |
+
|
| 224 |
+
def onMouseWheel(self, event):
|
| 225 |
+
self.parent.callEvent("onMouseWheel", event)
|
| 226 |
+
|
| 227 |
+
def addTopWidget(self, widget):
|
| 228 |
+
mh.addTopWidget(widget)
|
| 229 |
+
self.widgets.append(widget)
|
| 230 |
+
widget._parent = self
|
| 231 |
+
if self.isVisible():
|
| 232 |
+
widget.show()
|
| 233 |
+
else:
|
| 234 |
+
widget.hide()
|
| 235 |
+
return widget
|
| 236 |
+
|
| 237 |
+
def removeTopWidget(self, widget):
|
| 238 |
+
self.widgets.remove(widget)
|
| 239 |
+
mh.removeTopWidget(widget)
|
| 240 |
+
|
| 241 |
+
def showWidgets(self):
|
| 242 |
+
for w in self.widgets:
|
| 243 |
+
w.show()
|
| 244 |
+
|
| 245 |
+
def hideWidgets(self):
|
| 246 |
+
for w in self.widgets:
|
| 247 |
+
w.hide()
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
class TaskView(View):
|
| 251 |
+
|
| 252 |
+
def __init__(self, category, name, label=None):
|
| 253 |
+
super(TaskView, self).__init__()
|
| 254 |
+
self.name = name
|
| 255 |
+
self.category = category
|
| 256 |
+
self.label = label
|
| 257 |
+
self.focusWidget = None
|
| 258 |
+
self.tab = None
|
| 259 |
+
self.left, self.right = mh.addPanels()
|
| 260 |
+
self.sortOrder = None
|
| 261 |
+
|
| 262 |
+
def getModifiers(self):
|
| 263 |
+
return {}
|
| 264 |
+
|
| 265 |
+
def showWidgets(self):
|
| 266 |
+
super(TaskView, self).showWidgets()
|
| 267 |
+
mh.showPanels(self.left, self.right)
|
| 268 |
+
|
| 269 |
+
def addLeftWidget(self, widget):
|
| 270 |
+
return self.left.addWidget(widget)
|
| 271 |
+
|
| 272 |
+
def addRightWidget(self, widget):
|
| 273 |
+
return self.right.addWidget(widget)
|
| 274 |
+
|
| 275 |
+
def removeLeftWidget(self, widget):
|
| 276 |
+
self.left.removeWidget(widget)
|
| 277 |
+
|
| 278 |
+
def removeRightWidget(self, widget):
|
| 279 |
+
self.right.removeWidget(widget)
|
| 280 |
+
|
| 281 |
+
|
| 282 |
+
class Category(View):
|
| 283 |
+
|
| 284 |
+
def __init__(self, name, label=None):
|
| 285 |
+
super(Category, self).__init__()
|
| 286 |
+
self.name = name
|
| 287 |
+
self.label = label
|
| 288 |
+
self.tasks = []
|
| 289 |
+
self.tasksByName = {}
|
| 290 |
+
self.tab = None
|
| 291 |
+
self.tabs = None
|
| 292 |
+
self.panel = None
|
| 293 |
+
self.task = None
|
| 294 |
+
self.sortOrder = None
|
| 295 |
+
|
| 296 |
+
def _taskTab(self, task):
|
| 297 |
+
if task.tab is None:
|
| 298 |
+
task.tab = self.tabs.addTab(task.name, task.label or task.name, self.tasks.index(task))
|
| 299 |
+
|
| 300 |
+
def realize(self, app):
|
| 301 |
+
self.tasks.sort(key=lambda t: t.sortOrder)
|
| 302 |
+
for task in self.tasks:
|
| 303 |
+
self._taskTab(task)
|
| 304 |
+
|
| 305 |
+
@self.tabs.mhEvent
|
| 306 |
+
def onTabSelected(tab):
|
| 307 |
+
self.task = tab.name
|
| 308 |
+
app.switchTask(tab.name)
|
| 309 |
+
|
| 310 |
+
def addTask(self, task):
|
| 311 |
+
if task.name in self.tasksByName:
|
| 312 |
+
raise KeyError("A task with this name already exists", task.name)
|
| 313 |
+
if task.sortOrder is None:
|
| 314 |
+
orders = [t.sortOrder for t in self.tasks]
|
| 315 |
+
o = 0
|
| 316 |
+
while o in orders:
|
| 317 |
+
o = o + 1
|
| 318 |
+
task.sortOrder = o
|
| 319 |
+
|
| 320 |
+
self.tasks.append(task)
|
| 321 |
+
self.tasks.sort(key=lambda t: t.sortOrder)
|
| 322 |
+
|
| 323 |
+
self.tasksByName[task.name] = task
|
| 324 |
+
self.addView(task)
|
| 325 |
+
if self.tabs is not None:
|
| 326 |
+
self._taskTab(task)
|
| 327 |
+
self.task = self.tasks[0].name
|
| 328 |
+
|
| 329 |
+
categories = sorted(list(self.parent.categories.values()), key=lambda c: c.sortOrder)
|
| 330 |
+
categoryOrder = categories.index(self)
|
| 331 |
+
# Ensure that event order is per category, per task
|
| 332 |
+
eventOrder = 1000 * categoryOrder + task.sortOrder
|
| 333 |
+
self.parent.addEventHandler(task, eventOrder)
|
| 334 |
+
|
| 335 |
+
return task
|
| 336 |
+
|
| 337 |
+
def getTaskByName(self, name):
|
| 338 |
+
return self.tasksByName.get(name)
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
# The application
|
| 342 |
+
app = None
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
class Application(events3d.EventHandler):
|
| 346 |
+
"""
|
| 347 |
+
The Application.
|
| 348 |
+
"""
|
| 349 |
+
|
| 350 |
+
singleton = None
|
| 351 |
+
|
| 352 |
+
def __init__(self):
|
| 353 |
+
global app
|
| 354 |
+
app = self
|
| 355 |
+
self.parent = self
|
| 356 |
+
self.children = []
|
| 357 |
+
self.objects = []
|
| 358 |
+
self.categories = {}
|
| 359 |
+
self.currentCategory = None
|
| 360 |
+
self.currentTask = None
|
| 361 |
+
self.mouseDownObject = None
|
| 362 |
+
self.enteredObject = None
|
| 363 |
+
self.fullscreen = False
|
| 364 |
+
|
| 365 |
+
self.tabs = None # Assigned in mhmain.py
|
| 366 |
+
|
| 367 |
+
def addObject(self, object):
|
| 368 |
+
"""
|
| 369 |
+
Adds the object to the application. The object will also be attached and will get an OpenGL counterpart.
|
| 370 |
+
|
| 371 |
+
:param object: The object to be added.
|
| 372 |
+
:type object: gui3d.Object
|
| 373 |
+
:return: The object, for convenience.
|
| 374 |
+
:rvalue: gui3d.Object
|
| 375 |
+
"""
|
| 376 |
+
if object._view:
|
| 377 |
+
raise RuntimeError("The object is already attached to a view")
|
| 378 |
+
|
| 379 |
+
object._view = weakref.ref(self)
|
| 380 |
+
object._attach()
|
| 381 |
+
|
| 382 |
+
self.objects.append(object)
|
| 383 |
+
|
| 384 |
+
return object
|
| 385 |
+
|
| 386 |
+
def removeObject(self, object):
|
| 387 |
+
"""
|
| 388 |
+
Removes the object from the application. Its OpenGL counterpart will be removed as well.
|
| 389 |
+
|
| 390 |
+
:param object: The object to be removed.
|
| 391 |
+
:type object: gui3d.Object
|
| 392 |
+
"""
|
| 393 |
+
if object not in self.objects:
|
| 394 |
+
raise RuntimeError("The object is not a child of this view")
|
| 395 |
+
|
| 396 |
+
object._view = None
|
| 397 |
+
object._detach()
|
| 398 |
+
|
| 399 |
+
self.objects.remove(object)
|
| 400 |
+
|
| 401 |
+
def addView(self, view):
|
| 402 |
+
"""
|
| 403 |
+
Adds the view to the application.The view will also be attached.
|
| 404 |
+
|
| 405 |
+
:param view: The view to be added.
|
| 406 |
+
:type view: gui3d.View
|
| 407 |
+
:return: The view, for convenience.
|
| 408 |
+
:rvalue: gui3d.View
|
| 409 |
+
"""
|
| 410 |
+
if view.parent:
|
| 411 |
+
raise RuntimeError("The view is already attached")
|
| 412 |
+
|
| 413 |
+
view._parent = weakref.ref(self)
|
| 414 |
+
view._updateVisibility()
|
| 415 |
+
view._attach()
|
| 416 |
+
|
| 417 |
+
self.children.append(view)
|
| 418 |
+
|
| 419 |
+
return view
|
| 420 |
+
|
| 421 |
+
def removeView(self, view):
|
| 422 |
+
"""
|
| 423 |
+
Removes the view from the application. The view will be detached.
|
| 424 |
+
|
| 425 |
+
:param view: The view to be removed.
|
| 426 |
+
:type view: gui3d.View
|
| 427 |
+
"""
|
| 428 |
+
if view not in self.children:
|
| 429 |
+
raise RuntimeError("The view is not a child of this view")
|
| 430 |
+
|
| 431 |
+
view._parent = None
|
| 432 |
+
view._detach()
|
| 433 |
+
|
| 434 |
+
self.children.remove(view)
|
| 435 |
+
|
| 436 |
+
def isVisible(self):
|
| 437 |
+
return True
|
| 438 |
+
|
| 439 |
+
def addCategory(self, category, sortOrder=None):
|
| 440 |
+
if category.name in self.categories:
|
| 441 |
+
raise KeyError("A category with this name already exists", category.name)
|
| 442 |
+
|
| 443 |
+
if category.parent:
|
| 444 |
+
raise RuntimeError("The category is already attached")
|
| 445 |
+
|
| 446 |
+
if sortOrder is None:
|
| 447 |
+
orders = [c.sortOrder for c in list(self.categories.values())]
|
| 448 |
+
o = 0
|
| 449 |
+
while o in orders:
|
| 450 |
+
o = o + 1
|
| 451 |
+
sortOrder = o
|
| 452 |
+
|
| 453 |
+
category.sortOrder = sortOrder
|
| 454 |
+
self.categories[category.name] = category
|
| 455 |
+
|
| 456 |
+
categories = list(self.categories.values())
|
| 457 |
+
categories.sort(key=lambda c: c.sortOrder)
|
| 458 |
+
|
| 459 |
+
category.tab = self.tabs.addTab(
|
| 460 |
+
category.name, category.label or category.name, categories.index(category)
|
| 461 |
+
)
|
| 462 |
+
category.tabs = category.tab.child
|
| 463 |
+
self.addView(category)
|
| 464 |
+
category.realize(self)
|
| 465 |
+
|
| 466 |
+
return category
|
| 467 |
+
|
| 468 |
+
def switchTask(self, name):
|
| 469 |
+
if not self.currentCategory:
|
| 470 |
+
return
|
| 471 |
+
newTask = self.currentCategory.tasksByName[name]
|
| 472 |
+
|
| 473 |
+
if self.currentTask and self.currentTask is newTask:
|
| 474 |
+
return
|
| 475 |
+
|
| 476 |
+
if self.currentTask:
|
| 477 |
+
log.debug("hiding task %s", self.currentTask.name)
|
| 478 |
+
self.currentTask.hide()
|
| 479 |
+
self.currentTask.hideWidgets()
|
| 480 |
+
|
| 481 |
+
self.currentTask = self.currentCategory.tasksByName[name]
|
| 482 |
+
|
| 483 |
+
if self.currentTask:
|
| 484 |
+
log.debug("showing task %s", self.currentTask.name)
|
| 485 |
+
self.currentTask.show()
|
| 486 |
+
self.currentTask.showWidgets()
|
| 487 |
+
|
| 488 |
+
def switchCategory(self, name):
|
| 489 |
+
|
| 490 |
+
# Do we need to switch at all
|
| 491 |
+
|
| 492 |
+
if self.currentCategory and self.currentCategory.name == name:
|
| 493 |
+
return
|
| 494 |
+
|
| 495 |
+
# Does the category exist
|
| 496 |
+
|
| 497 |
+
if name not in self.categories:
|
| 498 |
+
return
|
| 499 |
+
|
| 500 |
+
category = self.categories[name]
|
| 501 |
+
|
| 502 |
+
# Does the category have at least one view
|
| 503 |
+
|
| 504 |
+
if len(category.tasks) == 0:
|
| 505 |
+
return
|
| 506 |
+
|
| 507 |
+
if self.currentCategory:
|
| 508 |
+
log.debug("hiding category %s", self.currentCategory.name)
|
| 509 |
+
self.currentCategory.hide()
|
| 510 |
+
self.currentCategory.hideWidgets()
|
| 511 |
+
|
| 512 |
+
self.currentCategory = category
|
| 513 |
+
|
| 514 |
+
log.debug("showing category %s", self.currentCategory.name)
|
| 515 |
+
self.currentCategory.show()
|
| 516 |
+
self.currentCategory.showWidgets()
|
| 517 |
+
|
| 518 |
+
self.switchTask(category.task)
|
| 519 |
+
|
| 520 |
+
def getCategory(self, name, sortOrder=None):
|
| 521 |
+
category = self.categories.get(name)
|
| 522 |
+
if category:
|
| 523 |
+
return category
|
| 524 |
+
return self.addCategory(Category(name), sortOrder=sortOrder)
|
| 525 |
+
|
| 526 |
+
def getTask(self, category, task):
|
| 527 |
+
"""
|
| 528 |
+
Retrieve a task by category and name.
|
| 529 |
+
Will not create a task or category if it does not exist.
|
| 530 |
+
|
| 531 |
+
Set category to None or False to search for a task by name. Will raise
|
| 532 |
+
an exception when the result is ambiguous (there are multiple tasks with
|
| 533 |
+
the same name in different categories).
|
| 534 |
+
This quickhand is mostly useful for shell usage, but dangerous to use in
|
| 535 |
+
a plugin.
|
| 536 |
+
"""
|
| 537 |
+
if category:
|
| 538 |
+
if category not in list(self.categories.keys()):
|
| 539 |
+
raise RuntimeWarning('Category with name "%s" does not exist.' % category)
|
| 540 |
+
c = self.getCategory(category)
|
| 541 |
+
if task not in list(c.tasksByName.keys()):
|
| 542 |
+
raise RuntimeWarning(
|
| 543 |
+
'Category "%s" does not contain a task with name "%s".' % (category, task)
|
| 544 |
+
)
|
| 545 |
+
return c.getTaskByName(task)
|
| 546 |
+
else:
|
| 547 |
+
tasks = []
|
| 548 |
+
for c in list(self.categories.keys()):
|
| 549 |
+
if task in list(self.getCategory(c).tasksByName.keys()):
|
| 550 |
+
tasks.append(self.getCategory(c).tasksByName[task])
|
| 551 |
+
if len(tasks) == 0:
|
| 552 |
+
raise RuntimeWarning('No task with name "%s" found.' % task)
|
| 553 |
+
if len(tasks) > 1:
|
| 554 |
+
raise RuntimeWarning(
|
| 555 |
+
'Ambiguous result for task "%s", there are multiple tasks with that name.'
|
| 556 |
+
% task
|
| 557 |
+
)
|
| 558 |
+
return tasks[0]
|
| 559 |
+
|
| 560 |
+
# called from native
|
| 561 |
+
|
| 562 |
+
def onMouseDownCallback(self, event):
|
| 563 |
+
# Get picked object
|
| 564 |
+
pickedObject = self.getSelectedFaceGroupAndObject()
|
| 565 |
+
|
| 566 |
+
# Do not allow picking detached objects (in case of stale picking buffer)
|
| 567 |
+
if pickedObject and hasattr(pickedObject, "view") and not pickedObject.view:
|
| 568 |
+
pickedObject = None
|
| 569 |
+
|
| 570 |
+
if pickedObject:
|
| 571 |
+
object = pickedObject[1].object
|
| 572 |
+
else:
|
| 573 |
+
object = self
|
| 574 |
+
|
| 575 |
+
# It is the object which will receive the following mouse messages
|
| 576 |
+
self.mouseDownObject = object
|
| 577 |
+
|
| 578 |
+
# Send event to the object
|
| 579 |
+
if object:
|
| 580 |
+
object.callEvent("onMouseDown", event)
|
| 581 |
+
|
| 582 |
+
def onMouseUpCallback(self, event):
|
| 583 |
+
if event.button == 4 or event.button == 5:
|
| 584 |
+
return
|
| 585 |
+
|
| 586 |
+
# Get picked object
|
| 587 |
+
pickedObject = self.getSelectedFaceGroupAndObject()
|
| 588 |
+
|
| 589 |
+
# Do not allow picking detached objects (in case of stale picking buffer)
|
| 590 |
+
if pickedObject and hasattr(pickedObject, "view") and not pickedObject.view:
|
| 591 |
+
pickedObject = None
|
| 592 |
+
|
| 593 |
+
if pickedObject:
|
| 594 |
+
object = pickedObject[1].object
|
| 595 |
+
else:
|
| 596 |
+
object = self
|
| 597 |
+
|
| 598 |
+
# Clean up handles to detached (guicommon.Object) objects
|
| 599 |
+
if (
|
| 600 |
+
self.mouseDownObject
|
| 601 |
+
and hasattr(self.mouseDownObject, "view")
|
| 602 |
+
and not self.mouseDownObject.view
|
| 603 |
+
):
|
| 604 |
+
self.mouseDownObject = None
|
| 605 |
+
|
| 606 |
+
if self.mouseDownObject:
|
| 607 |
+
self.mouseDownObject.callEvent("onMouseUp", event)
|
| 608 |
+
if self.mouseDownObject is object:
|
| 609 |
+
self.mouseDownObject.callEvent("onClicked", event)
|
| 610 |
+
|
| 611 |
+
def onMouseMovedCallback(self, event):
|
| 612 |
+
# Get picked object
|
| 613 |
+
picked = self.getSelectedFaceGroupAndObject()
|
| 614 |
+
|
| 615 |
+
# Do not allow picking detached objects (in case of stale picking buffer)
|
| 616 |
+
if picked and hasattr(picked, "view") and not picked.view:
|
| 617 |
+
picked = None
|
| 618 |
+
|
| 619 |
+
if picked and picked[1]:
|
| 620 |
+
group = picked[0]
|
| 621 |
+
object = picked[1].object or self
|
| 622 |
+
else:
|
| 623 |
+
group = None
|
| 624 |
+
object = self
|
| 625 |
+
|
| 626 |
+
event.object = object
|
| 627 |
+
event.group = group
|
| 628 |
+
|
| 629 |
+
# Clean up handles to detached (guicommon.Object) objects
|
| 630 |
+
if (
|
| 631 |
+
self.mouseDownObject
|
| 632 |
+
and hasattr(self.mouseDownObject, "view")
|
| 633 |
+
and not self.mouseDownObject.view
|
| 634 |
+
):
|
| 635 |
+
self.mouseDownObject = None
|
| 636 |
+
if (
|
| 637 |
+
self.enteredObject
|
| 638 |
+
and hasattr(self.enteredObject, "view")
|
| 639 |
+
and not self.enteredObject.view
|
| 640 |
+
):
|
| 641 |
+
self.enteredObject = None
|
| 642 |
+
|
| 643 |
+
if event.button:
|
| 644 |
+
if self.mouseDownObject:
|
| 645 |
+
self.mouseDownObject.callEvent("onMouseDragged", event)
|
| 646 |
+
else:
|
| 647 |
+
if self.enteredObject != object:
|
| 648 |
+
if self.enteredObject:
|
| 649 |
+
self.enteredObject.callEvent("onMouseExited", event)
|
| 650 |
+
self.enteredObject = object
|
| 651 |
+
self.enteredObject.callEvent("onMouseEntered", event)
|
| 652 |
+
if object != self:
|
| 653 |
+
object.callEvent("onMouseMoved", event)
|
| 654 |
+
elif self.currentTask:
|
| 655 |
+
self.currentTask.callEvent("onMouseMoved", event)
|
| 656 |
+
|
| 657 |
+
def onMouseWheelCallback(self, event):
|
| 658 |
+
if self.currentTask:
|
| 659 |
+
self.currentTask.callEvent("onMouseWheel", event)
|
| 660 |
+
|
| 661 |
+
def onResizedCallback(self, event):
|
| 662 |
+
if self.fullscreen != event.fullscreen:
|
| 663 |
+
module3d.reloadTextures()
|
| 664 |
+
|
| 665 |
+
self.fullscreen = event.fullscreen
|
| 666 |
+
|
| 667 |
+
for category in list(self.categories.values()):
|
| 668 |
+
category.callEvent("onResized", event)
|
| 669 |
+
for task in category.tasks:
|
| 670 |
+
task.callEvent("onResized", event)
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/gui/core/guicommon.py
ADDED
|
@@ -0,0 +1,860 @@
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
|
| 4 |
+
"""
|
| 5 |
+
**Project Name:** MakeHuman
|
| 6 |
+
|
| 7 |
+
**Product Home Page:** http://www.makehumancommunity.org/
|
| 8 |
+
|
| 9 |
+
**Github Code Home Page:** https://github.com/makehumancommunity/
|
| 10 |
+
|
| 11 |
+
**Authors:** Joel Palmius, Marc Flerackers
|
| 12 |
+
|
| 13 |
+
**Copyright(c):** MakeHuman Team 2001-2020
|
| 14 |
+
|
| 15 |
+
**Licensing:** AGPL3
|
| 16 |
+
|
| 17 |
+
This file is part of MakeHuman Community (www.makehumancommunity.org).
|
| 18 |
+
|
| 19 |
+
This program is free software: you can redistribute it and/or modify
|
| 20 |
+
it under the terms of the GNU Affero General Public License as
|
| 21 |
+
published by the Free Software Foundation, either version 3 of the
|
| 22 |
+
License, or (at your option) any later version.
|
| 23 |
+
|
| 24 |
+
This program is distributed in the hope that it will be useful,
|
| 25 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 26 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 27 |
+
GNU Affero General Public License for more details.
|
| 28 |
+
|
| 29 |
+
You should have received a copy of the GNU Affero General Public License
|
| 30 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
Abstract
|
| 34 |
+
--------
|
| 35 |
+
|
| 36 |
+
Common GUI elements extracted from gui3d to minimize coupling with gui backend.
|
| 37 |
+
"""
|
| 38 |
+
|
| 39 |
+
import collections
|
| 40 |
+
|
| 41 |
+
import events3d
|
| 42 |
+
import library.log as log
|
| 43 |
+
import library.matrix as matrix
|
| 44 |
+
import numpy as np
|
| 45 |
+
import shared.material as material
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
class Action(object):
|
| 49 |
+
def __init__(self, name):
|
| 50 |
+
self.name = name
|
| 51 |
+
|
| 52 |
+
def do(self):
|
| 53 |
+
return True
|
| 54 |
+
|
| 55 |
+
def undo(self):
|
| 56 |
+
return True
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
# Wrapper around Object3D
|
| 60 |
+
class Object(events3d.EventHandler):
|
| 61 |
+
"""
|
| 62 |
+
An object on the screen.
|
| 63 |
+
|
| 64 |
+
:param position: The position in 3d space.
|
| 65 |
+
:type position: list or tuple
|
| 66 |
+
:param mesh: The mesh object.
|
| 67 |
+
:param visible: Wether the object should be initially visible.
|
| 68 |
+
:type visible: Boolean
|
| 69 |
+
"""
|
| 70 |
+
|
| 71 |
+
def __init__(self, mesh, position=[0.0, 0.0, 0.0], visible=True):
|
| 72 |
+
|
| 73 |
+
if mesh.object:
|
| 74 |
+
raise RuntimeError("This mesh is already attached to an object")
|
| 75 |
+
|
| 76 |
+
self.mesh = mesh
|
| 77 |
+
self.mesh.object = self
|
| 78 |
+
self.mesh.setVisibility(visible)
|
| 79 |
+
|
| 80 |
+
self._material = material.Material(self.name + "_Material") # Render material
|
| 81 |
+
|
| 82 |
+
self._loc = np.zeros(3, dtype=np.float32)
|
| 83 |
+
self._rot = np.zeros(3, dtype=np.float32)
|
| 84 |
+
self._scale = np.ones(3, dtype=np.float32)
|
| 85 |
+
|
| 86 |
+
self.setLoc(*position)
|
| 87 |
+
# Set to true to make the rotation of this object independent of the camera rotation
|
| 88 |
+
self.lockRotation = False
|
| 89 |
+
# Set to true to automatically set Y loc (position) to height of ground helper joint of the human
|
| 90 |
+
self.placeAtFeet = False
|
| 91 |
+
|
| 92 |
+
self._view = None
|
| 93 |
+
|
| 94 |
+
self.visible = visible
|
| 95 |
+
self.excludeFromProduction = False # Set to true to exclude from production renders
|
| 96 |
+
|
| 97 |
+
self.proxy = None
|
| 98 |
+
|
| 99 |
+
self.__seedMesh = self.mesh
|
| 100 |
+
self.__proxyMesh = None
|
| 101 |
+
self.__subdivisionMesh = None
|
| 102 |
+
self.__proxySubdivisionMesh = None
|
| 103 |
+
|
| 104 |
+
self.setUVMap(mesh.material.uvMap)
|
| 105 |
+
|
| 106 |
+
def __str__(self):
|
| 107 |
+
return "<guicommon.Object %s>" % self.name
|
| 108 |
+
|
| 109 |
+
# TODO
|
| 110 |
+
def clone(self):
|
| 111 |
+
raise NotImplementedError("You probably want to do object.mesh.clone()")
|
| 112 |
+
|
| 113 |
+
def _attach(self):
|
| 114 |
+
if self.view.isVisible() and self.visible:
|
| 115 |
+
self.mesh.setVisibility(1)
|
| 116 |
+
else:
|
| 117 |
+
self.mesh.setVisibility(0)
|
| 118 |
+
|
| 119 |
+
for mesh in self._meshes():
|
| 120 |
+
self.attachMesh(mesh)
|
| 121 |
+
|
| 122 |
+
def _detach(self):
|
| 123 |
+
for mesh in self._meshes():
|
| 124 |
+
self.detachMesh(mesh)
|
| 125 |
+
|
| 126 |
+
@staticmethod
|
| 127 |
+
def attachMesh(mesh):
|
| 128 |
+
import object3d
|
| 129 |
+
import selection
|
| 130 |
+
|
| 131 |
+
selection.selectionColorMap.assignSelectionID(mesh)
|
| 132 |
+
object3d.Object3D.attach(mesh)
|
| 133 |
+
|
| 134 |
+
@staticmethod
|
| 135 |
+
def detachMesh(mesh):
|
| 136 |
+
import object3d
|
| 137 |
+
|
| 138 |
+
object3d.Object3D.detach(mesh)
|
| 139 |
+
|
| 140 |
+
def _meshes(self):
|
| 141 |
+
for mesh in (
|
| 142 |
+
self.__seedMesh,
|
| 143 |
+
self.__proxyMesh,
|
| 144 |
+
self.__subdivisionMesh,
|
| 145 |
+
self.__proxySubdivisionMesh,
|
| 146 |
+
):
|
| 147 |
+
if mesh is not None:
|
| 148 |
+
yield mesh
|
| 149 |
+
|
| 150 |
+
@property
|
| 151 |
+
def view(self):
|
| 152 |
+
if not self._view or not isinstance(self._view, collections.abc.Callable):
|
| 153 |
+
return None
|
| 154 |
+
return self._view()
|
| 155 |
+
|
| 156 |
+
def show(self):
|
| 157 |
+
self.visible = True
|
| 158 |
+
self.setVisibility(True)
|
| 159 |
+
|
| 160 |
+
def hide(self):
|
| 161 |
+
self.visible = False
|
| 162 |
+
self.setVisibility(False)
|
| 163 |
+
|
| 164 |
+
def isVisible(self):
|
| 165 |
+
return self.visible
|
| 166 |
+
|
| 167 |
+
@property
|
| 168 |
+
def name(self):
|
| 169 |
+
return self.mesh.name
|
| 170 |
+
|
| 171 |
+
def setVisibility(self, visibility):
|
| 172 |
+
if not self.view:
|
| 173 |
+
self.mesh.setVisibility(0)
|
| 174 |
+
if self.view.isVisible() and self.visible and visibility:
|
| 175 |
+
self.mesh.setVisibility(1)
|
| 176 |
+
else:
|
| 177 |
+
self.mesh.setVisibility(0)
|
| 178 |
+
|
| 179 |
+
def getPriority(self):
|
| 180 |
+
return self.mesh.priority
|
| 181 |
+
|
| 182 |
+
def setPriority(self, priority):
|
| 183 |
+
self.mesh.priority = priority
|
| 184 |
+
|
| 185 |
+
priority = property(getPriority, setPriority)
|
| 186 |
+
|
| 187 |
+
##
|
| 188 |
+
# Orientation properties
|
| 189 |
+
##
|
| 190 |
+
|
| 191 |
+
def getLoc(self):
|
| 192 |
+
result = np.zeros(3, dtype=np.float32)
|
| 193 |
+
result[:] = self._loc[:]
|
| 194 |
+
if self.placeAtFeet:
|
| 195 |
+
from core import G
|
| 196 |
+
|
| 197 |
+
human = G.app.selectedHuman
|
| 198 |
+
result[1] = human.getJointPosition("ground")[1]
|
| 199 |
+
return result
|
| 200 |
+
|
| 201 |
+
def setLoc(self, locx, locy, locz):
|
| 202 |
+
"""
|
| 203 |
+
This method is used to set the location of the object in the 3D coordinate space of the scene.
|
| 204 |
+
|
| 205 |
+
:param locx: The x coordinate of the object.
|
| 206 |
+
:type locx: float
|
| 207 |
+
:param locy: The y coordinate of the object.
|
| 208 |
+
:type locy: float
|
| 209 |
+
:param locz: The z coordinate of the object.
|
| 210 |
+
:type locz: float
|
| 211 |
+
"""
|
| 212 |
+
self._loc[...] = (locx, locy, locz)
|
| 213 |
+
|
| 214 |
+
loc = property(getLoc, setLoc)
|
| 215 |
+
|
| 216 |
+
def get_x(self):
|
| 217 |
+
return self.loc[0]
|
| 218 |
+
|
| 219 |
+
def set_x(self, x):
|
| 220 |
+
self._loc[0] = x
|
| 221 |
+
|
| 222 |
+
x = property(get_x, set_x)
|
| 223 |
+
|
| 224 |
+
def get_y(self):
|
| 225 |
+
return self.loc[1]
|
| 226 |
+
|
| 227 |
+
def set_y(self, y):
|
| 228 |
+
self._loc[1] = y
|
| 229 |
+
|
| 230 |
+
y = property(get_y, set_y)
|
| 231 |
+
|
| 232 |
+
def get_z(self):
|
| 233 |
+
return self.loc[2]
|
| 234 |
+
|
| 235 |
+
def set_z(self, z):
|
| 236 |
+
self._loc[2] = z
|
| 237 |
+
|
| 238 |
+
z = property(get_z, set_z)
|
| 239 |
+
|
| 240 |
+
def get_rx(self):
|
| 241 |
+
return self._rot[0]
|
| 242 |
+
|
| 243 |
+
def set_rx(self, rx):
|
| 244 |
+
self._rot[0] = rx
|
| 245 |
+
|
| 246 |
+
rx = property(get_rx, set_rx)
|
| 247 |
+
|
| 248 |
+
def get_ry(self):
|
| 249 |
+
return self._rot[1]
|
| 250 |
+
|
| 251 |
+
def set_ry(self, ry):
|
| 252 |
+
self._rot[1] = ry
|
| 253 |
+
|
| 254 |
+
ry = property(get_ry, set_ry)
|
| 255 |
+
|
| 256 |
+
def get_rz(self):
|
| 257 |
+
return self._rot[2]
|
| 258 |
+
|
| 259 |
+
def set_rz(self, rz):
|
| 260 |
+
self._rot[2] = rz
|
| 261 |
+
|
| 262 |
+
rz = property(get_rz, set_rz)
|
| 263 |
+
|
| 264 |
+
def get_sx(self):
|
| 265 |
+
return self._scale[0]
|
| 266 |
+
|
| 267 |
+
def set_sx(self, sx):
|
| 268 |
+
self._scale[0] = sx
|
| 269 |
+
|
| 270 |
+
sx = property(get_sx, set_sx)
|
| 271 |
+
|
| 272 |
+
def get_sy(self):
|
| 273 |
+
return self._scale[1]
|
| 274 |
+
|
| 275 |
+
def set_sy(self, sy):
|
| 276 |
+
self._scale[1] = sy
|
| 277 |
+
|
| 278 |
+
sy = property(get_sy, set_sy)
|
| 279 |
+
|
| 280 |
+
def get_sz(self):
|
| 281 |
+
return self._scale[2]
|
| 282 |
+
|
| 283 |
+
def set_sz(self, sz):
|
| 284 |
+
self._scale[2] = sz
|
| 285 |
+
|
| 286 |
+
sz = property(get_sz, set_sz)
|
| 287 |
+
|
| 288 |
+
def getPosition(self):
|
| 289 |
+
return [self.x, self.y, self.z]
|
| 290 |
+
|
| 291 |
+
def setPosition(self, position):
|
| 292 |
+
self.setLoc(position[0], position[1], position[2])
|
| 293 |
+
|
| 294 |
+
def getRotation(self):
|
| 295 |
+
return [self.rx, self.ry, self.rz]
|
| 296 |
+
|
| 297 |
+
def setRotation(self, rotation):
|
| 298 |
+
rotation[0] = rotation[0] % 360
|
| 299 |
+
rotation[1] = rotation[1] % 360
|
| 300 |
+
|
| 301 |
+
if rotation[2] != 0.0:
|
| 302 |
+
log.warning("Setting a non-zero rotation around Z axis is not supported!")
|
| 303 |
+
rotation[2] = 0.0
|
| 304 |
+
|
| 305 |
+
self.setRot(rotation[0], rotation[1], rotation[2])
|
| 306 |
+
|
| 307 |
+
def setRot(self, rx, ry, rz):
|
| 308 |
+
"""
|
| 309 |
+
This method sets the orientation of the object in the 3D coordinate space of the scene.
|
| 310 |
+
|
| 311 |
+
:param rx: Rotation around the x-axis.
|
| 312 |
+
:type rx: float
|
| 313 |
+
:param ry: Rotation around the y-axis.
|
| 314 |
+
:type ry: float
|
| 315 |
+
:param rz: Rotation around the z-axis.
|
| 316 |
+
:type rz: float
|
| 317 |
+
"""
|
| 318 |
+
self._rot[...] = (rx, ry, rz)
|
| 319 |
+
|
| 320 |
+
rot = property(getRotation, setRotation)
|
| 321 |
+
|
| 322 |
+
def setScale(self, scale, scaleY=None, scaleZ=1):
|
| 323 |
+
"""
|
| 324 |
+
This method sets the scale of the object in the 3D coordinate space of
|
| 325 |
+
the scene, relative to the initially defined size of the object.
|
| 326 |
+
|
| 327 |
+
:param scale: Scale along the x-axis, uniform scale if other params not
|
| 328 |
+
specified.
|
| 329 |
+
:type scale: float
|
| 330 |
+
:param scaleY: Scale along the x-axis.
|
| 331 |
+
:type scaleY: float
|
| 332 |
+
:param scaleZ: Scale along the x-axis.
|
| 333 |
+
:type scaleZ: float
|
| 334 |
+
"""
|
| 335 |
+
if scaleY is None:
|
| 336 |
+
scaleY = scale
|
| 337 |
+
scaleZ = scale
|
| 338 |
+
self._scale[...] = (scale, scaleY, scaleZ)
|
| 339 |
+
|
| 340 |
+
def getScale(self):
|
| 341 |
+
return list(self._scale)
|
| 342 |
+
|
| 343 |
+
scale = property(getScale, setScale)
|
| 344 |
+
|
| 345 |
+
@property
|
| 346 |
+
def transform(self):
|
| 347 |
+
m = matrix.translate(self.loc)
|
| 348 |
+
if any(x != 0 for x in self.rot):
|
| 349 |
+
m = m * matrix.rotx(self.rx)
|
| 350 |
+
m = m * matrix.roty(self.ry)
|
| 351 |
+
m = m * matrix.rotz(self.rz)
|
| 352 |
+
if any(x != 1 for x in self.scale):
|
| 353 |
+
m = m * matrix.scale(self.scale)
|
| 354 |
+
return m
|
| 355 |
+
|
| 356 |
+
def getSeedMesh(self):
|
| 357 |
+
return self.__seedMesh
|
| 358 |
+
|
| 359 |
+
def getProxyMesh(self):
|
| 360 |
+
return self.__proxyMesh
|
| 361 |
+
|
| 362 |
+
def updateProxyMesh(self, fit_to_posed=False):
|
| 363 |
+
if self.proxy and self.__proxyMesh:
|
| 364 |
+
self.proxy.update(self.__proxyMesh, fit_to_posed)
|
| 365 |
+
self.__proxyMesh.update()
|
| 366 |
+
|
| 367 |
+
def isProxied(self):
|
| 368 |
+
return self.mesh == self.__proxyMesh or self.mesh == self.__proxySubdivisionMesh
|
| 369 |
+
|
| 370 |
+
def setProxy(self, proxy):
|
| 371 |
+
isSubdivided = self.isSubdivided()
|
| 372 |
+
|
| 373 |
+
if self.proxy:
|
| 374 |
+
self.proxy = None
|
| 375 |
+
self.detachMesh(self.__proxyMesh)
|
| 376 |
+
self.__proxyMesh.clear()
|
| 377 |
+
self.__proxyMesh = None
|
| 378 |
+
if self.__proxySubdivisionMesh:
|
| 379 |
+
self.detachMesh(self.__proxySubdivisionMesh)
|
| 380 |
+
self.__proxySubdivisionMesh.clear()
|
| 381 |
+
self.__proxySubdivisionMesh = None
|
| 382 |
+
self.mesh = self.__seedMesh
|
| 383 |
+
self.mesh.setVisibility(1)
|
| 384 |
+
|
| 385 |
+
if proxy:
|
| 386 |
+
|
| 387 |
+
self.proxy = proxy
|
| 388 |
+
|
| 389 |
+
self.__proxyMesh = proxy.object.mesh.clone()
|
| 390 |
+
self.__proxyMesh.object = self
|
| 391 |
+
|
| 392 |
+
# Copy attributes from human mesh to proxy mesh
|
| 393 |
+
for attr in ("visibility", "pickable", "cameraMode"):
|
| 394 |
+
setattr(self.__proxyMesh, attr, getattr(self.mesh, attr))
|
| 395 |
+
|
| 396 |
+
self.updateProxyMesh()
|
| 397 |
+
|
| 398 |
+
# Attach to GL object if this object is attached to viewport
|
| 399 |
+
if self.__seedMesh.object3d:
|
| 400 |
+
self.attachMesh(self.__proxyMesh)
|
| 401 |
+
|
| 402 |
+
self.mesh.setVisibility(0)
|
| 403 |
+
self.mesh = self.__proxyMesh
|
| 404 |
+
self.mesh.setVisibility(1)
|
| 405 |
+
|
| 406 |
+
self.setSubdivided(isSubdivided)
|
| 407 |
+
|
| 408 |
+
def getProxy(self):
|
| 409 |
+
return self.proxy
|
| 410 |
+
|
| 411 |
+
def getSubdivisionMesh(self, update=True):
|
| 412 |
+
"""
|
| 413 |
+
Create or update the Catmull-Clark subdivided (or smoothed) mesh for
|
| 414 |
+
this mesh.
|
| 415 |
+
This does not change the status of isSubdivided(), use setSubdivided()
|
| 416 |
+
for that.
|
| 417 |
+
|
| 418 |
+
If this mesh is doubled by a proxy, when isProxied() is true, a
|
| 419 |
+
subdivision mesh for the proxy is used.
|
| 420 |
+
|
| 421 |
+
Returns the subdivided mesh data.
|
| 422 |
+
|
| 423 |
+
"""
|
| 424 |
+
import catmull_clark_subdivision as cks
|
| 425 |
+
|
| 426 |
+
if self.isProxied():
|
| 427 |
+
if not self.__proxySubdivisionMesh:
|
| 428 |
+
self.__proxySubdivisionMesh = cks.createSubdivisionObject(self.__proxyMesh, None)
|
| 429 |
+
if self.__seedMesh.object3d:
|
| 430 |
+
self.attachMesh(self.__proxySubdivisionMesh)
|
| 431 |
+
elif update:
|
| 432 |
+
cks.updateSubdivisionObject(self.__proxySubdivisionMesh)
|
| 433 |
+
|
| 434 |
+
return self.__proxySubdivisionMesh
|
| 435 |
+
else:
|
| 436 |
+
if not self.__subdivisionMesh:
|
| 437 |
+
self.__subdivisionMesh = cks.createSubdivisionObject(
|
| 438 |
+
self.__seedMesh, self.staticFaceMask
|
| 439 |
+
)
|
| 440 |
+
if self.__seedMesh.object3d:
|
| 441 |
+
self.attachMesh(self.__subdivisionMesh)
|
| 442 |
+
elif update:
|
| 443 |
+
cks.updateSubdivisionObject(self.__subdivisionMesh)
|
| 444 |
+
|
| 445 |
+
return self.__subdivisionMesh
|
| 446 |
+
|
| 447 |
+
def isSubdivided(self):
|
| 448 |
+
"""
|
| 449 |
+
Returns whether this mesh is currently set to be subdivided
|
| 450 |
+
(or smoothed).
|
| 451 |
+
|
| 452 |
+
"""
|
| 453 |
+
return self.mesh == self.__subdivisionMesh or self.mesh == self.__proxySubdivisionMesh
|
| 454 |
+
|
| 455 |
+
def setSubdivided(self, flag, update=True):
|
| 456 |
+
"""
|
| 457 |
+
Set whether this mesh is to be subdivided (or smoothed).
|
| 458 |
+
When set to true, the subdivision mesh is automatically created or
|
| 459 |
+
updated.
|
| 460 |
+
|
| 461 |
+
"""
|
| 462 |
+
if flag == self.isSubdivided():
|
| 463 |
+
return False
|
| 464 |
+
|
| 465 |
+
if flag:
|
| 466 |
+
self.mesh.setVisibility(0)
|
| 467 |
+
originalMesh = self.mesh
|
| 468 |
+
self.mesh = self.getSubdivisionMesh(update)
|
| 469 |
+
self.mesh.setVisibility(1)
|
| 470 |
+
else:
|
| 471 |
+
originalMesh = (
|
| 472 |
+
self.__seedMesh if self.mesh == self.__subdivisionMesh else self.__proxyMesh
|
| 473 |
+
)
|
| 474 |
+
|
| 475 |
+
self.mesh.setVisibility(0)
|
| 476 |
+
self.mesh = originalMesh
|
| 477 |
+
if update:
|
| 478 |
+
self.mesh.calcNormals()
|
| 479 |
+
self.mesh.update()
|
| 480 |
+
self.mesh.setVisibility(1)
|
| 481 |
+
|
| 482 |
+
return True
|
| 483 |
+
|
| 484 |
+
def updateSubdivisionMesh(self, rebuildIndexBuffer=False):
|
| 485 |
+
if rebuildIndexBuffer:
|
| 486 |
+
# Purge old subdivision mesh and recalculate entirely
|
| 487 |
+
self.setSubdivided(False)
|
| 488 |
+
self.__subdivisionMesh = self.__proxySubdivisionMesh = None
|
| 489 |
+
self.setSubdivided(True)
|
| 490 |
+
else:
|
| 491 |
+
self.getSubdivisionMesh(True)
|
| 492 |
+
|
| 493 |
+
def _setMeshUVMap(self, filename, mesh):
|
| 494 |
+
if filename == self.material.uvMap:
|
| 495 |
+
# No change, do nothing
|
| 496 |
+
return
|
| 497 |
+
|
| 498 |
+
if not hasattr(mesh, "_originalUVMap") or not mesh._originalUVMap:
|
| 499 |
+
# Backup original mesh UVs
|
| 500 |
+
mesh._originalUVMap = dict()
|
| 501 |
+
mesh._originalUVMap["texco"] = mesh.texco
|
| 502 |
+
mesh._originalUVMap["fuvs"] = mesh.fuvs
|
| 503 |
+
# self._originalUVMap['fvert'] = mesh.fvert
|
| 504 |
+
# self._originalUVMap['group'] = mesh.group
|
| 505 |
+
|
| 506 |
+
faceMask = mesh.getFaceMask()
|
| 507 |
+
faceGroups = mesh.group
|
| 508 |
+
|
| 509 |
+
self.material.uvMap = filename
|
| 510 |
+
|
| 511 |
+
if not filename:
|
| 512 |
+
# Restore original UVs
|
| 513 |
+
mesh.setUVs(mesh._originalUVMap["texco"])
|
| 514 |
+
mesh.setFaces(mesh.fvert, mesh._originalUVMap["fuvs"], faceGroups)
|
| 515 |
+
mesh._originalUVMap = None
|
| 516 |
+
else:
|
| 517 |
+
uvset = material.UVMap(filename)
|
| 518 |
+
uvset.read(mesh, filename)
|
| 519 |
+
|
| 520 |
+
if len(uvset.fuvs) != len(mesh.fuvs):
|
| 521 |
+
raise NameError(
|
| 522 |
+
"The UV file %s is not valid for mesh %s. \
|
| 523 |
+
Number of faces %d != %d"
|
| 524 |
+
% (filename, mesh.name, len(uvset.fuvs), len(mesh.fuvs))
|
| 525 |
+
)
|
| 526 |
+
|
| 527 |
+
mesh.setUVs(uvset.uvs)
|
| 528 |
+
mesh.setFaces(mesh.fvert, uvset.fuvs, faceGroups)
|
| 529 |
+
|
| 530 |
+
mesh.changeFaceMask(faceMask)
|
| 531 |
+
mesh.updateIndexBuffer()
|
| 532 |
+
|
| 533 |
+
@property
|
| 534 |
+
def staticFaceMask(self):
|
| 535 |
+
if not hasattr(self, "_staticFaceMask") or self._staticFaceMask is None:
|
| 536 |
+
# If not already set, consider the current face mask state of the
|
| 537 |
+
# mesh to be the static face mask
|
| 538 |
+
self._staticFaceMask = self.__seedMesh.face_mask.copy()
|
| 539 |
+
return self._staticFaceMask
|
| 540 |
+
|
| 541 |
+
def changeVertexMask(self, vertsMask):
|
| 542 |
+
"""
|
| 543 |
+
Apply a face mask to the meshes (original seed mesh, subdivided mesh
|
| 544 |
+
and proxied meshes) specified by a vertex mask.
|
| 545 |
+
The vertex mask is a list of booleans, one for each vertex, where True
|
| 546 |
+
means not masked (visible), and False means masked (hidden).
|
| 547 |
+
A face is masked if all of the vertices that define it are masked.
|
| 548 |
+
"""
|
| 549 |
+
if vertsMask is None:
|
| 550 |
+
# Undo face mask set by vertex mask
|
| 551 |
+
self.__seedMesh.changeFaceMask(self.staticFaceMask)
|
| 552 |
+
self.__seedMesh.updateIndexBufferFaces()
|
| 553 |
+
if self.__subdivisionMesh:
|
| 554 |
+
self.__subdivisionMesh.changeFaceMask(self.staticFaceMask)
|
| 555 |
+
self.__subdivisionMesh.updateIndexBufferFaces()
|
| 556 |
+
if self.__proxyMesh:
|
| 557 |
+
self.__proxyMesh.changeFaceMask(
|
| 558 |
+
np.ones(self.__proxyMesh.getFaceCount(), dtype=bool)
|
| 559 |
+
)
|
| 560 |
+
self.__proxyMesh.updateIndexBufferFaces()
|
| 561 |
+
if self.__proxySubdivisionMesh:
|
| 562 |
+
self.__proxySubdivisionMesh.changeFaceMask(
|
| 563 |
+
np.ones(self.__proxySubdivisionMesh.getFaceCount(), dtype=bool)
|
| 564 |
+
)
|
| 565 |
+
self.__proxySubdivisionMesh.updateIndexBufferFaces()
|
| 566 |
+
return
|
| 567 |
+
|
| 568 |
+
# Mask seed mesh
|
| 569 |
+
faceMask = self.__seedMesh.getFaceMaskForVertices(np.argwhere(vertsMask)[..., 0])
|
| 570 |
+
self.__seedMesh.changeFaceMask(np.logical_and(faceMask, self.staticFaceMask))
|
| 571 |
+
self.__seedMesh.updateIndexBufferFaces()
|
| 572 |
+
|
| 573 |
+
import log
|
| 574 |
+
|
| 575 |
+
log.debug("%s faces masked for %s", np.count_nonzero(~faceMask), self.__seedMesh.name)
|
| 576 |
+
|
| 577 |
+
# Mask smoothed seed mesh
|
| 578 |
+
if self.__subdivisionMesh:
|
| 579 |
+
# Remap faceMask to subdivision mesh base faces, accounting for the
|
| 580 |
+
# excluded faces of the static facemask (staticFaceMask).
|
| 581 |
+
|
| 582 |
+
# Statically masked faces (staticFaceMask) are excluded from
|
| 583 |
+
# subdivision mesh geometry, for performance.
|
| 584 |
+
# Dynamically masked faces (eg. using this method) are not excluded
|
| 585 |
+
# from the subdivision mesh and simply masked, allowing faster
|
| 586 |
+
# changes to the face mask without requiring a rebuild of the
|
| 587 |
+
# subdivision mesh.
|
| 588 |
+
self.__subdivisionMesh.changeFaceMask(faceMask)
|
| 589 |
+
self.__subdivisionMesh.updateIndexBufferFaces()
|
| 590 |
+
|
| 591 |
+
# Mask proxy and subdivided proxy mesh
|
| 592 |
+
if self.__proxyMesh:
|
| 593 |
+
import proxy
|
| 594 |
+
|
| 595 |
+
# Transfer face mask to proxy
|
| 596 |
+
proxyVertMask = proxy.transferVertexMaskToProxy(vertsMask, self.proxy)
|
| 597 |
+
proxyFaceMask = self.__proxyMesh.getFaceMaskForVertices(
|
| 598 |
+
np.argwhere(proxyVertMask)[..., 0]
|
| 599 |
+
)
|
| 600 |
+
|
| 601 |
+
self.__proxyMesh.changeFaceMask(proxyFaceMask)
|
| 602 |
+
self.__proxyMesh.updateIndexBufferFaces()
|
| 603 |
+
|
| 604 |
+
if self.__proxySubdivisionMesh:
|
| 605 |
+
self.__proxySubdivisionMesh.changeFaceMask(proxyFaceMask)
|
| 606 |
+
self.__proxySubdivisionMesh.updateIndexBufferFaces()
|
| 607 |
+
|
| 608 |
+
##
|
| 609 |
+
# Material properties
|
| 610 |
+
##
|
| 611 |
+
|
| 612 |
+
def setTexture(self, path):
|
| 613 |
+
"""
|
| 614 |
+
This method is used to specify the path of a file on disk containing the object texture.
|
| 615 |
+
|
| 616 |
+
:param path: The path of a texture file.
|
| 617 |
+
:type path: str
|
| 618 |
+
:param cache: The texture cache to use.
|
| 619 |
+
:type cache: dict
|
| 620 |
+
"""
|
| 621 |
+
self.material.diffuseTexture = path
|
| 622 |
+
|
| 623 |
+
def getTexture(self):
|
| 624 |
+
return self.material.diffuseTexture
|
| 625 |
+
|
| 626 |
+
texture = property(getTexture, setTexture)
|
| 627 |
+
|
| 628 |
+
def clearTexture(self):
|
| 629 |
+
"""
|
| 630 |
+
This method is used to clear an object's texture.
|
| 631 |
+
"""
|
| 632 |
+
self.material.diffuseTexture = None
|
| 633 |
+
|
| 634 |
+
def hasTexture(self):
|
| 635 |
+
return self.texture is not None
|
| 636 |
+
|
| 637 |
+
def setShader(self, shader):
|
| 638 |
+
"""
|
| 639 |
+
This method is used to specify the shader.
|
| 640 |
+
|
| 641 |
+
:param shader: The path to a pair of shader files.
|
| 642 |
+
:type shader: string
|
| 643 |
+
"""
|
| 644 |
+
self.material.setShader(shader)
|
| 645 |
+
|
| 646 |
+
def getShader(self):
|
| 647 |
+
return self.material.shader
|
| 648 |
+
|
| 649 |
+
shader = property(getShader, setShader)
|
| 650 |
+
|
| 651 |
+
@property
|
| 652 |
+
def shaderObj(self):
|
| 653 |
+
return self.material.shaderObj
|
| 654 |
+
|
| 655 |
+
def configureShading(
|
| 656 |
+
self, diffuse=None, bump=None, normal=None, displacement=None, spec=None, vertexColors=None
|
| 657 |
+
):
|
| 658 |
+
"""
|
| 659 |
+
Configure shader options and set the necessary properties based on
|
| 660 |
+
the material configuration of this object.
|
| 661 |
+
This can be done without an actual shader being set for this object.
|
| 662 |
+
Call this method when changes are made to the material property.
|
| 663 |
+
"""
|
| 664 |
+
self.material.configureShading(diffuse, bump, normal, displacement, spec, vertexColors)
|
| 665 |
+
|
| 666 |
+
def getMaterial(self):
|
| 667 |
+
return self._material
|
| 668 |
+
|
| 669 |
+
def setMaterial(self, material):
|
| 670 |
+
if self.material.uvMap != material.uvMap:
|
| 671 |
+
# UV map has changed
|
| 672 |
+
self.setUVMap(material.uvMap)
|
| 673 |
+
self._material.copyFrom(material)
|
| 674 |
+
|
| 675 |
+
material = property(getMaterial, setMaterial)
|
| 676 |
+
|
| 677 |
+
def setShaderParameter(self, name, value):
|
| 678 |
+
"""
|
| 679 |
+
Updates the shader parameters.
|
| 680 |
+
"""
|
| 681 |
+
self.material.setShaderParameter(name, value)
|
| 682 |
+
|
| 683 |
+
@property
|
| 684 |
+
def shaderParameters(self):
|
| 685 |
+
return self.material.shaderParameters
|
| 686 |
+
|
| 687 |
+
@property
|
| 688 |
+
def shaderConfig(self):
|
| 689 |
+
return self.material.shaderConfig
|
| 690 |
+
|
| 691 |
+
@property
|
| 692 |
+
def shaderDefines(self):
|
| 693 |
+
return self.material.shaderDefines
|
| 694 |
+
|
| 695 |
+
def addShaderDefine(self, defineStr):
|
| 696 |
+
self.material.addShaderDefine(defineStr)
|
| 697 |
+
|
| 698 |
+
def removeShaderDefine(self, defineStr):
|
| 699 |
+
self.material.removeShaderDefine(defineStr)
|
| 700 |
+
|
| 701 |
+
def clearShaderDefines(self):
|
| 702 |
+
self.material.clearShaderDefines()
|
| 703 |
+
|
| 704 |
+
def setShadeless(self, shadeless):
|
| 705 |
+
"""
|
| 706 |
+
This method is used to specify whether or not the object is affected by lights.
|
| 707 |
+
This is used for certain GUI controls to give them a more 2D type
|
| 708 |
+
appearance (predominantly the top bar of GUI controls).
|
| 709 |
+
|
| 710 |
+
NOTE enabling this option disables the use of the shader configured in the material.
|
| 711 |
+
|
| 712 |
+
:param shadeless: Whether or not the object is unaffected by lights.
|
| 713 |
+
:type shadeless: Boolean
|
| 714 |
+
"""
|
| 715 |
+
self.material.shadeless = shadeless
|
| 716 |
+
|
| 717 |
+
def getShadeless(self):
|
| 718 |
+
return self.material.shadeless
|
| 719 |
+
|
| 720 |
+
shadeless = property(getShadeless, setShadeless)
|
| 721 |
+
|
| 722 |
+
def setDepthless(self, depthless):
|
| 723 |
+
"""
|
| 724 |
+
This method is used to specify whether or not the object occludes or is occluded
|
| 725 |
+
by other objects
|
| 726 |
+
|
| 727 |
+
:param depthless: Whether or not the object is occluded or occludes.
|
| 728 |
+
:type depthless: Boolean
|
| 729 |
+
"""
|
| 730 |
+
self.material.depthless = depthless
|
| 731 |
+
|
| 732 |
+
def getDepthless(self):
|
| 733 |
+
return self.material.depthless
|
| 734 |
+
|
| 735 |
+
depthless = property(getDepthless, setDepthless)
|
| 736 |
+
|
| 737 |
+
def setSolid(self, solid):
|
| 738 |
+
"""
|
| 739 |
+
This method is used to specify whether or not the object is drawn solid or wireframe.
|
| 740 |
+
|
| 741 |
+
:param solid: Whether or not the object is drawn solid or wireframe.
|
| 742 |
+
:type solid: Boolean
|
| 743 |
+
"""
|
| 744 |
+
self.material.wireframe = not solid
|
| 745 |
+
|
| 746 |
+
def isSolid(self):
|
| 747 |
+
return self.solid
|
| 748 |
+
|
| 749 |
+
def getSolid(self):
|
| 750 |
+
return not self.material.wireframe
|
| 751 |
+
|
| 752 |
+
solid = property(getSolid, setSolid)
|
| 753 |
+
|
| 754 |
+
def setCull(self, cull):
|
| 755 |
+
"""
|
| 756 |
+
This method is used to specify whether or not the object is back-face culled.
|
| 757 |
+
|
| 758 |
+
:param cull: Whether and how to cull
|
| 759 |
+
:type cull: 0 => no culling, >0 => draw front faces, <0 => draw back faces
|
| 760 |
+
"""
|
| 761 |
+
|
| 762 |
+
# Because we don't really need frontface culling, we simplify to only backface culling
|
| 763 |
+
if (isinstance(cull, bool) and cull) or cull > 0:
|
| 764 |
+
self.material.backfaceCull = True
|
| 765 |
+
else:
|
| 766 |
+
self.material.backfaceCull = False
|
| 767 |
+
|
| 768 |
+
def getCull(self):
|
| 769 |
+
# Because we don't really need frontface culling, we simplify to only backface culling
|
| 770 |
+
if self.material.backfaceCull:
|
| 771 |
+
return 1
|
| 772 |
+
else:
|
| 773 |
+
return 0
|
| 774 |
+
|
| 775 |
+
cull = property(getCull, setCull)
|
| 776 |
+
|
| 777 |
+
def getAlphaToCoverage(self):
|
| 778 |
+
return self.material.alphaToCoverage
|
| 779 |
+
|
| 780 |
+
def setAlphaToCoverage(self, a2cEnabled):
|
| 781 |
+
self.material.alphaToCoverage = a2cEnabled
|
| 782 |
+
|
| 783 |
+
alphaToCoverage = property(getAlphaToCoverage, setAlphaToCoverage)
|
| 784 |
+
|
| 785 |
+
def setUVMap(self, filename):
|
| 786 |
+
subdivided = self.isSubdivided()
|
| 787 |
+
|
| 788 |
+
if subdivided:
|
| 789 |
+
# Re-generate the subdivided mesh
|
| 790 |
+
self.setSubdivided(False)
|
| 791 |
+
|
| 792 |
+
# Remove stale subdivision cache if present
|
| 793 |
+
self.__subdivisionMesh = None
|
| 794 |
+
|
| 795 |
+
# Set uv map on original, unsubdivided, unproxied mesh
|
| 796 |
+
self._setMeshUVMap(filename, self.__seedMesh)
|
| 797 |
+
|
| 798 |
+
if self.isProxied():
|
| 799 |
+
# TODO transfer UV coordinates to proxy mesh
|
| 800 |
+
pass
|
| 801 |
+
|
| 802 |
+
if subdivided:
|
| 803 |
+
# Re-generate the subdivided mesh with new UV coordinates
|
| 804 |
+
self.setSubdivided(True)
|
| 805 |
+
|
| 806 |
+
def onMouseDown(self, event):
|
| 807 |
+
if self.view:
|
| 808 |
+
self.view.callEvent("onMouseDown", event)
|
| 809 |
+
else:
|
| 810 |
+
import log
|
| 811 |
+
|
| 812 |
+
log.debug("FAILED: mouseDown")
|
| 813 |
+
|
| 814 |
+
def onMouseMoved(self, event):
|
| 815 |
+
if self.view:
|
| 816 |
+
self.view.callEvent("onMouseMoved", event)
|
| 817 |
+
else:
|
| 818 |
+
import log
|
| 819 |
+
|
| 820 |
+
log.debug("FAILED: mouseMoved")
|
| 821 |
+
|
| 822 |
+
def onMouseDragged(self, event):
|
| 823 |
+
if self.view:
|
| 824 |
+
self.view.callEvent("onMouseDragged", event)
|
| 825 |
+
else:
|
| 826 |
+
import log
|
| 827 |
+
|
| 828 |
+
log.debug("FAILED: mouseDragged")
|
| 829 |
+
|
| 830 |
+
def onMouseUp(self, event):
|
| 831 |
+
if self.view:
|
| 832 |
+
self.view.callEvent("onMouseUp", event)
|
| 833 |
+
|
| 834 |
+
def onMouseEntered(self, event):
|
| 835 |
+
if self.view:
|
| 836 |
+
self.view.callEvent("onMouseEntered", event)
|
| 837 |
+
else:
|
| 838 |
+
import log
|
| 839 |
+
|
| 840 |
+
log.debug("FAILED: mouseEntered")
|
| 841 |
+
|
| 842 |
+
def onMouseExited(self, event):
|
| 843 |
+
if self.view:
|
| 844 |
+
self.view.callEvent("onMouseExited", event)
|
| 845 |
+
else:
|
| 846 |
+
import log
|
| 847 |
+
|
| 848 |
+
log.debug("FAILED: mouseExited")
|
| 849 |
+
|
| 850 |
+
def onClicked(self, event):
|
| 851 |
+
if self.view:
|
| 852 |
+
self.view.callEvent("onClicked", event)
|
| 853 |
+
else:
|
| 854 |
+
import log
|
| 855 |
+
|
| 856 |
+
log.debug("FAILED: clicked")
|
| 857 |
+
|
| 858 |
+
def onMouseWheel(self, event):
|
| 859 |
+
if self.view:
|
| 860 |
+
self.view.callEvent("onMouseWheel", event)
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/gui/core/module3d.py
ADDED
|
@@ -0,0 +1,1307 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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** https://github.com/makehumancommunity/
|
| 10 |
+
|
| 11 |
+
**Authors:** Marc Flerackers, Glynn Clements, Jonas Hauquier
|
| 12 |
+
|
| 13 |
+
**Copyright(c):** MakeHuman Team 2001-2020
|
| 14 |
+
|
| 15 |
+
**Licensing:** AGPL3
|
| 16 |
+
|
| 17 |
+
This file is part of MakeHuman Community (www.makehumancommunity.org).
|
| 18 |
+
|
| 19 |
+
This program is free software: you can redistribute it and/or modify
|
| 20 |
+
it under the terms of the GNU Affero General Public License as
|
| 21 |
+
published by the Free Software Foundation, either version 3 of the
|
| 22 |
+
License, or (at your option) any later version.
|
| 23 |
+
|
| 24 |
+
This program is distributed in the hope that it will be useful,
|
| 25 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 26 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 27 |
+
GNU Affero General Public License for more details.
|
| 28 |
+
|
| 29 |
+
You should have received a copy of the GNU Affero General Public License
|
| 30 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
Abstract
|
| 34 |
+
--------
|
| 35 |
+
|
| 36 |
+
TODO
|
| 37 |
+
"""
|
| 38 |
+
|
| 39 |
+
import weakref
|
| 40 |
+
|
| 41 |
+
# import material
|
| 42 |
+
import library.log as log
|
| 43 |
+
import numpy as np
|
| 44 |
+
|
| 45 |
+
# import unique # Bugfix for numpy.unique on older numpy versions
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
class FaceGroup(object):
|
| 49 |
+
"""
|
| 50 |
+
A FaceGroup (a group of faces with a unique name).
|
| 51 |
+
|
| 52 |
+
Each Face object can be part of one FaceGroup. Each face object has an
|
| 53 |
+
attribute, *group*, storing the FaceGroup it is a member of.
|
| 54 |
+
|
| 55 |
+
The FaceGroup object contains a list of the faces in the group and must be
|
| 56 |
+
kept in sync with the FaceGroup references stored by the individual faces.
|
| 57 |
+
|
| 58 |
+
.. py:attribute:: name
|
| 59 |
+
|
| 60 |
+
The name. str
|
| 61 |
+
|
| 62 |
+
.. py:attribute:: parent
|
| 63 |
+
|
| 64 |
+
The parent. :py:class:`module3d.Object3D`
|
| 65 |
+
|
| 66 |
+
:param name: The name of the group.
|
| 67 |
+
:type name: str
|
| 68 |
+
"""
|
| 69 |
+
|
| 70 |
+
black = np.zeros(3, dtype=np.uint8)
|
| 71 |
+
|
| 72 |
+
def __init__(self, object, name, idx):
|
| 73 |
+
self.object = object
|
| 74 |
+
self.name = name
|
| 75 |
+
self.idx = idx
|
| 76 |
+
self.color = None
|
| 77 |
+
self.colorID = self.black.copy()
|
| 78 |
+
|
| 79 |
+
def __str__(self):
|
| 80 |
+
"""
|
| 81 |
+
This method returns a string containing the name of the FaceGroup. This
|
| 82 |
+
method is called when the object is passed to the 'print' function.
|
| 83 |
+
|
| 84 |
+
**Parameters:** This method has no parameters.
|
| 85 |
+
|
| 86 |
+
"""
|
| 87 |
+
return "facegroup %s" % self.name
|
| 88 |
+
|
| 89 |
+
def setColor(self, rgba):
|
| 90 |
+
self.color = np.asarray(rgba, dtype=np.uint8)
|
| 91 |
+
|
| 92 |
+
def getObject(self):
|
| 93 |
+
if self.__object:
|
| 94 |
+
return self.__object()
|
| 95 |
+
else:
|
| 96 |
+
return None
|
| 97 |
+
|
| 98 |
+
def setObject(self, value):
|
| 99 |
+
if value is None:
|
| 100 |
+
self.__object = None
|
| 101 |
+
else:
|
| 102 |
+
# Ensure link to gui3d.object is weak to avoid circular references (which break garbage collection)
|
| 103 |
+
self.__object = weakref.ref(value)
|
| 104 |
+
|
| 105 |
+
object = property(getObject, setObject)
|
| 106 |
+
|
| 107 |
+
@property
|
| 108 |
+
def parent(self):
|
| 109 |
+
return self.object
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
class Object3D(object):
|
| 113 |
+
def __init__(self, objName, vertsPerPrimitive=4):
|
| 114 |
+
self.clear()
|
| 115 |
+
|
| 116 |
+
self.name = objName
|
| 117 |
+
self.vertsPerPrimitive = vertsPerPrimitive
|
| 118 |
+
self._faceGroups = []
|
| 119 |
+
self._groups_rev = {}
|
| 120 |
+
self.cameraMode = 0
|
| 121 |
+
self._visibility = True
|
| 122 |
+
self.pickable = False
|
| 123 |
+
self.calculateTangents = True # TODO disable when not needed by shader
|
| 124 |
+
self.object3d = None
|
| 125 |
+
self._priority = 0
|
| 126 |
+
self.MAX_FACES = 8
|
| 127 |
+
|
| 128 |
+
# Cache used for retrieving vertex colors multiplied with material diffuse color
|
| 129 |
+
self._old_diff = None
|
| 130 |
+
self._r_color_diff = None
|
| 131 |
+
|
| 132 |
+
self.__object = None
|
| 133 |
+
|
| 134 |
+
def clone(
|
| 135 |
+
self, scale=1.0, filterMaskedVerts=False
|
| 136 |
+
): # TODO it's also possible to add offset to the parameters
|
| 137 |
+
"""
|
| 138 |
+
Create a clone of this mesh, with adapted scale.
|
| 139 |
+
If filterVerts is True, all vertices that are not required (do not
|
| 140 |
+
belong to any visible face) are removed and vertex mapping is added to
|
| 141 |
+
cloned object (see filterMaskedVerts()). For a face mapping, the
|
| 142 |
+
facemask of the original mesh can be used.
|
| 143 |
+
|
| 144 |
+
By default cloning a mesh links it to the object of its parent, remove
|
| 145 |
+
the link by setting other.object to None before attaching it to a new
|
| 146 |
+
object.
|
| 147 |
+
"""
|
| 148 |
+
if self.getFaceCount(excludeMaskedFaces=filterMaskedVerts) == 0:
|
| 149 |
+
raise RuntimeError(
|
| 150 |
+
"Error cloning mesh %s. Cannot clone a mesh with 0 (unmasked) faces!", self.name
|
| 151 |
+
)
|
| 152 |
+
|
| 153 |
+
other = type(self)(self.name, self.vertsPerPrimitive)
|
| 154 |
+
|
| 155 |
+
for prop in [
|
| 156 |
+
"cameraMode",
|
| 157 |
+
"visibility",
|
| 158 |
+
"pickable",
|
| 159 |
+
"calculateTangents",
|
| 160 |
+
"priority",
|
| 161 |
+
"MAX_FACES",
|
| 162 |
+
"object",
|
| 163 |
+
]:
|
| 164 |
+
setattr(other, prop, getattr(self, prop))
|
| 165 |
+
|
| 166 |
+
for fg in self.faceGroups:
|
| 167 |
+
ofg = other.createFaceGroup(fg.name)
|
| 168 |
+
if fg.color is not None:
|
| 169 |
+
ofg.color = fg.color.copy()
|
| 170 |
+
else:
|
| 171 |
+
ofg.color = fg.color
|
| 172 |
+
|
| 173 |
+
if filterMaskedVerts:
|
| 174 |
+
self.filterMaskedVerts(other, update=False)
|
| 175 |
+
if scale != 1:
|
| 176 |
+
other.coord = scale * other.coord
|
| 177 |
+
else:
|
| 178 |
+
other.setCoords(scale * self.coord)
|
| 179 |
+
other.setColor(self.color.copy())
|
| 180 |
+
other.setUVs(self.texco.copy())
|
| 181 |
+
other.setFaces(self.fvert.copy(), self.fuvs.copy(), self.group.copy())
|
| 182 |
+
other.changeFaceMask(self.face_mask.copy())
|
| 183 |
+
|
| 184 |
+
other.calcNormals()
|
| 185 |
+
other.updateIndexBuffer()
|
| 186 |
+
|
| 187 |
+
return other
|
| 188 |
+
|
| 189 |
+
def transformed(self, transform_mat, filterMaskedVerts=False):
|
| 190 |
+
"""Create a clone of this mesh with its coordinates transformed
|
| 191 |
+
with the specified transformation matrix. filterMaskedVerts works the
|
| 192 |
+
same is for clone()
|
| 193 |
+
"""
|
| 194 |
+
if transform_mat.shape == (4, 4):
|
| 195 |
+
translation = transform_mat[:3, 3]
|
| 196 |
+
transform_mat = transform_mat[:3, :3]
|
| 197 |
+
else:
|
| 198 |
+
translation = np.zeros(3, dtype=np.float32)
|
| 199 |
+
|
| 200 |
+
result = self.clone(filterMaskedVerts=filterMaskedVerts)
|
| 201 |
+
|
| 202 |
+
coords = np.dot(transform_mat, result.getCoords().T).T
|
| 203 |
+
coords += translation
|
| 204 |
+
result.changeCoords(coords)
|
| 205 |
+
result.calcNormals()
|
| 206 |
+
result.update()
|
| 207 |
+
return result
|
| 208 |
+
|
| 209 |
+
@property
|
| 210 |
+
def parent_map(self):
|
| 211 |
+
"""
|
| 212 |
+
Maps vertex indices from this mesh to its original parent mesh
|
| 213 |
+
(self.parent). This happens recursively to the topmost parent.
|
| 214 |
+
|
| 215 |
+
Forward vertex mapping (self -> self.parent):
|
| 216 |
+
parent_map[idx] = mIdx: self.coord[idx] -> self.parent.coord[mIdx]
|
| 217 |
+
|
| 218 |
+
Will return a (n, self.MAX_FACES) array if this chain of meshes
|
| 219 |
+
contains a subdivided mesh.
|
| 220 |
+
|
| 221 |
+
Note that vertex maps only support one subdivision in a chain of mesh
|
| 222 |
+
to parent meshes.
|
| 223 |
+
"""
|
| 224 |
+
if not hasattr(self, "parent") or not self.parent:
|
| 225 |
+
return None
|
| 226 |
+
|
| 227 |
+
if not hasattr(self, "_parent_map"):
|
| 228 |
+
mapping = np.arange(self.getVertexCount(), dtype=np.uint32)
|
| 229 |
+
else:
|
| 230 |
+
mapping = self._parent_map
|
| 231 |
+
|
| 232 |
+
# Traverse to parent
|
| 233 |
+
pmap = self.parent.parent_map
|
| 234 |
+
if pmap is None:
|
| 235 |
+
return mapping
|
| 236 |
+
else:
|
| 237 |
+
# Combine mappings to topmost parent
|
| 238 |
+
return pmap[mapping]
|
| 239 |
+
|
| 240 |
+
@property
|
| 241 |
+
def parent_map_weights(self):
|
| 242 |
+
return np.ones(self.getVertexCount(), dtype=np.float32)
|
| 243 |
+
|
| 244 |
+
@property
|
| 245 |
+
def inverse_parent_map(self):
|
| 246 |
+
"""
|
| 247 |
+
Maps vertex indices from original parent mesh (self.parent) to
|
| 248 |
+
this mesh (-1 if vertex is removed in this mesh).
|
| 249 |
+
This happens recursively to the topmost parent.
|
| 250 |
+
|
| 251 |
+
Reverse vertex mapping:
|
| 252 |
+
inverse_parent_map[idx] = mIdx: self.parent.coord[idx] -> self.coord[mIdx]
|
| 253 |
+
|
| 254 |
+
Will return a (n, 1+self.MAX_FACES*2) array if this chain of meshes
|
| 255 |
+
contains a subdivided mesh.
|
| 256 |
+
|
| 257 |
+
Note that vertex maps only support one subdivision in a chain of mesh
|
| 258 |
+
to parent meshes.
|
| 259 |
+
"""
|
| 260 |
+
# TODO will require nxn matrix if subdivided (catmull-clark module)
|
| 261 |
+
|
| 262 |
+
if not hasattr(self, "parent") or not self.parent:
|
| 263 |
+
return None
|
| 264 |
+
|
| 265 |
+
if not hasattr(self, "_inverse_parent_map"):
|
| 266 |
+
mapping = np.arange(self.parent.getVertexCount(), dtype=np.int32)
|
| 267 |
+
else:
|
| 268 |
+
mapping = self._inverse_parent_map
|
| 269 |
+
|
| 270 |
+
# Traverse to parent
|
| 271 |
+
pmap = self.parent.inverse_parent_map
|
| 272 |
+
if pmap is None:
|
| 273 |
+
return mapping
|
| 274 |
+
else:
|
| 275 |
+
# Combine mappings to topmost parent
|
| 276 |
+
if len(mapping.shape) > 1:
|
| 277 |
+
shape = (len(pmap), mapping.shape[1])
|
| 278 |
+
else:
|
| 279 |
+
shape = len(pmap)
|
| 280 |
+
result = -np.ones(shape, dtype=np.int32)
|
| 281 |
+
idx = np.where(pmap > -1)
|
| 282 |
+
result[idx] = mapping[pmap[idx]]
|
| 283 |
+
return result
|
| 284 |
+
|
| 285 |
+
def filterMaskedVerts(self, other, update=True):
|
| 286 |
+
"""
|
| 287 |
+
Set the vertices, faces and vertex attributes of other object to the
|
| 288 |
+
vertices and faces of this mesh object, with the hidden faces and
|
| 289 |
+
vertices filtered out.
|
| 290 |
+
|
| 291 |
+
The other mesh contains a parent_map which maps vertex indices from
|
| 292 |
+
the other to its original mesh and inverse_parent_map which maps vertex
|
| 293 |
+
indexes from original to other (-1 if removed).
|
| 294 |
+
|
| 295 |
+
other.parent is set to the original mesh.
|
| 296 |
+
"""
|
| 297 |
+
# TODO or build a chain of parents?
|
| 298 |
+
if hasattr(self, "parent") and self.parent:
|
| 299 |
+
other.parent = self.parent
|
| 300 |
+
else:
|
| 301 |
+
other.parent = self
|
| 302 |
+
|
| 303 |
+
# Forward vertex mapping:
|
| 304 |
+
# _parent_map[idx] = mIdx: other.coord[idx] -> self.coord[mIdx]
|
| 305 |
+
other._parent_map = np.unique(self.getVerticesForFaceMask(self.face_mask))
|
| 306 |
+
|
| 307 |
+
# Reverse vertex mapping:
|
| 308 |
+
# _inverse_parent_map[idx] = mIdx: self.coord[idx] -> other.coord[mIdx]
|
| 309 |
+
other._inverse_parent_map = -np.ones(self.getVertexCount(), dtype=np.int32)
|
| 310 |
+
other._inverse_parent_map[other.parent_map] = np.arange(
|
| 311 |
+
len(other._parent_map), dtype=np.int32
|
| 312 |
+
)
|
| 313 |
+
# other._inverse_parent_map = np.ma.masked_less(other._inverse_parent_map, 0) # TODO might be useful
|
| 314 |
+
|
| 315 |
+
other.setCoords(self.coord[other.parent_map])
|
| 316 |
+
other.setColor(self.color[other.parent_map])
|
| 317 |
+
|
| 318 |
+
# Filter out and remap masked faces
|
| 319 |
+
fvert = self.fvert[self.face_mask]
|
| 320 |
+
for i in range(self.vertsPerPrimitive):
|
| 321 |
+
fvert[:, i] = other._inverse_parent_map[fvert[:, i]]
|
| 322 |
+
|
| 323 |
+
# Filter out and remap unused UVs
|
| 324 |
+
fuvs = self.fuvs[self.face_mask]
|
| 325 |
+
uv_idx = np.unique(fuvs.reshape(-1))
|
| 326 |
+
inverse_uv_idx = -np.ones(self.texco.shape[0], dtype=np.int32)
|
| 327 |
+
inverse_uv_idx[uv_idx] = np.arange(uv_idx.shape[0], dtype=np.int32)
|
| 328 |
+
for i in range(self.vertsPerPrimitive):
|
| 329 |
+
fuvs[:, i] = inverse_uv_idx[fuvs[:, i]]
|
| 330 |
+
|
| 331 |
+
other.setUVs(self.texco[uv_idx])
|
| 332 |
+
|
| 333 |
+
other.setFaces(fvert, fuvs, self.group[self.face_mask])
|
| 334 |
+
|
| 335 |
+
if update:
|
| 336 |
+
other.calcNormals()
|
| 337 |
+
other.updateIndexBuffer()
|
| 338 |
+
|
| 339 |
+
def getCenter(self):
|
| 340 |
+
"""
|
| 341 |
+
Get center position of mesh using center of its bounding box.
|
| 342 |
+
"""
|
| 343 |
+
bBox = self.calcBBox()
|
| 344 |
+
bmin = np.asarray(bBox[0], dtype=np.float32)
|
| 345 |
+
bmax = np.asarray(bBox[1], dtype=np.float32)
|
| 346 |
+
return -(bmin + ((bmax - bmin) / 2))
|
| 347 |
+
|
| 348 |
+
def calcFaceNormals(self, ix=None):
|
| 349 |
+
"""
|
| 350 |
+
Calculate the face normals. A right-handed coordinate system is assumed,
|
| 351 |
+
which requires mesh faces to be defined with counter clock-wise vertex order.
|
| 352 |
+
Face normals are not normalized.
|
| 353 |
+
|
| 354 |
+
Faces are treated as if they were triangles (using only the 3 first verts),
|
| 355 |
+
so for quads with non co-planar points, inaccuracies may occur (even though
|
| 356 |
+
those have a high change of being corrected by neighbouring faces).
|
| 357 |
+
"""
|
| 358 |
+
# We assume counter clock-wise winding order
|
| 359 |
+
# (if your normals are inversed, you're using clock-wise winding order)
|
| 360 |
+
if ix is None:
|
| 361 |
+
ix = np.s_[:]
|
| 362 |
+
fvert = self.coord[self.fvert[ix]]
|
| 363 |
+
v1 = fvert[:, 0, :]
|
| 364 |
+
v2 = fvert[:, 1, :]
|
| 365 |
+
v3 = fvert[:, 2, :]
|
| 366 |
+
va = v1 - v2
|
| 367 |
+
vb = v2 - v3
|
| 368 |
+
self.fnorm[ix] = np.cross(va, vb)
|
| 369 |
+
|
| 370 |
+
def calcVertexNormals(self, ix=None):
|
| 371 |
+
"""
|
| 372 |
+
Calculate per-vertex normals from the face normals for smooth shading
|
| 373 |
+
the model. Requires face normals to be calculated first.
|
| 374 |
+
"""
|
| 375 |
+
self.markCoords(ix, norm=True)
|
| 376 |
+
if ix is None:
|
| 377 |
+
ix = np.s_[:]
|
| 378 |
+
|
| 379 |
+
vface = self.vface[ix]
|
| 380 |
+
norms = self.fnorm[vface]
|
| 381 |
+
norms *= np.arange(self.MAX_FACES)[None, :, None] < self.nfaces[ix][:, None, None]
|
| 382 |
+
norms = np.sum(norms, axis=1)
|
| 383 |
+
norms /= np.sqrt(np.sum(norms**2, axis=-1))[:, None]
|
| 384 |
+
self.vnorm[ix] = norms
|
| 385 |
+
|
| 386 |
+
def calcVertexTangents(self, ix=None):
|
| 387 |
+
"""
|
| 388 |
+
Calculate vertex tangents using Lengyel’s Method.
|
| 389 |
+
"""
|
| 390 |
+
if not self.has_uv:
|
| 391 |
+
return
|
| 392 |
+
self.markCoords(ix, norm=True)
|
| 393 |
+
if ix is None:
|
| 394 |
+
ix = np.s_[:]
|
| 395 |
+
xLen = self.getVertexCount()
|
| 396 |
+
f_ix = np.s_[:]
|
| 397 |
+
else:
|
| 398 |
+
xLen = len(ix)
|
| 399 |
+
f_ix = np.unique(self.vface[ix])
|
| 400 |
+
|
| 401 |
+
# This implementation is based on
|
| 402 |
+
# http://www.terathon.com/code/tangent.html
|
| 403 |
+
|
| 404 |
+
tan = np.zeros((xLen, 2, 3), dtype=np.float32)
|
| 405 |
+
|
| 406 |
+
fvert = self.coord[self.fvert[f_ix]]
|
| 407 |
+
v1 = fvert[:, 0, :]
|
| 408 |
+
v2 = fvert[:, 1, :]
|
| 409 |
+
v3 = fvert[:, 2, :]
|
| 410 |
+
|
| 411 |
+
x1 = v2[:, 0] - v1[:, 0]
|
| 412 |
+
x2 = v3[:, 0] - v1[:, 0]
|
| 413 |
+
y1 = v2[:, 1] - v1[:, 1]
|
| 414 |
+
y2 = v3[:, 1] - v1[:, 1]
|
| 415 |
+
z1 = v2[:, 2] - v1[:, 2]
|
| 416 |
+
z2 = v3[:, 2] - v1[:, 2]
|
| 417 |
+
|
| 418 |
+
fuv = self.texco[self.fuvs[f_ix]]
|
| 419 |
+
w1 = fuv[:, 0, :]
|
| 420 |
+
w2 = fuv[:, 1, :]
|
| 421 |
+
w3 = fuv[:, 2, :]
|
| 422 |
+
|
| 423 |
+
s1 = w2[:, 0] - w1[:, 0]
|
| 424 |
+
s2 = w3[:, 0] - w1[:, 0]
|
| 425 |
+
t1 = w2[:, 1] - w1[:, 1]
|
| 426 |
+
t2 = w3[:, 1] = w1[:, 1]
|
| 427 |
+
|
| 428 |
+
# Prevent NANs because of borked up UV coordinates # TODO perhaps remove this
|
| 429 |
+
s1[np.argwhere(np.equal(s1, 0.0))] = 0.0000001
|
| 430 |
+
s2[np.argwhere(np.equal(s2, 0.0))] = 0.0000001
|
| 431 |
+
t1[np.argwhere(np.equal(t1, 0.0))] = 0.0000001
|
| 432 |
+
t2[np.argwhere(np.equal(t2, 0.0))] = 0.0000001
|
| 433 |
+
|
| 434 |
+
r = np.repeat(1.0, len(s1)) / ((s1 * t2) - (s2 * t1))
|
| 435 |
+
sdir = np.zeros((self.getFaceCount(), 3), dtype=np.float32)
|
| 436 |
+
tdir = np.zeros((self.getFaceCount(), 3), dtype=np.float32)
|
| 437 |
+
sdir[f_ix] = np.column_stack(
|
| 438 |
+
[((t2 * x1) - (t1 * x2)) * r, ((t2 * y1) - (t1 * y2)) * r, ((t2 * z1) - (t1 * z2)) * r]
|
| 439 |
+
)
|
| 440 |
+
tdir[f_ix] = np.column_stack(
|
| 441 |
+
[((s1 * x2) - (s2 * x1)) * r, ((s1 * y2) - (s2 * y1)) * r, ((s1 * z2) - (s2 * z1)) * r]
|
| 442 |
+
)
|
| 443 |
+
|
| 444 |
+
tan[:, 0] = np.sum(sdir[self.vface[ix]])
|
| 445 |
+
tan[:, 1] = np.sum(tdir[self.vface[ix]])
|
| 446 |
+
|
| 447 |
+
# Gramm-Schmidt orthogonalize
|
| 448 |
+
dotP = dot_v3(self.vnorm[ix], tan[:, 0])
|
| 449 |
+
# Duplicate dot product value in 3 columns because scalar * (n x 3)
|
| 450 |
+
# does not work
|
| 451 |
+
dotP = np.tile(dotP, (3, 1)).transpose().reshape(len(tan), 3)
|
| 452 |
+
self.vtang[ix, :3] = tan[:, 0] - dotP * self.vnorm[ix]
|
| 453 |
+
# Normalize
|
| 454 |
+
self.vtang[ix, :3] /= np.sqrt(np.sum(self.vtang[ix, :3] ** 2, axis=-1))[:, None]
|
| 455 |
+
|
| 456 |
+
# Determine Handedness as w parameter
|
| 457 |
+
self.vtang[ix, 3] = 1.0
|
| 458 |
+
indx = np.argwhere(np.less(dot_v3(np.cross(self.vnorm[ix], tan[:, 0]), tan[:, 1]), 0.0))
|
| 459 |
+
self.vtang[ix, 3][indx] = -1.0
|
| 460 |
+
|
| 461 |
+
def getObject(self):
|
| 462 |
+
if self.__object:
|
| 463 |
+
return self.__object()
|
| 464 |
+
else:
|
| 465 |
+
return None
|
| 466 |
+
|
| 467 |
+
def setObject(self, value):
|
| 468 |
+
if value is None:
|
| 469 |
+
self.__object = None
|
| 470 |
+
else:
|
| 471 |
+
# Ensure link to gui3d.object is weak to avoid circular references (which break garbage collection)
|
| 472 |
+
self.__object = weakref.ref(value)
|
| 473 |
+
|
| 474 |
+
object = property(getObject, setObject)
|
| 475 |
+
|
| 476 |
+
@property
|
| 477 |
+
def faceGroups(self):
|
| 478 |
+
return iter(self._faceGroups)
|
| 479 |
+
|
| 480 |
+
@property
|
| 481 |
+
def faceGroupCount(self):
|
| 482 |
+
return len(self._faceGroups)
|
| 483 |
+
|
| 484 |
+
def clear(self):
|
| 485 |
+
"""
|
| 486 |
+
Clears both local and remote data to repurpose this object
|
| 487 |
+
"""
|
| 488 |
+
|
| 489 |
+
# Clear remote data
|
| 490 |
+
self._faceGroups = []
|
| 491 |
+
|
| 492 |
+
self._transparentPrimitives = 0
|
| 493 |
+
|
| 494 |
+
# Reference to vertex attributes (coordinate, normal, color, tang) that form the faces (idx = face idx)
|
| 495 |
+
self.fvert = []
|
| 496 |
+
# Stores the face normal of the faces (idx = face idx)
|
| 497 |
+
self.fnorm = []
|
| 498 |
+
# References to UVs at the verts of the faces (idx = face idx)
|
| 499 |
+
# (NOTE: UVs are not tied to vertex IDs, and are not necessarily
|
| 500 |
+
# uniform per vertex, like the other attributes!)
|
| 501 |
+
self.fuvs = []
|
| 502 |
+
self.group = [] # Determines facegroup per face (idx = face idx)
|
| 503 |
+
self.face_mask = [] # Determines visibility per face (idx = face idx)
|
| 504 |
+
|
| 505 |
+
self.texco = [] # UV coordinates (idx = uv idx)
|
| 506 |
+
|
| 507 |
+
self.coord = [] # Vertex coordinates (positions) (idx = vertex idx)
|
| 508 |
+
self.vnorm = [] # Vertex normals (idx = vertex idx)
|
| 509 |
+
self.vtang = [] # Vertex tangents (idx = vertex idx)
|
| 510 |
+
self.color = [] # Vertex colors (idx = vertex idx)
|
| 511 |
+
self.vface = (
|
| 512 |
+
[]
|
| 513 |
+
) # References the faces that a vertex belongs to (limited to MAX_FACES) (idx = vertex idx)
|
| 514 |
+
self.nfaces = 0 # Polycount
|
| 515 |
+
|
| 516 |
+
self.ucoor = False # Update flags for updating to OpenGL renderbuffers
|
| 517 |
+
self.unorm = False
|
| 518 |
+
self.utang = False
|
| 519 |
+
self.ucolr = False
|
| 520 |
+
self.utexc = False
|
| 521 |
+
|
| 522 |
+
self.has_uv = False
|
| 523 |
+
|
| 524 |
+
if hasattr(self, "index"):
|
| 525 |
+
del self.index
|
| 526 |
+
if hasattr(self, "grpix"):
|
| 527 |
+
del self.grpix
|
| 528 |
+
|
| 529 |
+
# Maps unwelded vertices back to original welded ones (idx = unwelded vertex idx)
|
| 530 |
+
self.vmap = None
|
| 531 |
+
# Maps unwelded vertex texture (UV) coordinates back to original ones (idx = unwelded vertex idx)
|
| 532 |
+
self.tmap = None
|
| 533 |
+
|
| 534 |
+
# Cached inverse of vmap: maps original welded vert idx (coord) to one or multiple unwelded
|
| 535 |
+
# vert idxs (r_coord)
|
| 536 |
+
self._inverse_vmap = None
|
| 537 |
+
|
| 538 |
+
# Unwelded vertex buffers used by OpenGL
|
| 539 |
+
if hasattr(self, "r_coord"):
|
| 540 |
+
del self.r_coord
|
| 541 |
+
if hasattr(self, "r_texco"):
|
| 542 |
+
del self.r_texco
|
| 543 |
+
if hasattr(self, "r_vnorm"):
|
| 544 |
+
del self.r_vnorm
|
| 545 |
+
if hasattr(self, "r_vtang"):
|
| 546 |
+
del self.r_vtang
|
| 547 |
+
if hasattr(self, "r_color"):
|
| 548 |
+
del self.r_color
|
| 549 |
+
if hasattr(self, "r_faces"):
|
| 550 |
+
del self.r_faces
|
| 551 |
+
|
| 552 |
+
def setCoords(self, coords):
|
| 553 |
+
nverts = len(coords)
|
| 554 |
+
self.coord = np.asarray(coords, dtype=np.float32)
|
| 555 |
+
self.vnorm = np.zeros((nverts, 3), dtype=np.float32)
|
| 556 |
+
self.vtang = np.zeros((nverts, 4), dtype=np.float32)
|
| 557 |
+
self.color = np.zeros((nverts, 4), dtype=np.uint8) + 255
|
| 558 |
+
self.vface = np.zeros((nverts, self.MAX_FACES), dtype=np.uint32)
|
| 559 |
+
self.nfaces = np.zeros(nverts, dtype=np.uint8)
|
| 560 |
+
|
| 561 |
+
self.orig_coord = self.coord.copy() # Keep a copy of the original coordinates
|
| 562 |
+
|
| 563 |
+
self.ucoor = True
|
| 564 |
+
self.unorm = True
|
| 565 |
+
self.utang = True
|
| 566 |
+
self.ucolr = True
|
| 567 |
+
|
| 568 |
+
self.markCoords(None, True, True, True)
|
| 569 |
+
|
| 570 |
+
def getVertexCount(self, excludeMaskedVerts=False):
|
| 571 |
+
# return len(self.vface)
|
| 572 |
+
if excludeMaskedVerts:
|
| 573 |
+
return np.count_nonzero(self.getVertexMaskForFaceMask(self.getFaceMask()))
|
| 574 |
+
return len(self.coord)
|
| 575 |
+
|
| 576 |
+
def getCoords(self, indices=None):
|
| 577 |
+
if indices is None:
|
| 578 |
+
indices = np.s_[...]
|
| 579 |
+
return self.coord[indices]
|
| 580 |
+
|
| 581 |
+
def getNormals(self, indices=None):
|
| 582 |
+
if indices is None:
|
| 583 |
+
indices = np.s_[...]
|
| 584 |
+
return self.vnorm[indices]
|
| 585 |
+
|
| 586 |
+
def markCoords(self, indices=None, coor=False, norm=False, colr=False):
|
| 587 |
+
if isinstance(indices, tuple):
|
| 588 |
+
indices = indices[0]
|
| 589 |
+
|
| 590 |
+
nverts = len(self.coord)
|
| 591 |
+
|
| 592 |
+
if coor:
|
| 593 |
+
if indices is None:
|
| 594 |
+
self.ucoor = True
|
| 595 |
+
else:
|
| 596 |
+
if self.ucoor is False:
|
| 597 |
+
self.ucoor = np.zeros(nverts, dtype=bool)
|
| 598 |
+
if self.ucoor is not True:
|
| 599 |
+
self.ucoor[indices] = True
|
| 600 |
+
|
| 601 |
+
if norm:
|
| 602 |
+
if indices is None:
|
| 603 |
+
self.unorm = self.utang = True
|
| 604 |
+
else:
|
| 605 |
+
if self.unorm is False:
|
| 606 |
+
self.unorm = self.utang = np.zeros(nverts, dtype=bool)
|
| 607 |
+
if self.unorm is not True:
|
| 608 |
+
self.unorm[indices] = True
|
| 609 |
+
self.utang[indices] = True
|
| 610 |
+
|
| 611 |
+
if colr:
|
| 612 |
+
if indices is None:
|
| 613 |
+
self.ucolr = True
|
| 614 |
+
else:
|
| 615 |
+
if self.ucolr is False:
|
| 616 |
+
self.ucolr = np.zeros(nverts, dtype=bool)
|
| 617 |
+
if self.ucolr is not True:
|
| 618 |
+
self.ucolr[indices] = True
|
| 619 |
+
|
| 620 |
+
def changeCoords(self, coords, indices=None):
|
| 621 |
+
self.markCoords(indices, coor=True)
|
| 622 |
+
|
| 623 |
+
if indices is None:
|
| 624 |
+
indices = np.s_[...]
|
| 625 |
+
self.coord[indices] = coords
|
| 626 |
+
|
| 627 |
+
def setUVs(self, uvs):
|
| 628 |
+
self.texco = np.asarray(uvs, dtype=np.float32)
|
| 629 |
+
self.utexc = True
|
| 630 |
+
|
| 631 |
+
def getUVCount(self):
|
| 632 |
+
return len(self.texco)
|
| 633 |
+
|
| 634 |
+
def getUVs(self, indices=None):
|
| 635 |
+
if indices is None:
|
| 636 |
+
indices = np.s_[...]
|
| 637 |
+
return self.texco[indices]
|
| 638 |
+
|
| 639 |
+
def markUVs(self, indices=None):
|
| 640 |
+
if isinstance(indices, tuple):
|
| 641 |
+
indices = indices[0]
|
| 642 |
+
|
| 643 |
+
ntexco = len(self.texco)
|
| 644 |
+
|
| 645 |
+
if indices is None:
|
| 646 |
+
self.utexc = True
|
| 647 |
+
else:
|
| 648 |
+
if self.utexc is False:
|
| 649 |
+
self.utexc = np.zeros(ntexco, dtype=bool)
|
| 650 |
+
if self.utexc is not True:
|
| 651 |
+
self.utexc[indices] = True
|
| 652 |
+
|
| 653 |
+
def setFaces(self, verts, uvs=None, groups=None, skipUpdate=False):
|
| 654 |
+
nfaces = len(verts)
|
| 655 |
+
|
| 656 |
+
self.fvert = np.empty((nfaces, self.vertsPerPrimitive), dtype=np.uint32)
|
| 657 |
+
self.fnorm = np.zeros((nfaces, 3), dtype=np.float32)
|
| 658 |
+
self.fuvs = np.zeros(self.fvert.shape, dtype=np.uint32)
|
| 659 |
+
self.group = np.zeros(nfaces, dtype=np.uint16)
|
| 660 |
+
self.face_mask = np.ones(nfaces, dtype=bool)
|
| 661 |
+
|
| 662 |
+
# preset number of vertices for all export formats to 4
|
| 663 |
+
self.vertsPerFaceForExport = 4
|
| 664 |
+
if nfaces != 0:
|
| 665 |
+
|
| 666 |
+
# evaluate if we have 3 or 4 vertices per face, do it here so it works for npz or obj file
|
| 667 |
+
if len(verts[0]) == 4 and verts[0][0] == verts[0][3]:
|
| 668 |
+
self.vertsPerFaceForExport = 3
|
| 669 |
+
|
| 670 |
+
self.fvert[...] = verts
|
| 671 |
+
if uvs is not None:
|
| 672 |
+
self.fuvs[...] = uvs
|
| 673 |
+
if groups is not None:
|
| 674 |
+
self.group[...] = groups
|
| 675 |
+
|
| 676 |
+
self.has_uv = uvs is not None
|
| 677 |
+
|
| 678 |
+
if not skipUpdate:
|
| 679 |
+
self._update_faces(resize=True)
|
| 680 |
+
|
| 681 |
+
def changeFaceMask(self, mask, indices=None):
|
| 682 |
+
if indices is None:
|
| 683 |
+
indices = np.s_[...]
|
| 684 |
+
self.face_mask[indices] = mask
|
| 685 |
+
|
| 686 |
+
def getFaceMask(self, indices=None):
|
| 687 |
+
if indices is None:
|
| 688 |
+
indices = np.s_[...]
|
| 689 |
+
return self.face_mask[indices]
|
| 690 |
+
|
| 691 |
+
def hasUVs(self):
|
| 692 |
+
return self.has_uv
|
| 693 |
+
|
| 694 |
+
def getFaceCount(self, excludeMaskedFaces=False):
|
| 695 |
+
if excludeMaskedFaces:
|
| 696 |
+
return np.count_nonzero(self.getFaceMask())
|
| 697 |
+
return len(self.fvert)
|
| 698 |
+
|
| 699 |
+
def getFaceVerts(self, indices=None):
|
| 700 |
+
if indices is None:
|
| 701 |
+
indices = np.s_[...]
|
| 702 |
+
return self.fvert[indices]
|
| 703 |
+
|
| 704 |
+
def getFaceUVs(self, indices=None):
|
| 705 |
+
if indices is None:
|
| 706 |
+
indices = np.s_[...]
|
| 707 |
+
return self.fuvs[indices]
|
| 708 |
+
|
| 709 |
+
@property
|
| 710 |
+
def inverse_vmap(self):
|
| 711 |
+
"""
|
| 712 |
+
The inverse of vmap: a mapping of original welded (relating to UVs)
|
| 713 |
+
vertex (coord indices) to a set of unwelded vertices that represent the
|
| 714 |
+
same coordinate (r_coord indices).
|
| 715 |
+
"""
|
| 716 |
+
if self._inverse_vmap is None:
|
| 717 |
+
# TODO this loop is quite slow and could benefit from numpy optimization
|
| 718 |
+
originalToUnweldedMap = {}
|
| 719 |
+
for unweldedIdx, originalIdx in enumerate(self.vmap):
|
| 720 |
+
if originalIdx not in originalToUnweldedMap:
|
| 721 |
+
originalToUnweldedMap[originalIdx] = []
|
| 722 |
+
originalToUnweldedMap[originalIdx].append(unweldedIdx)
|
| 723 |
+
self._inverse_vmap = originalToUnweldedMap
|
| 724 |
+
return self._inverse_vmap
|
| 725 |
+
|
| 726 |
+
def _update_faces(self, resize=False):
|
| 727 |
+
#
|
| 728 |
+
# this procedure is only called, when geometry is not taken from npz-file
|
| 729 |
+
#
|
| 730 |
+
# create an 2dim array self.vface for each vertex
|
| 731 |
+
# which contains an array of faces, where the vertex belongs to, maximum of
|
| 732 |
+
# the array inside is self.MAX_FACES
|
| 733 |
+
#
|
| 734 |
+
# use self.nfaces as counter for the inner array, it is needed afterwards
|
| 735 |
+
|
| 736 |
+
nverts = len(self.coord)
|
| 737 |
+
self.nfaces = np.zeros(nverts, dtype=np.uint8) # reset the counters to zero
|
| 738 |
+
|
| 739 |
+
for idx, vert in enumerate(self.fvert): # contains faces with vertex number
|
| 740 |
+
for i in range(
|
| 741 |
+
0, min(len(vert), self.vertsPerFaceForExport)
|
| 742 |
+
): # use minimum of attached vertices, works for less than 3 also
|
| 743 |
+
vn = vert[i] # vertex.number
|
| 744 |
+
if self.nfaces[vn] >= self.MAX_FACES:
|
| 745 |
+
log.error(
|
| 746 |
+
"Failed to index faces of mesh %s, you are probably loading a mesh "
|
| 747 |
+
"with mixed nb of verts per face (do not mix tris and quads). "
|
| 748 |
+
"Or your mesh has too many faces attached to one vertex "
|
| 749 |
+
"(the maximum is %s-poles). In the second case, either increase "
|
| 750 |
+
"MAX_FACES for this mesh, or improve the mesh topology.",
|
| 751 |
+
self.name,
|
| 752 |
+
self.MAX_FACES,
|
| 753 |
+
)
|
| 754 |
+
raise RuntimeError("Incompatible mesh topology.")
|
| 755 |
+
return
|
| 756 |
+
self.vface[vn, self.nfaces[vn]] = (
|
| 757 |
+
idx # add the index of the face to the array, row given by vn, column by counter nfaces[vn]
|
| 758 |
+
)
|
| 759 |
+
self.nfaces[vn] += 1 # now increment the counter
|
| 760 |
+
|
| 761 |
+
imax = i + 1 # just needed later not to be recalculated.
|
| 762 |
+
|
| 763 |
+
# in case this function is not called from catmull-clark function resize the self.vface to a minimum
|
| 764 |
+
if resize is True:
|
| 765 |
+
# now lets recalculate the maximum number of faces belonging to a plane
|
| 766 |
+
newmax = np.max(self.nfaces)
|
| 767 |
+
if (
|
| 768 |
+
newmax > 2
|
| 769 |
+
): # Avoid the information when function calculates internal objects not to confuse users
|
| 770 |
+
log.debug("Calculated maximum number of faces for one vertex: %d", newmax)
|
| 771 |
+
|
| 772 |
+
# unfortunately catmull-clark expects maxpoles and not maxfaces, so we need
|
| 773 |
+
# also to calculate max-poles
|
| 774 |
+
#
|
| 775 |
+
# for each vertex we have to check all attached faces, these faces are already collected in self.vface
|
| 776 |
+
# when we check all the faces we will collect the neighbors using a modulo function, the vertices are
|
| 777 |
+
# entered clockwise ... modulo allows us to use neighbor of 1 and 3 when index is 0
|
| 778 |
+
# if not already existent, the neighbors are added to an array and the maximum size of this array will
|
| 779 |
+
# be maxpole
|
| 780 |
+
|
| 781 |
+
maxpole = 0
|
| 782 |
+
for vn, row in enumerate(self.vface):
|
| 783 |
+
noticed = np.zeros(self.MAX_FACES * 4, dtype=int)
|
| 784 |
+
m = 0
|
| 785 |
+
for j in range(0, self.nfaces[vn]):
|
| 786 |
+
# collect neighbors
|
| 787 |
+
face = row[j]
|
| 788 |
+
for ix, v2 in enumerate(self.fvert[face]):
|
| 789 |
+
if v2 == vn:
|
| 790 |
+
ln = self.fvert[face][(ix - 1) % imax]
|
| 791 |
+
rn = self.fvert[face][(ix + 1) % imax]
|
| 792 |
+
if ln not in noticed:
|
| 793 |
+
noticed[m] = ln
|
| 794 |
+
m += 1
|
| 795 |
+
if rn not in noticed:
|
| 796 |
+
noticed[m] = rn
|
| 797 |
+
m += 1
|
| 798 |
+
break
|
| 799 |
+
if m > maxpole:
|
| 800 |
+
maxpole = m
|
| 801 |
+
|
| 802 |
+
if (
|
| 803 |
+
maxpole > 2
|
| 804 |
+
): # Avoid the information when function calculates internal objects not to confuse users
|
| 805 |
+
log.debug("Calculated maximum number of poles for one vertex: %d", maxpole)
|
| 806 |
+
|
| 807 |
+
if newmax < maxpole:
|
| 808 |
+
newmax = maxpole
|
| 809 |
+
|
| 810 |
+
# keep in mind that a maximum number of neighboring faces lower than 4 will crash subdiv
|
| 811 |
+
# (try to load a cube)
|
| 812 |
+
if newmax < 4:
|
| 813 |
+
newmax = 4
|
| 814 |
+
|
| 815 |
+
if newmax != self.MAX_FACES:
|
| 816 |
+
# it is different so resize vface
|
| 817 |
+
self.vface = np.delete(self.vface, np.s_[newmax::], 1)
|
| 818 |
+
self.MAX_FACES = newmax
|
| 819 |
+
|
| 820 |
+
def getVertexWeights(self, parentWeights):
|
| 821 |
+
"""
|
| 822 |
+
Map armature weights mapped to the root parent (original mesh) to this
|
| 823 |
+
child mesh. Returns parentWeights unaltered if this mesh has no parent.
|
| 824 |
+
If this is a proxy mesh, parentWeights should be the weights mapped
|
| 825 |
+
through the proxy.getVertexWeights() method first.
|
| 826 |
+
|
| 827 |
+
This particular vertex weights mapping is only used for exporting rigged
|
| 828 |
+
meshes, as in MakeHuman only unsubdivided meshes are posed, and then
|
| 829 |
+
smoothed in their posed state if required. Vertices are not removed
|
| 830 |
+
within MH when faces are hidden, either.
|
| 831 |
+
"""
|
| 832 |
+
if not hasattr(self, "parent") or not self.parent:
|
| 833 |
+
return parentWeights
|
| 834 |
+
|
| 835 |
+
vmap = self.inverse_parent_map
|
| 836 |
+
vwmap = self.parent_map_weights
|
| 837 |
+
|
| 838 |
+
from collections import OrderedDict
|
| 839 |
+
|
| 840 |
+
weights = OrderedDict()
|
| 841 |
+
for bname, (verts, wghts) in list(parentWeights.data.items()):
|
| 842 |
+
vgroup = []
|
| 843 |
+
empty = True
|
| 844 |
+
for v, wt in zip(verts, wghts):
|
| 845 |
+
mvs = vmap[v]
|
| 846 |
+
if isinstance(mvs, (int, np.int32)):
|
| 847 |
+
mvs = [mvs]
|
| 848 |
+
for mv in mvs:
|
| 849 |
+
w = vwmap[mv]
|
| 850 |
+
if mv > -1:
|
| 851 |
+
vgroup.append((mv, w * wt))
|
| 852 |
+
empty = False
|
| 853 |
+
if not empty:
|
| 854 |
+
weights[bname] = vgroup
|
| 855 |
+
|
| 856 |
+
return parentWeights.create(weights, self.getVertexCount())
|
| 857 |
+
|
| 858 |
+
def updateIndexBuffer(self):
|
| 859 |
+
self.updateIndexBufferVerts()
|
| 860 |
+
self.updateIndexBufferFaces()
|
| 861 |
+
|
| 862 |
+
def updateIndexBufferVerts(self):
|
| 863 |
+
packed = self.fvert.astype(np.uint64) << 32
|
| 864 |
+
packed |= self.fuvs
|
| 865 |
+
packed = packed.reshape(-1)
|
| 866 |
+
|
| 867 |
+
u, rev = np.unique(packed, return_inverse=True)
|
| 868 |
+
del packed
|
| 869 |
+
|
| 870 |
+
unwelded = u[:, None] >> np.array([[32, 0]], dtype=np.uint64)
|
| 871 |
+
unwelded = unwelded.astype(np.uint32)
|
| 872 |
+
nverts = len(unwelded)
|
| 873 |
+
iverts = rev.reshape(self.fvert.shape)
|
| 874 |
+
del rev, u
|
| 875 |
+
|
| 876 |
+
self.vmap = unwelded[:, 0]
|
| 877 |
+
self.tmap = unwelded[:, 1]
|
| 878 |
+
self._inverse_vmap = None
|
| 879 |
+
del unwelded
|
| 880 |
+
|
| 881 |
+
self.r_coord = np.empty((nverts, 3), dtype=np.float32)
|
| 882 |
+
self.r_texco = np.empty((nverts, 2), dtype=np.float32)
|
| 883 |
+
self.r_vnorm = np.zeros((nverts, 3), dtype=np.float32)
|
| 884 |
+
self.r_vtang = np.zeros((nverts, 4), dtype=np.float32)
|
| 885 |
+
self.r_color = np.zeros((nverts, 4), dtype=np.uint8) + 255
|
| 886 |
+
|
| 887 |
+
self.r_faces = np.array(iverts, dtype=np.uint32)
|
| 888 |
+
|
| 889 |
+
def updateIndexBufferFaces(self):
|
| 890 |
+
index = self.r_faces[self.face_mask]
|
| 891 |
+
group = self.group[self.face_mask]
|
| 892 |
+
|
| 893 |
+
if len(group) > 0:
|
| 894 |
+
order = np.argsort(group)
|
| 895 |
+
group = group[order]
|
| 896 |
+
index = index[order]
|
| 897 |
+
|
| 898 |
+
group, start = np.unique(group, return_index=True)
|
| 899 |
+
count = np.empty(len(start), dtype=np.uint32)
|
| 900 |
+
count[:-1] = start[1:] - start[:-1]
|
| 901 |
+
count[-1] = len(index) - start[-1]
|
| 902 |
+
|
| 903 |
+
grpix = np.zeros((max(self.group) + 1, 2), dtype=np.uint32)
|
| 904 |
+
grpix[group, 0] = start
|
| 905 |
+
grpix[group, 1] = count
|
| 906 |
+
else:
|
| 907 |
+
grpix = np.zeros((0, 2), dtype=np.uint32)
|
| 908 |
+
|
| 909 |
+
self.index = index
|
| 910 |
+
self.grpix = grpix
|
| 911 |
+
|
| 912 |
+
self.ucoor = True
|
| 913 |
+
self.unorm = True
|
| 914 |
+
self.utang = True
|
| 915 |
+
self.ucolr = True
|
| 916 |
+
self.utexc = True
|
| 917 |
+
self.sync_all()
|
| 918 |
+
|
| 919 |
+
def sync_coord(self):
|
| 920 |
+
if self.ucoor is False:
|
| 921 |
+
return
|
| 922 |
+
if self.vmap is None or len(self.vmap) == 0:
|
| 923 |
+
return
|
| 924 |
+
if self.ucoor is True:
|
| 925 |
+
self.r_coord[...] = self.coord[self.vmap]
|
| 926 |
+
else:
|
| 927 |
+
self.r_coord[self.ucoor[self.vmap]] = self.coord[self.vmap][self.ucoor[self.vmap]]
|
| 928 |
+
self.ucoor = False
|
| 929 |
+
|
| 930 |
+
def sync_norms(self):
|
| 931 |
+
if self.unorm is False:
|
| 932 |
+
return
|
| 933 |
+
if self.vmap is None or len(self.vmap) == 0:
|
| 934 |
+
return
|
| 935 |
+
if self.unorm is True:
|
| 936 |
+
self.r_vnorm[...] = self.vnorm[self.vmap]
|
| 937 |
+
else:
|
| 938 |
+
self.r_vnorm[self.unorm[self.vmap]] = self.vnorm[self.vmap][self.unorm[self.vmap]]
|
| 939 |
+
self.unorm = False
|
| 940 |
+
|
| 941 |
+
def sync_tangents(self):
|
| 942 |
+
if not self.has_uv:
|
| 943 |
+
return
|
| 944 |
+
if self.utang is False:
|
| 945 |
+
return
|
| 946 |
+
if self.vmap is None or len(self.vmap) == 0:
|
| 947 |
+
return
|
| 948 |
+
if self.utang is True:
|
| 949 |
+
self.r_vtang[...] = self.vtang[self.vmap]
|
| 950 |
+
else:
|
| 951 |
+
self.r_vtang[self.utang[self.vmap]] = self.vtang[self.vmap][self.utang[self.vmap]]
|
| 952 |
+
self.utang = False
|
| 953 |
+
|
| 954 |
+
def sync_color(self):
|
| 955 |
+
if self.ucolr is False:
|
| 956 |
+
return
|
| 957 |
+
if self.vmap is None or len(self.vmap) == 0:
|
| 958 |
+
return
|
| 959 |
+
if self.ucolr is True:
|
| 960 |
+
self.r_color[...] = self.color[self.vmap]
|
| 961 |
+
else:
|
| 962 |
+
self.r_color[self.ucolr[self.vmap]] = self.color[self.vmap][self.ucolr[self.vmap]]
|
| 963 |
+
self.ucolr = False
|
| 964 |
+
self._r_color_diff = None
|
| 965 |
+
|
| 966 |
+
def sync_texco(self):
|
| 967 |
+
if not self.has_uv:
|
| 968 |
+
return
|
| 969 |
+
if self.utexc is False:
|
| 970 |
+
return
|
| 971 |
+
if self.tmap is None or len(self.tmap) == 0:
|
| 972 |
+
return
|
| 973 |
+
if self.utexc is True:
|
| 974 |
+
self.r_texco[...] = self.texco[self.tmap]
|
| 975 |
+
else:
|
| 976 |
+
self.r_texco[self.utexc[self.tmap]] = self.texco[self.tmap][self.utexc[self.tmap]]
|
| 977 |
+
self.utexc = False
|
| 978 |
+
|
| 979 |
+
def sync_all(self):
|
| 980 |
+
self.sync_coord()
|
| 981 |
+
self.sync_norms()
|
| 982 |
+
if self.calculateTangents:
|
| 983 |
+
self.sync_tangents()
|
| 984 |
+
self.sync_color()
|
| 985 |
+
self.sync_texco()
|
| 986 |
+
|
| 987 |
+
def createFaceGroup(self, name):
|
| 988 |
+
"""
|
| 989 |
+
Creates a new module3d.FaceGroup with the given name.
|
| 990 |
+
|
| 991 |
+
:param name: The name for the face group.
|
| 992 |
+
:type name: [float, float, float]
|
| 993 |
+
:return: The new face group.
|
| 994 |
+
:rtype: :py:class:`module3d.FaceGroup`
|
| 995 |
+
"""
|
| 996 |
+
idx = len(self._faceGroups)
|
| 997 |
+
fg = FaceGroup(self, name, idx)
|
| 998 |
+
self._groups_rev[name] = fg
|
| 999 |
+
self._faceGroups.append(fg)
|
| 1000 |
+
return fg
|
| 1001 |
+
|
| 1002 |
+
def setColor(self, color):
|
| 1003 |
+
"""
|
| 1004 |
+
Sets the vertex colors for the entire object.
|
| 1005 |
+
|
| 1006 |
+
:param color: The color in rgba.
|
| 1007 |
+
:type color: [byte, byte, byte, byte]
|
| 1008 |
+
"""
|
| 1009 |
+
color = np.asarray(color, dtype=np.uint8)
|
| 1010 |
+
if len(color.shape) == 1: # One color for all vertices
|
| 1011 |
+
if len(color) == 3:
|
| 1012 |
+
# Add alpha component to simple RGB color
|
| 1013 |
+
color = list(color) + [255]
|
| 1014 |
+
self.color[:] = color
|
| 1015 |
+
else:
|
| 1016 |
+
self.color[...] = color[None, :]
|
| 1017 |
+
self.markCoords(colr=True)
|
| 1018 |
+
self.sync_color()
|
| 1019 |
+
|
| 1020 |
+
@property
|
| 1021 |
+
def r_color_diff(self):
|
| 1022 |
+
"""
|
| 1023 |
+
Vertex colors multiplied with the diffuse material color.
|
| 1024 |
+
"""
|
| 1025 |
+
if self._r_color_diff is None:
|
| 1026 |
+
self._r_color_diff = np.zeros(self.r_color.shape, dtype=np.uint8)
|
| 1027 |
+
self._old_diff = None
|
| 1028 |
+
|
| 1029 |
+
diff = self.material.diffuseColor.values + [self.material.opacity]
|
| 1030 |
+
if diff != self._old_diff:
|
| 1031 |
+
# Update diffuse * vertex colors
|
| 1032 |
+
self._r_color_diff[:] = diff * self.r_color
|
| 1033 |
+
self._old_diff = diff
|
| 1034 |
+
return self._r_color_diff
|
| 1035 |
+
|
| 1036 |
+
@property
|
| 1037 |
+
def visibility(self):
|
| 1038 |
+
return self._visibility
|
| 1039 |
+
|
| 1040 |
+
def setVisibility(self, visible):
|
| 1041 |
+
self.visibility = visible
|
| 1042 |
+
|
| 1043 |
+
@visibility.setter
|
| 1044 |
+
def visibility(self, visible):
|
| 1045 |
+
"""
|
| 1046 |
+
This method sets the visibility of the object.
|
| 1047 |
+
|
| 1048 |
+
:param visible: Whether or not the object is visible.
|
| 1049 |
+
:type visible: Boolean
|
| 1050 |
+
"""
|
| 1051 |
+
self._visibility = visible
|
| 1052 |
+
|
| 1053 |
+
def setPickable(self, pickable):
|
| 1054 |
+
"""
|
| 1055 |
+
This method sets the pickable flag of the object.
|
| 1056 |
+
|
| 1057 |
+
:param pickable: Whether or not the object is pickable.
|
| 1058 |
+
:type pickable: Boolean
|
| 1059 |
+
"""
|
| 1060 |
+
|
| 1061 |
+
self.pickable = pickable
|
| 1062 |
+
|
| 1063 |
+
def getPriority(self):
|
| 1064 |
+
"""
|
| 1065 |
+
The rendering priority of this object.
|
| 1066 |
+
Objects with higher priorities will be drawn later.
|
| 1067 |
+
|
| 1068 |
+
Common priorities used:
|
| 1069 |
+
file description 2D/3D priority
|
| 1070 |
+
|
| 1071 |
+
core/mhmain.py background-gradient 2D -200
|
| 1072 |
+
0_modeling_background.py background 2D -90
|
| 1073 |
+
core/mhmain.py human 3D 0
|
| 1074 |
+
3_libraries_clothes_chooser.py clothing 3D 10
|
| 1075 |
+
3_libraries_polygon_hair_chooser.py hair 3D 20
|
| 1076 |
+
2_posing_armature.py armature 3D 30
|
| 1077 |
+
0_modeling_a_measurement.py measureMesh 2D 50
|
| 1078 |
+
5_settings_censor.py censor rectangles 2D 80
|
| 1079 |
+
apps/gui/guifiles.py black frame 2D 90
|
| 1080 |
+
"""
|
| 1081 |
+
return self._priority
|
| 1082 |
+
|
| 1083 |
+
def setPriority(self, priority):
|
| 1084 |
+
"""
|
| 1085 |
+
Set the rendering priority of this object.
|
| 1086 |
+
Objects with higher priorities will be drawn later.
|
| 1087 |
+
|
| 1088 |
+
Common priorities used:
|
| 1089 |
+
file description 2D/3D priority
|
| 1090 |
+
|
| 1091 |
+
0_modeling_background.py background 2D -90
|
| 1092 |
+
core/mhmain.py human 3D 0
|
| 1093 |
+
3_libraries_clothes_chooser.py clothing 3D 10
|
| 1094 |
+
3_libraries_polygon_hair_chooser.py hair 3D 20
|
| 1095 |
+
2_posing_armature.py armature 3D 30
|
| 1096 |
+
0_modeling_a_measurement.py measureMesh 2D 50
|
| 1097 |
+
5_settings_censor.py censor rectangles 2D 80
|
| 1098 |
+
apps/gui/guifiles.py black frame 2D 90
|
| 1099 |
+
"""
|
| 1100 |
+
self._priority = priority
|
| 1101 |
+
|
| 1102 |
+
priority = property(getPriority, setPriority)
|
| 1103 |
+
|
| 1104 |
+
@property
|
| 1105 |
+
def material(self):
|
| 1106 |
+
if not self.object and hasattr(self, "parent"):
|
| 1107 |
+
return self.parent.material
|
| 1108 |
+
return self.object.material
|
| 1109 |
+
|
| 1110 |
+
def setTransparentPrimitives(self, transparentPrimitives):
|
| 1111 |
+
"""
|
| 1112 |
+
This method is used to specify the amount of transparent faces.
|
| 1113 |
+
This property is overridden if self.material.transparent is set to True.
|
| 1114 |
+
|
| 1115 |
+
:param transparentPrimitives: The amount of transparent faces.
|
| 1116 |
+
:type transparentPrimitives: int
|
| 1117 |
+
"""
|
| 1118 |
+
self._transparentPrimitives = transparentPrimitives
|
| 1119 |
+
|
| 1120 |
+
def getTransparentPrimitives(self):
|
| 1121 |
+
# Object allows transparency rendering of only a subset (starting from
|
| 1122 |
+
# the first face) of faces of the mesh, but material property transparent
|
| 1123 |
+
# set to True overrides this and makes all faces render with transparency technique
|
| 1124 |
+
if self.material.transparent:
|
| 1125 |
+
return len(self.fvert)
|
| 1126 |
+
else:
|
| 1127 |
+
return self._transparentPrimitives
|
| 1128 |
+
|
| 1129 |
+
transparentPrimitives = property(getTransparentPrimitives, setTransparentPrimitives)
|
| 1130 |
+
|
| 1131 |
+
def getFaceGroup(self, name):
|
| 1132 |
+
"""
|
| 1133 |
+
This method searches the list of FaceGroups held for this object, and
|
| 1134 |
+
returns the FaceGroup with the specified name. If no FaceGroup is found
|
| 1135 |
+
for that name, this method returns None.
|
| 1136 |
+
|
| 1137 |
+
:param name: The name of the FaceGroup to retrieve.
|
| 1138 |
+
:type name: str
|
| 1139 |
+
:return: The FaceGroup if found, None otherwise.
|
| 1140 |
+
:rtype: :py:class:`module3d.FaceGroup`
|
| 1141 |
+
"""
|
| 1142 |
+
return self._groups_rev.get(name, None)
|
| 1143 |
+
|
| 1144 |
+
def getFaceGroups(self):
|
| 1145 |
+
"""
|
| 1146 |
+
The names of the facegroups available on this mesh.
|
| 1147 |
+
"""
|
| 1148 |
+
return list(self._groups_rev.keys())
|
| 1149 |
+
|
| 1150 |
+
def getGroupMaskForGroups(self, groupNames):
|
| 1151 |
+
groups = np.zeros(len(self._faceGroups), dtype=bool)
|
| 1152 |
+
for name in groupNames:
|
| 1153 |
+
groups[self._groups_rev[name].idx] = True
|
| 1154 |
+
return groups
|
| 1155 |
+
|
| 1156 |
+
def getFaceMaskForGroups(self, groupNames):
|
| 1157 |
+
groups = self.getGroupMaskForGroups(groupNames)
|
| 1158 |
+
face_mask = groups[self.group]
|
| 1159 |
+
return face_mask
|
| 1160 |
+
|
| 1161 |
+
def getFacesForGroups(self, groupNames):
|
| 1162 |
+
face_mask = self.getFaceMaskForGroups(groupNames)
|
| 1163 |
+
faces = np.argwhere(face_mask)[..., 0]
|
| 1164 |
+
return faces
|
| 1165 |
+
|
| 1166 |
+
def getVertexMaskForGroups(self, groupNames):
|
| 1167 |
+
face_mask = self.getFaceMaskForGroups(groupNames)
|
| 1168 |
+
verts = self.fvert[face_mask]
|
| 1169 |
+
vert_mask = np.zeros(len(self.coord), dtype=bool)
|
| 1170 |
+
vert_mask[verts] = True
|
| 1171 |
+
return vert_mask
|
| 1172 |
+
|
| 1173 |
+
def getVerticesForGroups(self, groupNames):
|
| 1174 |
+
vert_mask = self.getVertexMaskForGroups(groupNames)
|
| 1175 |
+
verts = np.argwhere(vert_mask)[..., 0]
|
| 1176 |
+
return verts
|
| 1177 |
+
|
| 1178 |
+
def getVerticesForFaceMask(self, face_mask):
|
| 1179 |
+
verts = self.fvert[face_mask]
|
| 1180 |
+
verts = verts.reshape(-1)
|
| 1181 |
+
return verts
|
| 1182 |
+
|
| 1183 |
+
def getVertexMaskForFaceMask(self, face_mask):
|
| 1184 |
+
verts = self.getVerticesForFaceMask(face_mask)
|
| 1185 |
+
vert_mask = np.zeros(len(self.coord), dtype=bool)
|
| 1186 |
+
vert_mask[verts] = True
|
| 1187 |
+
return vert_mask
|
| 1188 |
+
|
| 1189 |
+
def getVertexAndFaceMasksForGroups(self, groupNames):
|
| 1190 |
+
face_mask = self.getFaceMaskForGroups(groupNames)
|
| 1191 |
+
verts = self.fvert[face_mask]
|
| 1192 |
+
vert_mask = np.zeros(len(self.coord), dtype=bool)
|
| 1193 |
+
vert_mask[verts] = True
|
| 1194 |
+
return vert_mask, face_mask
|
| 1195 |
+
|
| 1196 |
+
def getFaceMaskForVertices(self, verts):
|
| 1197 |
+
"""
|
| 1198 |
+
Get mask that selects all faces that are connected to the specified
|
| 1199 |
+
vertices.
|
| 1200 |
+
"""
|
| 1201 |
+
mask = np.zeros(len(self.fvert), dtype=bool)
|
| 1202 |
+
valid = (
|
| 1203 |
+
np.arange(self.MAX_FACES)[None, :] < self.nfaces[verts][:, None]
|
| 1204 |
+
) # Mask that filters out unused slots for faces connected to a vert
|
| 1205 |
+
vface = self.vface[verts]
|
| 1206 |
+
faces = vface[valid]
|
| 1207 |
+
mask[faces] = True
|
| 1208 |
+
return mask
|
| 1209 |
+
|
| 1210 |
+
def getFacesForVertices(self, verts):
|
| 1211 |
+
return np.argwhere(self.getFaceMaskForVertices(verts))[..., 0]
|
| 1212 |
+
|
| 1213 |
+
def setCameraProjection(self, cameraMode):
|
| 1214 |
+
"""
|
| 1215 |
+
This method sets the camera mode used to visualize this object (fixed or movable).
|
| 1216 |
+
The 3D engine has two camera modes (both perspective modes).
|
| 1217 |
+
The first is moved by the mouse, while the second is fixed.
|
| 1218 |
+
The first is generally used to model 3D objects (a human, clothes,
|
| 1219 |
+
etc.), while the second is used for 3D GUI controls.
|
| 1220 |
+
|
| 1221 |
+
:param cameraMode: The camera mode. 0 = movable camera (modelCamera);
|
| 1222 |
+
1 = static camera (guiCamera).
|
| 1223 |
+
:type cameraMode: int
|
| 1224 |
+
"""
|
| 1225 |
+
|
| 1226 |
+
self.cameraMode = cameraMode
|
| 1227 |
+
|
| 1228 |
+
def getCamera(self):
|
| 1229 |
+
"""
|
| 1230 |
+
The camera with which this mesh is rendered.
|
| 1231 |
+
"""
|
| 1232 |
+
from core import G
|
| 1233 |
+
|
| 1234 |
+
return G.cameras[self.cameraMode]
|
| 1235 |
+
|
| 1236 |
+
def update(self):
|
| 1237 |
+
"""
|
| 1238 |
+
This method is used to call the update methods on each of a list of vertices
|
| 1239 |
+
or all vertices that form part of this object. Passes the current mesh state
|
| 1240 |
+
to the OpenGL buffers.
|
| 1241 |
+
"""
|
| 1242 |
+
self.sync_all()
|
| 1243 |
+
|
| 1244 |
+
def calcNormals(
|
| 1245 |
+
self, recalcVertexNormals=1, recalcFaceNormals=1, verticesToUpdate=None, facesToUpdate=None
|
| 1246 |
+
):
|
| 1247 |
+
"""
|
| 1248 |
+
Updates the given vertex and/or face normals.
|
| 1249 |
+
|
| 1250 |
+
:param recalcVertexNormals: A flag to indicate whether or not the vertex normals should be recalculated.
|
| 1251 |
+
:type recalcVertexNormals: Boolean
|
| 1252 |
+
:param recalcFaceNormals: A flag to indicate whether or not the face normals should be recalculated.
|
| 1253 |
+
:type recalcFaceNormals: Boolean
|
| 1254 |
+
:param verticesToUpdate: The list of vertices to be updated, if None all vertices are updated.
|
| 1255 |
+
:type verticesToUpdate: list of :py:class:`module3d.Vert`
|
| 1256 |
+
:param facesToUpdate: The list of faces to be updated, if None all faces are updated.
|
| 1257 |
+
:type facesToUpdate: list of :py:class:`module3d.Face`
|
| 1258 |
+
"""
|
| 1259 |
+
|
| 1260 |
+
if recalcFaceNormals:
|
| 1261 |
+
self.calcFaceNormals(facesToUpdate)
|
| 1262 |
+
|
| 1263 |
+
if recalcVertexNormals:
|
| 1264 |
+
self.calcVertexNormals(verticesToUpdate)
|
| 1265 |
+
|
| 1266 |
+
if recalcFaceNormals or recalcVertexNormals and self.calculateTangents:
|
| 1267 |
+
self.calcVertexTangents(verticesToUpdate)
|
| 1268 |
+
|
| 1269 |
+
def calcBBox(self, ix=None, onlyVisible=True, fixedFaceMask=None):
|
| 1270 |
+
"""
|
| 1271 |
+
Calculates the axis aligned bounding box of this object in the object's coordinate system.
|
| 1272 |
+
"""
|
| 1273 |
+
# TODO maybe cache bounding box
|
| 1274 |
+
if ix is None:
|
| 1275 |
+
ix = np.s_[:]
|
| 1276 |
+
if fixedFaceMask is not None:
|
| 1277 |
+
verts = self.getVerticesForFaceMask(fixedFaceMask)
|
| 1278 |
+
coord = self.coord[verts]
|
| 1279 |
+
elif onlyVisible:
|
| 1280 |
+
verts = self.getVerticesForFaceMask(self.getFaceMask())
|
| 1281 |
+
coord = self.coord[verts]
|
| 1282 |
+
else:
|
| 1283 |
+
coord = self.coord[ix]
|
| 1284 |
+
if len(coord) == 0:
|
| 1285 |
+
return np.zeros((2, 3), dtype=np.float32)
|
| 1286 |
+
v0 = np.amin(coord, axis=0)
|
| 1287 |
+
v1 = np.amax(coord, axis=0)
|
| 1288 |
+
return np.vstack((v0, v1))
|
| 1289 |
+
|
| 1290 |
+
def __str__(self):
|
| 1291 |
+
return "object3D Mesh named: %s, nverts: %s, nfaces: %s" % (
|
| 1292 |
+
self.name,
|
| 1293 |
+
self.getVertexCount(),
|
| 1294 |
+
self.getFaceCount(),
|
| 1295 |
+
)
|
| 1296 |
+
|
| 1297 |
+
|
| 1298 |
+
def dot_v3(v3_arr1, v3_arr2):
|
| 1299 |
+
"""
|
| 1300 |
+
Numpy Ufunc'ed implementation of a series of dot products of two vector3
|
| 1301 |
+
objects.
|
| 1302 |
+
"""
|
| 1303 |
+
return (
|
| 1304 |
+
(v3_arr1[:, 0] * v3_arr2[:, 0])
|
| 1305 |
+
+ (v3_arr1[:, 1] * v3_arr2[:, 1])
|
| 1306 |
+
+ (v3_arr2[:, 2] * v3_arr1[:, 2])
|
| 1307 |
+
)
|
third-party/GR00T-WholeBodyControl/decoupled_wbc/control/teleop/gui/core/selection.py
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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ancommunity/
|
| 10 |
+
|
| 11 |
+
**Authors:** Glynn Clements
|
| 12 |
+
|
| 13 |
+
**Copyright(c):** MakeHuman Team 2001-2020
|
| 14 |
+
|
| 15 |
+
**Licensing:** AGPL3
|
| 16 |
+
|
| 17 |
+
This file is part of MakeHuman Community (www.makehumancommunity.org).
|
| 18 |
+
|
| 19 |
+
This program is free software: you can redistribute it and/or modify
|
| 20 |
+
it under the terms of the GNU Affero General Public License as
|
| 21 |
+
published by the Free Software Foundation, either version 3 of the
|
| 22 |
+
License, or (at your option) any later version.
|
| 23 |
+
|
| 24 |
+
This program is distributed in the hope that it will be useful,
|
| 25 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 26 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 27 |
+
GNU Affero General Public License for more details.
|
| 28 |
+
|
| 29 |
+
You should have received a copy of the GNU Affero General Public License
|
| 30 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
Abstract
|
| 34 |
+
--------
|
| 35 |
+
|
| 36 |
+
TODO
|
| 37 |
+
"""
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
class SelectionColorMap:
|
| 41 |
+
"""
|
| 42 |
+
The objects support the use of a technique called *Selection Using Unique
|
| 43 |
+
Color IDs*, that internally uses color-coding of components within the
|
| 44 |
+
scene to support the selection of objects by the user using the mouse.
|
| 45 |
+
|
| 46 |
+
This technique generates a sequence of colors (color IDs), assigning a
|
| 47 |
+
unique color to each uniquely selectable object or component in the scene.
|
| 48 |
+
These colors are not displayed, but are used by MakeHuman to generates an
|
| 49 |
+
unseen image of the various selectable elements. This image uses the same
|
| 50 |
+
camera settings currently being used for the actual, on-screen image.
|
| 51 |
+
When the mouse is clicked, the position of the mouse is used with the
|
| 52 |
+
unseen image to retrieve a color. MakeHuman uses this color as an ID to
|
| 53 |
+
identify which object or component the user clicked with the mouse.
|
| 54 |
+
|
| 55 |
+
This technique uses glReadPixels() to read the single pixel at the
|
| 56 |
+
current mouse location, using the unseen, color-coded image.
|
| 57 |
+
|
| 58 |
+
For further information on this technique, see:
|
| 59 |
+
|
| 60 |
+
- http://www.opengl.org/resources/faq/technical/selection.htm and
|
| 61 |
+
- http://wiki.gamedev.net/index.php/OpenGL_Selection_Using_Unique_Color_IDs
|
| 62 |
+
|
| 63 |
+
**Note.** Because the 3D engine uses glDrawElements in a highly opimized
|
| 64 |
+
way and each vertex can have only one color ID, there there is a known
|
| 65 |
+
problem with selecting individual faces with very small FaceGroups using
|
| 66 |
+
this technique. However, this is not a major problem for MakeHuman, which
|
| 67 |
+
doesn't use such low polygon groupings.
|
| 68 |
+
|
| 69 |
+
- **self.colorIDToFaceGroup**: *Dictionary of colors IDs* A dictionary of the color IDs used for
|
| 70 |
+
selection (see MakeHuman Selectors, above).
|
| 71 |
+
- **self.colorID**: *float list* A progressive color ID.
|
| 72 |
+
|
| 73 |
+
The attributes *self.colorID* and *self.colorIDToFaceGroup*
|
| 74 |
+
support a technique called *Selection Using Unique Color IDs* to make each
|
| 75 |
+
FaceGroup independently clickable.
|
| 76 |
+
|
| 77 |
+
The attribute *self.colorID* stores a progressive color that is incremented for each successive
|
| 78 |
+
FaceGroup added to the scene.
|
| 79 |
+
The *self.colorIDToFaceGroup* attribute contains a list that serves as a directory to map
|
| 80 |
+
each color back to the corresponding FaceGroup by using its color ID.
|
| 81 |
+
"""
|
| 82 |
+
|
| 83 |
+
def __init__(self):
|
| 84 |
+
|
| 85 |
+
self.colorIDToFaceGroup = {}
|
| 86 |
+
self.colorID = 0
|
| 87 |
+
|
| 88 |
+
def assignSelectionID(self, obj):
|
| 89 |
+
"""
|
| 90 |
+
This method generates a new, unique color ID for each FaceGroup,
|
| 91 |
+
within a particular Object3D object, that forms a part of this scene3D
|
| 92 |
+
object. This color ID can subsequently be used in a non-displayed
|
| 93 |
+
image map to determine the FaceGroup that a mouse click was made in.
|
| 94 |
+
|
| 95 |
+
This method loops through the FaceGroups, assigning the next color
|
| 96 |
+
in the sequence to each subsequent FaceGroup. The color value is
|
| 97 |
+
written into a 'dictionary' to serve as a color ID that can be
|
| 98 |
+
translated back into the corresponding FaceGroup name when a mouse
|
| 99 |
+
click is detected.
|
| 100 |
+
This is part of a technique called *Selection Using Unique Color IDs*
|
| 101 |
+
to make each FaceGroup independently clickable.
|
| 102 |
+
|
| 103 |
+
:param obj: The object3D object for which color dictionary entries need to be generated.
|
| 104 |
+
:type obj: module3d.Object 3D
|
| 105 |
+
"""
|
| 106 |
+
for g in obj.faceGroups:
|
| 107 |
+
self.colorID += 1
|
| 108 |
+
|
| 109 |
+
# 555 to 24-bit rgb
|
| 110 |
+
|
| 111 |
+
idR = (self.colorID % 32) * 8
|
| 112 |
+
idG = ((self.colorID >> 5) % 32) * 8
|
| 113 |
+
idB = ((self.colorID >> 10) % 32) * 8
|
| 114 |
+
|
| 115 |
+
g.colorID = (idR, idG, idB)
|
| 116 |
+
|
| 117 |
+
self.colorIDToFaceGroup[self.colorID] = g
|
| 118 |
+
|
| 119 |
+
def getSelectedFaceGroup(self, picked):
|
| 120 |
+
"""
|
| 121 |
+
This method uses a non-displayed image containing color-coded faces
|
| 122 |
+
to return the index of the FaceGroup selected by the user with the mouse.
|
| 123 |
+
This is part of a technique called *Selection Using Unique Color IDs* to make each
|
| 124 |
+
FaceGroup independently clickable.
|
| 125 |
+
|
| 126 |
+
:return: The selected face group.
|
| 127 |
+
:rtype: :py:class:`module3d.FaceGroup`
|
| 128 |
+
"""
|
| 129 |
+
# Force integer divide
|
| 130 |
+
IDkey = picked[0] // 8 | picked[1] // 8 << 5 | picked[2] // 8 << 10 # 555
|
| 131 |
+
|
| 132 |
+
# print "DEBUG COLOR PICKED: %s,%s,%s %s"%(picked[0], picked[1], picked[2], IDkey)
|
| 133 |
+
|
| 134 |
+
try:
|
| 135 |
+
groupSelected = self.colorIDToFaceGroup[IDkey]
|
| 136 |
+
except Exception:
|
| 137 |
+
print("Color %s (%s) not found" % (IDkey, picked))
|
| 138 |
+
# print (groupSelected.name)
|
| 139 |
+
# this print should only come on while debugging color picking
|
| 140 |
+
# print ('Color %s (%s) not found' % (IDkey, picked))
|
| 141 |
+
groupSelected = None
|
| 142 |
+
return groupSelected
|
| 143 |
+
|
| 144 |
+
def getSelectedFaceGroupAndObject(self, picked):
|
| 145 |
+
"""
|
| 146 |
+
This method determines whether a FaceGroup or a non-selectable zone has been
|
| 147 |
+
clicked with the mouse. It returns a tuple, showing the FaceGroup and the parent
|
| 148 |
+
Object3D object, or None.
|
| 149 |
+
If no object is picked, this method will simply print \"no clickable zone.\"
|
| 150 |
+
|
| 151 |
+
:return: The selected face group and object.
|
| 152 |
+
:rtype: (:py:class:`module3d.FaceGroup`, :py:class:`module3d.Object3d`)
|
| 153 |
+
"""
|
| 154 |
+
|
| 155 |
+
facegroupPicked = self.getSelectedFaceGroup(picked)
|
| 156 |
+
if facegroupPicked:
|
| 157 |
+
objPicked = facegroupPicked.parent
|
| 158 |
+
return (facegroupPicked, objPicked)
|
| 159 |
+
else:
|
| 160 |
+
# this print should only be made while debugging picking
|
| 161 |
+
# print ('not a clickable zone')
|
| 162 |
+
return None
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
selectionColorMap = SelectionColorMap()
|