Controlling PhantomX Pincher Robot Arm
In this tutorial, we will show you how to configure and remotely control PhantomX Pincher Robot connected to the Rover.
source: trossenrobotics.com

Prerequisites

Before you begin, make sure you have internet connection on your Rover.
Also, you need to have ROS installed both on a Rover and your computer
And, of course, assembled Pincher Arm together with ArbotiX-M Robocontroller connected to your Rover.

1. On your computer

1.1 Flash ArbotiX-M Robocontroller board

To program Arbotix board, you can follow the Getting Started Guide from Trossen Robotics.
If everything works, open and upload the following sketch
1
File -> Sketchbook -> ArbotiX Sketches -> ros
Copied!

1.2 Install Arbotix ROS drivers

You can install arbotix ROS packages from repository (ros-kinetic-arbotix package), but for the pincher gripper to work, you need to build an unrealeased 0.11.0 version which adds support for prismatic joints.
To build it, you can follow these steps:
1
source /opt/ros/kinetic/setup.bash
2
mkdir -p ~/ros_ws/src && cd ~/ros_ws/src
3
git clone https://github.com/corb555/arbotix_ros
4
cd ~/ros_ws
5
rosdep update
6
rosdep install --from-paths src -iry
7
catkin build
Copied!

1.3 Set Dynamixel IDs

Connect Arbotix-M board to your computer through FTDI-USB Cable
Source your catkin workspace (either /opt/ros/kinetic or ~/ros_ws/devel depending on how you installed Arbotix ROS drivers) and run:
1
arbotix_terminal
Copied!
arbotix_terminal by default, assumes the board is connected on /dev/ttyUSB0 port. If it is attached to another device, you can specify it like this:
1
arbotix_terminal [PORT]
Copied!
To check which port the device connects to, you can, for instance, run dmesg -w (Ctrl+C to exit), connect the device and check kernel logs.
If you are using Ubuntu on Windows Subsytem for Linux , you need to open Device Manager and look under Ports for COM port number of the device. COM[N] corresponds to /dev/ttyS[N] path. (e.g. COM4 -> /dev/ttyS4). You might need to run:
1
sudo chmod 666 /dev/ttyS[N]
Copied!
A terminal prompt should appear. Type help for list of commands.
Connect the Dynamixel you want to set id to. Then type ls to see id of connected servo and mv [source] [target] to change it. For example, when the servo has id 1 and we want to set it to 2, just type mv 1 2.
On PhantomX pincher arm, servo ids should look like this:
source: trossenrobotics.com
When done, type Ctrl+C to exit terminal

1.4 Test Arbotix ROS drivers

We will create a package that tests arbotix driver. Let's start by creating an empty package
1
source /opt/ros/kinetic/setup.bash
2
mkdir -p ~/ros_ws/src && cd ~/ros_ws/src
3
catkin create pkg arbotix_test --catkin-deps arbotix_python
Copied!
Inside your package, create config/test.yaml file with following content (change port if needed):
1
port: /dev/ttyUSB0
2
rate: 15
3
joints: {
4
servo1: {id: 1},
5
servo2: {id: 2},
6
servo3: {id: 3},
7
servo4: {id: 4},
8
servo5: {id: 5}
9
}
Copied!
You can set more parameters for each joint, like maximum speed, minimum and maximum angle etc. A brief documentation (Unfortunately, a little outdated) can be found here
And launch/test.launch with following:
1
<launch>
2
<node name="arbotix" pkg="arbotix_python" type="arbotix_driver" output="screen">
3
<rosparam file="$(find arbotix_test)/config/test.yaml" command="load" />
4
</node>
5
</launch>
Copied!
Now, build your workspace
1
cd ~/ros_ws
2
catkin build
Copied!
From now on, you need to run source ~/ros_ws/devel/setup.bash on every terminal session you open (or add it to ~/.bashrc)
Run Master node on one terminal
1
roscore
Copied!
And on another, run your launch file
1
roslaunch arbotix_test test.launch
Copied!
Now, check available topics and services
1
rostopic list
2
rosservice list
Copied!
You should see command topics that let you set position (in radians) for each servo and joint_states topic that informs about position and velocity of each joint. There should also be services that allow enabling, relaxing or setting speed (in radians/sec) for each servo.
Let's try to move servo1 joint.
First, set speed to a safe value (0.2 r/s in this case):
1
rosservice call /servo1/set_speed 0.2
Copied!
Move servo to a default neutral value:
1
rostopic pub /servo1/command std_mgs/Float64 -- 0.0
Copied!
The maximum angle range for a dynamixel servo is [-150, 150] degrees which is equal to approximately [-2.62, 2.62] in radians
Relax joint:
1
rosservice call /servo1/relax
Copied!
You can also use arbotix_gui to control each joint. Just type:
1
arbotix_gui
Copied!
A graphical application should appear:
Enable and relax servos by clicking on checkboxes and set position by moving sliders.

Summary

Here's a recording of a terminal session in which we do things mentioned in the tutorial up to this point:

1.5 Install turtlebot_arm packages

The turtlebot_arm packages contain very useful utilities for PhantomX Pincher arm such as:
    configuration for arbotix driver
    URDF model of the arm
    Moveit! configuration package
    IKFast Kinematics solver plugin
    MoveIt! pick and place demo
Let's build it
1
source ~/ros_ws/devel/setup.bash
2
cd ~/ros_ws/src
3
git clone https://github.com/turtlebot/turtlebot_arm.git -b kinetic-devel
4
cd ~/ros_ws
5
rosdep install --from-paths src -iry
6
catkin build
Copied!
To use this packages with PhantomX Pincher, you need to have TURTLEBOT_ARM1 environment variable set to pincher . To set it automatically on every terminal session, add export command to .bashrc file:
1
echo "export TURTLEBOT_ARM1=pincher" >> ~/.bashrc
2
source ~/.bashrc
Copied!
Make sure to have roscore running, then type:
1
roslaunch turtlebot_arm_bringup arm.launch
Copied!
This should run Arbotix driver, robot_state_publisher and set robot_description parameter.
To view robot arm model with actual position:
    Open rviz
    For Fixed Frame select arm_base_link
    Click Add in Displays panel
    Select RobotModel and click Ok
To test Motion Planning with MoveIt! :
    Run turtlebot_arm_moveit launch file:
    1
    roslaunch turtlebot_arm_moveit_config turtlebot_arm_moveit.launch sim:=false
    Copied!
    Click on Planning tab in Motion Planning display
    Move interactive marker to intended position
    Click on Plan to see Motion visualization and then Execute or just click on Plan and Execute
    Run pick and place demo (in another terminal session)
    1
    rosrun turtlebot_arm_moveit_demos pick_and_place.py
    Copied!

2. On your Turtle Rover

2.1 Prepare catkin workspace

Let's prepare a catkin workspace for pincher arm. Start by sourcing the workspace you want to extend. If you don't have an existing development workspace, just do:
1
source /opt/ros/kinetic/setup.bash
Copied!
Download necessary packages
1
mkdir -p ~/ros_ws/src && cd ~/ros_ws/src
2
git clone https://github.com/corb555/arbotix_ros.git
3
git clone https://github.com/turtlebot/turtlebot_arm.git
Copied!
We only need turtlebot_arm_bringup and turtlebot_arm_description packages, so we can remove the rest
1
cd ~/ros_ws/src/turtlebot_arm
2
mv turtlebot_arm_bringup turtlebot_arm_description ~/ros_ws/src
3
cd ~/ros_ws/src
4
rm -rf turtlebot_arm
Copied!
Use rosdep to check for missing dependencies
1
cd ~/ros_ws
2
rosdep update
3
rosdep install --from-paths src -i
Copied!
You should see an error message similar to this:
1
ERROR: the following packages/stacks could not have their rosdep keys resolved
2
to system dependencies:
3
arbotix_python: No definition of [actionlib] for OS [debian]
4
turtlebot_arm_description: No definition of [xacro] for OS [debian]
5
arbotix_controllers: No definition of [tf] for OS [debian]
6
turtlebot_arm_bringup: No definition of [robot_state_publisher] for OS [debian]
Copied!
Download missing packages and their recursive dependencies
1
rosinstall_generator actionlib xacro tf robot_state_publisher control_msgs --deps --wet-only --exclude RPP > src/.rosinstall
2
wstool update -t src
Copied!
Run rosdep again to install any new system dependencies
1
rosdep install --from-paths src -iry
Copied!
Now, build the workspace
1
catkin build -j 2
Copied!

2.2 Start necessary Nodes

Source your workspace
1
source ~/ros_ws/devel/setup.bash
Copied!
For ROS to work on multiple machines, you need to set specific Environment Variables:
1
export TURTLEBOT_ARM1=pincher
2
export ROS_IP=10.0.0.1
3
export ROS_MASTER_URI=http://10.0.0.1:11311
Copied!
Add these lines to ~/.bashrc to set them automatically
Now, run Master node on one terminal
1
roscore
Copied!
And on another, type:
1
roslaunch turtlebot_arm_bringup arm.launch
Copied!

2.3 Control the arm from your computer

Source your workspace containing turtlebot_arm packages
1
source ~/ros_ws/devel/setup.bash
Copied!
Set required variables
1
export TURTLEBOT_ARM1=pincher
2
export ROS_IP=X.X.X.X
3
export ROS_MASTER_URI=http://10.0.0.1:11311
Copied!
Replace X.X.X.X with your local IP address. To check your address, you can use ip address command
You can now use the examples we described earlier, e.g.:
1
arbotix_gui
Copied!
or MoveIt! demo:
1
roslaunch turtlebot_arm_moveit_config turtlebot_arm_moveit.launch sim:=false
Copied!
Last modified 2yr ago