robotic 0.2.9.dev1__cp311-cp311-manylinux2014_x86_64.whl → 0.2.9.dev2__cp311-cp311-manylinux2014_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of robotic might be problematic. Click here for more details.

Files changed (312) hide show
  1. robotic/__init__.py +4 -0
  2. robotic/_robotic.pyi +5 -5
  3. robotic/_robotic.so +0 -0
  4. robotic/cleanMeshes.py +59 -0
  5. robotic/include/rai/Core/array.ipp +3 -1
  6. robotic/include/rai/Core/util.h +8 -7
  7. robotic/include/rai/Geo/geo.h +2 -1
  8. robotic/include/rai/KOMO/manipTools.h +2 -2
  9. robotic/include/rai/Kin/frame.h +2 -2
  10. robotic/include/rai/Kin/kin.h +3 -3
  11. robotic/include/rai/ry/types.h +3 -2
  12. robotic/librai.so +0 -0
  13. robotic/meshTool +0 -0
  14. robotic/mujoco-import.py +10 -0
  15. robotic/rai-robotModels/g1/g1.g +1 -1
  16. robotic/rai-robotModels/g1/g1_29dof_conv.g +77 -0
  17. robotic/rai-robotModels/g1/g1_clean.g +38 -73
  18. robotic/rai-robotModels/g1/meshes/head_link.h5 +0 -0
  19. robotic/rai-robotModels/g1/meshes/left_ankle_pitch_link.h5 +0 -0
  20. robotic/rai-robotModels/g1/meshes/left_ankle_roll_link.h5 +0 -0
  21. robotic/rai-robotModels/g1/meshes/left_elbow_link.h5 +0 -0
  22. robotic/rai-robotModels/g1/meshes/left_hip_pitch_link.h5 +0 -0
  23. robotic/rai-robotModels/g1/meshes/left_hip_roll_link.h5 +0 -0
  24. robotic/rai-robotModels/g1/meshes/left_hip_yaw_link.h5 +0 -0
  25. robotic/rai-robotModels/g1/meshes/left_knee_link.h5 +0 -0
  26. robotic/rai-robotModels/g1/meshes/left_rubber_hand.h5 +0 -0
  27. robotic/rai-robotModels/g1/meshes/left_shoulder_pitch_link.h5 +0 -0
  28. robotic/rai-robotModels/g1/meshes/left_shoulder_roll_link.h5 +0 -0
  29. robotic/rai-robotModels/g1/meshes/left_shoulder_yaw_link.h5 +0 -0
  30. robotic/rai-robotModels/g1/meshes/left_wrist_pitch_link.h5 +0 -0
  31. robotic/rai-robotModels/g1/meshes/left_wrist_roll_link.h5 +0 -0
  32. robotic/rai-robotModels/g1/meshes/left_wrist_yaw_link.h5 +0 -0
  33. robotic/rai-robotModels/g1/meshes/logo_link.h5 +0 -0
  34. robotic/rai-robotModels/g1/meshes/pelvis.h5 +0 -0
  35. robotic/rai-robotModels/g1/meshes/pelvis_contour_link.h5 +0 -0
  36. robotic/rai-robotModels/g1/meshes/right_ankle_pitch_link.h5 +0 -0
  37. robotic/rai-robotModels/g1/meshes/right_ankle_roll_link.h5 +0 -0
  38. robotic/rai-robotModels/g1/meshes/right_elbow_link.h5 +0 -0
  39. robotic/rai-robotModels/g1/meshes/right_hip_pitch_link.h5 +0 -0
  40. robotic/rai-robotModels/g1/meshes/right_hip_roll_link.h5 +0 -0
  41. robotic/rai-robotModels/g1/meshes/right_hip_yaw_link.h5 +0 -0
  42. robotic/rai-robotModels/g1/meshes/right_knee_link.h5 +0 -0
  43. robotic/rai-robotModels/g1/meshes/right_rubber_hand.h5 +0 -0
  44. robotic/rai-robotModels/g1/meshes/right_shoulder_pitch_link.h5 +0 -0
  45. robotic/rai-robotModels/g1/meshes/right_shoulder_roll_link.h5 +0 -0
  46. robotic/rai-robotModels/g1/meshes/right_shoulder_yaw_link.h5 +0 -0
  47. robotic/rai-robotModels/g1/meshes/right_wrist_pitch_link.h5 +0 -0
  48. robotic/rai-robotModels/g1/meshes/right_wrist_roll_link.h5 +0 -0
  49. robotic/rai-robotModels/g1/meshes/right_wrist_yaw_link.h5 +0 -0
  50. robotic/rai-robotModels/g1/meshes/torso_link.h5 +0 -0
  51. robotic/rai-robotModels/g1/meshes/waist_roll_link.h5 +0 -0
  52. robotic/rai-robotModels/g1/meshes/waist_support_link.h5 +0 -0
  53. robotic/rai-robotModels/g1/meshes/waist_yaw_link.h5 +0 -0
  54. robotic/rai-robotModels/panda/meshes/finger.h5 +0 -0
  55. robotic/rai-robotModels/panda/meshes/hand.h5 +0 -0
  56. robotic/rai-robotModels/panda/meshes/link0.h5 +0 -0
  57. robotic/rai-robotModels/panda/meshes/link1.h5 +0 -0
  58. robotic/rai-robotModels/panda/meshes/link2.h5 +0 -0
  59. robotic/rai-robotModels/panda/meshes/link3.h5 +0 -0
  60. robotic/rai-robotModels/panda/meshes/link4.h5 +0 -0
  61. robotic/rai-robotModels/panda/meshes/link5.h5 +0 -0
  62. robotic/rai-robotModels/panda/meshes/link6.h5 +0 -0
  63. robotic/rai-robotModels/panda/meshes/link7.h5 +0 -0
  64. robotic/rai-robotModels/panda/panda.g +1 -1
  65. robotic/rai-robotModels/panda/panda_arm_hand_conv.g +24 -0
  66. robotic/rai-robotModels/panda/panda_clean.g +21 -45
  67. robotic/rai-robotModels/panda/panda_gripper.g +3 -3
  68. robotic/rai-robotModels/pr2/meshes/base.h5 +0 -0
  69. robotic/rai-robotModels/pr2/meshes/base_color.png +0 -0
  70. robotic/rai-robotModels/pr2/meshes/caster.h5 +0 -0
  71. robotic/rai-robotModels/pr2/meshes/elbow_flex.h5 +0 -0
  72. robotic/rai-robotModels/pr2/meshes/elbow_flex_color.png +0 -0
  73. robotic/rai-robotModels/pr2/meshes/forearm.h5 +0 -0
  74. robotic/rai-robotModels/pr2/meshes/forearm_color.png +0 -0
  75. robotic/rai-robotModels/pr2/meshes/forearm_roll.h5 +0 -0
  76. robotic/rai-robotModels/pr2/meshes/gripper_palm.h5 +0 -0
  77. robotic/rai-robotModels/pr2/meshes/gripper_palm_color.png +0 -0
  78. robotic/rai-robotModels/pr2/meshes/head_pan.h5 +0 -0
  79. robotic/rai-robotModels/pr2/meshes/head_pan_color.png +0 -0
  80. robotic/rai-robotModels/pr2/meshes/head_tilt.h5 +0 -0
  81. robotic/rai-robotModels/pr2/meshes/head_tilt_color.png +0 -0
  82. robotic/rai-robotModels/pr2/meshes/l_finger.h5 +0 -0
  83. robotic/rai-robotModels/pr2/meshes/l_finger_color.png +0 -0
  84. robotic/rai-robotModels/pr2/meshes/l_finger_tip.h5 +0 -0
  85. robotic/rai-robotModels/pr2/meshes/l_finger_tip_color.png +0 -0
  86. robotic/rai-robotModels/pr2/meshes/shoulder_lift.h5 +0 -0
  87. robotic/rai-robotModels/pr2/meshes/shoulder_lift_color.png +0 -0
  88. robotic/rai-robotModels/pr2/meshes/shoulder_pan.h5 +0 -0
  89. robotic/rai-robotModels/pr2/meshes/shoulder_pan_color.png +0 -0
  90. robotic/rai-robotModels/pr2/meshes/tilting_hokuyo.h5 +0 -0
  91. robotic/rai-robotModels/pr2/meshes/tilting_hokuyo_color.png +0 -0
  92. robotic/rai-robotModels/pr2/meshes/torso_lift.h5 +0 -0
  93. robotic/rai-robotModels/pr2/meshes/torso_lift_color.png +0 -0
  94. robotic/rai-robotModels/pr2/meshes/upper_arm.h5 +0 -0
  95. robotic/rai-robotModels/pr2/meshes/upper_arm_color.png +0 -0
  96. robotic/rai-robotModels/pr2/meshes/upper_arm_roll.h5 +0 -0
  97. robotic/rai-robotModels/pr2/meshes/upper_arm_roll_color.png +0 -0
  98. robotic/rai-robotModels/pr2/meshes/wheel.h5 +0 -0
  99. robotic/rai-robotModels/pr2/meshes/wheel_color.png +0 -0
  100. robotic/rai-robotModels/pr2/meshes/wrist_color.png +0 -0
  101. robotic/rai-robotModels/pr2/meshes/wrist_flex.h5 +0 -0
  102. robotic/rai-robotModels/pr2/meshes/wrist_roll.h5 +0 -0
  103. robotic/rai-robotModels/pr2/pr2.g +1 -1
  104. robotic/rai-robotModels/pr2/pr2_clean.g +5 -1
  105. robotic/rai-robotModels/pr2/pr2_conv.g +218 -0
  106. robotic/rai-robotModels/ranger/meshes/ranger_mini3.h5 +0 -0
  107. robotic/rai-robotModels/ranger/meshes/ranger_mini_v3_wheel.h5 +0 -0
  108. robotic/rai-robotModels/ranger/meshes/ranger_mini_v3_wheel_right.h5 +0 -0
  109. robotic/rai-robotModels/ranger/ranger.g +5 -5
  110. robotic/rai-robotModels/ranger/ranger_clean.g +5 -5
  111. robotic/rai-robotModels/ranger/ranger_mini_conv.g +14 -0
  112. robotic/rai-robotModels/robotiq/meshes/robotiq_arg2f_85_base_link.h5 +0 -0
  113. robotic/rai-robotModels/robotiq/meshes/robotiq_arg2f_85_inner_finger.h5 +0 -0
  114. robotic/rai-robotModels/robotiq/meshes/robotiq_arg2f_85_inner_knuckle.h5 +0 -0
  115. robotic/rai-robotModels/robotiq/meshes/robotiq_arg2f_85_outer_finger.h5 +0 -0
  116. robotic/rai-robotModels/robotiq/meshes/robotiq_arg2f_85_outer_knuckle.h5 +0 -0
  117. robotic/rai-robotModels/robotiq/robotiq.g +2 -2
  118. robotic/rai-robotModels/robotiq/robotiq_arg2f_85_model_conv.g +21 -0
  119. robotic/rai-robotModels/robotiq/robotiq_clean.g +16 -16
  120. robotic/rai-robotModels/scenarios/ballFinger.g +2 -2
  121. robotic/rai-robotModels/tests/compound.g +3 -6
  122. robotic/rai-robotModels/ur10/meshes/base.h5 +0 -0
  123. robotic/rai-robotModels/ur10/meshes/forearm.h5 +0 -0
  124. robotic/rai-robotModels/ur10/meshes/shoulder.h5 +0 -0
  125. robotic/rai-robotModels/ur10/meshes/upperarm.h5 +0 -0
  126. robotic/rai-robotModels/ur10/meshes/wrist1.h5 +0 -0
  127. robotic/rai-robotModels/ur10/meshes/wrist2.h5 +0 -0
  128. robotic/rai-robotModels/ur10/meshes/wrist3.h5 +0 -0
  129. robotic/rai-robotModels/ur10/ur10.g +1 -1
  130. robotic/rai-robotModels/ur10/ur10_conv.g +17 -0
  131. robotic/ry-urdfConvert.py +73 -0
  132. robotic/src/config_mujoco.py +237 -0
  133. robotic/src/config_urdf.py +237 -0
  134. robotic/src/mesh_helper.py +395 -0
  135. robotic/src/yaml_helper.py +19 -0
  136. robotic/version.py +1 -1
  137. {robotic-0.2.9.dev1.dist-info → robotic-0.2.9.dev2.dist-info}/METADATA +1 -1
  138. robotic-0.2.9.dev2.dist-info/RECORD +369 -0
  139. {robotic-0.2.9.dev1.dist-info → robotic-0.2.9.dev2.dist-info}/WHEEL +1 -1
  140. robotic/import.py +0 -0
  141. robotic/rai-robotModels/baxter/baxter.g +0 -49
  142. robotic/rai-robotModels/baxter/baxter_clean.g +0 -116
  143. robotic/rai-robotModels/baxter/baxter_clean2.g +0 -205
  144. robotic/rai-robotModels/baxter/baxter_clean3.g +0 -223
  145. robotic/rai-robotModels/baxter/baxter_description/meshes/base/PEDESTAL.ply +0 -0
  146. robotic/rai-robotModels/baxter/baxter_description/meshes/base/pedestal_link_collision.ply +0 -0
  147. robotic/rai-robotModels/baxter/baxter_description/meshes/head/H0.ply +0 -0
  148. robotic/rai-robotModels/baxter/baxter_description/meshes/head/H1.ply +0 -0
  149. robotic/rai-robotModels/baxter/baxter_description/meshes/lower_elbow/E1.ply +0 -0
  150. robotic/rai-robotModels/baxter/baxter_description/meshes/lower_forearm/W1.ply +0 -0
  151. robotic/rai-robotModels/baxter/baxter_description/meshes/lower_shoulder/S1.ply +0 -0
  152. robotic/rai-robotModels/baxter/baxter_description/meshes/torso/base_link.ply +0 -0
  153. robotic/rai-robotModels/baxter/baxter_description/meshes/torso/base_link_collision.ply +0 -0
  154. robotic/rai-robotModels/baxter/baxter_description/meshes/upper_elbow/E0.ply +0 -0
  155. robotic/rai-robotModels/baxter/baxter_description/meshes/upper_forearm/W0.ply +0 -0
  156. robotic/rai-robotModels/baxter/baxter_description/meshes/upper_shoulder/S0.ply +0 -0
  157. robotic/rai-robotModels/baxter/baxter_description/meshes/wrist/W2.ply +0 -0
  158. robotic/rai-robotModels/baxter/baxter_new.g +0 -53
  159. robotic/rai-robotModels/baxter/rethink_ee_description/meshes/electric_gripper/electric_gripper_base.ply +0 -0
  160. robotic/rai-robotModels/baxter/rethink_ee_description/meshes/electric_gripper/fingers/extended_narrow.ply +0 -0
  161. robotic/rai-robotModels/baxter/rethink_ee_description/meshes/electric_gripper/fingers/half_round_tip.ply +0 -0
  162. robotic/rai-robotModels/baxter/rethink_ee_description/meshes/electric_gripper/fingers/paddle_tip.ply +0 -0
  163. robotic/rai-robotModels/baxter/rethink_ee_description/meshes/pneumatic_gripper/pneumatic_gripper_base.ply +0 -0
  164. robotic/rai-robotModels/baxter/rethink_ee_description/meshes/pneumatic_gripper/pneumatic_gripper_w_cup.ply +0 -0
  165. robotic/rai-robotModels/g1/meshes/head_link.ply +0 -0
  166. robotic/rai-robotModels/g1/meshes/left_ankle_pitch_link.ply +0 -0
  167. robotic/rai-robotModels/g1/meshes/left_ankle_roll_link.ply +0 -0
  168. robotic/rai-robotModels/g1/meshes/left_elbow_link.ply +0 -0
  169. robotic/rai-robotModels/g1/meshes/left_hand_index_0_link.ply +0 -0
  170. robotic/rai-robotModels/g1/meshes/left_hand_index_1_link.ply +0 -0
  171. robotic/rai-robotModels/g1/meshes/left_hand_middle_0_link.ply +0 -0
  172. robotic/rai-robotModels/g1/meshes/left_hand_middle_1_link.ply +0 -0
  173. robotic/rai-robotModels/g1/meshes/left_hand_palm_link.ply +0 -0
  174. robotic/rai-robotModels/g1/meshes/left_hand_thumb_0_link.ply +0 -0
  175. robotic/rai-robotModels/g1/meshes/left_hand_thumb_1_link.ply +0 -0
  176. robotic/rai-robotModels/g1/meshes/left_hand_thumb_2_link.ply +0 -0
  177. robotic/rai-robotModels/g1/meshes/left_hip_pitch_link.ply +0 -0
  178. robotic/rai-robotModels/g1/meshes/left_hip_roll_link.ply +0 -0
  179. robotic/rai-robotModels/g1/meshes/left_hip_yaw_link.ply +0 -0
  180. robotic/rai-robotModels/g1/meshes/left_knee_link.ply +0 -0
  181. robotic/rai-robotModels/g1/meshes/left_rubber_hand.ply +0 -0
  182. robotic/rai-robotModels/g1/meshes/left_shoulder_pitch_link.ply +0 -0
  183. robotic/rai-robotModels/g1/meshes/left_shoulder_roll_link.ply +0 -0
  184. robotic/rai-robotModels/g1/meshes/left_shoulder_yaw_link.ply +0 -0
  185. robotic/rai-robotModels/g1/meshes/left_wrist_pitch_link.ply +0 -0
  186. robotic/rai-robotModels/g1/meshes/left_wrist_roll_link.ply +0 -0
  187. robotic/rai-robotModels/g1/meshes/left_wrist_roll_rubber_hand.ply +0 -0
  188. robotic/rai-robotModels/g1/meshes/left_wrist_yaw_link.ply +0 -0
  189. robotic/rai-robotModels/g1/meshes/logo_link.ply +0 -0
  190. robotic/rai-robotModels/g1/meshes/pelvis.ply +0 -0
  191. robotic/rai-robotModels/g1/meshes/pelvis_contour_link.ply +0 -0
  192. robotic/rai-robotModels/g1/meshes/right_ankle_pitch_link.ply +0 -0
  193. robotic/rai-robotModels/g1/meshes/right_ankle_roll_link.ply +0 -0
  194. robotic/rai-robotModels/g1/meshes/right_elbow_link.ply +0 -0
  195. robotic/rai-robotModels/g1/meshes/right_hand_index_0_link.ply +0 -0
  196. robotic/rai-robotModels/g1/meshes/right_hand_index_1_link.ply +0 -0
  197. robotic/rai-robotModels/g1/meshes/right_hand_middle_0_link.ply +0 -0
  198. robotic/rai-robotModels/g1/meshes/right_hand_middle_1_link.ply +0 -0
  199. robotic/rai-robotModels/g1/meshes/right_hand_palm_link.ply +0 -0
  200. robotic/rai-robotModels/g1/meshes/right_hand_thumb_0_link.ply +0 -0
  201. robotic/rai-robotModels/g1/meshes/right_hand_thumb_1_link.ply +0 -0
  202. robotic/rai-robotModels/g1/meshes/right_hand_thumb_2_link.ply +0 -0
  203. robotic/rai-robotModels/g1/meshes/right_hip_pitch_link.ply +0 -0
  204. robotic/rai-robotModels/g1/meshes/right_hip_roll_link.ply +0 -0
  205. robotic/rai-robotModels/g1/meshes/right_hip_yaw_link.ply +0 -0
  206. robotic/rai-robotModels/g1/meshes/right_knee_link.ply +0 -0
  207. robotic/rai-robotModels/g1/meshes/right_rubber_hand.ply +0 -0
  208. robotic/rai-robotModels/g1/meshes/right_shoulder_pitch_link.ply +0 -0
  209. robotic/rai-robotModels/g1/meshes/right_shoulder_roll_link.ply +0 -0
  210. robotic/rai-robotModels/g1/meshes/right_shoulder_yaw_link.ply +0 -0
  211. robotic/rai-robotModels/g1/meshes/right_wrist_pitch_link.ply +0 -0
  212. robotic/rai-robotModels/g1/meshes/right_wrist_roll_link.ply +0 -0
  213. robotic/rai-robotModels/g1/meshes/right_wrist_roll_rubber_hand.ply +0 -0
  214. robotic/rai-robotModels/g1/meshes/right_wrist_yaw_link.ply +0 -0
  215. robotic/rai-robotModels/g1/meshes/torso_constraint_L_link.ply +0 -0
  216. robotic/rai-robotModels/g1/meshes/torso_constraint_L_rod_link.ply +0 -0
  217. robotic/rai-robotModels/g1/meshes/torso_constraint_R_link.ply +0 -0
  218. robotic/rai-robotModels/g1/meshes/torso_constraint_R_rod_link.ply +0 -0
  219. robotic/rai-robotModels/g1/meshes/torso_link.ply +0 -0
  220. robotic/rai-robotModels/g1/meshes/waist_constraint_L.ply +0 -0
  221. robotic/rai-robotModels/g1/meshes/waist_constraint_R.ply +0 -0
  222. robotic/rai-robotModels/g1/meshes/waist_roll_link.ply +0 -0
  223. robotic/rai-robotModels/g1/meshes/waist_support_link.ply +0 -0
  224. robotic/rai-robotModels/g1/meshes/waist_yaw_link.ply +0 -0
  225. robotic/rai-robotModels/panda/franka_description/meshes/collision/finger.stl +0 -0
  226. robotic/rai-robotModels/panda/franka_description/meshes/collision/hand.stl +0 -0
  227. robotic/rai-robotModels/panda/franka_description/meshes/collision/link0.stl +0 -0
  228. robotic/rai-robotModels/panda/franka_description/meshes/collision/link1.stl +0 -0
  229. robotic/rai-robotModels/panda/franka_description/meshes/collision/link2.stl +0 -0
  230. robotic/rai-robotModels/panda/franka_description/meshes/collision/link3.stl +0 -0
  231. robotic/rai-robotModels/panda/franka_description/meshes/collision/link4.stl +0 -0
  232. robotic/rai-robotModels/panda/franka_description/meshes/collision/link5.stl +0 -0
  233. robotic/rai-robotModels/panda/franka_description/meshes/collision/link6.stl +0 -0
  234. robotic/rai-robotModels/panda/franka_description/meshes/collision/link7.stl +0 -0
  235. robotic/rai-robotModels/panda/franka_description/meshes/visual/HOWTO.sh +0 -10
  236. robotic/rai-robotModels/panda/franka_description/meshes/visual/HOWTO2.sh +0 -7
  237. robotic/rai-robotModels/panda/franka_description/meshes/visual/convMeshes.mlx +0 -38
  238. robotic/rai-robotModels/panda/franka_description/meshes/visual/finger.ply +0 -0
  239. robotic/rai-robotModels/panda/franka_description/meshes/visual/hand.ply +0 -0
  240. robotic/rai-robotModels/panda/franka_description/meshes/visual/link0.ply +0 -0
  241. robotic/rai-robotModels/panda/franka_description/meshes/visual/link1.ply +0 -0
  242. robotic/rai-robotModels/panda/franka_description/meshes/visual/link2.ply +0 -0
  243. robotic/rai-robotModels/panda/franka_description/meshes/visual/link3.ply +0 -0
  244. robotic/rai-robotModels/panda/franka_description/meshes/visual/link4.ply +0 -0
  245. robotic/rai-robotModels/panda/franka_description/meshes/visual/link5.ply +0 -0
  246. robotic/rai-robotModels/panda/franka_description/meshes/visual/link6.ply +0 -0
  247. robotic/rai-robotModels/panda/franka_description/meshes/visual/link7.ply +0 -0
  248. robotic/rai-robotModels/panda/franka_description/meshes/visual/script.mlx +0 -28
  249. robotic/rai-robotModels/pr2/pr2_description/meshes/base_v0/base.ply +0 -0
  250. robotic/rai-robotModels/pr2/pr2_description/meshes/base_v0/base_L.ply +0 -0
  251. robotic/rai-robotModels/pr2/pr2_description/meshes/base_v0/caster.ply +0 -0
  252. robotic/rai-robotModels/pr2/pr2_description/meshes/base_v0/caster_L.ply +0 -0
  253. robotic/rai-robotModels/pr2/pr2_description/meshes/base_v0/pr2_wheel.ply +0 -0
  254. robotic/rai-robotModels/pr2/pr2_description/meshes/base_v0/wheel.ply +0 -0
  255. robotic/rai-robotModels/pr2/pr2_description/meshes/forearm_v0/forearm.ply +0 -0
  256. robotic/rai-robotModels/pr2/pr2_description/meshes/forearm_v0/wrist_flex.ply +0 -0
  257. robotic/rai-robotModels/pr2/pr2_description/meshes/forearm_v0/wrist_roll.ply +0 -0
  258. robotic/rai-robotModels/pr2/pr2_description/meshes/forearm_v0/wrist_roll_L.ply +0 -0
  259. robotic/rai-robotModels/pr2/pr2_description/meshes/gripper_v0/gripper_palm.ply +0 -0
  260. robotic/rai-robotModels/pr2/pr2_description/meshes/gripper_v0/l_finger.ply +0 -0
  261. robotic/rai-robotModels/pr2/pr2_description/meshes/gripper_v0/l_finger_tip.ply +0 -0
  262. robotic/rai-robotModels/pr2/pr2_description/meshes/head_v0/head_pan.ply +0 -0
  263. robotic/rai-robotModels/pr2/pr2_description/meshes/head_v0/head_pan_L.ply +0 -0
  264. robotic/rai-robotModels/pr2/pr2_description/meshes/head_v0/head_tilt.ply +0 -0
  265. robotic/rai-robotModels/pr2/pr2_description/meshes/head_v0/head_tilt_L.ply +0 -0
  266. robotic/rai-robotModels/pr2/pr2_description/meshes/shoulder_v0/shoulder_lift.ply +0 -0
  267. robotic/rai-robotModels/pr2/pr2_description/meshes/shoulder_v0/shoulder_pan.ply +0 -0
  268. robotic/rai-robotModels/pr2/pr2_description/meshes/shoulder_v0/shoulder_yaw.ply +0 -0
  269. robotic/rai-robotModels/pr2/pr2_description/meshes/shoulder_v0/upper_arm_roll.ply +0 -0
  270. robotic/rai-robotModels/pr2/pr2_description/meshes/shoulder_v0/upper_arm_roll_L.ply +0 -0
  271. robotic/rai-robotModels/pr2/pr2_description/meshes/tilting_laser_v0/hok_tilt.ply +0 -0
  272. robotic/rai-robotModels/pr2/pr2_description/meshes/tilting_laser_v0/tilting_hokuyo.ply +0 -0
  273. robotic/rai-robotModels/pr2/pr2_description/meshes/tilting_laser_v0/tilting_hokuyo_L.ply +0 -0
  274. robotic/rai-robotModels/pr2/pr2_description/meshes/torso_v0/torso.ply +0 -0
  275. robotic/rai-robotModels/pr2/pr2_description/meshes/torso_v0/torso_lift.ply +0 -0
  276. robotic/rai-robotModels/pr2/pr2_description/meshes/torso_v0/torso_lift_L.ply +0 -0
  277. robotic/rai-robotModels/pr2/pr2_description/meshes/upper_arm_v0/elbow_flex.ply +0 -0
  278. robotic/rai-robotModels/pr2/pr2_description/meshes/upper_arm_v0/forearm_roll.ply +0 -0
  279. robotic/rai-robotModels/pr2/pr2_description/meshes/upper_arm_v0/forearm_roll_L.ply +0 -0
  280. robotic/rai-robotModels/pr2/pr2_description/meshes/upper_arm_v0/upper_arm.ply +0 -0
  281. robotic/rai-robotModels/ranger/meshes/cleanMeshes.mlx +0 -23
  282. robotic/rai-robotModels/ranger/meshes/cleanMeshes.sh +0 -8
  283. robotic/rai-robotModels/ranger/meshes/ranger_mini3.ply +0 -0
  284. robotic/rai-robotModels/ranger/meshes/ranger_mini_v3_wheel.ply +0 -0
  285. robotic/rai-robotModels/ranger/meshes/ranger_mini_v3_wheel_right.ply +0 -0
  286. robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_base_link.ply +0 -0
  287. robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_base_link_x.ply +0 -10
  288. robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_inner_finger.ply +0 -0
  289. robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_inner_knuckle.ply +0 -0
  290. robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_outer_finger.ply +0 -0
  291. robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_outer_knuckle.ply +0 -0
  292. robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_pad.ply +0 -0
  293. robotic/rai-robotModels/robotiq/meshes/visual/robotiq_gripper_coupling.ply +0 -0
  294. robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/Base.ply +0 -0
  295. robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/Forearm.ply +0 -0
  296. robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/Shoulder.ply +0 -0
  297. robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/UpperArm.ply +0 -0
  298. robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/Wrist1.ply +0 -0
  299. robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/Wrist2.ply +0 -0
  300. robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/Wrist3.ply +0 -0
  301. robotic-0.2.9.dev1.dist-info/RECORD +0 -421
  302. /robotic/rai-robotModels/robotiq/meshes/{visual/robotiq_ft300.ply → robotiq_ft300.ply} +0 -0
  303. {robotic-0.2.9.dev1.data → robotic-0.2.9.dev2.data}/scripts/ry-bot +0 -0
  304. {robotic-0.2.9.dev1.data → robotic-0.2.9.dev2.data}/scripts/ry-h5info +0 -0
  305. {robotic-0.2.9.dev1.data → robotic-0.2.9.dev2.data}/scripts/ry-info +0 -0
  306. {robotic-0.2.9.dev1.data → robotic-0.2.9.dev2.data}/scripts/ry-meshTool +0 -0
  307. {robotic-0.2.9.dev1.data → robotic-0.2.9.dev2.data}/scripts/ry-test +0 -0
  308. {robotic-0.2.9.dev1.data → robotic-0.2.9.dev2.data}/scripts/ry-urdf2rai +0 -0
  309. {robotic-0.2.9.dev1.data → robotic-0.2.9.dev2.data}/scripts/ry-urdf2yaml +0 -0
  310. {robotic-0.2.9.dev1.data → robotic-0.2.9.dev2.data}/scripts/ry-view +0 -0
  311. {robotic-0.2.9.dev1.dist-info → robotic-0.2.9.dev2.dist-info}/licenses/LICENSE +0 -0
  312. {robotic-0.2.9.dev1.dist-info → robotic-0.2.9.dev2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,237 @@
1
+ import os
2
+ import numpy as np
3
+ import robotic as ry
4
+ from lxml import etree
5
+
6
+
7
+ class URDFLoader():
8
+
9
+ def __init__(self, file, visualsOnly=True, meshPathRemove='', meshExt=None):
10
+ self.meshPathRemove = meshPathRemove
11
+ self.meshExt = meshExt
12
+
13
+ xmlData = etree.parse(file)
14
+ self.path, _ = os.path.split(file)
15
+
16
+ self.C = ry.Config()
17
+
18
+ useCollisionShapes = not visualsOnly
19
+
20
+ # materials
21
+
22
+ self.materials = {}
23
+ mats = xmlData.findall('./material')
24
+ for mat in mats:
25
+ name = mat.attrib.get('name', '')
26
+ tex = mat.find('texture')
27
+ if tex is not None:
28
+ tex_file = tex.attrib['filename'].replace(self.meshPathRemove,'',1)
29
+ self.materials[name] = os.path.join(self.path, tex_file)
30
+ else:
31
+ col = mat.find('color')
32
+ if col is not None:
33
+ self.materials[name] = self.as_floats(col.attrib['rgba'])
34
+
35
+ # links with shapes
36
+
37
+ links = xmlData.findall('./link')
38
+ for link in links:
39
+ link_name = link.attrib['name']
40
+ f_link = self.C.addFrame(link_name)
41
+
42
+
43
+ elem = link.find('inertial/inertia')
44
+ matrix=[]
45
+ if elem is not None:
46
+ tags = ['ixx', 'ixy', 'ixz', 'iyy', 'iyz', 'izz']
47
+ matrix = [float(elem.attrib[tag]) for tag in tags]
48
+
49
+ elem = link.find('inertial/mass')
50
+ if elem is not None:
51
+ mass = float(elem.attrib['value'])
52
+ f_link.setMass(mass, matrix)
53
+
54
+ for visual in link.findall('visual'):
55
+ self.add_shape(visual, f'{link_name}_0', f_link, isVisual=True)
56
+
57
+ # collision shape
58
+ if useCollisionShapes:
59
+ for collision in link.findall('collision'):
60
+ f_shape = self.add_shape(collision, f'{link_name}_1', f_link, isVisual=False)
61
+ f_shape.setColor([1,0,0,.2])
62
+
63
+ # joints
64
+
65
+ joints = xmlData.findall('./joint')
66
+ for joint in joints:
67
+ joint_name = joint.attrib['name']
68
+ if joint.find('child') is None:
69
+ continue
70
+
71
+ parent_name = joint.find('parent').attrib['link']
72
+ f_parent = self.C.getFrame(parent_name)
73
+ if f_parent is None:
74
+ print('SHIT', joint_name)
75
+ break
76
+
77
+ # add an origin frame as pre frame?
78
+ elem = joint.find('origin')
79
+ if elem is not None:
80
+ f_origin = self.C.addFrame(f'{joint_name}_origin')
81
+ f_origin.setParent(f_parent)
82
+ self.setRelativePose(f_origin, elem)
83
+ f_parent = f_origin
84
+
85
+ f_joint = self.C.addFrame(joint_name)
86
+ f_joint.setParent(f_parent)
87
+
88
+ child_name = joint.find('child').attrib['link']
89
+ f_child = self.C.getFrame(child_name)
90
+ if f_child is None:
91
+ print('SHIT', joint_name)
92
+ break
93
+ f_child.setParent(f_joint, False)
94
+
95
+ elem = joint.find('limit')
96
+ limits = []
97
+ if elem is not None:
98
+ lo = elem.attrib.get('lower')
99
+ up = elem.attrib.get('upper')
100
+ eff = elem.attrib.get('effort')
101
+ vel = elem.attrib.get('velocity')
102
+ if eff=='0':
103
+ eff=None
104
+ if vel=='0':
105
+ vel=None
106
+ if lo is not None:
107
+ limits = [float(lo), float(up)]
108
+ # if vel is not None:
109
+ # print(' ctrl_limits: [%s -1 %s],' % (vel, eff), end='') #the 2nd value is an acceleration limit
110
+ # else:
111
+ # elem = joint.find('safety_controller')
112
+ # if elem is not None:
113
+ # lo = elem.attrib.get('soft_lower_limit')
114
+ # up = elem.attrib.get('soft_upper_limit')
115
+ # if lo is not None:
116
+ # print(' limits: [%s %s],' % (lo, up), end='')
117
+
118
+ elem = joint.find('mimic')
119
+ f_mimic = None
120
+ if elem is not None:
121
+ f_mimic = self.C.getFrame(elem.attrib['joint'])
122
+ if f_mimic is None:
123
+ print('SHIT', elem.attrib['joint'])
124
+ break
125
+
126
+ att = joint.attrib.get('type')
127
+
128
+ if att in ['revolute', 'continuous']:
129
+ elem = joint.find('axis')
130
+ if elem is not None:
131
+ axis = elem.attrib['xyz']
132
+ if axis=='1 0 0':
133
+ f_joint.setJoint(ry.JT.hingeX, limits, 1., f_mimic)
134
+ elif axis=='0 1 0':
135
+ f_joint.setJoint(ry.JT.hingeY, limits, 1., f_mimic)
136
+ elif axis=='0 0 1':
137
+ f_joint.setJoint(ry.JT.hingeZ, limits, 1., f_mimic)
138
+ elif axis=='0 0 -1':
139
+ f_joint.setJoint(ry.JT.hingeZ, limits, -1., f_mimic)
140
+ else:
141
+ raise Exception('CAN ONLY PROCESS X Y Z hinge joints, not', axis)
142
+ else:
143
+ f_joint.setJoint(ry.JT.hingeX, limits, 1., f_mimic)
144
+
145
+ if att == 'prismatic':
146
+ elem = joint.find('axis')
147
+ if elem is not None:
148
+ axis = elem.attrib['xyz']
149
+ if axis=='1 0 0':
150
+ f_joint.setJoint(ry.JT.transX, limits, 1., f_mimic)
151
+ elif axis=='0 1 0':
152
+ f_joint.setJoint(ry.JT.transY, limits, 1., f_mimic)
153
+ elif axis=='0 -1 0':
154
+ f_joint.setJoint(ry.JT.transY, limits, -1., f_mimic)
155
+ elif axis=='0 0 1':
156
+ f_joint.setJoint(ry.JT.transZ, limits, 1., f_mimic)
157
+ elif axis=='0 0 -1':
158
+ f_joint.setJoint(ry.JT.transZ, limits, -1., f_mimic)
159
+ else:
160
+ raise Exception('CAN ONLY PROCESS X Y Z prismatic joints, not', axis)
161
+ else:
162
+ f_joint.setJoint(ry.JT.transX, limits, 1., f_mimic)
163
+
164
+ if att == 'fixed':
165
+ f_joint.setJoint(ry.JT.rigid)
166
+
167
+ #elem = joint.find('axis')
168
+ #if elem is not None:
169
+ # print('axis:[%s]' % elem.attrib['xyz'])
170
+
171
+ def add_shape(self, shape, shape_name, f_link, isVisual):
172
+ f_shape = self.C.addFrame(shape_name)
173
+ f_shape.setParent(f_link)
174
+
175
+ elem = shape.find('origin')
176
+ if elem is not None:
177
+ self.setRelativePose(f_shape, elem)
178
+
179
+ elem = shape.find('geometry/box')
180
+ if elem is not None:
181
+ size = self.as_floats(elem.attrib['size'])
182
+ f_shape.setShape(ry.ST.box, size)
183
+
184
+ elem = shape.find('geometry/sphere')
185
+ if elem is not None:
186
+ size = self.as_floats(elem.attrib['size'])
187
+ f_shape.setShape(ry.ST.sphere, size)
188
+
189
+ elem = shape.find('geometry/cylinder')
190
+ if elem is not None:
191
+ size = [float(elem.attrib[tag]) for tag in ['length', 'radius']]
192
+ f_shape.setShape(ry.ST.cylinder, size)
193
+
194
+ elem = shape.find('geometry/mesh')
195
+ if elem is not None:
196
+ filename = elem.attrib['filename'].replace(self.meshPathRemove,'',1)
197
+ if self.meshExt is not None:
198
+ filename = filename[:-3] + self.meshExt
199
+ if 'scale' in elem.attrib:
200
+ scale = self.as_floats(elem.attrib['scale'])[0]
201
+ else:
202
+ scale = 1
203
+ filename = os.path.join(self.path, filename)
204
+ f_shape.setMeshFile(filename, scale)
205
+
206
+ elem = shape.find('material/color')
207
+ if elem is not None:
208
+ f_shape.setColor(self.as_floats(elem.attrib['rgba']))
209
+
210
+ # elem = shape.find('material')
211
+ # if elem is not None and 'name' in elem.attrib:
212
+ # mat = self.materials[elem.attrib['name']]
213
+ # if len(mat)==4: #rgba
214
+ # f_shape.setColor(mat)
215
+ # else:
216
+ # f_shape.setTextureFile(mat)
217
+
218
+
219
+ return f_shape
220
+
221
+ def as_floats(self, input_string):
222
+ return [float(num) for num in input_string.replace(',', ' ').split()]
223
+
224
+ def setRelativePose(self, f, attrib):
225
+ pos = attrib.get('xyz')
226
+ if pos=='0 0 0':
227
+ pos=None
228
+ if pos is not None:
229
+ f.setRelativePosition(self.as_floats(pos))
230
+
231
+ rpy = attrib.get('rpy')
232
+ if rpy=='0 0 0':
233
+ rpy=None
234
+ if rpy is not None:
235
+ q = ry.Quaternion()
236
+ q.setRollPitchYaw(self.as_floats(rpy))
237
+ f.setRelativeQuaternion(q.getArr())
@@ -0,0 +1,395 @@
1
+ import os
2
+ import numpy as np
3
+ #import matplotlib.pyplot as plt
4
+ import trimesh
5
+ import base64
6
+ import yaml
7
+ import h5py
8
+ import matplotlib.pyplot as plt
9
+ from PIL import Image
10
+
11
+ def write_arr(X, fil, type='float32'):
12
+ data = (type, list(X.shape), )
13
+ fil.write(f'[ "{type}", {list(X.shape)}, "')
14
+ fil.write(base64.b64encode(X.astype(type)).decode('utf-8'))
15
+ fil.write('" ]')
16
+
17
+ def conv_tuple_arr(data_tuple):
18
+ X = np.frombuffer(base64.decodebytes(bytearray(data_tuple[2].encode('utf-8'))), dtype=data_tuple[0])
19
+ X = X.reshape(data_tuple[1])
20
+ return X
21
+
22
+ class MeshHelper():
23
+ def __init__(self, file):
24
+ self.failed = False
25
+ self.inertiaIsDiagonal = False
26
+ if file[-3:]==".h5":
27
+ self.load_h5(file)
28
+ else:
29
+ self.load(file)
30
+ self.file = file
31
+
32
+ def load(self, file):
33
+ print('=== file: ', file)
34
+ self.filebase = os.path.splitext(file)[0]
35
+ self.mesh = trimesh.load(file, force='mesh')
36
+ try:
37
+ scene_or_mesh = trimesh.load(file, force='mesh')
38
+ except Exception as e:
39
+ print(e)
40
+ print(' load failed:', file)
41
+ return None
42
+
43
+ if isinstance(scene_or_mesh, trimesh.Scene):
44
+ if len(scene_or_mesh.geometry) == 0:
45
+ self.mesh = None
46
+ self.failed = True
47
+ else:
48
+ # we lose texture information here
49
+ self.mesh = trimesh.util.concatenate(
50
+ tuple(trimesh.Trimesh(vertices=g.vertices, faces=g.faces)
51
+ for g in scene_or_mesh.geometry.values()))
52
+ else:
53
+ assert(isinstance(scene_or_mesh, trimesh.Trimesh))
54
+ self.mesh = scene_or_mesh
55
+
56
+ def view(self):
57
+ self.mesh.show(resolution=(300,300))
58
+
59
+ def report(self):
60
+ print(' filebase:', self.filebase)
61
+ print(' #vertices:', self.mesh.vertices.shape)
62
+ print(' #faces:', self.mesh.faces.shape)
63
+ if hasattr(self.mesh.visual, 'uv'):
64
+ print('#uv:', self.mesh.visual.uv.shape)
65
+
66
+ def autoScale(self):
67
+ scale = 1
68
+ #if self.mesh.scale > 10000:
69
+ # scale = 1e-5
70
+ #elif self.mesh.scale > 1000:
71
+ # scale = 1e-4
72
+ if self.mesh.scale > 200:
73
+ scale = 1e-3
74
+ elif self.mesh.scale > 20:
75
+ scale = 1e-2
76
+ elif self.mesh.scale > 2:
77
+ scale = 1e-1
78
+ #translate = -mesh.centroid
79
+ translate = -.5*(self.mesh.bounds[0]+self.mesh.bounds[1])
80
+ matrix = np.eye(4)
81
+ matrix[0:3, 3] = translate
82
+ matrix[0:3, 0:4] *= scale
83
+ self.mesh.apply_transform(matrix)
84
+
85
+ def transformInertia(self, verbose=False):
86
+ print("prior COM" , self.mesh.center_mass)
87
+ print("prior inertia\n" , self.mesh.moment_inertia)
88
+
89
+ U, D, V = np.linalg.svd(self.mesh.moment_inertia)
90
+
91
+ # Ensure proper rotation
92
+ if np.linalg.det(V) < 0:
93
+ V[:, -1] *= -1
94
+
95
+ matrix = np.eye(4)
96
+ matrix[0:3, 3] = V @ (-self.mesh.center_mass) # Move center of mass to origin
97
+ matrix[0:3, 0:3] = V # Rotate the mesh to align with principal axes
98
+
99
+ self.mesh.apply_transform(matrix)
100
+
101
+ if verbose:
102
+ print("COM after transformation:" , self.mesh.center_mass)
103
+ print("Inertia after transfromation:\n" , self.mesh.moment_inertia)
104
+ self.inertiaIsDiagonal = True
105
+
106
+ return np.linalg.inv(matrix)
107
+
108
+ def repair(self, mergeTolerance=1e-6):
109
+ try:
110
+ trimesh.constants.tol.merge = mergeTolerance
111
+ self.mesh.process(validate=True)
112
+ trimesh.repair.fill_holes(self.mesh)
113
+ trimesh.repair.fix_inversion(self.mesh, multibody=True)
114
+ except Exception as e:
115
+ print(' --- repair failed ---', e)
116
+ print(' --- this might be a trimesh bug: change order within mesh.process method')
117
+ self.failed = True
118
+ exit(0) # this might be a trimesh bug: change order within mesh.process method
119
+
120
+ # if self.mesh.visual != None:
121
+ # self.mesh.visual.uv = np.array([[0,0]])
122
+
123
+ def texture2vertexColors(self):
124
+ if hasattr(self.mesh.visual, 'uv'):
125
+ colors = self.mesh.visual.material.to_color(self.mesh.visual.uv)
126
+ vis = trimesh.visual.ColorVisuals(mesh=self.mesh, vertex_colors=colors)
127
+ self.mesh.visual = vis
128
+ # else:
129
+ # raise ValueError("Mesh does not have UV coordinates!")
130
+
131
+ def export_ply(self, filename=None):
132
+ if filename is None:
133
+ filename = self.filebase+'-.ply'
134
+ print(' exporting', filename)
135
+ self.mesh.export(filename)
136
+
137
+ def export_scene(self, convex=False):
138
+ with open(self.filebase+'.g', 'w', encoding='utf-8') as fil:
139
+ if self.inertiaIsDiagonal:
140
+ if convex:
141
+ fil.write(f'obj: {{ X:[0., 0., 1.], mesh_decomp: <{self.filebase}.h5>, mass: {self.mesh.center_mass.tolist()}, inertia: {np.diagonal(self.mesh.moment_inertia).tolist()} }}\n')
142
+ else:
143
+ fil.write(f'obj: {{ X:[0., 0., 12.], mass: {self.mesh.center_mass.tolist()}, inertia: {self.mesh.moment_inertia.reshape([9]).tolist()} }}\n')
144
+ fil.write(f'obj_mesh (obj): {{ mesh: <{self.filebase}.h5> }}\n')
145
+ #fil.write(f'obj_points (obj): {{ mesh_points: <{self.filebase}.h5>, color: [1 1 0], size: [2.] }}\n')
146
+ return self.filebase+'.g'
147
+
148
+ def createPoints(self):
149
+ self.pts, faces = trimesh.sample.sample_surface(self.mesh, 20000)
150
+ self.normals = self.mesh.face_normals[faces]
151
+ #bary = trimesh.triangles.points_to_barycentric(self.mesh.triangles[faces], pts)
152
+ #normals = trimesh.unitize((self.mesh.vertex_normals[self.mesh.faces[faces]] *
153
+ # trimesh.unitize(bary).reshape((-1, 3, 1))).sum(axis=1))
154
+
155
+
156
+ def createDecomposition(self):
157
+
158
+ convex_hulls = self.mesh.convex_decomposition()
159
+
160
+ self.decomp_parts = [0]
161
+ self.decomp_vertices = np.asarray(convex_hulls[0].vertices)
162
+ self.decomp_faces = np.asarray(convex_hulls[0].faces)
163
+ vert_len = len(convex_hulls[0].vertices)
164
+ for i, part in enumerate(convex_hulls[1:]):
165
+
166
+ self.decomp_vertices = np.concatenate([self.decomp_vertices, part.vertices])
167
+ self.decomp_faces = np.concatenate([self.decomp_faces, part.faces + vert_len])
168
+ self.decomp_parts.append(len(part.vertices)+self.decomp_parts[i])
169
+
170
+ vert_len+=len(part.vertices)
171
+
172
+ self.decomp_parts = np.asarray(self.decomp_parts)
173
+ self.decomp_colors = [0,255,255] # fixed blue for now
174
+
175
+ def createDecomposition_lowlevel(self):
176
+ ### create decomposition
177
+ ret = os.system('ry-meshTool.sh ' + self.filebase+'.mesh' + ' -decomp -hide -quiet'
178
+ ' && mv z.arr ' + self.filebase+'.decomp' )
179
+ if ret>0:
180
+ print(' --- decomposition failed --- return:', ret)
181
+ self.failed=True
182
+ return
183
+
184
+ ### load decomposition
185
+ with open(self.filebase+'.decomp', 'r') as fil:
186
+ decomp = yaml.safe_load(fil)
187
+ self.decomp_vertices = conv_tuple_arr(decomp['V'])
188
+ self.decomp_faces = conv_tuple_arr(decomp['T'])
189
+ self.decomp_colors = conv_tuple_arr(decomp['C'])
190
+ self.decomp_parts = conv_tuple_arr(decomp['cvxParts'])
191
+
192
+ def export_h5(self, filename=None, inertia=False):
193
+ if filename is None:
194
+ filename = self.filebase+'.h5'
195
+ print(' exporting', filename)
196
+ with h5py.File(filename, 'w') as fil:
197
+ fil.create_dataset('mesh/vertices', data=self.mesh.vertices, dtype='float32')
198
+ assert self.mesh.faces.shape[1]==3, 'can only export triangle meshes'
199
+ if(self.mesh.vertices.shape[0]<65535):
200
+ fil.create_dataset('mesh/faces', data=self.mesh.faces, dtype='uint16')
201
+ else:
202
+ fil.create_dataset('mesh/faces', data=self.mesh.faces, dtype='uint32')
203
+
204
+ if hasattr(self.mesh.visual, 'vertex_colors'):
205
+ colors = np.asarray(self.mesh.visual.vertex_colors)[:,0:3]
206
+ fil.create_dataset('mesh/colors', data=colors, dtype='uint8')
207
+
208
+ if hasattr(self.mesh.visual, 'uv'):
209
+ texCoords = self.mesh.visual.uv.copy()
210
+ texCoords[:, 1] = 1 - texCoords[:, 1]
211
+ fil.create_dataset('mesh/textureCoords', data=texCoords, dtype='float32')
212
+
213
+ if self.textureFile is not None:
214
+ file = np.frombuffer(self.textureFile.encode(), dtype=np.int8)
215
+ file = np.append(file, [0])
216
+ fil.create_dataset('mesh/textureFile', data=file, dtype='int8')
217
+ else:
218
+ if hasattr(self.mesh.visual.material, 'baseColorTexture'):
219
+ img = self.mesh.visual.material.baseColorTexture
220
+ else:
221
+ img = self.mesh.visual.material.image
222
+ if img is not None:
223
+ texImg = 255.*np.asanyarray(img.convert("RGB"))
224
+ fil.create_dataset('mesh/textureImg', data=texImg, dtype='uint8')
225
+
226
+ if hasattr(self, 'pts') and self.pts.shape[1]==3:
227
+ fil.create_dataset('points/vertices', data=self.pts, dtype='float32')
228
+ fil.create_dataset('points/normals', data=self.normals, dtype='float32')
229
+
230
+ if hasattr(self, 'decomp_vertices') and self.decomp_vertices.shape[1]==3:
231
+ fil.create_dataset('decomp/vertices', data=self.decomp_vertices, dtype='float32')
232
+ assert self.decomp_faces.shape[0]<65535
233
+ fil.create_dataset('decomp/faces', data=self.decomp_faces, dtype='uint16')
234
+ fil.create_dataset('decomp/colors', data=self.decomp_colors, dtype='uint8')
235
+ assert self.decomp_parts.shape[ 0]<65535
236
+ fil.create_dataset('decomp/parts', data=self.decomp_parts, dtype='uint16')
237
+
238
+ if inertia:
239
+ fil.create_dataset('inertia/mass', data=[self.mesh.mass], dtype='float32')
240
+ fil.create_dataset('inertia/com', data=self.mesh.center_mass, dtype='float32')
241
+ if self.inertiaIsDiagonal:
242
+ fil.create_dataset('inertia/tensor', data=np.diagonal(self.mesh.moment_inertia), dtype='float32')
243
+ else:
244
+ fil.create_dataset('inertia/tensor', data=self.mesh.moment_inertia, dtype='float32')
245
+
246
+ def load_h5(self, file):
247
+ print('=== file: ', file)
248
+ self.filebase = os.path.splitext(file)[0]
249
+ path, _ = os.path.split(file)
250
+ with h5py.File(file, 'r') as fil:
251
+ V = fil['mesh/vertices'][()]
252
+ T = fil['mesh/faces'][()]
253
+ if 'mesh/colors' in fil:
254
+ C = fil['mesh/colors'][()]
255
+ else:
256
+ C = None
257
+
258
+ texture = None
259
+ texImage = None
260
+ if 'mesh/textureFile' in fil:
261
+ self.textureFile = fil['mesh/textureFile'][()]
262
+ self.textureFile = ''.join([chr(i) for i in self.textureFile])[:-1] #cut the last embedding zero
263
+ print(self.textureFile)
264
+ texImage = Image.open(os.path.join(path, self.textureFile))
265
+ material = trimesh.visual.texture.SimpleMaterial(image=texImage)
266
+ if 'mesh/textureImg' in fil:
267
+ texImage = fil['mesh/textureImg'][()]
268
+ material = trimesh.visual.texture.SimpleMaterial(image=texImage)
269
+ if 'mesh/textureCoords' in fil and texImage is not None:
270
+ uv = fil['mesh/textureCoords'][()]
271
+ uv[:, 1] = 1 - uv[:, 1]
272
+ texture = trimesh.visual.TextureVisuals(uv=uv, image=texImage)
273
+
274
+ if texture is None:
275
+ self.mesh = trimesh.Trimesh(vertices=V, faces=T, vertex_colors=C, process=True)
276
+ else:
277
+ self.mesh = trimesh.Trimesh(vertices=V, faces=T, visual=texture, material=material, process=True)
278
+
279
+ # colors = self.mesh.visual.material.to_color(self.mesh.visual.uv)
280
+ # colors = mat.to_color(uv)
281
+ # vis = trimesh.visual.ColorVisuals(mesh=self.mesh, vertex_colors=colors)
282
+ # self.mesh.visual = vis
283
+
284
+
285
+ def apply_texture(self, texture_path):
286
+ try:
287
+ texture_image = Image.open(texture_path)
288
+ texture = trimesh.visual.TextureVisuals(image=texture_image, uv=self.mesh.visual.uv)
289
+ self.mesh.visual = texture
290
+
291
+ # texture = np.array(texture_image).astype(float) / 255.0
292
+ # if texture.shape[-1] == 3:
293
+ # alpha = np.ones((texture.shape[0], texture.shape[1], 1))
294
+ # texture = np.concatenate([texture, alpha], axis=-1)
295
+
296
+ # if not hasattr(self.mesh.visual, 'uv'):
297
+ # raise ValueError("Mesh does not have UV coordinates!")
298
+
299
+ # uv_coords = self.mesh.visual.uv
300
+ # uv_coords_copy = uv_coords.copy()
301
+ # uv_coords_copy[:, 1] = 1 - uv_coords_copy[:, 1]
302
+
303
+ # pixel_coords = (uv_coords_copy * [texture.shape[1] - 1, texture.shape[0] - 1]).astype(int)
304
+ # vertex_colors = texture[pixel_coords[:, 1], pixel_coords[:, 0]]
305
+
306
+ # self.mesh.visual = trimesh.visual.ColorVisuals(mesh=self.mesh, vertex_colors=vertex_colors)
307
+ except Exception as e:
308
+ print(texture_path, "is not a valid texture path or could not be applied to the mesh.", e)
309
+
310
+
311
+ # def apply_scaling(self, tri_obj, scale):
312
+ # if scale != 1.0:
313
+ # print(scale)
314
+ # scaling_mat = scale * np.eye(4)
315
+ # scaling_mat[-1, -1] = 1.0
316
+ # tri_obj.apply_transform(scaling_mat)
317
+
318
+
319
+ # def export_mesh(self, tri_obj, meshfile, ply_out, transformInertia, cvxDecomp):
320
+ # tri_obj.export(ply_out)
321
+ # print(f"Converted {meshfile}")
322
+ # M = MeshHelper(ply_out)
323
+ # if transformInertia:
324
+ # self.pose = M.transformInertia()
325
+ # if cvxDecomp:
326
+ # M.createDecomposition()
327
+ # M.export_h5(meshfile[:-3]+'h5', inertia=False)
328
+
329
+
330
+ # def obj2ply(self, ply_out: str, scale: float=1.0, texture_path: str="none", transformInertia = False, cvxDecomp = False) -> bool:
331
+ # tri_obj = self.mesh
332
+ # if hasattr(tri_obj.visual, 'to_color'):
333
+ # if texture_path == "none":
334
+ # tri_obj.visual = tri_obj.visual.to_color()
335
+ # else:
336
+ # self.apply_texture(tri_obj, texture_path)
337
+
338
+ # elif hasattr(tri_obj.visual, 'vertex_colors'):
339
+ # print("Mesh already has vertex colors.")
340
+
341
+ # else:
342
+ # print(f"Failed on {tri_obj}")
343
+ # return False
344
+
345
+ # self.apply_scaling(tri_obj, scale)
346
+ # self.export_mesh(tri_obj, self.file, ply_out, transformInertia, cvxDecomp)
347
+
348
+ # return True
349
+
350
+ def timeout(signum, frame):
351
+ raise Exception("timeout handler")
352
+
353
+ def get_sdf(mesh, N=30):
354
+ #scale_mesh(mesh, .1)
355
+ # get bounds
356
+ bounds = mesh.bounds.copy()
357
+ size = bounds[1] - bounds[0]
358
+ # enlarge by 10%
359
+ bounds[0] = bounds[0] - .1 * size
360
+ bounds[1] = bounds[1] + .1 * size
361
+ size = bounds[1] - bounds[0]
362
+ # decide on a voxel size
363
+ voxelSize = 1. / (N * np.power(np.prod(size), -1. / 3))
364
+ gridDim = (size / voxelSize).astype(int) + 2
365
+ # change bounds[1] to be on the grid
366
+ bounds[1] = bounds[0] + voxelSize * (gridDim - 1)
367
+ print(' sdf voxel:', voxelSize, 'dim:', gridDim, 'mem:', np.prod(gridDim))
368
+ # create grid
369
+ x_range = np.linspace(bounds[0, 0], bounds[1, 0], num=gridDim[0])
370
+ y_range = np.linspace(bounds[0, 1], bounds[1, 1], num=gridDim[1])
371
+ z_range = np.linspace(bounds[0, 2], bounds[1, 2], num=gridDim[2])
372
+ grid = np.stack(np.meshgrid(x_range, y_range, z_range, indexing='ij'), axis=-1)
373
+ # get sdf
374
+ #sdf = -mesh.nearest.signed_distance(grid).reshape(gridDim)
375
+ sdf = np.empty(gridDim)
376
+ for z in range(0, sdf.shape[2]):
377
+ print('\r slice', z, end=' ', flush=True)
378
+ sdf[:,:,z] = -mesh.nearest.signed_distance(grid[:,:,z,:].reshape(-1, 3)).reshape(gridDim[:2])
379
+ print('- done')
380
+ #scale_mesh(mesh, 10.)
381
+ #bounds *= 10.
382
+ return [sdf, bounds]
383
+
384
+ def display_sdf(sdf):
385
+ ax = plt.subplot()
386
+ cax = plt.axes([0.85, 0.1, 0.075, 0.8])
387
+ for z in range(0, sdf.shape[2]):
388
+ print(z)
389
+ print(sdf[:, :, z])
390
+ im = ax.imshow(sdf[:, :, z])
391
+ plt.colorbar(im, cax=cax)
392
+ plt.pause(.2)
393
+
394
+
395
+
@@ -0,0 +1,19 @@
1
+ import yaml
2
+ #from ruamel import yaml
3
+
4
+ # yaml dump tweaks
5
+ class noflow_dict(dict):
6
+ pass
7
+ def noflow_dict_rep(dumper, data):
8
+ return dumper.represent_mapping("tag:yaml.org,2002:map", data, flow_style=False)
9
+ yaml.add_representer(noflow_dict, noflow_dict_rep)
10
+
11
+ class quoted_string(str):
12
+ pass
13
+ def quoted_string_rep(dumper, data):
14
+ return dumper.represent_scalar("tag:yaml.org,2002:str", data, style='"')
15
+ yaml.add_representer(quoted_string, quoted_string_rep)
16
+
17
+ def yaml_write_dict(data, filename):
18
+ with open(filename, 'w') as fil:
19
+ yaml.dump(noflow_dict(data), fil, default_flow_style=True, sort_keys=False, width=500)
robotic/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.2.9.dev1'
1
+ __version__ = '0.2.9.dev2'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: robotic
3
- Version: 0.2.9.dev1
3
+ Version: 0.2.9.dev2
4
4
  Summary: Robotic Control Interface & Manipulation Planning Library
5
5
  Home-page: https://github.com/MarcToussaint/robotic/
6
6
  Author: Marc Toussaint