diff --git a/.gitignore b/.gitignore index ab974948..70b72a5e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ build/ install/ log/ .vscode/ +MUJOCO_LOG.TXT diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..c7dce189 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,50 @@ +# AI Code Assistant Instructions for MoveIt Pro Example Workspace + +## MuJoCo Scene Files + +### Keyframe qpos must match model DOF count + +When editing `scene.xml` files (adding/removing bodies with joints), the `` section's `qpos` attribute must have exactly the number of values matching the model's total degrees of freedom. A mismatch causes `ros2_control_node` to crash with: + +``` +Error: keyframe 0: invalid qpos size, expected length +``` + +Each joint type contributes to qpos: +- **freejoint**: 7 values (x, y, z, qw, qx, qy, qz) +- **hinge/slide**: 1 value each +- **ball**: 4 values (quaternion) + +After adding or removing bodies with joints, either: +1. **Remove the keyframe** and let MuJoCo use body `pos=` attributes for initial positions +2. **Regenerate the keyframe** from the MuJoCo Interactive Viewer (Ctrl+Shift+K) once the scene is stable + +### MuJoCo documentation + +Refer to [docs.picknik.ai](https://docs.picknik.ai) for MuJoCo configuration guides: + +- [Physics Simulator Setup](https://docs.picknik.ai/how_to/configuration_tutorials/migrate_to_mujoco_config/) — creating scene.xml from URDF, camera/sensor setup, mesh conversion, MuJoCo Interactive Viewer +- [config.yaml Reference](https://docs.picknik.ai/how_to/configuration_tutorials/config_yaml_reference/) — `hardware` section for `picknik_mujoco_ros/MujocoSystem` plugin configuration +- [Simulator Keyframes Setup](https://docs.picknik.ai/how_to/configuration_tutorials/configure_keyframes/) — defining keyframes in scene.xml, `ResetMujocoKeyframe` Behavior +- [Optimize Model Meshes](https://docs.picknik.ai/how_to/configuration_tutorials/optimizing_robot_model_meshes/) — MuJoCo enforces 1-200,000 faces per STL +- [Simulation Troubleshooting](https://docs.picknik.ai/troubleshooting/Simulation%20Troubleshooting/) — physics parameters, grip stability, mass/inertia errors, rendering issues + +## Objective XML Files + +### MetadataFields required for CI + +Every objective XML file must include a `MetadataFields` block inside the `TreeNodesModel` section. The `validate_objectives` CI check will fail without it. + +```xml + + + + + + + + +``` + +- `runnable` — set to `"true"` for top-level objectives the user can run, `"false"` for subtrees only called by other objectives +- `subcategory` — groups the objective in the UI (e.g., `"AprilTag"`, `"Grasping"`, `"MuJoCo Simulation"`) diff --git a/src/lab_sim/config/config.yaml b/src/lab_sim/config/config.yaml index ca1ceeb2..e78f0500 100644 --- a/src/lab_sim/config/config.yaml +++ b/src/lab_sim/config/config.yaml @@ -48,6 +48,8 @@ objectives: - "moveit_pro::behaviors::VisionBehaviorsLoader" - "moveit_pro::behaviors::ConverterBehaviorsLoader" - "moveit_pro::behaviors::MujocoBehaviorsLoader" + lab_sim: + - "lab_sim_behaviors::LabSimBehaviorsLoader" # Specify source folder for objectives # [Required] objective_library_paths: diff --git a/src/lab_sim/config/control/picknik_ur.ros2_control.yaml b/src/lab_sim/config/control/picknik_ur.ros2_control.yaml index 022396ad..4638d966 100644 --- a/src/lab_sim/config/control/picknik_ur.ros2_control.yaml +++ b/src/lab_sim/config/control/picknik_ur.ros2_control.yaml @@ -64,18 +64,25 @@ joint_trajectory_controller: stopped_velocity_tolerance: 0.0 goal_time: 0.0 linear_rail_joint: + trajectory: 0.5 goal: 0.05 shoulder_pan_joint: + trajectory: 0.5 goal: 0.05 shoulder_lift_joint: + trajectory: 0.5 goal: 0.05 elbow_joint: + trajectory: 0.5 goal: 0.05 wrist_1_joint: + trajectory: 0.5 goal: 0.05 wrist_2_joint: + trajectory: 0.5 goal: 0.05 wrist_3_joint: + trajectory: 0.5 goal: 0.05 acceleration_limits: linear_rail_joint: 10.0 @@ -91,8 +98,8 @@ robotiq_gripper_controller: default: true joint: robotiq_85_left_knuckle_joint allow_stalling: true - stall_timeout: 0.05 - goal_tolerance: 0.02 + stall_timeout: 0.3 + goal_tolerance: 0.3 force_torque_sensor_broadcaster: ros__parameters: diff --git a/src/lab_sim/description/keyboard-texture.png b/src/lab_sim/description/keyboard-texture.png new file mode 100644 index 00000000..9e685eab --- /dev/null +++ b/src/lab_sim/description/keyboard-texture.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0b212c56658ff5e5936f82867413fb357322e432664609c6b496c190925d20c +size 170370 diff --git a/src/lab_sim/description/laptop-screen.png b/src/lab_sim/description/laptop-screen.png new file mode 100644 index 00000000..67982b9f --- /dev/null +++ b/src/lab_sim/description/laptop-screen.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4045f46ccec667d8c317cde63758d9ab826f8990ebcdee163ca10a0241d52b09 +size 215006 diff --git a/src/lab_sim/description/picknik_ur.xacro b/src/lab_sim/description/picknik_ur.xacro index fe73e3e8..98d1a434 100644 --- a/src/lab_sim/description/picknik_ur.xacro +++ b/src/lab_sim/description/picknik_ur.xacro @@ -663,7 +663,7 @@ - + @@ -672,7 +672,7 @@ - + @@ -681,7 +681,7 @@ - + @@ -690,7 +690,7 @@ - + @@ -699,7 +699,7 @@ - + @@ -708,7 +708,7 @@ - + diff --git a/src/lab_sim/description/scene.xml b/src/lab_sim/description/scene.xml index 7d896c29..18e75e90 100644 --- a/src/lab_sim/description/scene.xml +++ b/src/lab_sim/description/scene.xml @@ -6,12 +6,87 @@ -