robotic 0.2.8.dev4__cp311-cp311-manylinux2014_x86_64.whl → 0.3.4.dev5__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.
- robotic/DataGen.pyi +11 -1
- robotic/__init__.py +8 -1
- robotic/_robotic.pyi +236 -114
- robotic/_robotic.so +0 -0
- robotic/algo.pyi +17 -0
- robotic/include/rai/{Geo → Algo}/Lewiner/MarchingCubes.h +0 -29
- robotic/include/rai/Algo/SplineCtrlFeed.h +1 -1
- robotic/include/rai/Algo/marching_cubes.h +9 -0
- robotic/include/rai/Algo/rungeKutta.h +2 -2
- robotic/include/rai/Algo/spline.h +4 -8
- robotic/include/rai/Algo/trilinear.h +10 -0
- robotic/include/rai/Control/CtrlSolver.h +1 -1
- robotic/include/rai/Control/TimingMPC.h +2 -2
- robotic/include/rai/Core/array.h +99 -64
- robotic/include/rai/Core/array.ipp +290 -136
- robotic/include/rai/Core/arrayDouble.h +36 -26
- robotic/include/rai/Core/defines.h +7 -9
- robotic/include/rai/Core/graph.h +33 -37
- robotic/include/rai/Core/h5.h +3 -1
- robotic/include/rai/Core/thread.h +12 -12
- robotic/include/rai/Core/util.h +58 -79
- robotic/include/rai/DataGen/rndStableConfigs.h +1 -0
- robotic/include/rai/DataGen/shapenetGrasps.h +5 -3
- robotic/include/rai/Geo/depth2PointCloud.h +2 -0
- robotic/include/rai/Geo/geo.h +24 -16
- robotic/include/rai/Geo/{fclInterface.h → i_fcl.h} +3 -1
- robotic/include/rai/Geo/mesh.h +22 -16
- robotic/include/rai/Geo/pairCollision.h +43 -43
- robotic/include/rai/Geo/signedDistanceFunctions.h +7 -5
- robotic/include/rai/Geo/stb_image.h +1 -1
- robotic/include/rai/Gui/RenderData.h +12 -9
- robotic/include/rai/Gui/opengl.h +6 -6
- robotic/include/rai/Gui/plot.h +1 -1
- robotic/include/rai/KOMO/komo.h +6 -3
- robotic/include/rai/KOMO/komo_NLP.h +2 -2
- robotic/include/rai/KOMO/manipTools.h +7 -2
- robotic/include/rai/KOMO/testProblems_KOMO.h +5 -9
- robotic/include/rai/Kin/F_forces.h +3 -3
- robotic/include/rai/Kin/cameraview.h +24 -36
- robotic/include/rai/Kin/dof_forceExchange.h +7 -7
- robotic/include/rai/Kin/feature.h +1 -1
- robotic/include/rai/Kin/frame.h +24 -26
- robotic/include/rai/Kin/{kin_physx.h → i_Physx.h} +11 -10
- robotic/include/rai/Kin/kin.h +30 -20
- robotic/include/rai/Kin/proxy.h +1 -1
- robotic/include/rai/Kin/simulation.h +20 -10
- robotic/include/rai/Kin/viewer.h +14 -1
- robotic/include/rai/LGP/LGP_TAMP_Abstraction.h +33 -0
- robotic/include/rai/LGP/LGP_Tool.h +4 -25
- robotic/include/rai/LGP/LGP_computers.h +1 -1
- robotic/include/rai/LGP/LGP_computers2.h +196 -0
- robotic/include/rai/LGP/NLP_Descriptor.h +5 -0
- robotic/include/rai/Logic/folWorld.h +1 -1
- robotic/include/rai/Logic/treeSearchDomain.h +2 -2
- robotic/include/rai/Optim/BayesOpt.h +13 -6
- robotic/include/rai/Optim/CMA/boundary_transformation.h +73 -0
- robotic/include/rai/Optim/CMA/cmaes.h +175 -0
- robotic/include/rai/Optim/CMA/cmaes_interface.h +68 -0
- robotic/include/rai/Optim/GlobalIterativeNewton.h +7 -3
- robotic/include/rai/Optim/NLP.h +23 -7
- robotic/include/rai/Optim/NLP_GraphSolver.h +1 -1
- robotic/include/rai/Optim/NLP_Solver.h +5 -5
- robotic/include/rai/Optim/constrained.h +4 -4
- robotic/include/rai/Optim/{opt-ceres.h → i_Ceres.h} +2 -2
- robotic/include/rai/Optim/{opt-nlopt.h → i_NLopt.h} +4 -0
- robotic/include/rai/Optim/lagrangian.h +7 -5
- robotic/include/rai/Optim/liblbfgs/liblbfgs.h +755 -0
- robotic/include/rai/Optim/m_EvoStrategies.h +114 -0
- robotic/include/rai/Optim/{gradient.h → m_Gradient.h} +13 -12
- robotic/include/rai/Optim/m_LBFGS.h +21 -0
- robotic/include/rai/Optim/m_LeastSquaresZeroOrder.h +104 -0
- robotic/include/rai/Optim/m_LocalGreedy.h +31 -0
- robotic/include/rai/Optim/m_NelderMead.h +23 -0
- robotic/include/rai/Optim/{newton.h → m_Newton.h} +7 -4
- robotic/include/rai/Optim/{SlackGaussNewton.h → m_SlackGaussNewton.h} +0 -10
- robotic/include/rai/Optim/options.h +8 -7
- robotic/include/rai/Optim/primalDual.h +10 -6
- robotic/include/rai/Optim/testProblems_Opt.h +25 -19
- robotic/include/rai/Optim/utils.h +16 -85
- robotic/include/rai/PathAlgos/ConfigurationProblem.h +3 -2
- robotic/include/rai/PathAlgos/RRT_PathFinder.h +2 -2
- robotic/include/rai/Perception/pcl.h +10 -10
- robotic/include/rai/Perception/surfels.h +1 -1
- robotic/include/rai/Search/TreeSearchNode.h +1 -1
- robotic/include/rai/ry/py-algo.h +17 -0
- robotic/include/rai/ry/types.h +4 -2
- robotic/librai.so +0 -0
- robotic/manipulation.py +5 -7
- robotic/meshTool +0 -0
- robotic/mujoco-import.py +8 -0
- robotic/rai-robotModels/g1/g1.g +11 -2
- robotic/rai-robotModels/g1/g1_29dof_conv.yml +64 -0
- robotic/rai-robotModels/g1/g1_clean.g +38 -73
- robotic/rai-robotModels/g1/meshes/head_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_ankle_pitch_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_ankle_roll_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_elbow_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_hip_pitch_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_hip_roll_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_hip_yaw_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_knee_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_rubber_hand.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_shoulder_pitch_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_shoulder_roll_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_shoulder_yaw_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_wrist_pitch_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_wrist_roll_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_wrist_yaw_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/logo_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/pelvis.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/pelvis_contour_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_ankle_pitch_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_ankle_roll_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_elbow_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_hip_pitch_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_hip_roll_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_hip_yaw_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_knee_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_rubber_hand.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_shoulder_pitch_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_shoulder_roll_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_shoulder_yaw_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_wrist_pitch_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_wrist_roll_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_wrist_yaw_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/torso_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/waist_roll_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/waist_support_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/waist_yaw_link.h5 +0 -0
- robotic/rai-robotModels/objects/shelf.g +1 -1
- robotic/rai-robotModels/panda/meshes/finger.h5 +0 -0
- robotic/rai-robotModels/panda/meshes/hand.h5 +0 -0
- robotic/rai-robotModels/panda/meshes/link0.h5 +0 -0
- robotic/rai-robotModels/panda/meshes/link1.h5 +0 -0
- robotic/rai-robotModels/panda/meshes/link2.h5 +0 -0
- robotic/rai-robotModels/panda/meshes/link3.h5 +0 -0
- robotic/rai-robotModels/panda/meshes/link4.h5 +0 -0
- robotic/rai-robotModels/panda/meshes/link5.h5 +0 -0
- robotic/rai-robotModels/panda/meshes/link6.h5 +0 -0
- robotic/rai-robotModels/panda/meshes/link7.h5 +0 -0
- robotic/rai-robotModels/panda/panda.g +10 -10
- robotic/rai-robotModels/panda/panda_arm_hand_conv.g +24 -0
- robotic/rai-robotModels/panda/panda_arm_hand_conv.yml +24 -0
- robotic/rai-robotModels/panda/panda_clean.g +21 -45
- robotic/rai-robotModels/panda/panda_gripper.g +5 -7
- robotic/rai-robotModels/panda/panda_withoutCollisionModels.g +3 -11
- robotic/rai-robotModels/pr2/meshes/base.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/base_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/caster.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/elbow_flex.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/elbow_flex_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/forearm.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/forearm_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/forearm_roll.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/gripper_palm.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/gripper_palm_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/head_pan.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/head_pan_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/head_tilt.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/head_tilt_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/l_finger.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/l_finger_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/l_finger_tip.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/l_finger_tip_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/shoulder_lift.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/shoulder_lift_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/shoulder_pan.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/shoulder_pan_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/tilting_hokuyo.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/tilting_hokuyo_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/torso_lift.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/torso_lift_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/upper_arm.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/upper_arm_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/upper_arm_roll.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/upper_arm_roll_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/wheel.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/wheel_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/wrist_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/wrist_flex.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/wrist_roll.h5 +0 -0
- robotic/rai-robotModels/pr2/pr2.g +12 -12
- robotic/rai-robotModels/pr2/pr2_clean.g +122 -118
- robotic/rai-robotModels/pr2/pr2_conv.g +218 -0
- robotic/rai-robotModels/pr2/pr2_modifications.g +2 -2
- robotic/rai-robotModels/ranger/meshes/ranger_mini3.h5 +0 -0
- robotic/rai-robotModels/ranger/meshes/ranger_mini_v3_wheel.h5 +0 -0
- robotic/rai-robotModels/ranger/meshes/ranger_mini_v3_wheel_right.h5 +0 -0
- robotic/rai-robotModels/ranger/ranger.g +33 -0
- robotic/rai-robotModels/ranger/ranger_clean.g +18 -0
- robotic/rai-robotModels/ranger/ranger_mini_conv.g +14 -0
- robotic/rai-robotModels/robotiq/meshes/robotiq_arg2f_85_base_link.h5 +0 -0
- robotic/rai-robotModels/robotiq/meshes/robotiq_arg2f_85_inner_finger.h5 +0 -0
- robotic/rai-robotModels/robotiq/meshes/robotiq_arg2f_85_inner_knuckle.h5 +0 -0
- robotic/rai-robotModels/robotiq/meshes/robotiq_arg2f_85_outer_finger.h5 +0 -0
- robotic/rai-robotModels/robotiq/meshes/robotiq_arg2f_85_outer_knuckle.h5 +0 -0
- robotic/rai-robotModels/robotiq/robotiq.g +2 -2
- robotic/rai-robotModels/robotiq/robotiq_arg2f_85_model_conv.yml +19 -0
- robotic/rai-robotModels/robotiq/robotiq_clean.g +16 -16
- robotic/rai-robotModels/scenarios/ballFinger.g +2 -2
- robotic/rai-robotModels/scenarios/liftRing.g +2 -2
- robotic/rai-robotModels/scenarios/pandaFloatingGripper.g +1 -1
- robotic/rai-robotModels/scenarios/pandaSingle.g +1 -1
- robotic/rai-robotModels/scenarios/panda_fixRobotiq.g +3 -3
- robotic/rai-robotModels/tests/arm.g +18 -19
- robotic/rai-robotModels/tests/compound.g +3 -6
- robotic/rai-robotModels/ur10/meshes/base.h5 +0 -0
- robotic/rai-robotModels/ur10/meshes/forearm.h5 +0 -0
- robotic/rai-robotModels/ur10/meshes/shoulder.h5 +0 -0
- robotic/rai-robotModels/ur10/meshes/upperarm.h5 +0 -0
- robotic/rai-robotModels/ur10/meshes/wrist1.h5 +0 -0
- robotic/rai-robotModels/ur10/meshes/wrist2.h5 +0 -0
- robotic/rai-robotModels/ur10/meshes/wrist3.h5 +0 -0
- robotic/rai-robotModels/ur10/ur10.g +2 -2
- robotic/rai-robotModels/ur10/ur10_clean.g +8 -8
- robotic/rai-robotModels/ur10/ur10_conv.g +17 -0
- robotic/ry-h5info +3 -8
- robotic/ry-test +6 -5
- robotic/ry-urdfConvert.py +74 -0
- robotic/ry-view +28 -6
- robotic/src/__init__.py +0 -0
- robotic/src/cleanMeshes.py +59 -0
- robotic/src/h5_helper.py +46 -0
- robotic/src/h5_helper.py~ +42 -0
- robotic/src/mesh_helper.py +395 -0
- robotic/src/meshlabFilters.mlx +20 -0
- robotic/src/mujoco_io.py +242 -0
- robotic/src/urdf_io.py +237 -0
- robotic/src/yaml_helper.py +29 -0
- robotic/version.py +1 -1
- {robotic-0.2.8.dev4.data → robotic-0.3.4.dev5.data}/scripts/ry-h5info +3 -8
- {robotic-0.2.8.dev4.data → robotic-0.3.4.dev5.data}/scripts/ry-test +6 -5
- robotic-0.3.4.dev5.data/scripts/ry-urdfConvert.py +74 -0
- robotic-0.3.4.dev5.data/scripts/ry-view +46 -0
- {robotic-0.2.8.dev4.dist-info → robotic-0.3.4.dev5.dist-info}/METADATA +20 -23
- robotic-0.3.4.dev5.dist-info/RECORD +386 -0
- {robotic-0.2.8.dev4.dist-info → robotic-0.3.4.dev5.dist-info}/WHEEL +1 -1
- robotic/nlp.py +0 -113
- robotic/rai-robotModels/baxter/baxter.g +0 -49
- robotic/rai-robotModels/baxter/baxter_clean.g +0 -116
- robotic/rai-robotModels/baxter/baxter_clean2.g +0 -205
- robotic/rai-robotModels/baxter/baxter_clean3.g +0 -223
- robotic/rai-robotModels/baxter/baxter_description/meshes/base/PEDESTAL.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/base/pedestal_link_collision.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/head/H0.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/head/H1.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/lower_elbow/E1.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/lower_forearm/W1.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/lower_shoulder/S1.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/torso/base_link.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/torso/base_link_collision.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/upper_elbow/E0.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/upper_forearm/W0.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/upper_shoulder/S0.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/wrist/W2.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_new.g +0 -53
- robotic/rai-robotModels/baxter/rethink_ee_description/meshes/electric_gripper/electric_gripper_base.ply +0 -0
- robotic/rai-robotModels/baxter/rethink_ee_description/meshes/electric_gripper/fingers/extended_narrow.ply +0 -0
- robotic/rai-robotModels/baxter/rethink_ee_description/meshes/electric_gripper/fingers/half_round_tip.ply +0 -0
- robotic/rai-robotModels/baxter/rethink_ee_description/meshes/electric_gripper/fingers/paddle_tip.ply +0 -0
- robotic/rai-robotModels/baxter/rethink_ee_description/meshes/pneumatic_gripper/pneumatic_gripper_base.ply +0 -0
- robotic/rai-robotModels/baxter/rethink_ee_description/meshes/pneumatic_gripper/pneumatic_gripper_w_cup.ply +0 -0
- robotic/rai-robotModels/g1/meshes/head_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_ankle_pitch_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_ankle_roll_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_elbow_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hand_index_0_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hand_index_1_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hand_middle_0_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hand_middle_1_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hand_palm_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hand_thumb_0_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hand_thumb_1_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hand_thumb_2_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hip_pitch_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hip_roll_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hip_yaw_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_knee_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_rubber_hand.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_shoulder_pitch_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_shoulder_roll_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_shoulder_yaw_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_wrist_pitch_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_wrist_roll_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_wrist_roll_rubber_hand.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_wrist_yaw_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/logo_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/pelvis.ply +0 -0
- robotic/rai-robotModels/g1/meshes/pelvis_contour_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_ankle_pitch_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_ankle_roll_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_elbow_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hand_index_0_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hand_index_1_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hand_middle_0_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hand_middle_1_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hand_palm_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hand_thumb_0_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hand_thumb_1_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hand_thumb_2_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hip_pitch_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hip_roll_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hip_yaw_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_knee_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_rubber_hand.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_shoulder_pitch_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_shoulder_roll_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_shoulder_yaw_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_wrist_pitch_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_wrist_roll_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_wrist_roll_rubber_hand.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_wrist_yaw_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/torso_constraint_L_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/torso_constraint_L_rod_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/torso_constraint_R_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/torso_constraint_R_rod_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/torso_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/waist_constraint_L.ply +0 -0
- robotic/rai-robotModels/g1/meshes/waist_constraint_R.ply +0 -0
- robotic/rai-robotModels/g1/meshes/waist_roll_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/waist_support_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/waist_yaw_link.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/finger.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/hand.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/link0.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/link1.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/link2.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/link3.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/link4.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/link5.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/link6.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/link7.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/HOWTO.sh +0 -10
- robotic/rai-robotModels/panda/franka_description/meshes/visual/HOWTO2.sh +0 -7
- robotic/rai-robotModels/panda/franka_description/meshes/visual/convMeshes.mlx +0 -38
- robotic/rai-robotModels/panda/franka_description/meshes/visual/finger.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/hand.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/link0.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/link1.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/link2.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/link3.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/link4.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/link5.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/link6.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/link7.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/script.mlx +0 -28
- robotic/rai-robotModels/pr2/pr2_description/meshes/base_v0/base.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/base_v0/base_L.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/base_v0/caster.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/base_v0/caster_L.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/base_v0/pr2_wheel.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/base_v0/wheel.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/forearm_v0/forearm.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/forearm_v0/wrist_flex.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/forearm_v0/wrist_roll.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/forearm_v0/wrist_roll_L.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/gripper_v0/gripper_palm.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/gripper_v0/l_finger.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/gripper_v0/l_finger_tip.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/head_v0/head_pan.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/head_v0/head_pan_L.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/head_v0/head_tilt.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/head_v0/head_tilt_L.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/shoulder_v0/shoulder_lift.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/shoulder_v0/shoulder_pan.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/shoulder_v0/shoulder_yaw.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/shoulder_v0/upper_arm_roll.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/shoulder_v0/upper_arm_roll_L.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/tilting_laser_v0/hok_tilt.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/tilting_laser_v0/tilting_hokuyo.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/tilting_laser_v0/tilting_hokuyo_L.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/torso_v0/torso.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/torso_v0/torso_lift.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/torso_v0/torso_lift_L.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/upper_arm_v0/elbow_flex.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/upper_arm_v0/forearm_roll.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/upper_arm_v0/forearm_roll_L.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/upper_arm_v0/upper_arm.ply +0 -0
- robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_base_link.ply +0 -0
- robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_base_link_x.ply +0 -10
- robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_inner_finger.ply +0 -0
- robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_inner_knuckle.ply +0 -0
- robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_outer_finger.ply +0 -0
- robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_outer_knuckle.ply +0 -0
- robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_pad.ply +0 -0
- robotic/rai-robotModels/robotiq/meshes/visual/robotiq_gripper_coupling.ply +0 -0
- robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/Base.ply +0 -0
- robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/Forearm.ply +0 -0
- robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/Shoulder.ply +0 -0
- robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/UpperArm.ply +0 -0
- robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/Wrist1.ply +0 -0
- robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/Wrist2.ply +0 -0
- robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/Wrist3.ply +0 -0
- robotic/ry-urdf2rai +0 -222
- robotic/ry-urdf2yaml +0 -250
- robotic-0.2.8.dev4.data/scripts/ry-urdf2rai +0 -222
- robotic-0.2.8.dev4.data/scripts/ry-urdf2yaml +0 -250
- robotic-0.2.8.dev4.data/scripts/ry-view +0 -24
- robotic-0.2.8.dev4.dist-info/RECORD +0 -413
- /robotic/include/rai/{Geo → Algo}/Lewiner/LookUpTable.h +0 -0
- /robotic/include/rai/Geo/{assimpInterface.h → i_assimp.h} +0 -0
- /robotic/include/rai/Kin/{kin_bullet.h → i_Bullet.h} +0 -0
- /robotic/include/rai/Kin/{kin_feather.h → i_Feather.h} +0 -0
- /robotic/include/rai/Kin/{kin_ode.h → i_Ode.h} +0 -0
- /robotic/include/rai/Optim/{opt-ipopt.h → i_Ipopt.h} +0 -0
- /robotic/rai-robotModels/robotiq/meshes/{visual/robotiq_ft300.ply → robotiq_ft300.ply} +0 -0
- {robotic-0.2.8.dev4.data → robotic-0.3.4.dev5.data}/scripts/ry-bot +0 -0
- {robotic-0.2.8.dev4.data → robotic-0.3.4.dev5.data}/scripts/ry-info +0 -0
- {robotic-0.2.8.dev4.data → robotic-0.3.4.dev5.data}/scripts/ry-meshTool +0 -0
- {robotic-0.2.8.dev4.dist-info → robotic-0.3.4.dev5.dist-info/licenses}/LICENSE +0 -0
- {robotic-0.2.8.dev4.dist-info → robotic-0.3.4.dev5.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import glob
|
|
5
|
+
import os
|
|
6
|
+
from robotic.src.mesh_helper import *
|
|
7
|
+
|
|
8
|
+
parser = argparse.ArgumentParser(
|
|
9
|
+
description='Utility to clean meshes in meshes/')
|
|
10
|
+
|
|
11
|
+
parser.add_argument('-view', help='view mesh', action="store_true")
|
|
12
|
+
parser.add_argument('-meshlab', help='apply meshlab filters', action="store_true", default=False)
|
|
13
|
+
|
|
14
|
+
def main():
|
|
15
|
+
args = parser.parse_args()
|
|
16
|
+
|
|
17
|
+
files = sorted(glob.glob('meshes/*.h5'))
|
|
18
|
+
|
|
19
|
+
for file in files:
|
|
20
|
+
if file[-4]=='-':
|
|
21
|
+
continue
|
|
22
|
+
|
|
23
|
+
M = MeshHelper(file)
|
|
24
|
+
if M.mesh is None:
|
|
25
|
+
continue
|
|
26
|
+
|
|
27
|
+
#-- repair
|
|
28
|
+
print(' before repair:')
|
|
29
|
+
M.report()
|
|
30
|
+
M.repair(mergeTolerance=1e-4)
|
|
31
|
+
# M.texture2vertexColors()
|
|
32
|
+
print(' after repair:')
|
|
33
|
+
print(' watertight:', M.mesh.is_watertight)
|
|
34
|
+
print(' oriented:', M.mesh.is_winding_consistent)
|
|
35
|
+
M.report()
|
|
36
|
+
|
|
37
|
+
#-- export/view
|
|
38
|
+
M.export_h5()
|
|
39
|
+
# M.export_h5(M.filebase+'-.h5')
|
|
40
|
+
if args.view:
|
|
41
|
+
M.view()
|
|
42
|
+
|
|
43
|
+
#-- meshlab processing
|
|
44
|
+
if args.meshlab:
|
|
45
|
+
M.export_ply('z.ply')
|
|
46
|
+
print('<<< meshlab <<<')
|
|
47
|
+
ret = os.system(f'meshlabserver -i z.ply -o {M.filebase}.ply -m vc -s meshlabFilters.mlx')
|
|
48
|
+
print('>>> meshlab >>>')
|
|
49
|
+
if not ret:
|
|
50
|
+
M2 = MeshHelper(f'{M.filebase}.ply')
|
|
51
|
+
# uv = M2.mesh.visual.uv
|
|
52
|
+
# M2.mesh.visual = M.mesh.visual
|
|
53
|
+
# M2.mesh.visual.uv = uv
|
|
54
|
+
# M2.view()
|
|
55
|
+
M2.export_h5(M.filebase+'.h5')
|
|
56
|
+
# os.system(f'rm z.ply {M.filebase}.ply')
|
|
57
|
+
|
|
58
|
+
if __name__ == "__main__":
|
|
59
|
+
main()
|
robotic/src/h5_helper.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import h5py
|
|
5
|
+
import json
|
|
6
|
+
import ast
|
|
7
|
+
|
|
8
|
+
class H5Writer:
|
|
9
|
+
def __init__(self, filename):
|
|
10
|
+
self.fil = h5py.File(filename, 'w')
|
|
11
|
+
|
|
12
|
+
def write(self, name, data, dtype = 'float64'):
|
|
13
|
+
self.fil.create_dataset(name, data=data, dtype=dtype)
|
|
14
|
+
|
|
15
|
+
def write_dict(self, name, data):
|
|
16
|
+
self.write(name, bytearray(json.dumps(data), 'utf-8'), dtype='int8')
|
|
17
|
+
|
|
18
|
+
class H5Reader:
|
|
19
|
+
def __init__(self, filename):
|
|
20
|
+
self.fil = h5py.File(filename, 'r')
|
|
21
|
+
|
|
22
|
+
def print_attrs(self, name, obj):
|
|
23
|
+
if isinstance(obj, h5py.Dataset):
|
|
24
|
+
print(' ', obj.name, obj.shape, obj.dtype, f'{obj.size*obj.dtype.itemsize/1024:.2f}kB')
|
|
25
|
+
if obj.dtype=='int8':
|
|
26
|
+
str = ''.join([chr(x) for x in obj[()]])
|
|
27
|
+
print(' ', str)
|
|
28
|
+
elif obj.size<20:
|
|
29
|
+
print(' ', obj[()])
|
|
30
|
+
else:
|
|
31
|
+
print('---', obj.name)
|
|
32
|
+
|
|
33
|
+
def print_info(self):
|
|
34
|
+
self.fil.visititems(self.print_attrs)
|
|
35
|
+
|
|
36
|
+
def read(self, name):
|
|
37
|
+
return self.fil[name][()]
|
|
38
|
+
|
|
39
|
+
def read_dict(self, name):
|
|
40
|
+
obj = self.fil[name]
|
|
41
|
+
assert obj.dtype=='int8'
|
|
42
|
+
str = ''.join([chr(x) for x in obj[()]])
|
|
43
|
+
d = ast.literal_eval(str)
|
|
44
|
+
return d
|
|
45
|
+
|
|
46
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import h5py
|
|
5
|
+
import ast
|
|
6
|
+
|
|
7
|
+
class H5Writer:
|
|
8
|
+
def __init__(self, filename):
|
|
9
|
+
self.fil = h5py.File(filename, 'w')
|
|
10
|
+
|
|
11
|
+
def write(self, name, data, dtype = 'float64'):
|
|
12
|
+
self.fil.create_dataset(name, data=data, dtype=dtype)
|
|
13
|
+
|
|
14
|
+
class H5Reader:
|
|
15
|
+
def __init__(self, filename):
|
|
16
|
+
self.fil = h5py.File(filename, 'r')
|
|
17
|
+
|
|
18
|
+
def print_attrs(self, name, obj):
|
|
19
|
+
if isinstance(obj, h5py.Dataset):
|
|
20
|
+
print(' ', obj.name, obj.shape, obj.dtype, f'{obj.size*obj.dtype.itemsize/1024:.2f}kB')
|
|
21
|
+
if obj.dtype=='int8':
|
|
22
|
+
str = ''.join([chr(x) for x in obj[()]])
|
|
23
|
+
print(' ', str)
|
|
24
|
+
elif obj.size<20:
|
|
25
|
+
print(' ', obj[()])
|
|
26
|
+
else:
|
|
27
|
+
print('---', obj.name)
|
|
28
|
+
|
|
29
|
+
def print_info(self):
|
|
30
|
+
self.fil.visititems(self.print_attrs)
|
|
31
|
+
|
|
32
|
+
def read(self, name):
|
|
33
|
+
return self.fil[name][()]
|
|
34
|
+
|
|
35
|
+
def read_dict(self, name):
|
|
36
|
+
obj = self.fil[name]
|
|
37
|
+
assert obj.dtype=='int8'
|
|
38
|
+
str = ''.join([chr(x) for x in obj[()]])
|
|
39
|
+
d = ast.literal_eval(str)
|
|
40
|
+
return d
|
|
41
|
+
|
|
42
|
+
|
|
@@ -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,20 @@
|
|
|
1
|
+
<!DOCTYPE FilterScript>
|
|
2
|
+
<FilterScript>
|
|
3
|
+
<filter name="Repair non Manifold Edges by removing faces"/>
|
|
4
|
+
<filter name="Simplification: Quadric Edge Collapse Decimation">
|
|
5
|
+
<Param tooltip="The desired final number of faces." type="RichInt" description="Target number of faces" value="20000" name="TargetFaceNum"/>
|
|
6
|
+
<Param tooltip="If non zero, this parameter specifies the desired final size of the mesh as a percentage of the initial size." type="RichFloat" description="Percentage reduction (0..1)" value="0" name="TargetPerc"/>
|
|
7
|
+
<Param tooltip="Quality threshold for penalizing bad shaped faces.<br>The value is in the range [0..1]
 0 accept any kind of face (no penalties),
 0.5 penalize faces with quality < 0.5, proportionally to their shape
" type="RichFloat" description="Quality threshold" value="0.3" name="QualityThr"/>
|
|
8
|
+
<Param tooltip="The simplification process tries to do not affect mesh boundaries during simplification" type="RichBool" description="Preserve Boundary of the mesh" value="false" name="PreserveBoundary"/>
|
|
9
|
+
<Param tooltip="The importance of the boundary during simplification. Default (1.0) means that the boundary has the same importance of the rest. Values greater than 1.0 raise boundary importance and has the effect of removing less vertices on the border. Admitted range of values (0,+inf). " type="RichFloat" description="Boundary Preserving Weight" value="1" name="BoundaryWeight"/>
|
|
10
|
+
<Param tooltip="Try to avoid face flipping effects and try to preserve the original orientation of the surface" type="RichBool" description="Preserve Normal" value="false" name="PreserveNormal"/>
|
|
11
|
+
<Param tooltip="Avoid all the collapses that should cause a topology change in the mesh (like closing holes, squeezing handles, etc). If checked the genus of the mesh should stay unchanged." type="RichBool" description="Preserve Topology" value="false" name="PreserveTopology"/>
|
|
12
|
+
<Param tooltip="Each collapsed vertex is placed in the position minimizing the quadric error.
 It can fail (creating bad spikes) in case of very flat areas. 
If disabled edges are collapsed onto one of the two original vertices and the final mesh is composed by a subset of the original vertices. " type="RichBool" description="Optimal position of simplified vertices" value="true" name="OptimalPlacement"/>
|
|
13
|
+
<Param tooltip="Add additional simplification constraints that improves the quality of the simplification of the planar portion of the mesh, as a side effect, more triangles will be preserved in flat areas (allowing better shaped triangles)." type="RichBool" description="Planar Simplification" value="false" name="PlanarQuadric"/>
|
|
14
|
+
<Param tooltip="How much we should try to preserve the triangles in the planar regions. If you lower this value planar areas will be simplified more." type="RichFloat" description="Planar Simp. Weight" value="0.001" name="PlanarWeight"/>
|
|
15
|
+
<Param tooltip="Use the Per-Vertex quality as a weighting factor for the simplification. The weight is used as a error amplification value, so a vertex with a high quality value will not be simplified and a portion of the mesh with low quality values will be aggressively simplified." type="RichBool" description="Weighted Simplification" value="false" name="QualityWeight"/>
|
|
16
|
+
<Param tooltip="After the simplification an additional set of steps is performed to clean the mesh (unreferenced vertices, bad faces, etc)" type="RichBool" description="Post-simplification cleaning" value="true" name="AutoClean"/>
|
|
17
|
+
<Param tooltip="The simplification is applied only to the selected set of faces.
 Take care of the target number of faces!" type="RichBool" description="Simplify only selected faces" value="false" name="Selected"/>
|
|
18
|
+
</filter>
|
|
19
|
+
<filter name="Repair non Manifold Edges by removing faces"/>
|
|
20
|
+
</FilterScript>
|