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

ROSLIB.Param.get() callback not executing

asked 2018-07-16 11:01:46 -0500

AndrewJSchoen gravatar image

updated 2018-07-16 11:58:01 -0500

Hey all,

Not sure if something is broken, or if I am doing something wrong. I have started the bridge, and got to the point where when I load the page:

var ros = new ROSLIB.Ros({
        url: 'ws://localhost:9090'
    });
ros.on('connection', function() {
        console.log('Connected to websocket server.');
    });

Result:

"Connected to websocket server."

However, I have some parameters already on the server under the namespace /lookup. These were loaded in from a yaml file with rosparam load. When I attempt to load these values, I get no callback behavior:

var ros = new ROSLIB.Ros({
        url: 'ws://localhost:9090'
    });

var lookup = new ROSLIB.Param({
        ros : ros,
        name : '/lookup'
    });

ros.on('connection', function() {
        console.log('Connected to websocket server.');
        lookup.get(function(value){
            console.log("Lookup: "+value);
        });
        console.log('Ended connection sequence');
    });

Result:

"Connected to websocket server." "Ended connection sequence"

No errors, but no printing of my info.

I also verified that I am able to use the set command, and these parameters get set and are visible when running rosparam get <parameter>. When I tried to get this parameter with the above logic, however, it never executed the callback, as with the others.

I also tried with ros.getParams, but that didn't work either. Am I doing something incorrectly? Also, using ros-kinetic, if that helps.

edit retag flag offensive close merge delete

Comments

I'm facing a similar issue. By any chance, did you find a solution?

jubeira gravatar image jubeira  ( 2018-11-07 13:14:02 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-11-07 14:52:01 -0500

jubeira gravatar image

I had this problem, and I ended up realizing the communication between ROS and the socket wasn't bi-directional. web --> ros was alright, but ros --> web was not. In other words, I could publish messages using roslibjs but not subscribe to a topic (nor get parameters, etc).

I ended up in this issue, and in particular, this comment. I reinstalled twisted using pip and roslibjs started working properly again.

Your issue might have a different cause, but this solution worked for me.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2018-07-16 11:01:46 -0500

Seen: 615 times

Last updated: Nov 07 '18