RobotWebTools / rosbridge_suite

Server Implementations of the rosbridge v2 Protocol
https://robotwebtools.github.io
BSD 3-Clause "New" or "Revised" License
919 stars 519 forks source link

Nothing returned from rosbridge webserver #336

Closed rachelspykerman closed 6 years ago

rachelspykerman commented 6 years ago

Hi,

I am running rosbridge on a raspberry pi 3 model B+ (Stretch), and using roslibjs to create a simple webpage that can subscribe to a topic. I am unable to retrieve anything from the rosbridge server though. I know my code is correct because I had this previously set up on a raspberry pi model B (not B+) which ran Jessie (not Stretch), and everything worked fine. I was able to get topics from the server and subscribe to topics. I recently moved over to the 3 B+, installed rosbridge from source and a few extra packages, and now I'm no longer able to retrieve a list of topics or receive subscribed data.

I've done a lot of reading on forums that ran into the same issue (like this one: https://github.com/RobotWebTools/rosbridge_suite/issues/198) which suggested to install pymongo and not bson. So I uninstalled bson, and did a "sudo pip install pymongo", however, this did not resolve my issues.

My install steps are outlined below: cd ~/catkin_ws/src git clone https://github.com/RobotWebTools/rosbridge_suite.git git clone https://github.com/GT-RAIL/rosauth.git cd ~/catkin_ws catkin_make

When running "roslaunch rosbridge_server rosbridge_websocket.launch", I ran into missing packages: tornado, bson, and python-twisted. I ran the following to install these packages: sudo pip install tornado sudo pip install pymongo sudo apt-get install python-twisted

The rosbridge server now starts without any issues, I can connect to port 9090, but I do not receive any data back from the server. Example, the following code use to return a list of topics (when running on Jessie and older pi model): function getTopics() { var topicsClient = new ROSLIB.Service({ ros : ros, name : '/rosapi/topics', serviceType : 'rosapi/Topics' }); var request = new ROSLIB.ServiceRequest(); topicsClient.callService(request, function(result) { console.log("Getting topics..."); var resultsSorted = result.topics.sort(); for(var i=0; i < resultsSorted.length; i++) { //console.log(resultsSorted[i]); var opt = document.createElement("option"); document.getElementById("topicNameSub").innerHTML += '<option id="' + i + '">' + resultsSorted[i] + '</option>'; } }); };

The following are the versions of some of the packages I installed:

Raspberry pi: model 3 B+ running Raspbian Stretch version 9.4 python: 2.7.13 pymongo: 3.6.1 tornado: 5.0.2 twisted: 16, 6, 0

How can I fix this issue? I don't get any errors messages in the rosbridge log files. It seems to just silently ignore any requests to the server. Please let me know if you need any other information. I really appreciate your help!

Rachel

Behery commented 6 years ago

Maybe you aren't exposing any topics? there are parameters that control which topics/services/parameters are exposed in the rosapi:

<node name="rosapi" pkg="rosapi" type="rosapi_node">
        <param name="topics_glob" value="$(arg topics_glob)"/>
        <param name="services_glob" value="$(arg services_glob)"/>
        <param name="params_glob" value="$(arg params_glob)"/>
</node>
rachelspykerman commented 6 years ago

So when I run "roslaunch rosbridge_server rosbridge_websocket.launch", it tells me the following:

SUMMARY

PARAMETERS

NODES / rosapi (rosapi/rosapi_node) rosbridge_websocket (rosbridge_server/rosbridge_websocket)

ROS_MASTER_URI=http://192.168.8.3:11311

process[rosbridge_websocket-1]: started with pid [3777] process[rosapi-2]: started with pid [3778] registered capabilities (classes):

So it seems from the parameters list that /rosapi/params_glob, /rosapi/services_glob, and /rosapi/topics_glob are all being exposed (since they are set to *). Maybe I'm misunderstanding that though. If it's being exposed, how do I go about setting it up?

Behery commented 6 years ago

you're right. it means everything should be exposed. To see where the problem is, can you try calling the rosapi services themselves?

    rosservice call /rosapi/topics
    rosservice call /rosapi/services

it should give you the same output as rostopic list

rachelspykerman commented 6 years ago

rosservice call /rosapi/topics outputs all the topics in an array and rosservice call /rosapi/services outputs services in an array:

services: [/rosapi/set_param, /rosapi/get_loggers, /rosapi/has_param, /detectmarkers_realsense/get_loggers, /rosapi/delete_param, /rosapi/search_param, /rosapi/action_servers, /rosapi/topic_type, /detectmarkers_realsense/set_logger_level, /rosapi/subscribers, /rosapi/set_logger_level, /rosbridge_websocket/set_logger_level, /rosout/set_logger_level, /rosapi/service_host, /rosbridge_websocket/get_loggers, /rosapi/publishers, /rosapi/topics, /rosapi/get_param_names, /rosapi/get_time, /rosapi/service_response_details, /rosapi/message_details, /rosapi/services, /rosapi/service_node, /rosapi/services_for_type, /rosservice_1700_1529439894808/get_loggers, /rosapi/nodes, /rosapi/node_details, /arm_gripper/get_loggers, /rosapi/service_providers, /rosout/get_loggers, /rosapi/get_param, /rosapi/topics_for_type, /arm_gripper/set_logger_level, /rosapi/service_request_details, /rosservice_1700_1529439894808/set_logger_level, /rosapi/service_type]

So that seems to be working fine.

TechnoX commented 6 years ago

Seems like I have the same problem. The only solutions are referring to the bson bug, but as far as I can see I have the correct version (from pymongo).

Tried your code above and no topics were reported back.

On my Ubuntu where I run roscore and rosbridge: pymongo (3.6.1) Python 2.7.12 tornado (5.0.2) Twisted (18.4.0)

Linux 4.13.0-45-generic #50~16.04.1-Ubuntu SMP Wed May 30 11:18:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

rachelspykerman commented 6 years ago

I finally got it working! So I uninstalled pymongo, tornado, and python-twisted (and any other packages I had manually installed that had caused the roslaunch not to run). After uninstalling, I ran rosdep install, which will install all dependent packages needed for your current ros setup: rosdep install --from-paths src --ignore-src -r -y

After doing this, my problems were resolved :) I'm now able to retrieve topics and subscribe to topics.

TechnoX commented 6 years ago

Thanks! That resolved the issue for me as well! Strange that we happened to get the same error at the same time! I have no idea what was the cause, probably some inconsistencies between packages.

mpena2099 commented 6 years ago

Thank you very much, @rachelspykerman.

ericq commented 5 years ago

tornado version must be in 4.5.3. pip uninstall tornado pip install tornado==4.5.3 // this is so bad now.. because my jupyter notebook won't work with such an old version of tornado.

mvollrath commented 5 years ago

If you use rosbridge_server from the develop branch it will run Autobahn instead of Tornado. Should be released for kinetic+ soon.