GithubHelp home page GithubHelp logo

robotwebtools / rosbridge_suite Goto Github PK

View Code? Open in Web Editor NEW
855.0 47.0 506.0 3.04 MB

Server Implementations of the rosbridge v2 Protocol

Home Page: https://robotwebtools.github.io

License: BSD 3-Clause "New" or "Revised" License

CMake 1.04% Python 98.96%

rosbridge_suite's Introduction

rosbridge_suite

ROS Foxy version ROS Galactic version ROS Humble version ROS Rolling version

Server Implementations of the rosbridge v2 Protocol

rosbridge provides a JSON interface to ROS, allowing any client to send JSON to publish or subscribe to ROS topics, call ROS services, and more. rosbridge supports a variety of transport layers, including WebSockets and TCP. For information on the protocol itself, see the rosbridge protocol specification.

For full documentation, see the ROS wiki.

This project is released as part of the Robot Web Tools effort.

Packages

  • rosbridge_suite is a ROS meta-package including all the rosbridge packages.

  • rosbridge_library contains the Python API that receives JSON-formatted strings as input and controls ROS publishers/subscribers/service calls according to the content of the JSON strings.

  • rosbridge_server contains a WebSocket server implementation that exposes the rosbridge_library.

  • rosapi provides service calls for getting meta-information related to ROS like topic lists as well as interacting with the Parameter Server.

Clients

A rosbridge client is a program that communicates with rosbridge using its JSON API. rosbridge clients include:

  • roslibjs - A JavaScript API, which communicates with rosbridge over WebSockets.
  • jrosbridge - A Java API, which communicates with rosbridge over WebSockets.
  • roslibpy - A Python API, which communicates with rosbridge over WebSockets.
  • roslibrust - A Rust API, which communicates with rosbridge over WebSockets.

License

rosbridge_suite is released with a BSD license. For full terms and conditions, see the LICENSE file.

Authors

See the AUTHORS file for a full list of contributors.

Quality Declaration

This package claims to be in the Quality Level 3 category, see the Quality Declaration for more details.

Troubleshooting

See the TROUBLESHOOTING doc for common problems and solutions.

Release process

Releasing requires push access to RobotWebTools/rosbridge_suite as well as ros2-gbp/rosbridge_suite-release. For more details on how the release process works, see the bloom tutorial.

  1. Run catkin_generate_changelog to update CHANGELOG.rst files.
  2. Manually edit and clean up the changelogs. Commit the changes.
  3. Run catkin_prepare_release --bump [major/minor/patch] to bump versions in package.xml and push changes to origin.
  4. Run bloom-release commands to create PRs to update rosdistro:
    • bloom-release --rosdistro foxy --track foxy rosbridge_suite
    • bloom-release --rosdistro galactic --track galactic rosbridge_suite
    • bloom-release --rosdistro rolling --track rolling rosbridge_suite

Once the PRs are merged, packages will be available for each distro after the next sync. Build/sync status can be viewed at: foxy, galactic, rolling.

rosbridge_suite's People

Contributors

achim-k avatar amacneil avatar baalexander avatar behery avatar cclauss avatar dabertram avatar dependabot[bot] avatar dirk-thomas avatar dlu avatar dwlee avatar flynneva avatar fmessmer avatar hidmic avatar jihoonl avatar jonathanmace avatar jonbinney avatar jtbandes avatar kenji-miyake avatar marcoarruda avatar mvollrath avatar otl avatar rayman avatar rctoris avatar sanic avatar sea-bass avatar syrnick avatar t045t avatar travipross avatar xuhao1 avatar zflat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rosbridge_suite's Issues

How do I fix the error: __init__() got an unexpected keyword argument 'queue_size'?

I am running Groovy on Ubuntu 12.04. I just apt-get upgraded my ros-groovy packages (to version 0.5.4-0precise-20140417-0429-+0000) and now code that used to work fine is suddenly broken. I am simply publishing an empty message on a topic from javascript using roslibjs (revision 6) and subscribing with a smach_ros.MonitorState. I get the error: "init() got an unexpected keyword argument 'queue_size'". I have tried several versions of roslibjs, so I assume the problem might lie with recent changes in rosbridge. I wish I had never run 'apt-get upgrade' as everything was working well before I did. Any suggestions on how to fix this error or how to revert back to previous versions of ros-groovy packages that were working before? Thanks!

Check many-to-many topics

Need to check if If the topic already exists with the same type, a warning status message is sent and this message is dropped. which is in ROSBRIDGE_PROTOCOL.md is a typo. See #34 (comment)

Unable to load the manifest for package

I'm using rosbridge with catkin packages on hydro.

ros_rope (the webserver for the GUI) is started with a python script. At the same time rosbridge_websocket is started. Here's my launchfile:

<launch>
        <node name="ros_rope_server" pkg="ros_rope" type="server.py" output="screen" />
        <node name="ros_rope_bridge" pkg="rosbridge_server" type="rosbridge_websocket" />
        <node name="ros_rope_helper" pkg="ros_rope_helper" type="listener.py" output="screen" />
</launch>

Additionally there's another ROS node ros_rope_test providing the different services for the gui:

<launch>
        <node name="ros_rope_test_server" pkg="ros_rope_test" type="rope_server.py" output="screen" />
</launch>

I start both packages with roslaunch ros_rope server and roslaunch ros_rope_test server.

When the ros_rope executes the first service call to ros_rope_test, it throws the following exception:

[ERROR] [WallTime: 1396864502.429285] [Client 0] [id: call_service:/get_process_list:2] call_service InvalidPackageException: Unable to load the manifest for package ros_rope_test. Caused by: ros_rope_test

The next calls work without any problem. So this exception is only thrown once after the node is started.

(I already posted this bug here: http://answers.ros.org/question/149531/unable-to-load-the-manifest-for-package/ but no answer yet)

Serialization buffer size

Topic Subscriber buffers are currently infinite. This is a problem on systems with limited resources when there's a lot of big entries to serialize. Ideally the buffer sizes of the rosbridge subscribers would be taken into account.

advertisement with wrong type if the topic has 'parent' topic

rosbridge_server cannot advertise 'correct' message type if the topic has 'parent' topic.

For example, the topic foo is already advertised as std_msgs/String and if rosbridge tries to advertise the topics under foo such as foo/bar, the type of the topic is ignored and it will be std_msgs/String

Defragmentation TODOs

There were a few TODO items in the defragmentation code inside Pull Request #48. I'm moving the items to this ticket for safe keeping and to track the progress.

  • Add integration with rosauth in rosbridge_tcp
  • Adjust max_msg_length value based on further testing in rosbridge_tcp
  • Add documentation
  • Add exception handling
  • Add type checking
  • In defragmentation.py, use String.join() instead of "+=" to improve performance during message reconstruction

parsing of incomplete / multiple JSON-objects and other extensions

during my experimenting and prototyping with rosbridge I found that clients need to add some delay between sending (many) messages (at once) to rosbridge.

So, I added a buffer string to protocol.py for incoming data as well as some code to process this buffer (mainly trying to get complete JSON objects on after another).
This allows rosbridge-clients to send messages without delay and improves rosbridge performance significantly.

This is not a big issue in many cases, but during my tests for fragmentation and service_requests with huge response-messages, rosbridge constantly was not able " .. to deserialize message from client.."

are you aware of this?
is any work-around planned to address this?

my solution for now is just to look for opening and closing brackets and then simply try & error if this part of the buffer can be loaded as json object.
a cleaner solution would be e.g. to send the overall message size right before json message begins..

Let me know if you are interested in merging my changes and extensions into the main rosbridge_suite. I could try to do separate pull requests for each of them. I have done some manual testing of my code but would still need to write some automated unit-tests..

I currently have the code for:

  • tcp-server
  • defragmention of fragments sent by clients
  • enabled fragmentation of outgoing messages
  • advertising services
  • unadvertising services
  • requests to service providers connected via rosbridge

Test capability

jihoonl@whoola:~/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library$ rostest rosbridge_library test_capabilities.test 
... logging to /home/jihoonl/.ros/log/rostest-whoola-20062.log
[ROSUNIT] Outputting test results to /home/jihoonl/research/ros/isolate/build/test_results/rosbridge_library/rostest-test_capabilities_test_capabilities.xml
Traceback (most recent call last):
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/test/capabilities/test_call_service.py", line 13, in <module>
    from rosbridge_library.capabilities.call_service import CallService
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/capabilities/call_service.py", line 34, in <module>
    from rosbridge_library.capability import Capability
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/capability.py", line 33, in <module>
    from rosbridge_library.protocol import InvalidArgumentException
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/protocol.py", line 43, in <module>
    from rosbridge_library.capabilities.fragmentation import Fragmentation
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/capabilities/fragmentation.py", line 33, in <module>
    from rosbridge_library.capability import Capability
ImportError: cannot import name Capability
Traceback (most recent call last):
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/test/capabilities/test_subscribe.py", line 11, in <module>
    from rosbridge_library.capabilities import subscribe
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/capabilities/subscribe.py", line 36, in <module>
    from rosbridge_library.capability import Capability
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/capability.py", line 33, in <module>
    from rosbridge_library.protocol import InvalidArgumentException
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/protocol.py", line 43, in <module>
    from rosbridge_library.capabilities.fragmentation import Fragmentation
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/capabilities/fragmentation.py", line 33, in <module>
    from rosbridge_library.capability import Capability
ImportError: cannot import name Capability
testtest_advertise ... ok
testtest_call_service ... FAILURE!
FAILURE: test [test_call_service] did not generate test results
  File "/usr/lib/python2.7/unittest/case.py", line 327, in run
    testMethod()
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rostest/runner.py", line 162, in fn
    self.assert_(os.path.isfile(test_file), "test [%s] did not generate test results"%test_name)
  File "/usr/lib/python2.7/unittest/case.py", line 420, in assertTrue
    raise self.failureException(msg)
--------------------------------------------------------------------------------
testtest_publish ... ok
testtest_subscribe ... FAILURE!
FAILURE: test [test_subscribe] did not generate test results
  File "/usr/lib/python2.7/unittest/case.py", line 327, in run
    testMethod()
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rostest/runner.py", line 162, in fn
    self.assert_(os.path.isfile(test_file), "test [%s] did not generate test results"%test_name)
  File "/usr/lib/python2.7/unittest/case.py", line 420, in assertTrue
    raise self.failureException(msg)
--------------------------------------------------------------------------------

[ROSTEST]-----------------------------------------------------------------------

[rosbridge_library.rosunit-test_advertise/test_do_advertise][ERROR]-------------
Protocol instance has no attribute 'parameters'
  File "/usr/lib/python2.7/unittest/case.py", line 327, in run
    testMethod()
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/test/capabilities/test_advertise.py", line 122, in test_do_advertise
    proto = Protocol("hello")
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/protocol.py", line 99, in __init__
    if self.parameters:
--------------------------------------------------------------------------------

[rosbridge_library.rosunit-test_advertise/test_invalid_arguments][ERROR]--------
Protocol instance has no attribute 'parameters'
  File "/usr/lib/python2.7/unittest/case.py", line 327, in run
    testMethod()
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/test/capabilities/test_advertise.py", line 39, in test_invalid_arguments
    proto = Protocol("hello")
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/protocol.py", line 99, in __init__
    if self.parameters:
--------------------------------------------------------------------------------

[rosbridge_library.rosunit-test_advertise/test_invalid_msg_classes][ERROR]------
Protocol instance has no attribute 'parameters'
  File "/usr/lib/python2.7/unittest/case.py", line 327, in run
    testMethod()
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/test/capabilities/test_advertise.py", line 95, in test_invalid_msg_classes
    proto = Protocol("hello")
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/protocol.py", line 99, in __init__
    if self.parameters:
--------------------------------------------------------------------------------

[rosbridge_library.rosunit-test_advertise/test_invalid_msg_module][ERROR]-------
Protocol instance has no attribute 'parameters'
  File "/usr/lib/python2.7/unittest/case.py", line 327, in run
    testMethod()
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/test/capabilities/test_advertise.py", line 81, in test_invalid_msg_module
    proto = Protocol("hello")
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/protocol.py", line 99, in __init__
    if self.parameters:
--------------------------------------------------------------------------------

[rosbridge_library.rosunit-test_advertise/test_invalid_msg_package][ERROR]------
Protocol instance has no attribute 'parameters'
  File "/usr/lib/python2.7/unittest/case.py", line 327, in run
    testMethod()
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/test/capabilities/test_advertise.py", line 68, in test_invalid_msg_package
    proto = Protocol("hello")
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/protocol.py", line 99, in __init__
    if self.parameters:
--------------------------------------------------------------------------------

[rosbridge_library.rosunit-test_advertise/test_invalid_msg_typestrings][ERROR]--
Protocol instance has no attribute 'parameters'
  File "/usr/lib/python2.7/unittest/case.py", line 327, in run
    testMethod()
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/test/capabilities/test_advertise.py", line 54, in test_invalid_msg_typestrings
    proto = Protocol("hello")
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/protocol.py", line 99, in __init__
    if self.parameters:
--------------------------------------------------------------------------------

[rosbridge_library.rosunit-test_advertise/test_missing_arguments][ERROR]--------
Protocol instance has no attribute 'parameters'
  File "/usr/lib/python2.7/unittest/case.py", line 327, in run
    testMethod()
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/test/capabilities/test_advertise.py", line 27, in test_missing_arguments
    proto = Protocol("hello")
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/protocol.py", line 99, in __init__
    if self.parameters:
--------------------------------------------------------------------------------

[rosbridge_library.rosunit-test_advertise/test_valid_msg_classes][ERROR]--------
Protocol instance has no attribute 'parameters'
  File "/usr/lib/python2.7/unittest/case.py", line 327, in run
    testMethod()
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/test/capabilities/test_advertise.py", line 112, in test_valid_msg_classes
    proto = Protocol("hello")
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/protocol.py", line 99, in __init__
    if self.parameters:
--------------------------------------------------------------------------------

[rosbridge_library.rosunit-test_publish/test_invalid_arguments][ERROR]----------
Protocol instance has no attribute 'parameters'
  File "/usr/lib/python2.7/unittest/case.py", line 327, in run
    testMethod()
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/test/capabilities/test_publish.py", line 34, in test_invalid_arguments
    proto = Protocol("hello")
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/protocol.py", line 99, in __init__
    if self.parameters:
--------------------------------------------------------------------------------

[rosbridge_library.rosunit-test_publish/test_missing_arguments][ERROR]----------
Protocol instance has no attribute 'parameters'
  File "/usr/lib/python2.7/unittest/case.py", line 327, in run
    testMethod()
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/test/capabilities/test_publish.py", line 25, in test_missing_arguments
    proto = Protocol("hello")
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/protocol.py", line 99, in __init__
    if self.parameters:
--------------------------------------------------------------------------------

[rosbridge_library.rosunit-test_publish/test_publish_works][ERROR]--------------
Protocol instance has no attribute 'parameters'
  File "/usr/lib/python2.7/unittest/case.py", line 327, in run
    testMethod()
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/test/capabilities/test_publish.py", line 41, in test_publish_works
    proto = Protocol("hello")
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/src/rosbridge_library/protocol.py", line 99, in __init__
    if self.parameters:
--------------------------------------------------------------------------------

Support for subscription IDs in messages

I would like the ROSBridge server to return subscription ids along with
messages. This would allow me, on the client side, to associate received
messages with the components that requested the subscription. Then a
component, could, for example, unsubscribe after it receives N messages.

handling ros service call fail

rosbridge v2.0 protocol seems it does not support 'Failure of ros service'.
Failure means the service server returns false code.

I think it is better to handle the service result.
Adding

 "result": <bool> 

field to Service Response JSON will solve this problem.
(And if rosbridge server failed to call service, return JSON with this result:false for the response)
How do you think of this topic?

Error while obtaining service_type for services with a long name

https://github.com/RobotWebTools/rosbridge_suite/blob/develop/rosbridge_library/src/rosbridge_library/internal/services.py#L100 throws an exception for me when the full service name is too long. I believe this happens because a unicode string is passed to the rosservice tool to obtain the service type.

A quick check shows that this might be an upstream issue at, or the fact that unicode strings are not supposed to be passed to the rosservice tool. Some examples are below.

Changing the above line of code from:

service_type = get_service_type(service)

to

service_type = get_service_type(str(service))

should solve the problem.

@dirk-thomas: Do you think this is an upstream issue?

Examples:

piyushk@robot-devil:~/catkin_ws/src/bwi_guidance/bwi_guidance/www$ python
Python 2.7.3 (default, Feb 27 2014, 19:58:35) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from rosservice import get_service_type
>>> get_service_type('/services/bwi_guidance_server_service/person/camera/rgb/image_raw/compressed/set_parameters')
'dynamic_reconfigure/Reconfigure'
>>> get_service_type(u'/services/bwi_guidance_server_service/person/camera/rgb/image_raw/compressed/set_parameters')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rosservice/__init__.py", line 147, in get_service_type
    return get_service_headers(service_name, service_uri).get('type', None)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rosservice/__init__.py", line 123, in get_service_headers
    rosgraph.network.write_ros_handshake_header(s, header)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rosgraph/network.py", line 415, in write_ros_handshake_header
    s = encode_ros_handshake_header(header)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rosgraph/network.py", line 401, in encode_ros_handshake_header
    return struct.pack('<I', len(s)) + s
UnicodeDecodeError: 'ascii' codec can't decode byte 0x96 in position 0: ordinal not in range(128)
>>> get_service_type(u'/services/bwi_guidance_server_service/person/camera/rgb/image_raw/compressed/set_parameters')
KeyboardInterrupt
>>> get_service_type(u'/services/bwi_guidance_server_service/person/camera/rgb/image_raw/compressed/set_parameters')
KeyboardInterrupt
>>> get_service_type('/services/bwi_guidance_server_service/rosapi/service_request_details')
'rosapi/ServiceRequestDetails'
>>> get_service_type(u'/services/bwi_guidance_server_service/rosapi/service_request_details')
'rosapi/ServiceRequestDetails'
>>> get_service_type(u'/services/bwi_guidance_server_service/rosapi/service_response_details')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rosservice/__init__.py", line 147, in get_service_type
    return get_service_headers(service_name, service_uri).get('type', None)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rosservice/__init__.py", line 123, in get_service_headers
    rosgraph.network.write_ros_handshake_header(s, header)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rosgraph/network.py", line 415, in write_ros_handshake_header
    s = encode_ros_handshake_header(header)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rosgraph/network.py", line 401, in encode_ros_handshake_header
    return struct.pack('<I', len(s)) + s
UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128)

'/services/bwi_guidance_server_service/rosapi/service_request_details' was the longest service name I was able to process succesfully.

Port parameter should be within node's namespace

Currently, the parameter to set the port must be at /rosbridge/port. It should be located inside the node's namespace to adhere to better standards (~port). This also allows the possibility of starting multiple rosbridge server nodes on the same machine.

rosbridge documentation should migrate to ros.org

Most rosbridge users will be using the documentation on ros.org. Currently, if you search around for rosbridge on the site, you find one of two things: the old rosbridge with a depreciation notice that can be easily overlooked (someone even released it into groovy...?) or the new rosbridge with a completely blank page.

At the very least, install and run commands should be put up. I also feel the protocol itself should be clearly displayed on the WIKI in HTML. Currently the protocol is hidden on a page within a PDF. Since rosbridge should really be thought of as a protocol, it is important to have this information clearly available. Furthermore, since rosbridge is still "young", it will make it easier to suggest and collaborate on protocol enhancements.

How to install rosbridge

Hi,
I am using ubuntu 12.10 and I have ros electric.
How can I get and install rosbridge, from robot web tools?

Thank you

error while almost simultaneous rospy get/set params

Testing simple.html with current release causes this error. It seems like changes in rospy causes error.

Traceback (most recent call last):
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 618, in _handle_request
    response = convert_return_to_response(self.handler(request), self.response_class)
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosapi/scripts/rosapi", line 135, in set_param
    rosapi.params.set_param(request.name, request.value)
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosapi/src/rosapi/params.py", line 53, in set_param
    rospy.set_param(name, d)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rospy/client.py", line 494, in set_param
    _param_server[param_name] = param_value #MasterProxy does all the magic for us
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rospy/msproxy.py", line 140, in __setitem__
    self.target.setParam(rospy.names.get_caller_id(), rospy.names.resolve_name(key), val)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1578, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/xmlrpclib.py", line 1264, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1289, in single_request
    self.send_request(h, handler, request_body)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1391, in send_request
    connection.putrequest("POST", handler, skip_accept_encoding=True)
  File "/usr/lib/python2.7/httplib.py", line 856, in putrequest
    raise CannotSendRequest()
CannotSendRequest
[ERROR] [WallTime: 1398643081.784109] Error processing request: 
None
[ERROR] [WallTime: 1398643081.784417] [Client 11] [id: call_service:/rosapi/set_param:2] call_service ServiceException: service [/rosapi/set_param] responded with an error: error processing request: 

Remove self.publisher.unregister

Unregistering does not work correctly. Causes issues when you refresh your webpage and reconnect, for example. Temporary fix is to just remove self.publisher.unregister from rosbridge_library/internal/publishers.py.

Error when sending some data to rosbridge tcp server

I'm sending the following data to rosbridge_tcp server

{
"op": "publish",
"topic": "/gz/cmd_vel",
"msg": {
"linear": {
"x": 0.8,
"y": 0.2,
"z": 0.3
},
"angular": {
"x": 0.8,
"y": 0.2,
"z": 0.3
}
}
}

Whereas it recognizes the connection, I get an error like this on the rosbridge_tcp side

[ERROR] [WallTime: 1387317137.587144] Unable to accept incoming connection. Reason: init() got an unexpected keyword argument 'parameters'

Exception happened during processing of request from ('127.0.0.1', 54156)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 582, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 640, in init
self.finish()
File "./rosbridge_tcp", line 100, in finish
self.protocol.finish()

AttributeError: RosbridgeTcpSocket instance has no attribute 'protocol'

How do I solve this. Is this something to do with the data I sent or a bug of the server?

branching hydro

We should freeze the current code with minor bug fixing and make hydro branch with major changes.

Release rosbridge_suite

Can you by any chance trigger a new release? Would be great to have all the latest fixes (e.g. launch file location fix) in debians... Thanks!

Implement fragmentation support

David Betram brought up in the Rosbridge User group implementing fragmentation. Fragmentation is described in the Rosbridge Protocol Specification, but not fully implemented.

I started to just write where the code should be updated, but this turned into more of an explanation of how rosbridge works from incoming client request to returning a subscribed message. The juicy bit is at the end, but hopefully this will help elucidate the rosbridge pipeline.

  1. A rosbridge client needs to be running. A rosbridge client provides some network interface to the outside world. Rosbridge_server is an example of a rosbridge client that provides a WebSocket connection. The network could be anything, someone could add a rosbridge_tcp_server, for example, and have a TCP interface to rosbridge.
  2. The rosbridge client offloads most of the ROS-related work to the rosbridge_library package. It does this by instantiating an instance of the RosbridgeProtocol. The RosbridgeProtocol instance is responsible for interfacing with rosbridge_library and handling the actual subscriptions, publications, etc.
  3. A JSON message will arrive to the rosbridge client following the Rosbridge Protocol Specification. Checkout the onMessage handler for an example implementation in rosbridge_server.
  4. The JSON message is then passed on to the RosbridgeProtocol.
  5. The incoming message handler takes in the JSON string, parses it, and then determines what to do next based on the OP code ("advertise", "publish", "subscribe").
  6. Let's assume the OP is "subscribe" since we're discussing fragmentation. Subscriber's subscribe function will be called with the parsed incoming message.
  7. Notice the subscriber_args already is looking for "fragment_size" attribute. The "fragment_size" attribute is propagated throughout the Subscriber class. A quick explanation of update_params function: as multiple clients may be subscribing to the same topic with rosbridge, some may specify compression, some may specify different fragmentation sizes, etc. This function ensures all the clients are on the same level (lowest common denominator).
  8. The "fragment_size" attribute is propagated all the way to the Subscriber's publish function (as far as I can tell). The publish function here is actually referring to sending the message to the client(s) that requested it. Here is the important part, a conditional should check if fragment_size is not None and if so, utilize the Fragmentation class to split the message up into "fragment_size" chunks, and publish each to the subscribing client in the format outlined in the RosbridgeProtocol.

In conclusion, from what I can tell, it's mostly integrating Subscriber's publish function to handle the "fragment_size" case and utilizing the Fragment helper class. The Fragment helper class is under the capabilities directory, but I think it should be moved to the internals directory and follow a similar pattern to pngcompression.py. In addition to the move, the class will probably need updated as it hasn't been tested or integrated before.

No extra work should be needed by the rosbridge_client. However, a client like roslibjs will need to pass the "fragment_size" attribute when subscribing and need to buffer the fragments and concatenate when receiving, like so:

{ "op": "subscribe", "fragment_size": 10, ... }

Test internal failure

rostest rosbridge_library test_internal.test

[rosbridge_library.rosunit-test_multi_publisher/test_unregister_multipublisher][FAILURE]
True is not false
  File "/usr/lib/python2.7/unittest/case.py", line 327, in run
    testMethod()
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/test/internal/publishers/test_multi_publisher.py", line 42, in test_unregister_multipublisher
    self.assertFalse(self.is_topic_published(topic))
  File "/usr/lib/python2.7/unittest/case.py", line 414, in assertFalse
    raise self.failureException(msg)
--------------------------------------------------------------------------------
[rosbridge_library.rosunit-test_publisher_manager/test_register_multiple_notopictype][FAILURE]
True is not false
  File "/usr/lib/python2.7/unittest/case.py", line 327, in run
    testMethod()
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/test/internal/publishers/test_publisher_manager.py", line 152, in test_register_multiple_notopictype
    self.assertFalse(self.is_topic_published(topic))
  File "/usr/lib/python2.7/unittest/case.py", line 414, in assertFalse
    raise self.failureException(msg)
--------------------------------------------------------------------------------

[rosbridge_library.rosunit-test_publisher_manager/test_register_multiple_publishers][FAILURE]
True is not false
  File "/usr/lib/python2.7/unittest/case.py", line 327, in run
    testMethod()
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/test/internal/publishers/test_publisher_manager.py", line 97, in test_register_multiple_publishers
    self.assertFalse(self.is_topic_published(topic1))
  File "/usr/lib/python2.7/unittest/case.py", line 414, in assertFalse
    raise self.failureException(msg)
--------------------------------------------------------------------------------

[rosbridge_library.rosunit-test_publisher_manager/test_register_no_msgtype][passed]
[rosbridge_library.rosunit-test_publisher_manager/test_register_publisher][FAILURE]
True is not false
  File "/usr/lib/python2.7/unittest/case.py", line 327, in run
    testMethod()
  File "/home/jihoonl/research/ros/isolate/src/rosbridge_suite/rosbridge_library/test/internal/publishers/test_publisher_manager.py", line 37, in test_register_publisher
    self.assertFalse(self.is_topic_published(topic))
  File "/usr/lib/python2.7/unittest/case.py", line 414, in assertFalse
    raise self.failureException(msg)

Handling latched topic

migrating issue from rosjs. https://github.com/RobotWebTools/rosjs/issues/23

In current implementation rosbridge are not aware of latched topic. It causes a problem when there are multiple rosbridge clients.(e.g only first subscriber receives the latched topic and the follower would not get any message).

I would like to suggest to have latchted:true option parsing handling in rosbridge. Though, this also require some changes in rosjs, it would be the quick way to fix the issue.

It is open question so please feed me any suggestion.

rosbridge protocol should support generic authentication

The current rosbridge protocol supports no kind of authentication mechanism. I move enhance the protocol to support a new op type called auth. Authentication will be based on the MAC (message authentication code) scheme discussed at previous Robot Web Tools meetings and provided by rosauth https://github.com/WPI-RAIL/rosauth

The key to using MAC is that it does not tie users to a single "user database." It simply requires some trusted third-party to provide the hash-keys. An example could be RMS but it makes not difference if it comes from any other source.

The idea behind the auth operation would be that any server that enabled authentication would wait for this request to come in first before accepting any other op code from the client. Once the request comes in, it would verify the information (in a ROS system, using rosauth, however, the verification method is not tied to ROS). If the authentication is good, the connection would be kept and rosbridge would function as normal. If the authentication is bad, the connection would be severed. In the case that authentication is not enabled on the server, the op code can be ignored.

Authentication Operation:
{op: 'auth', mac: <string>, client: <string>, dest: <string>, rand: <string>, t: <int>, level: <string>, end: <int>}

mac - MAC (hashed) string given by the client
client - IP of the client
dest - IP of the destination
rand - Random string given by the client
t - Time of the authorization request given by the client
level - User level as a string given by the client
end - End time of the client's session given by the client

Should I rerelease debs in groovy?

I am just curious if it is worth to release a new deb in groovy.
It seems to have many changes including latch support and tcp.
But do not want to release new features since the current deb is fairly stable enough unless many users want.

Param get function sticks on last value

I am using the latest Debian version of rosbridge_suite under ROS Hydro and Ubuntu 12.04. When I issue two parameter reads in a row as shown below, the two values are always the same even though they are different on the parameter server. Sometimes the two values are the same as the first parameter read and sometimes they are the same as the second parameter read. Here is my test snippet:

var videoTopicParam = new ROSLIB.Param({
ros : ros,
name : param_ns + '/videoTopic'
});

videoTopicParam.get(function(value) {
if (videoTopicParam != null) {
    videoTopic = value;
    console.log(videoTopic);
}

// Create the video viewer
mjpegViewer = new MJPEGCANVAS.Viewer({
    divID : 'videoCanvas',
    host : mjpegHost,
    port: mjpegPort,
    width : videoWidth,
    height : videoHeight,
    quality: videoQuality,
    topic : videoTopic
});
});

// Create a Param object for the max linear speed
var maxLinearSpeedParam = new ROSLIB.Param({
ros : ros,
name : param_ns + '/maxLinearSpeed'
});

// Get the value of the max linear speed paramater
maxLinearSpeedParam.get(function(value) {
console.log('Parameter maxLinearSpeed set to: ' + value);
});

And here is what I see on the web browser console:

Rosbridge connected. 
Starting publishers
Video topic set to: /camera/rgb/image_color
Parameter maxLinearSpeed set to: /camera/rgb/image_color 

Or sometimes I see this:

Rosbridge connected. 
Starting publishers
Video topic set to: 0.2
Parameter maxLinearSpeed set to: 0.2

Is there a way to ensure that the proper assignments are made?

incompatibility between roslibjs and rosbridge in advertise capability

rosbridge advertise capabilities uses 'advertise_id' (or simply 'id') to keep track of which clients have requested advertising a given topic and matches these IDs with unadvertise topics to decide whether to actually unadvertisde the topic or not.

See here for example implementation.

On the other hand, roslibjs is using an auto-incremented ID with a different prefix for advertise and unadvertise (see here).

As a result, unadvertise calls will never work, since they always look to rosbridge as coming from a different ID than the corresponding advertise request.

Not sure if I should log this here or in the roslib repo. I'm leaving this here as a finding since I can't pursue this further - I need to work with a workaround instead.

/rosapi/topics broken

Traceback from calling /rosapi/topics:

Traceback (most recent call last): File "/opt/ros/groovy/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 619, in _handle_request response = convert_return_to_response(self.handler(request), self.response_class) File "/wg/stor5/rtoris/Documents/WPI/RAIL/ROS/groovy/src/rosbridge_suite/rosapi/scripts/rosapi", line 68, in get_topics return TopicsResponse(proxy.get_topics()) NameError: global name 'proxy' is not defined [ERROR] [WallTime: 1362512489.827216] Error processing request: global name 'proxy' is not defined

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.