|Note: This tutorial assumes that you have completed the previous tutorials: Setting up TurtleBot Arm Servos.|
|Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.|
Using TurtleBot Arm Interactive MarkersDescription: Learn to control the TurtleBot arm through interactive markers in rviz, including doing trajectory control and individual joint control.
Powering the Arm
Once the board is properly connected to the TurtleBot power board (subject to change), and the servos wired to the controller board as shown below, connect the board via an FTDI USB cable to the computer. This should power the processor off USB. Make sure that you plug in the FTDI USB cable after the iRobot Create cable.
Next, turn on the correct breaker (breaker 1 or 2) from turtlebot_dashboard. You should see red LEDs flash on the back of the servos as they power on.
roslaunch turtlebot_arm_bringup arm.launch roslaunch turtlebot_arm_bringup simple_arm_server.launch
On the PC, type:
roslaunch turtlebot_arm_interactive_markers arm_markers.launch
to bring up the interactive marker server.
You can bring up rviz with a special config file for displaying the interactive markers using the following command on your PC:
roscd turtlebot_arm_interactive_markers rosrun rviz rviz -d launch/arm_interactive_markers.vcg
Alternatively, you can simply add an Interactive Markers topic and subscribe it to the /turtlebot_arm_marker_server/update topic.
Now if you select the Interact option on the tool menu of rviz, you should see the interactive markers overlaid on top of the arm.
By default, the arm is in trajectory control mode: that is, you manipulate where the end-effector should go, and the simple_arm_server calculates the IK (inverse kinematics) and a trajectory to achieve that position. This mode is great for going to specific positions, such as to pick up objects.
In this mode, you can manipulate where you want the gripper to end up by dragging on the arrows and circles as shown below. The arm will immediately try to go to that position.
The color of the block in the center will indicate what the status of the move is.
Green means that the gripper has reached a valid goal.
Blue means that the arm is trying to compute a valid IK (inverse kinematics) solution.
Red means no valid solution could be found, and you should reposition the marker to a spot that the arm can reach.
Immediate vs. Cached Commands
Since it is sometimes difficult to pull the arm into the exact position you want with one move, there is a cached command mode that does not send move commands to the arm unless you explicitly ask it to.
To enable this, right-click on the block in the middle of the gripper and un-check Send command immediately. Now, in order to send a move command to the arm, you will need to position the marker, right-click, and then select Send command.
Other times, you may want to un-power the arm - for example, if it has reached an undesirable position or if you'd rather position it by hand.
To do this, right-click on the block inside the arm, and select Relax joints -> All, or relax individual joints. Next time you send a trajectory or joint command, the servos will re-power.
Other times, the interactive arm marker will become out of synch with the actual position of the arm. For example, when you relax the joints, and then power the arm on again. In these cases, you will want to reset the marker to snap it back to the arm position.
Do this by right-clicking on the interactive arm block and selecting Reset marker.
From the trajectory control mode, you can also control the gripper individually. To control the gripper, pull on the smaller set of green arrows, attached to a green plate at the gripper position. Pulling and pushing on this plate will change the opening aperture of the gripper.
The other mode of operation is joint control. This mode allows you to simply control the position of each individual joint through an interactive marker interface. To switch to this mode, right-click on the interactive marker block and select Switch to Joint Control.
In this mode, you drag the blue circles to change the position of each individual joint. You right-click on the rings to relax each joint individually, and you can switch back to the other control mode at any time by right-clicking on a ring and selecting Switch back to Trajectory Control.
The video below shows how to use all aspects of the interactive markers.