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

When using roslibjs, getting value of some params returns empty.

asked 2013-05-07 06:41:32 -0500

Jamison gravatar image

Hello, I am trying to programmatically fetch params from my ROS instance using roslibjs. When fetching some params, the value returns successfully, however with other params the value returned is empty.

Here is a snippet of the code in question:

var bridge = new ROSLIB.Ros();
bridge.on('connection', onConnect);
bridge.on('error', onError);
bridge.connect('my-ros-server');

...

var param = new ROSLIB.Param({
    ros: bridge,
    name: name
});

param.get(function(value) {
    console.log(value.toString());
});
edit retag flag offensive close merge delete

Comments

It would be helpful if you could also post examples of some parameters that work and some that fail. For example, using rosparam dump param_name to show the type/value of each parameter.

Jeremy Zoss gravatar image Jeremy Zoss  ( 2013-05-07 07:08:32 -0500 )edit

I'll give it my best shot! ros_version returns "fuerte". "rrHardwareStatus4Enable", my own custom parameter, returns blank. Does that help?

Jamison gravatar image Jamison  ( 2013-05-07 07:53:43 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-05-07 10:41:23 -0500

Jamison gravatar image

Hi all, I wanted to post the answer to my question! I figured it out!

To get the value of a param from ROS using roslibjs, you must supply the full parameter name, not a truncated version!

My application was putting all of the params that ROS reported into a collapsible/expandable tree, and was stripping the /blah/ prefix from params like /blah/blahparam.

To reiterate, to get the value of a param from ROS, you must specify /blah/blahparam, not just blahparam.

Cheers!

edit flag offensive delete link more
1

answered 2013-05-07 10:41:45 -0500

rtoris288 gravatar image

There was an issue with roslibjs r5 and earlier: https://github.com/RobotWebTools/roslibjs/issues/37

r6 was pushed today with fixes and posted to the CDN as well.

If this still isn't working, verify the parameter is actually set using rosparam get <param_name> in the console.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-05-07 06:41:32 -0500

Seen: 715 times

Last updated: May 07 '13