Before running examples, you must have a robot control environment running. You can use RViz (fake control) or Gazebo (simulated control) via launch scripts from the panda_moveit_config package.
1. Start the controller:
- For RViz (fake control):
ros2 launch panda_moveit_config ex_fake_control.launch.py - For Gazebo (simulated control):
ros2 launch panda_moveit_config ex_gz_control.launch.py
2. Run the scripts:
Use ros2 run pymoveit2 <script_name>.py with ROS 2 parameters (--ros-args -p) to configure goals.
# Example: Move to joint configuration
ros2 run pymoveit2 ex_joint_goal.py --ros-args -p joint_positions:="[1.57, -1.57, 0.0, -1.57, 0.0, 1.57, 0.7854]"
# Example: Move to Cartesian pose
ros2 run pymoveit2 ex_pose_goal.py --ros-args -p position:="[0.25, 0.0, 1.0]" -p quat_xyzw:="[0.0, 0.0, 0.0, 1.0]" -p cartesian:=False
# Example: Toggle gripper
ros2 run pymoveit2 ex_gripper.py --ros-args -p action:="toggle"
# Example: Add a primitive collision object (sphere)
ros2 run pymoveit2 ex_collision_primitive.py --ros-args -p shape:="sphere" -p position:="[0.5, 0.0, 0.5]" -p dimensions:="[0.04]"