Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all 24 articles
Browse latest View live

Using roslibjs to read a ROS parameter

$
0
0
Hello, I have some Javascript code that uses rosbridge_suite (Hydro debian install under Ubuntu 12.04) and roslibjs (latest version) to read in a parameter value from the rosbridge server and then set its value in a form field. It seems I don't understand the timing of when the parameter is read or the sequence in which Javascript functions are executed (or both) because I'm not getting the result I expected. My code (included below) does the following: * sets a default value for the parameter * reads the parameter from the rosbridge server and, if not null, overrides the default value * sets the value of a form field to the parameter value What I see on my form is that I always get the default value, not the value from the parameter server. If I put some log statements in my script, I see that the form value is getting updated before the parameter value is read via roslib even though the roslib code comes first. I am also verifying that the value *is* being read from the parameter server correctly. Here now is the relevant snippet: var maxLinearSpeed = 0.2; // Create a Param object for the max linear speed var maxLinearSpeedParam = new ROSLIB.Param({ ros : ros, name : '/maxLinearSpeed' }); // Get the value of the max linear speed paramater maxLinearSpeedParam.get(function(value) { if (value != null) { maxLinearSpeed = value; console.log(maxLinearSpeed); } }); var formElement = document.getElementById('maxLinearSpeedDisplay'); formElement.innerHTML = maxLinearSpeed; So if I set the value of the maxLinearSpeed parameter to 0.5 on the rosbridge server, then run my script, I always see the default value of 0.2 in the form field labeled 'maxLinearSpeedDisplay' instead of 0.5 as I expected. Yet the statement console.log(value) above displays the correct value of 0.5. Any idea what I am doing wrong? Thanks,
patrick

send and receive service message using rosbridge

$
0
0
Hello, I'm using rosbridge 2.0 to connect to a remote computer and call a ROS service on the remote machine. I'm using the sample client below (from the the rosbride website) to make the connection and call the service: from json import dumps from ws4py.client.threadedclient import WebSocketClient class GetLoggersClient(WebSocketClient): def get_loggers(self): msg = {'op': 'call_service', 'service': '/rosout/get_loggers'} self.send(dumps(msg)) def opened(self): print "Connection opened..." self.get_loggers() def closed(self, code, reason=None): print code, reason def received_message(self, m): print "Received:", m if __name__=="__main__": try: ws = GetLoggersClient('ws://127.0.0.1:9090/') ws.connect() except KeyboardInterrupt: ws.close() My question is how I can receive the output message of the service call. The output message is printed in the console by received_message(self,m), but I intend to assign this output to a variable. Thanks

Error for running rosbridge_websocket.launch

$
0
0
Hi, I compiled the rosbridge_suite package (develop branch). When I want to run roslaunch rosbridge_server rosbridge_websocket.launch, I encounter with the following error: File "/home/users/al/catkin_ws/src/rosbridge_suite/rosbridge_server/scripts/rosbridge_websocket", line 37, in from rosauth.srv import Authentication ImportError: No module named rosauth.srv process[rosapi-3]: started with pid [23225] [rosbridge_websocket-2] process has died [pid 23222, exit code 1, cmd /home/users/al/catkin_ws/src/rosbridge_suite/rosbridge_server/scripts/rosbridge_websocket __name:=rosbridge_websocket __log:=/home/users/al/.ros/log/d36deb7c-e84b-11e4-b7bd-001aa0cf0b47/rosbridge_websocket-2.log]. log file: /home/users/al/.ros/log/d36deb7c-e84b-11e4-b7bd-001aa0cf0b47/rosbridge_websocket-2*.log Please let me know how to solve it. Best

How to connect to rosbridge_suite/roslibjs via WAN IP

$
0
0
Hi there, i was trying out the following tutorial: [http://wiki.ros.org/roslibjs/Tutorials/BasicRosFunctionality](http://wiki.ros.org/roslibjs/Tutorials/BasicRosFunctionality) `roslaunch rosbridge_server rosbridge_websocket.launch` was started with now errors I have nginx as webserver and everything works fine from within the local network, after changing var ros = new ROSLIB.Ros({ url : 'ws://localhost:9090'}); to my local IP in the corresponding html-file from the tutorial: var ros = new ROSLIB.Ros({ url : 'ws://192.168.2.114:9090'}); That way everything is fine and working from within the local network. The html from the example is working, its listening to topic /listener and publishing to /cmd_vel. So I changed the IP in the html-file to my WAN IP (the one provided from my Provider) and tried to reach the html-file over WAN-Adress from outside the local network instead. But that doesn't work with the html-file from the tutorial. (The Webserver is still reachable, so WAN IP must be correct). I allready tryed to forward port 9090 within my router settings, like i did for port 80 from the webserver. With no success. I also know, that my router doesn't support NAT-Loopback and so i'm connecting to the webserver from another network. Does anybody know how i can connect to ROS with that tutorial from external network via internet or what has to be changed that it's working? Thanks Fabian

Installing rosbridge indigo on OSX

$
0
0
brew install ros-indigo-rosbridge-suite Errors with "no available formulae" Is there a way to bring up rosbridge on OSX (yosemite) ? Thanks!

Rosbridge only one way on my OSX

$
0
0
This probably has the same underlying cause as the problem I posted in http://answers.ros.org/question/221048/roslibjs-dont-get-goal-result-on-client/, but now I have a simpler way to reproduce the problem and that uses no code from me and some extra clues. I'm running OSX Yosemite, ROS Indigo, Rosbridge with ROSlibjs using the Chrome Browser. I can call a service from the browser, and it successfully executes on the server, but I can't get any information back to the browser. The simplest way I can reproduce this is: In a terminal window: $ roscore In another terminal window: $ rosrun rospy_tutorials add_two_ints_server (in the tutorial) In a third terminal window: $ roslaunch rosbridge_server rosbridge_websocket.launch (in the tutorial) From the web page: http://wiki.ros.org/roslibjs/Tutorials/BasicRosFunctionality copy the whole page HTML into a file, say, simple.html Here is is:

Simple roslib Example

Check your Web Console for output.

In Chrome, browse: file:///your_dir/simple.html Open the Chrome Development tools: I see in the console: `"Connected to websocket server"` (This is good) but there's nothing else printed in the console (this is bad) as the JS code indicates it should print out: Result for service call on /add_two_ints: 3 In the rosrun terminal window, I see printed out: Returning [1 + 2 = 3] Indicating that the service request made it to the server and the server did the computation. Additional info that perhaps provides some clues: $ rosnode list /add_two_ints_server /rosapi /rosbridge_websocket /rosout $ roswtf Loaded plugin tf.tfwtf Package: rospy_tutorials ================================================================================ Static checks summary: No errors or warnings ================================================================================ Beginning tests of your ROS graph. These may take awhile... analyzing graph... ... done analyzing graph running graph rules... ... done running graph rules Online checks summary: Found 1 warning(s). Warnings are things that may be just fine, but are sometimes at fault WARNING The following node subscriptions are unconnected: * /rosbridge_websocket: * /listener $ rostopic pub /listener std_msgs/String "Hello, World" doesn't cause Received message on /listener: "Hello, World" to be printed out in the Chrome console, as indicated in the tutorial. $ printenv | grep ROS ROS_ROOT=/opt/ros/indigo/share/ros ROS_PACKAGE_PATH=/Users/Fry/ros_ws/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks ROS_MASTER_URI=http://localhost:11311 ROSLISP_PACKAGE_DIRECTORIES=/Users/Fry/ros_ws/devel/share/common-lisp ROS_DISTRO=indigo ROS_ETC_DIR=/opt/ros/indigo/etc/ros $ cat /etc/hosts 127.0.0.1 localhost macbook-pro-2.home My guess is this has something to due with my particular ROS installation, esp the Rosbridge package which is difficult to install on OSX since brew is not supported. I'd be curious if running this on Ubuntu worked. Any debugging hints greatly appreciated. PS: chrome dev tool/Network/WS for localhost indicates that messages are going out from the browser, but none are coming into the browser.

Hi guys, I am not being able to install rosbridge on a Raspberry Pi 2.

$
0
0
Here is what I get on `sudo apt-get install ros-indigo-rosbridge-suite` Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package ros-indigo-rosbridge-suite

rosbridge_suite: InvalidPackageException: Unable to load the manifest for package rosgraph_msgs.

$
0
0
Hi, I'm using the rosbridge internal library to get load the message class for a given message type: from rosbridge_library import ros_loader ... self.msg_class = ros_loader.get_message_class(self.msg_type) where self.msg_type is, for example, "rosgraph_msgs/Log". This is generating the following error: File "/opt/ros/indigo/lib/python2.7/dist-packages/rosbridge_library/internal/ros_loader.py", line 88, in get_message_class return _get_msg_class(typestring) File "/opt/ros/indigo/lib/python2.7/dist-packages/rosbridge_library/internal/ros_loader.py", line 128, in _get_msg_class return _get_class(typestring, "msg", _loaded_msgs, _msgs_lock) File "/opt/ros/indigo/lib/python2.7/dist-packages/rosbridge_library/internal/ros_loader.py", line 163, in _get_class cls = _load_class(modname, subname, classname) File "/opt/ros/indigo/lib/python2.7/dist-packages/rosbridge_library/internal/ros_loader.py", line 187, in _load_class raise InvalidPackageException(modname, exc) InvalidPackageException: Unable to load the manifest for package rosgraph_msgs. Caused by: 'NoneType' object has no attribute 'strip' >> failed with InvalidPackageException This error is occurring on all message types, not just `rosgraph_msgs/Log`. Any suggestions would be appreciated. Thanks! Simon

Difference between rosserial and rosbridge_suite+roslibjs ?

$
0
0
What is the difference btween using rosserial package and rosbridge_suite+roslibjs? Does rosbridge_suite+roslibjs package provide any more functionality than using rosserial package?

How to use rosbridge_tcp.launch?

$
0
0
I want to publish data to the Ethernet port, my Ethernet connection is working fine(ftp://192.168.0.xxx opens robot files in mozilla and chrome browsers which I suppose means that my connection is okay), I set the Ethernet connection's ip in my computer to 192.168.0.yyy so it works. Now I want to publish joint angles(which will be basically a string like): $NACHI0+00000+00000+00000+00000+00000+00000001 (^that represents all joints angle in degrees(all zeros) and velocity of 1) on that connection but I can't find any example on using rosbridge_tcp, so if anyone knows how to achieve that kindly guide me towards the light o wise ones :) When I run: `roslaunch rosbridge_server rosbridge_tcp.launch` I get: started roslaunch server http://localhost:42462/ SUMMARY ======== PARAMETERS * /rosbridge_tcp/authenticate: False * /rosbridge_tcp/delay_between_messages: 0 * /rosbridge_tcp/fragment_timeout: 600 * /rosbridge_tcp/host: 192.168.0.111 * /rosbridge_tcp/incoming_buffer: 65536 * /rosbridge_tcp/max_message_size: None * /rosbridge_tcp/port: 9090 * /rosbridge_tcp/retry_startup_delay: 5 * /rosbridge_tcp/socket_timeout: 10 * /rosdistro: jade * /rosversion: 1.11.20 NODES / rosapi (rosapi/rosapi_node) rosbridge_tcp (rosbridge_server/rosbridge_tcp) ROS_MASTER_URI=http://localhost:11311 core service [/rosout] found process[rosbridge_tcp-1]: started with pid [10451] process[rosapi-2]: started with pid [10452] registered capabilities (classes): - rosbridge_library.capabilities.call_service.CallService - rosbridge_library.capabilities.advertise.Advertise - rosbridge_library.capabilities.publish.Publish - rosbridge_library.capabilities.subscribe.Subscribe - - rosbridge_library.capabilities.advertise_service.AdvertiseService - rosbridge_library.capabilities.service_response.ServiceResponse - rosbridge_library.capabilities.unadvertise_service.UnadvertiseService trying to start rosbridge TCP server.. [INFO] [WallTime: 1479106715.200108] Rosbridge TCP server started on port 9090 Thanks in advance

What should be the messageType for a custom message?

$
0
0
HI, I created a custom ROS message: string message int32 a int32 b I will need to publish the messages from the web browser (roslibjs) and show it on the terminal, using python. Roslibjs requires us to specify a messageType when we start a topic, for example: var msgTopic = new ROSLIB.Topic({ ros: ros, name: 'chatter', messageType: }); I don't know what would be the messageType here, for my custom message. I would appreciate any help with this. Thank you!

[roslibjs,rosbridgesuite] How to get data back from the robot in turtleSim

$
0
0
According to the roslibjs documentation, we should be able to get the data back from the robot by using a listener: // Publish the Topic var cmdVel = new ROSLIB.Topic({ ros: ros, name: '/turtle1/cmd_vel', messageType: 'geometry_msgs/Twist' }); // Subscribe to the Topic var listener = new ROSLIB.Topic({ ros: ros, name: '/listener', messageType: 'std_msgs/String' }); listener.subscribe(function (message) { console.log("Recieved Message on: " + listener.name + ": " + message.data); }); However, when I tried to use this, there was a compilation error that said `property 'data does not exist on type 'message'`. I really need to get the turtle-robot data back to my web browser, any help with this matter would be highly appreciated. Many thanks!

rosbridge_suite to recieve meshes

$
0
0
Hi, I'm using rosbridge_suite to visualize the robot on a windows machine in VR. Ideally, I would like to recieve the complete robot's description directly from the robot. I managed to recieve the plain URDF xml via "/rosapi/getparam robot_description". Is there any possiblity to load the meshes which are referenced in the URDF in a similar way? Or do I have to copy them manually? Thank you for your advise!

How to publish topics with received json object using Rosbridge library?

$
0
0
Hi all, Due to certain network configurations on the robot side, which I am not allowed to modify whatsoever, its ROS_MASTER_URI is set to http://localhost:11311 which subsequently cannot share topics across the network, I am trying to use Rosbridge to work around such limitation. Unfortunately Rosbridge_suite does not offer much documentation on how to do it. Taking for instance to subscribe a laserScan topic from the robot side and publish it at my client side, what I've achieved so far are the following: 1. Launch rosbridge_tcp by the robot side 2. use Python socket to subscribe to robot's topic and decode the Json formatted string into Python object by my client side 3. I can acquire elements within the received and de-serialized Python object 4. I have the topic advertised using rosbridge library capabilities' protocol and advertise module 5. I have the topic published using rosbridge library capabilities' publish module But at this point, there is nothing publishing at my client side. What should be the proper way to publish any topic? Thank you in advance!

rosbridge for melodic distro?

$
0
0
I'm currently trying to get rosbridge to run on an Ubuntu-VM. I installed ROS with no problems, but when I try to install rosbridge (which should be "sudo apt-get install ros-melodic-rosbridge-suite") it tells me, that he is unable to locate the package. I haven't found any source online for what distros of ROS Rosbridge is available, so can someone help me out here?

I can't install rosbridge_suite

$
0
0
Hello I try installing [rosbridge_suite](http://wiki.ros.org/rosbridge_suite) on ubuntu 18.04 with melodic. I tried - sudo apt install ros-kinetic-rosbridge-server - sudo apt install ros-indigo-rosbridge-server - sudo apt install ros-melodic-rosbridge-server and also - sudo apt install ros-kinetic-rosbridge-suite - sudo apt install ros-indigo-rosbridge-suite - sudo apt install ros-melodic-rosbridge-suite I can't get it. Always the message "Unable to locate package ros--rosbridge-suite" or "Unable to locate package ros--rosbridge-server". What I do wrong?

Integration of ROS Into a Seperate System

$
0
0
I have a system running ROS kinetic, specifically for asynchronous data collection. I also have a system running the computationally heavy post-processing of the collected data, which I have designed to be a multi-threaded process. I wish to integrate the two systems via means of a web user interface. My primary approach was to use a python micro-framework (such as flask) to launch a python web server, and then use the python *roslaunch* API to interface with the ROS framework. However, as others have noted, I ran into the typical error message: > ValueError: signal only works in main> thread which is clearly caused by calling the *roslaunch* API from a sub thread, due to the call being made from a web server. This leaves me wondering as to whether I am forced to integrate my entire system into the ROS framework, and use the *ROSBridge Suite* to handle user based interaction. A process which I am unsure about due to the synchronous nature of my processing suite. Consequently, this has left me looking for another method to integrate ROS into non-ROS based architectures, and figured I would reach out to the community for support. Alternatively, are my concerns about the integration of a multi-threaded processing suite into ROS unwarranted? Will the industrialization of an entire ROS based architecture prove to be a difficult task? Note: I understand this question could be viewed as open-ended, if that is the case, if you could point me towards a more design-oriented platform it would be greatly appreciated.

Is there any package in ros2 that like package "rosbridge_suite" in ros1 ?

$
0
0
recently, we want to upgrade our ros1 project into ros2, but we have a frontend package that using javascript api to call ros pub/sub with the help of "rosbridge_suite", we are stuck in it, could any one give me some help ?

Lag between goal publish, accept, and feedback

$
0
0
Hello! Using ROS melodic and Rosbridge Server, I'm seeing on average a delay of about 115-130ms between the time that I publish my goal, receive a status message that is accepted, and then receive my first feedback message through the websocket. Unfortunately, our robot is capturing events that occur so quickly that this represents a pretty significant amount of time for us, so I need to find a way to bring it down. The breakdown is about 100ms between goal submit and status and then from status to feedback it's around 15-30ms. I'm not sure that the status and feedback messages are related, since the status topic publishes at 100hz, but the feedback topic should have no such delay. There are no sleep commands in the code that would have an impact here and nothing in the code jumps out at me, which leads me to believe that this is just the way it's expected to behave or something is misconfigured or... I should be using C++ instead of Python? I'm not sure but I'd love advice. I'm using ROS melodic but saw this in Kinetic as well. My server is written in Python and it's setup as a Simple Action Server. The client is JS using the latest roslibjs. Connection is via websocket, I'm using Rosbridge Server. Open to any and all recommendations, happy to provide any more information that may be needed.

roslibpy: why does TFClient seem to ignore the rate parameter?

$
0
0
Hello, We're using `roslibpy` to capture `tf` messages from a robot via `rosbridge`, and rebroadcasting them on my local machine for viewing in `rviz`. So far, it works well, but I'd like to reduce bandwidth by lowering the message rate a little (we get them at about 10Hz). Setting the `rate` parameter in `TFClient` seems to have no effect. Here's the little `TFSub` class we're using: class TFSub(object): """Manages a set of rosbridge callbacks associated with tfs on a remote robot.""" def __init__(self, rosbridge_client): self.tf_client = TFClient(rosbridge_client, fixed_frame='map', angular_threshold=0.5, translation_threshold=0.5, rate=1.0) self.tf_client.subscribe('odom', self.tf_map_odom_cb) self.tf_client.subscribe('base_link', self.tf_map_base_link_cb) self.tb = tf.TransformBroadcaster() def tf_map_odom_cb(self, msg): rospy.logdebug("got a map->odom transform.") self.tb.sendTransform((msg['translation']['x'], msg['translation']['y'], msg['translation']['z']), (msg['rotation']['x'], msg['rotation']['y'], msg['rotation']['z'], msg['rotation']['w']), rospy.Time.now(), 'odom', 'map') def tf_map_base_link_cb(self, msg): rospy.logdebug("got a map->base_link transform.") self.tb.sendTransform((msg['translation']['x'], msg['translation']['y'], msg['translation']['z']), (msg['rotation']['x'], msg['rotation']['y'], msg['rotation']['z'], msg['rotation']['w']), rospy.Time.now(), 'base_link', 'map') Here's our invocation of `tf2_web_republisher`, running on the remote robot: As you can see, we're setting the `rate` parameter to 1.0, and setting a large `angular_threshold` and `translation_threshold`, but stll getting messages at just over 10.0Hz. We're running Python 2.7 at both ends of the bridge, Ubuntu 14, ROS Indigo.
Viewing all 24 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>