ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Does rostopic echo no longer work for arrays?

asked 2013-08-14 11:15:11 -0500

mattadc gravatar image

updated 2013-08-14 11:19:42 -0500

Recently switched to groovy and rostopic doesn't seem to be able to handle arrays anymore. Does anyone know why?

Example for me, from a simple topic with a list of doubles: rostopic echo /robot/joint_states/position[1]

Results in:

Traceback (most recent call last):   File "/opt/ros/groovy/bin/rostopic", line 35, in <module>
    rostopic.rostopicmain()   File "/opt/ros/groovy/lib/python2.7/dist-packages/rostopic/__init__.py", line 1666, in rostopicmain
    _rostopic_cmd_echo(argv)   File "/opt/ros/groovy/lib/python2.7/dist-packages/rostopic/__init__.py", line 1026, in _rostopic_cmd_echo
    _rostopic_echo(topic, callback_echo, bag_file=options.bag)   File "/opt/ros/groovy/lib/python2.7/dist-packages/rostopic/__init__.py", line 692, in _rostopic_echo
    index = submsg_class.__slots__.index(field) ValueError: 'position[1]' is not in list`
edit retag flag offensive close merge delete

Comments

Are you sure that that topic is correct? Can you update this question with the results of rostopic info /robot/joint_states ?

SL Remy gravatar image SL Remy  ( 2013-08-15 06:44:58 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted
2

answered 2013-08-15 12:01:44 -0500

Dirk Thomas gravatar image

updated 2013-08-15 12:12:16 -0500

It looks like a regression of https://github.com/ros/ros_comm/issues/242

It is fixed in https://github.com/ros/ros_comm/commit/2af3d693645f084086ef0a5c50f9b666ea0fc1fd and will be available with the next ros_comm release (1.9.48).

edit flag offensive delete link more

Comments

Yes, this fixed the problem. Thank!

mattadc gravatar image mattadc  ( 2013-08-16 05:17:54 -0500 )edit
0

answered 2013-08-15 06:49:03 -0500

SL Remy gravatar image

This seems as if you expect an array of positions, but according to the the wiki, the array value is in data object .. something like rostopic echo /robot/joint_states/position/data[1] should work (assuming that the namespace is correct.. and that you really expected an array of joint states to be published.. then there's another issue)

edit flag offensive delete link more
0

answered 2013-08-15 08:15:39 -0500

mattadc gravatar image

updated 2013-08-15 08:17:50 -0500

My topic is correct. It's a standard sensor_msgs/JointState message type, so it does have a field position that's a float64 array.

Output of rostopic info is:

Type: sensor_msgs/JointState

Publishers: * /realtime_loop (http://p1307010:33103/)

I tried the echo of ...position/data[1] and also get an error, but a different one:

Traceback (most recent call last): ...snip...
File "/opt/ros/groovy/lib/python2.7/dist-packages/genpy/message.py", line 532, in _get_message_or_service_class raise ValueError("message type is missing package name: %s"%str(message_type)) ValueError: message type is missing package name: float64[]

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-08-14 11:15:11 -0500

Seen: 1,489 times

Last updated: Aug 15 '13