MoveIt 2 is a massive package, with many features, but it is still under heavy development
To make our robot move, without using C++, we will need to do some detective work
This guide is designed as a tutorial to introduce you to MoveIt and prepare your group for Homework 3
Preliminaries
You should install the nupanda workspace and the interbotix workspace
Each of these workspaces provides a different robot that you will be working with
First Steps
You can use either the franka or the px100 in this example
Using both will provide some extra comparisons when something inevitably goes wrong, helping you to narrow down whether the problem is robot-specific or more broadly related to moveit
To start the franka robot ros2 launch franka_moveit_config moveit.launch.py robot_ip:=dont-care use_fake_hardware:=true
This will start a franka MoveIt setup, with the MoveIt GUI in rviz
Rather than connecting to the actual robot or a simulation, a mock controller is used that takes
joint positions as inputs and returns fake joint states as sensor data
The mock controller provided by Franka does not work, which is part of why you are using a fork created by me.
To start the px100 robot use ros2 launch interbotix_xsarm_moveit xsarm_moveit.launch.py robot_model:=px100 hardware_type:=fake
If you installed the interbotix workspace at the beginning of the quarter you will need to update the interbotix_ros_manipulators repository and rebuild
Rviz2
There are two new Rviz widgets (which show up in the left-pane) that have been added by the setup when you run these launch files
PlanningScene, which keeps track of obstacles in the environment
MotionPlanning, which is a gui interface to move the robot
This is initally unchecked, check it to enable it. This provides a graphical interface for moving the robot
In ROS 2 Humble, there will be an interactive marker displayed near the robot's end-effector that you can drag to set the target location for the motion plan
In ROS 2 Iron, both for the franka and the px100 this marker does not appear
I have yet tracked down the cause of this bug
You can still move to pre-selected positions or use the Joint panel to directly manipulate the joints
We will not be using the graphical planning features much, once we can control everything programmatically
Motion Plan
When you enable the MotionPlanning Widget you should see
An orange overlay on the robot. This represents the planning group, the collection of joints (and there associated links) that are currently being controlled
In the MotionPlanning GUI, under the Planning Tab, you can change the planning group to, for example, control the gripper instead of the arm
While you can plan a path for the gripper, you cannot execute it successfully without the robot, as there is currently no fake gripper state
There are multiple control modes for the gripper, all through the gripper action server, some of which are not position control (and hence are not part of moveit)
An interactive marker, which can be dragged to move the arm to various positions
This marker controls the goal state, which is the target location of the robot's end-effector
As you drag the robot around, some of the links may turn red, which indicates a (possibly self) collision or otherwise invalid state
Try it! [Or Not since it does not work in ROS 2 Iron].
There are also pre-set positions that can be moved to
It is also possible to plan from a goal state that is not the current location of the robot by setting the Start State
In the Planning Tab, press plan to generate a motion plan
You should see an animation of the arm moving from start to goal
Press Execute to run the plan, and watch the arm move (Try It!)
If you press Plan & Execute you will se the robot start to move, with the plan happening slightly ahead of robot motion (Try It!)
You can change the speed of the motion by selecting Velocity Scaling and Accel Scaling
On the real robot be very careful with these, the robot can move fast!
There are also many options that are available for motion planning that are accessible via the gui
Joints
The Joints tab allows you to plan to a specific joint configuration rather than an end-effector configuration
Notice that if you move the marker at the end-effector, the joint states move as well indicating that inverse kinematics is happening here!
In other words, planning to an end-effector position means computing inverse kinematics to find the corresponding joint positions
Planning Scene
Under the Scene Objects tab, you can manipulate obstacles in the environment
Click the plus sign next to the word box to add a box into the scene
Move it to somewhere where the robot can potentially hit it
Click "publish" to set the box as part of the planning scene
It is also possible to attach objects to the end-effector (e.g., so that collision detection accounts for a grabbed object)
With the scene set, drag the end-effector into the box
What happens? (The links that collide should turn red)
What happens if you click plan? (The plan will fail)
Check "collision-aware IK" and move the end-effector into the box and hold it
You should see the IK solver try to keep moving the joints to avoid the collision
If the end-effector is colliding with the box, no IK solution can succeed at avoiding it
But it is possible if another link is hitting the box (maybe another arm orienation does not have that same collision)