Skip to content

Commit

Permalink
0.8.1 (#289)
Browse files Browse the repository at this point in the history
* Added new parameters for topic and service security.

Added 3 new parameters to rosapi and rosbridge_server which filter the
topics, services, and parameters broadcast by the server to match an
array of glob strings.

* Two minor fixes.

* Fixed time object field definitions to match documentation.

* As per the suggestions of @T045T, fixed several typos, improved logging, and made some style fixes.

* Added services_glob to CallServices, added globs to rosbridge_tcp and rosbridge_udp, and other miscellanous fixes.

* add missing imports and correct default values for glob parameters

* correct default values for security globs

also accept empty list as the default "do not check globs" value in addition to None.

Finally, append rosapi service glob after processing command line input so it's not overwritten

* add missing import

* adjust log level for security globs

Normal operation (i.e. no globs or successful verification of requests) is now silent, with illegal requests producing a warning.

* new service: get actionlib servers

* no rospy needed, just for debug logging

* Delay unregister to mitigate !138

* Fix: Set default to publish all topics

Without better doc, one does not understand why no topics are published. I thought, something is broken.
With this defaults, everything is working out of the box. And for a more secure setup, one can change it.

* Added default topics to all launch files, and fixed bug where it would crash if nothing was put into the lists as values

* Added bug fix in rosapi

* Fixed the launch files for the tcp and udp service. Without these modifications, the rosapi node fails because some rosparams are not defined properly before. Now the launchfiles comply to the websocket version.

* update changelog

* 0.7.17

* Implemented a bson_only_mode flag for the TCP version of rosbridge; This allows you to switch to a full-duplex transmission of BSON messages and therefore eliminates the need for a base64 encoding of binary data; Use the new mode by starting:'roslaunch rosbridge_server rosbridge_tcp.launch bson_only_mode:=True' or passing '--bson_only_mode' to the rosbridge_tcp.py script

* minor change in variable usage

* Move UNREGISTER_TIMEOUT to member class so it's accessible from outside

* Fix missing tests due to delayed unregistration

* Fix test advertise errors after delayed unregister changes

* Reduce timeout for tests

Tests will sleep for 10% extra of the timeout to prevent some situations
were the test sleep ended right before the unregister timer fired

* Change class constant to module constant

* Update protocol.py

Prevent a KeyError when bson_only_mode is unset.

* Set default for bson_only_mode in websocket handler and launch file.

* Create README.md

* Update README.md

Formatting and examples

* don't try to set TCP nodelay option for UDP

* expose binary_encoder rosparam that was hidden in deep depth

* correct the possible argument

* address review comment. more explicitly describe valid args

* Cleaning up travis configuration (#283)

configure travis to use industial ci configuration. Now it uses xenial and kinetic

* fix delete_param in rosapi (#284)

* added topic and service names to warnings in order to improve immediate debugability; minor linting (#286)

* Fixing errors in test. (#287)

* appease call service using timeout and proper arrival waiting

* add queue_size on publisher

* test them individually.

* add time after wait for service

* update changelog

* 0.8.0

* remove ujson from dependency to build in trusty (#290)

* update changelog

* 0.8.1
  • Loading branch information
jihoonl committed Aug 30, 2017
1 parent 7dc9ccd commit 75513f1
Show file tree
Hide file tree
Showing 39 changed files with 964 additions and 170 deletions.
49 changes: 24 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
language:
- cpp
- python
# This config file for Travis CI utilizes ros-industrial/industrial_ci package.
# For more info for the package, see https://github.com/ros-industrial/industrial_ci/blob/master/README.rst

dist: xenial
services:
- docker
language: generic
python:
- "2.7"
compiler:
- gcc

notifications:
email:
on_success: always
on_failure: always

env:
matrix:
- ROS_DISTRO="kinetic" ROS_REPOSITORY_PATH=http://packages.ros.org/ros/ubuntu USE_DEB=true
- ROS_DISTRO="kinetic" PRERELEASE=true PRERELEASE_DOWNSTREAM_DEPTH=0

matrix:
allow_failures:
- env: ROS_DISTRO="kinetic" PRERELEASE=true PRERELEASE_DOWNSTREAM_DEPTH=0

branches:
only:
- master
- develop

install:
- sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu precise main" > /etc/apt/sources.list.d/ros-latest.list'
- wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
- sudo apt-get update -qq
- sudo apt-get install python-catkin-pkg python-rosdep ros-hydro-catkin -qq
- sudo rosdep init
- rosdep update
- mkdir -p /tmp/ws/src
- ln -s `pwd` /tmp/ws/src/package
- cd /tmp/ws
- rosdep install --from-paths src --ignore-src --rosdistro hydro -y
- sudo pip install ujson
before_script:
- source /opt/ros/hydro/setup.bash
- catkin_make
- catkin_make install
- sudo apt-get install ros-hydro-rostest
- source devel/setup.bash
- export ROS_MASTER_URI=http://localhost:11311
- export ROS_HOSTNAME=localhost
- git clone https://github.com/ros-industrial/industrial_ci.git .ci_config

script:
- rostest rosbridge_library test_all.test
- sudo pip uninstall ujson -y -q
- rostest rosbridge_library test_all.test
- source .ci_config/travis.sh
33 changes: 33 additions & 0 deletions rosapi/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,39 @@
Changelog for package rosapi
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.8.1 (2017-08-30)
------------------

0.8.0 (2017-08-30)
------------------
* fix delete_param in rosapi (`#284 <https://github.com/RobotWebTools/rosbridge_suite/issues/284>`_)
* Merge pull request `#276 <https://github.com/RobotWebTools/rosbridge_suite/issues/276>`_ from sevenbitbyte/DOCUMENT_GLOB
Document glob
* Update README.md
Formatting and examples
* Create README.md
* Contributors: 7bit, Jihoon Lee

0.7.17 (2017-01-25)
-------------------
* Added bug fix in rosapi
* no rospy needed, just for debug logging
* new service: get actionlib servers
* adjust log level for security globs
Normal operation (i.e. no globs or successful verification of requests) is now silent, with illegal requests producing a warning.
* correct default values for security globs
also accept empty list as the default "do not check globs" value in addition to None.
Finally, append rosapi service glob after processing command line input so it's not overwritten
* Added services_glob to CallServices, added globs to rosbridge_tcp and rosbridge_udp, and other miscellanous fixes.
* As per the suggestions of @T045T, fixed several typos, improved logging, and made some style fixes.
* Fixed time object field definitions to match documentation.
* Two minor fixes.
* Added new parameters for topic and service security.
Added 3 new parameters to rosapi and rosbridge_server which filter the
topics, services, and parameters broadcast by the server to match an
array of glob strings.
* Contributors: Devon Ash, Eric, Marco Arruda, Nils Berg

0.7.16 (2016-08-15)
-------------------
* new srv: topics types and details
Expand Down
1 change: 1 addition & 0 deletions rosapi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ add_message_files(
add_service_files(
FILES
DeleteParam.srv
GetActionServers.srv
GetParam.srv
GetParamNames.srv
GetTime.srv
Expand Down
29 changes: 29 additions & 0 deletions rosapi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
rosapi
===============

#### Parameters

* `~topics_glob` (string, default '')
* `~services_glob` (string, default '')
* `~params_glob` (string, default '')

```Note: By default the rosapi calls for details about topics, services, and parameters will return nothing. You must specify a list of allowed resources.```
Each of the glob parameters may contain an array of one or more match patterns. Resources that match any of the specified patterns will be returned by calls to the rosapi services.

An example launch file which enables all information to be returned.

```
<node name="rosapi" pkg="rosapi" type="rosapi_node">
<param name="topics_glob" value="[*]" />
<param name="services_glob" value="[*]" />
<param name="params_glob" value="[*]" />
</node>
```


This example launch file enables only rosout and certain camera topics
```
<node name="rosapi" pkg="rosapi" type="rosapi_node">
<param name="topics_glob" value="[/rosout, /camera/rgb/*]" />
</node>
```
2 changes: 1 addition & 1 deletion rosapi/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package>
<name>rosapi</name>
<version>0.7.16</version>
<version>0.8.1</version>
<description>
Provides service calls for getting ros meta-information, like list of
topics, services, params, etc.
Expand Down
63 changes: 46 additions & 17 deletions rosapi/scripts/rosapi_node
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,27 @@ from rosapi import proxy, objectutils, params
from rosapi.srv import *
from rosapi.msg import *

topics_glob = []
services_glob = []
params_glob = []

def get_globs():
global topics_glob
global services_glob
global params_glob
topics_glob = [
element.strip().strip("'")
for element in rospy.get_param('~topics_glob', '')[1:-1].split(',')
if len(element.strip().strip("'")) > 0]
services_glob = [
element.strip().strip("'")
for element in rospy.get_param('~services_glob', '')[1:-1].split(',')
if len(element.strip().strip("'")) > 0]
params_glob = [
element.strip().strip("'")
for element in rospy.get_param('~params_glob', '')[1:-1].split(',')
if len(element.strip().strip("'")) > 0]

# Initialises the ROS node
def register_services():
rospy.Service('/rosapi/topics', Topics, get_topics)
Expand All @@ -45,6 +66,7 @@ def register_services():
rospy.Service('/rosapi/services_for_type', ServicesForType, get_services_for_type)
rospy.Service('/rosapi/nodes', Nodes, get_nodes)
rospy.Service('/rosapi/node_details', NodeDetails, get_node_details)
rospy.Service('/rosapi/action_servers', GetActionServers, get_action_servers)
rospy.Service('/rosapi/topic_type', TopicType, get_topic_type)
rospy.Service('/rosapi/service_type', ServiceType, get_service_type)
rospy.Service('/rosapi/publishers', Publishers, get_publishers)
Expand All @@ -65,21 +87,22 @@ def register_services():

def get_topics(request):
""" Called by the rosapi/Topics service. Returns a list of all the topics being published. """
topics = proxy.get_topics()
types = proxy.get_topics_types(topics)
rospy.logdebug("List of allowed topic globs: "+str(topics_glob))
topics = proxy.get_topics(topics_glob)
types = proxy.get_topics_types(topics, topics_glob)
return TopicsResponse(topics, types)

def get_topics_for_type(request):
""" Called by the rosapi/TopicsForType service. Returns a list of all the topics that are publishing a given type """
return TopicsForTypeResponse(proxy.get_topics_for_type(request.type))
return TopicsForTypeResponse(proxy.get_topics_for_type(request.type, topics_glob))

def get_services(request):
""" Called by the rosapi/Services service. Returns a list of all the services being advertised. """
return ServicesResponse(proxy.get_services())
return ServicesResponse(proxy.get_services(services_glob))

def get_services_for_type(request):
""" Called by the rosapi/ServicesForType service. Returns a list of all the services that are publishing a given type """
return ServicesForTypeResponse(proxy.get_services_for_type(request.type))
return ServicesForTypeResponse(proxy.get_services_for_type(request.type, services_glob))

def get_nodes(request):
""" Called by the rosapi/Nodes service. Returns a list of all the nodes that are registered """
Expand All @@ -90,34 +113,39 @@ def get_node_details(request):
node = request.node
return NodeDetailsResponse(proxy.get_node_subscriptions(node), proxy.get_node_publications(node), proxy.get_node_services(node))

def get_action_servers(request):
""" Called by the rosapi/GetActionServers service. Returns a list of action servers based on actions standard topics """
topics = proxy.get_topics(topics_glob)
action_servers = proxy.filter_action_servers(topics)
return GetActionServersResponse(action_servers)
def get_topic_type(request):
""" Called by the rosapi/TopicType service. Given the name of a topic, returns the name of the type of that topic.
Request class has one field, 'topic', which is a string value (the name of the topic)
Response class has one field, 'type', which is a string value (the type of the topic)
If the topic does not exist, an empty string is returned. """
return TopicTypeResponse(proxy.get_topic_type(request.topic))
return TopicTypeResponse(proxy.get_topic_type(request.topic, topics_glob))

def get_service_type(request):
""" Called by the rosapi/ServiceType service. Given the name of a service, returns the type of that service
Request class has one field, 'service', which is a string value (the name of the service)
Response class has one field, 'type', which is a string value (the type of the service)
If the service does not exist, an empty string is returned. """
return ServiceTypeResponse(proxy.get_service_type(request.service))
return ServiceTypeResponse(proxy.get_service_type(request.service, services_glob))

def get_publishers(request):
""" Called by the rosapi/Publishers service. Given the name of a topic, returns a list of node names
that are publishing on that topic. """
return PublishersResponse(proxy.get_publishers(request.topic))
return PublishersResponse(proxy.get_publishers(request.topic, topics_glob))

def get_subscribers(request):
""" Called by the rosapi/Subscribers service. Given the name of a topic, returns a list of node names
that are subscribing to that topic. """
return SubscribersResponse(proxy.get_subscribers(request.topic))
return SubscribersResponse(proxy.get_subscribers(request.topic, topics_glob))

def get_service_providers(request):
""" Called by the rosapi/ServiceProviders service. Given the name of a topic, returns a list of node names
that are advertising that service type """
return ServiceProvidersResponse(proxy.get_service_providers(request.service))
return ServiceProvidersResponse(proxy.get_service_providers(request.service, services_glob))

def get_service_node(request):
""" Called by the rosapi/ServiceNode service. Given the name of a service, returns the name of the node
Expand Down Expand Up @@ -146,24 +174,24 @@ def get_service_response_details(request):
return ServiceResponseDetailsResponse([dict_to_typedef(d) for d in objectutils.get_service_response_typedef_recursive(request.type)])

def set_param(request):
rosapi.params.set_param(request.name, request.value)
rosapi.params.set_param(request.name, request.value, params_glob)
return SetParamResponse()

def get_param(request):
return GetParamResponse(rosapi.params.get_param(request.name, request.default))
return GetParamResponse(rosapi.params.get_param(request.name, request.default, params_glob))

def has_param(request):
return HasParamResponse(rosapi.params.has_param(request.name))
return HasParamResponse(rosapi.params.has_param(request.name, params_glob))

def search_param(request):
return SearchParamResponse(rosapi.params.search_param(request.name))
return SearchParamResponse(rosapi.params.search_param(request.name, params_glob))

def delete_param(request):
rosapi.params.delete_param(request.name)
rosapi.params.delete_param(request.name, params_glob)
return DeleteParamResponse()

def get_param_names(request):
return GetParamNamesResponse(rosapi.params.get_param_names())
return GetParamNamesResponse(rosapi.params.get_param_names(params_glob))

def get_time(request):
return GetTimeResponse(rospy.get_rostime())
Expand All @@ -180,8 +208,9 @@ def dict_to_typedef(typedefdict):
if __name__ == '__main__':
try:
rospy.init_node('rosapi_node')
get_globs()
register_services()
rospy.loginfo("Rosapi started")
rospy.spin()
except rospy.ROSInterruptException:
pass
pass
2 changes: 1 addition & 1 deletion rosapi/src/rosapi/objectutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _get_special_typedef(type):
if type=="time" or type=="duration":
example = {
"type": type,
"fieldnames": ["sec", "nsec"],
"fieldnames": ["secs", "nsecs"],
"fieldtypes": ["int32", "int32"],
"fieldarraylen": [-1, -1],
"examples": [ "0", "0" ]
Expand Down
Loading

0 comments on commit 75513f1

Please sign in to comment.