Controlling PhantomX Pincher Robot Arm

Last updated 5 days ago

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 Flashing 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

File -> Sketchbook -> ArbotiX Sketches -> ros

1.2 Install Arbotix ROS drivers

You can install arbotix ROS packages from repository

sudo apt install ros-kinetic-arbotix

or build it yourself from sources

source /opt/ros/kinetic/setup.bash
mkdir -p ~/ros_ws/src && cd ~/ros_ws/src
git clone https://github.com/vanadiumlabs/arbotix_ros
cd ~/ros_ws
rosdep install --from-paths src -iry
catkin build

1.3 Set Dynamixels ID

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:

arbotix_terminal

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:

arbotix_terminal [PORT]

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:

sudo chmod 666 /dev/ttyS[N]

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

source /opt/ros/kinetic/setup.bash
mkdir -p ~/ros_ws/src && cd ~/ros_ws/src
catkin create pkg arbotix_test --catkin-deps arbotix_python

Inside your package, create config/test.yaml file with following content (change port if needed):

port: /dev/ttyUSB0
rate: 15
joints: {
servo1: {id: 1},
servo2: {id: 2},
servo3: {id: 3},
servo4: {id: 4},
servo5: {id: 5}
}

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:

<launch>
<node name="arbotix" pkg="arbotix_python" type="arbotix_driver" output="screen">
<rosparam file="$(find arbotix_test)/config/test.yaml" command="load" />
</node>
</launch>

Now, build your workspace

cd ~/ros_ws
catkin build

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

roscore

And on another, run your launch file

roslaunch arbotix_test test.launch

Now, check available topics and services

rostopic list
rosservice list

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):

rosservice call /servo1/set_speed 0.2

Move servo to a default neutral value:

rostopic pub /servo1/command std_mgs/Float64 -- 0.0

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:

rosservice call /servo1/relax

You can also use arbotix_gui to control each joint. Just type:

arbotix_gui

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:

asciicast

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

source ~/ros_ws/devel/setup.bash
cd ~/ros_ws/src
git clone https://github.com/turtlebot/turtlebot_arm.git -b kinetic-devel
cd ~/ros_ws
rosdep install --from-paths src -iry
catkin build

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:

echo "export TURTLEBOT_ARM1=pincher" >> ~/.bashrc
source ~/.bashrc

Make sure to have roscore running, then type:

roslaunch turtlebot_arm_bringup arm.launch

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:

    roslaunch turtlebot_arm_moveit_config turtlebot_arm_moveit.launch sim:=false
  • 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)

    rosrun turtlebot_arm_moveit_demos pick_and_place.py

2. On your Turtle Rover

coming soon