Skip to content

provides a non-ROS based remote or local socket based to command and control a robot visualized in ROS RVIZ

Notifications You must be signed in to change notification settings

usnistgov/tcp_c2_rviz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Readme for Textbased Command and Control using Socket of a ROS RVIZ Visualization of a Motoman


Michaloski, John L. (Fed)

1/26/2017 1:52:06 PM

MotomanRvizReadme.docx

This document presents a Command and Control (C&C) text based interface for communicating with Robot Operating System (ROS) package that interfaces to a ROS RVIZ visualization of a robot (currently only Motoma SI20D, Fanuc LRMate 200id, and Kuka LWR). This implementation offers robot controllers that are not ROS-based the ability to simulate robot motion that is displayed in RVIZ. It uses the Unified Robot Description Format (URDF) to provide the ROS parameter "robot_description" used by RVIZ to draw and control the robot.

The tested version information for the ROS implementation is:

  • ROS indigo

  • OS - Ubuntu 12.04 (64-bit)

  • Boost ASIO

  • Package versions at the end of the document. Note many of the packages don't appear to be used but are included as a dependency by other packages.

The text based C&C interface appear later in the document.

#Software Architecture

The ROS software is as minimalistic as possible. You will need ROS, RVIZ, joint_state_publisher, and robot_transform packages installed, but these are part of the main distribution or ROS so this should not be an issue. RVIZ reads the "robot_description" ROS parameter to determine how and where to display a robot. Using this "robot_description" ROS parameter the cmdinterpreter package understands the joint configuration of the robot. Note, only serial kinematic chains are supported (i.e., industrial robots not androids with a head and two arms.) The C&C interface maps joint numbers (0..n-1) into the corresponding joint names based on kinematic name position. The command and control interface to the RVIZ robot is only through joints. (However, the ability to send RVIZ markers which requires poses (position and orientation) is available, but is not documented at this time.)

The cmdinterpreter package advertises joint value updates to the /nist_controller/robot/joint_states topic which is read by the joint_state_publisher package.

![Figure1](./images/image1.gif?raw=true)

The cmdinterpreter package advertises updates to the /nist_controller/robot/joint_states topic which is read by the joint_state_publisher package. This communication is enabled in the launch file by the following snippet:

<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
    <param name="/use_gui" value="true"/>
    <rosparam param="/source_list">[nist_controller/robot/joint_states]</rosparam>
</node>

In roslaunch, a "robot description" is loaded into the ROS system (default is the motoman sia20d) is loaded and used by RVIZ.

<arg name="robotpkg" default="motoman_sia20d"/>
<param name="robotpkg" value="$(arg robotpkg)"/>
<param name="robot_description" textfile="src/$(arg robotpkg)_support/urdf/robot.urdf" />

The robot pkg argument can be specified on the roslaunch command line, using the "robot" ROS arg.

roslaunch cmdinterpreter rviz.launch robot:= kuka_lwr

This informs the launch file that the "robotpkg" arg is now "kuka_lwr" and not "motoman_sia20d".

Note, you must be in the root directory of the workspace. The reason you must be in the root /workspace (and not /src) is that the ros parameter "robot_description" uses a semi-hard-coded path to the robot urdf file. This was because ROS does not allow embedded execution of arg inside of find, i.e., the launch file does not support: $(find $(arg robotpkg)/urdf/robot.urdf) . Plus, ROS does also not allow programs to access the launch arguments (or if possible, it wasn't obvious.)

#Installation

The Motoman Command and Control Visualization assumes ROS indigo has been installed on your platform. It should work under Jade or Kinetic versions of ROS but has not been tested. There is not much source, and you will have to compile, so

##Download & Build from Source

First, build your workspace:

> mkdir -p tcp_c2_rviz/src 
> cd tcp_c2_rviz/src

Then clone the motoman visualizaton code from the github repository.

# clones motoman rvi packages into the src dirctory
> git clone https://github.com/usnistgov/tcp_c2_rviz.git
# commands are initiated from the home ws directory
> cd ..
# build where catkin is a set of CMake macros that simplify build and maintenance
> catkin build -DCMAKE_BUILD_TYPE=Debug 
# update path environment variable for ROS
> source devel/setup.sh

In conjunction with the ability to use different robots, each robot has different base link and end effector link and possibly world coordinate names. This discrepency must be resolved. So the cmdinterpreter.ini file in the FIXME: workspace/devel/cmdinterpreter/lib/cmdinterpreter.ini file now includes sections for each robot handled with the key definition for the base and eelink names. The ini file has:

[motoman_sia20d]
base= base_link
eelink=link_t

and for the fanuc lrmate 200 id the following ini section was added:

[fanuc_lrmate200id]
base= base_link
eelink=link_6

In RVIZ you will need to go into global options and change the world coordinates for the display to work properly. So far, it is not obvious how to change the value programmatically, and not manually.

#Testing

After compiling you will have 1 interface packages: cmdinterpreter and a bunch of robot URDF configurations, so far: motoman_sia20d_support, fanuc_lrmate200id_support, and kuka_lwr_support.

  • cmdinterpreter contains the ROS interface to the joint publisher, which reads commands on a socket and publishes the joints to a ROS topic and has the launch files.

  • motoman_sia20d_support, fanuc_lrmate200id_support, and kuka_lwr_support contains the urdf/xacro and robot description

To run the motoman RVIZ command and control interfface, YOU MUST BE IN THE ROOT WORKSPACE DIRECTORY, and then run the following roslaunch sequence:

> cd tcp_c2_rviz 
> sourc devel/setup.bash
> roslaunch cmdinterpreter rviz.launch robot:= motoman_sia20d | fanuc_lrmate200id | kuka_lwr

If you omit the robot roslaunch command line argument, the default value is "motoman_sia20d". You should see the following two screens: (1) the rviz motoman visualization; and (2) the joint_state_publisher.

![Figure2](./images/image2.gif?raw=true)

**Figure 1 Motoman RVIZ Visualization**

![Figure3](./images/image3.gif?raw=true)

**Figure 2 joint_state_publisher ROS GUI**

The reason you must be in the root /workspace (and not /src) is that the ros parameter robot_description uses a semi-hard-coded path to the robot urdf file. This was because ROS does not allow embedded execution of arg inside of find, i.e., the launch file does not support: $(find $(arg robotpkg)/urdf/robot.urdf) . So instead the following roslaunch code was used:
<arg name="robotpkg" default="motoman_sia20d"/>
<param name="robot_description" textfile="src/$(arg robotpkg) _support /urdf/robot.urdf" />

Thus, we can parameterize the robot on the roslaunch command line with the robot arg:

> roslaunch cmdinterpreter rviz.launch robot:= motoman_sia20d

Clearly not perfect but satisfactory.

Now you can test the RVIZ motoman command and control. Open a separate terminal and change to the tcp_c2_rviz directory and under it the python directory in the cmdinterpreter src package.

cd xxxx/tcp_c2_rviz/src/cmdinterpreter/python

Now run the python application that will accepts text based command and control joint values for the motoman:

> python socketcmdline.py 

You should see the following sequence of socket information be displayed, as the python program is connecting vial socket 31000 to the cmdinterpreter ROS package (where ">" is the command line prompt):

Socket Created
Socket Connected
>

You can now run some test commands that should be displayed in the RVIZ motoman display. Below are some sample commands with comments following the "#" pound sign:

> rand			# randonly move joints
> home	 		# home joints, i.e., move joints to all zero positions
> degrees           # use degrees as input values, not radians
> j 45,45,45,45,45,45,45 # move ALL joints to all given positions
                    # joints and j are identical commands
> sleep 10.0        # sleep 10.0 seconds (double to specify seconds) 
> move 0 90         # move n,m p,q : move joints n,m to  positions p,q
> move 0 -90        # ditto

There is not much error checking. So buyer beware. There is also the ability to read and process a test file of RVIZ motoman commands.

> file motoman.txt
subtokens ['sleep', '5'] 
subtokens ['degrees'] 
subtokens ['home'] 
subtokens ['rand'] 
subtokens ['sleep', '5'] 
subtokens ['move', '0', '90.0'] 
subtokens ['sleep', '3'] 
subtokens ['move', '0', '-90.0'] 
subtokens ['sleep', '3'] 
subtokens ['j', '45,45,45,45,45,45,45'] 
subtokens ['sleep', '3'] 
subtokens ['joints', '0,0,0,0,0,0,0'] 
subtokens ['sleep', '3'] 
subtokens ['move', '0,1', '90,90'] 
subtokens ['sleep', '4.0'] 
subtokens ['move', '0,1', '-90,-90'] 
>

If you want to quit the Python command line interface program hit ^C and the program will exit. If you want to exit both the Python command line interface program and the RVIZ motoman visualization, enter the command "quit".

Command and Control Language

Most of the command and control is for the ROS package intervace. Some commands instruct the Python test interpreter and the Description field will denote this use.

Command
Parameters
Description
rand

Moves to randomly generated joint values
home

home joints, i.e., move joints to all zero positions
degrees

Use degrees for joint angle values
radians

Use radians for joint angle values
joints
Val0,..., valn
move ALL joints to all given positions, ALL joint values must be specified, from 0 to number of robot joints.
j
Synomym for joints

move
{i,..., j} vali,..., valj
move joints i..j to joint values vali, …, valj
file
filename
Python interpreter will read the file and then send each command to the ROS C&C cmdinterpreter.
sleep
seconds
Python sleeps for seconds in double
goto
J1,Jn
Move from current joint position to goal joint position. Use linear interpolation to move each joint. You must specify values for all joints.

#Version Dependencies

Package
Version
actionlib
1.11.6
actionlib_msgs
1.11.9
catkin
0.6.18
class_loader
0.3.4
cpp_common
0.5.7
eigen_conversions
1.11.8
eigen_stl_containers
0.1.4
fcl
0.3.3
gencpp
0.5.5
genlisp
0.4.15
genmsg
0.5.7
genpy
0.5.10
geometric_shapes
0.4.4
geometry_msgs
1.11.9
graph_msgs
0.1.0
kdl_conversions
1.11.8
kdl_parser
1.11.11
libccd
1.5.0
message_filters
1.11.20
message_generation
0.2.10
message_runtime
0.4.12
moveit_core
0.7.2
moveit_msgs
0.7.4
object_recognition_msgs
0.4.1
octomap
1.6.9
octomap_msgs
0.3.3
orocos_kdl
1.3.1
pluginlib
1.10.3
python_orocos_kdl
1.3.1
random_numbers
0.3.0
resource_retriever
1.11.6
rosbag
1.11.20
rosbag_migration_rule
1.0.0
rosbag_storage
1.11.20
rosbuild
1.11.13
rosclean
1.11.13
rosconsole
1.11.20
rosconsole_bridge
0.4.4
roscpp
1.11.20
roscpp_serialization
0.5.7
roscpp_traits
0.5.7
rosgraph
1.11.20
rosgraph_msgs
1.11.2
roslaunch
1.11.20
roslib
1.11.13
roslz4
1.11.20
rosmaster
1.11.20
rosmsg
1.11.20
rosnode
1.11.20
rosout
1.11.20
rospack
2.2.7
rosparam
1.11.20
rospy
1.11.20
rosservice
1.11.20
rostest
1.11.20
rostime
0.5.7
rostopic
1.11.20
rosunit
1.11.13
roswtf
1.11.20
rviz_visual_tools
2.2.1
sensor_msgs
1.11.9
shape_msgs
1.11.9
srdfdom
0.3.1
std_msgs
0.5.10
tf
1.11.8
tf2
0.5.13
tf2_msgs
0.5.13
tf2_py
0.5.13
tf2_ros
0.5.13
tf_conversions
1.11.8
topic_tools
1.11.20
trajectory_msgs
1.11.9
urdf
1.11.11
urdf_parser_plugin
1.11.11
urdfdom_py
0.3.1
visualization_msgs
1.11.9
xmlrpcpp
1.11.20

Word2Markdown Autogenerated from Microsoft Word by Word2Markdown

About

provides a non-ROS based remote or local socket based to command and control a robot visualized in ROS RVIZ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published