ROS topic support

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

ROS topic support

Alberto Cardellino

Dear YARP users,

we are glad to announce that now YARP wrappers also support ROS topic messages.

In particular the supported messages are:

- ControlBoardWrapper2 publishes  sensor_msgs/JointState.msg message
- ServerInertial    publishes  sensor_msgs/Imu.msg message
- AnalogWrapper right now supports geometry_msgs/WrenchedStamped.msg message but could be extended to other messages in the future if need arises.

The key feature is that a YARP wrapper is able to publish a natively ROS compatible messages without having to install any ROS library, making it easy to configure and deploy your system.
For instance a source of data, like a robot, can use this feature to publish data either through YARP or ROS (or both) using only YARP wrappers, then on the other side a ROS node can read the data by subscribing to a ROS topic.

The parameters needed to configure the wrappers in order to open a ROS topic are enclosed in a ROS group and can be summarized with the following example:

General parameter for all wrappers
useROS         true  (can be 'false', 'true' or 'only', in the latter case no YARP ports will be opened for that wrapper)
ROS_topicName    /JointState
ROS_nodeName   /robotPublisher

Specific parameter for  controlBoardWrapper2
jointNames           r_shoulder_pitch r_shoulder_roll r_shoulder_yaw r_elbow r_wrist_prosup r_wrist_pitch r_wrist_yaw  

Specific parameter for  ServerInertial
frame_id            reference_frame_name

Specific parameter for  analogServer
frame_id            reference_frame_name
ROS_msgType   geometry_msgs/WrenchedStamped

ROS group is optional, if not present ROS initialization will be skipped and it is equivalent to put useROS equal to false. Parameters for each device are detailed in the relative doxygen page in the wiki.

For a quick test using the iCub_SIM, follow the instruction hereafter.

Step 1: on a machine with ROS installed, launch the roscore

Step 2: add the following parameters to an iCub_SIM config file, for example Sim_right_arm.ini
useROS                true
ROS_topicName  /sim/right_arm/rosTopicName
ROS_nodeName  /sim/right_arm/rosNodeName
jointNames          j0 j1 j2 j3 j4 j5 j6 j7 j8 j9 j10 j11 j12 j13 j14 j15

Step 3: connect the yarpserver to the roscore.

- set ROS_MASTER_URI environment variable to the ip address of the roscore, like explained in the ROS documentation
- launch yarp server  with "yarpserevr --ros"  to establish a connection between to the roscore (must be running somewhere).

Step 4: start the iCub_SIM

Step 5: verify ROS topic functionalities.
- rostopic list
 will print as output

-rostopic info  /sim/right_arm/rosNodeName
 will print as output:

Type: sensor_msgs/JointState

 * /sim/right_arm/rosNodeName (  

Subscribers: None

-rostopic echo /sim/right_arm/rosNodeName
will print the data
  seq: 6172
    secs: 1429529788
    nsecs: 624928000
  frame_id: ''
name: ['j0', 'j1', 'j2', 'j3', 'j4', 'j5', 'j6', 'j7', 'j8', 'j9', 'j10', 'j11', 'j12', 'j13', 'j14', 'j15']
position: [-0.4363134232077414, 0.3490567847758154, 2.2340960932181873e-06, 0.8726677899833618, 6.231653478018042e-07, 1.8754167368881575e-08, 1.5271788351811566e-07, 1.0297615223056957, 0.3490717025053828, 0.34907170233369883, 0.3490717026486767, 0.17453585098231797, 0.174535850838284, 0.17453585100877306, 0.17453585085117923, 0.1745358540914655]
velocity: [-1.6946113987326777e-06, -3.3540582317576583e-06, 8.411652280514529e-07, 4.559300447136039e-07, -1.3959037290565161e-08, 1.3144826190984973e-08, -5.87885290399614e-09, 1.7466279554175236e-10, 1.843954560227913e-10, -1.249781410921814e-10, 8.48785918906594e-11, 2.779529433118688e-10, 1.199568207945057e-10, 2.96780928330086e-10, 1.1803821667477136e-10, 5.36649803111618e-10]
effort: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

For any question or feedback, check the doxygen documentation or write an email.

Alberto Cardellino

BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises event?utm_
Robotcub-hackers mailing list
[hidden email]