Skip to content

Commit

Permalink
Merge pull request #236 from RobotWebTools/develop
Browse files Browse the repository at this point in the history
0.7.16
  • Loading branch information
jihoonl committed Aug 15, 2016
2 parents 4bf79bc + ee339d5 commit 9be60b6
Show file tree
Hide file tree
Showing 18 changed files with 122 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.pyc
*.iml
*.swp
.project
.pydevproject
.DS_Store
Expand Down
10 changes: 10 additions & 0 deletions rosapi/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
Changelog for package rosapi
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.7.16 (2016-08-15)
-------------------
* new srv: topics types and details
* Contributors: Marco Arruda

0.7.15 (2016-04-25)
-------------------
* changelog updated
* Contributors: Russell Toris

0.7.14 (2016-02-11)
-------------------
* Update proxy.py
Expand Down
2 changes: 1 addition & 1 deletion rosapi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ add_service_files(
HasParam.srv
MessageDetails.srv
Nodes.srv
NodeDetails.srv
Publishers.srv
SearchParam.srv
ServiceHost.srv
Expand Down Expand Up @@ -46,4 +47,3 @@ catkin_package(
install(PROGRAMS scripts/rosapi_node
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

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.14</version>
<version>0.7.16</version>
<description>
Provides service calls for getting ros meta-information, like list of
topics, services, params, etc.
Expand Down
15 changes: 12 additions & 3 deletions rosapi/scripts/rosapi_node
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def register_services():
rospy.Service('/rosapi/services', Services, get_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/topic_type', TopicType, get_topic_type)
rospy.Service('/rosapi/service_type', ServiceType, get_service_type)
rospy.Service('/rosapi/publishers', Publishers, get_publishers)
Expand All @@ -64,7 +65,9 @@ def register_services():

def get_topics(request):
""" Called by the rosapi/Topics service. Returns a list of all the topics being published. """
return TopicsResponse(proxy.get_topics())
topics = proxy.get_topics()
types = proxy.get_topics_types(topics)
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 """
Expand All @@ -82,6 +85,11 @@ def get_nodes(request):
""" Called by the rosapi/Nodes service. Returns a list of all the nodes that are registered """
return NodesResponse(proxy.get_nodes())

def get_node_details(request):
""" Called by the rosapi/Nodes service. Returns a node description """
node = request.node
return NodeDetailsResponse(proxy.get_node_subscriptions(node), proxy.get_node_publications(node), proxy.get_node_services(node))

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)
Expand Down Expand Up @@ -124,7 +132,8 @@ def get_service_host(request):
def get_message_details(request):
""" Called by the rosapi/MessageDetails service. Given the name of a message type, returns the TypeDef
for that type."""
return MessageDetailsResponse([dict_to_typedef(d) for d in objectutils.get_typedef_recursive(request.type)])
typedefs = [dict_to_typedef(d) for d in objectutils.get_typedef_recursive(request.type)]
return MessageDetailsResponse(typedefs)

def get_service_request_details(request):
""" Called by the rosapi/ServiceRequestDetails service. Given the name of a service type, returns the TypeDef
Expand Down Expand Up @@ -175,4 +184,4 @@ if __name__ == '__main__':
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 @@ -199,5 +199,5 @@ def _type_name(type, instance):
def _type_name_from_instance(instance):
mod = instance.__module__
type = mod[0:find(mod, '.')]+"/"+instance.__class__.__name__
return type
return type

49 changes: 48 additions & 1 deletion rosapi/src/rosapi/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ def get_topics():
except:
return []

def get_topics_types(topics):
try:
types = []
for i in topics:
types.append(get_topic_type(i))
return types
except:
return[]


def get_topics_for_type(type):
return find_by_type(type)
Expand All @@ -72,6 +81,44 @@ def get_nodes():
""" Returns a list of all the nodes registered in the ROS system """
return rosnode.get_node_names()

def get_node_publications(node):
""" Returns a list of topic names that are been published by the specified node """
try:
publishers, subscribers, services = Master('/rosbridge').getSystemState()
toReturn = []
for i,v in publishers:
if node in v:
toReturn.append(i)
toReturn.sort()
return toReturn
except socket.error:
return []

def get_node_subscriptions(node):
""" Returns a list of topic names that are been subscribed by the specified node """
try:
publishers, subscribers, services = Master('/rosbridge').getSystemState()
toReturn = []
for i,v in subscribers:
if node in v:
toReturn.append(i)
toReturn.sort()
return toReturn
except socket.error:
return []

def get_node_services(node):
""" Returns a list of service names that are been hosted by the specified node """
try:
publishers, subscribers, services = Master('/rosbridge').getSystemState()
toReturn = []
for i,v in services:
if node in v:
toReturn.append(i)
toReturn.sort()
return toReturn
except socket.error:
return []

def get_topic_type(topic):
""" Returns the type of the specified ROS topic """
Expand Down Expand Up @@ -146,4 +193,4 @@ def get_service_host(service):
else:
uri = uri[9:]
uri = uri[:uri.find(':')]
return uri
return uri
5 changes: 5 additions & 0 deletions rosapi/srv/NodeDetails.srv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
string node
---
string[] subscribing
string[] publishing
string[] services
3 changes: 2 additions & 1 deletion rosapi/srv/Topics.srv
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

---
string[] topics
string[] topics
string[] types
10 changes: 10 additions & 0 deletions rosbridge_library/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
Changelog for package rosbridge_library
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.7.16 (2016-08-15)
-------------------
* Fixed deprecated code in pillow
* Contributors: vladrotea

0.7.15 (2016-04-25)
-------------------
* changelog updated
* Contributors: Russell Toris

0.7.14 (2016-02-11)
-------------------
* Another fix for code
Expand Down
2 changes: 1 addition & 1 deletion rosbridge_library/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package>
<name>rosbridge_library</name>
<version>0.7.14</version>
<version>0.7.16</version>
<description>
The core rosbridge package, repsonsible for interpreting JSON andperforming
the appropriate ROS action, like subscribe, publish, call service, and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def encode(string):
while length < bytes_needed:
string += '\n'
length += 1
i = Image.fromstring('RGB', (int(width), int(height)), string)
i = Image.frombytes('RGB', (int(width), int(height)), string)
buff = StringIO()
i.save(buff, "png")
encoded = standard_b64encode(buff.getvalue())
Expand Down
14 changes: 14 additions & 0 deletions rosbridge_server/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
Changelog for package rosbridge_server
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.7.16 (2016-08-15)
-------------------

0.7.15 (2016-04-25)
-------------------
* Track Twisted run_depend
Fixes `#218 <https://github.com/RobotWebTools/rosbridge_suite/issues/218>`_
* Add rosbridge_udp cmake install rule `#225 <https://github.com/RobotWebTools/rosbridge_suite/issues/225>`_
* Stop UDP server on ROS shutdown
* changelog updated
* Track Twisted run_depend
Fixes `#218 <https://github.com/RobotWebTools/rosbridge_suite/issues/218>`_
* Contributors: Jihoon Lee, Matt Vollrath, Russell Toris

0.7.14 (2016-02-11)
-------------------
* Abort websocket server listen() retry on shutdown
Expand Down
3 changes: 3 additions & 0 deletions rosbridge_server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ install(PROGRAMS
scripts/rosbridge_websocket
scripts/rosbridge_tcp.py
scripts/rosbridge_tcp
scripts/rosbridge_udp
scripts/rosbridge_udp.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

install(FILES
launch/rosbridge_websocket.launch
launch/rosbridge_tcp.launch
launch/rosbridge_udp.launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
)

3 changes: 2 additions & 1 deletion rosbridge_server/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package>
<name>rosbridge_server</name>
<version>0.7.14</version>
<version>0.7.16</version>
<description>A WebSocket interface to rosbridge.</description>

<license>BSD</license>
Expand All @@ -18,6 +18,7 @@
<build_depend>rosbridge_library</build_depend>
<build_depend>rosapi</build_depend>
<build_depend>rospy</build_depend>
<run_depend>python-twisted-core</run_depend>
<run_depend>rosbridge_library</run_depend>
<run_depend>rosapi</run_depend>
<run_depend>rospy</run_depend>
Expand Down
2 changes: 1 addition & 1 deletion rosbridge_server/scripts/rosbridge_udp.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from twisted.internet import reactor
from rosbridge_server import RosbridgeUdpSocket,RosbridgeUdpFactory
def shutdown_hook():
pass
reactor.stop()
if __name__ == "__main__":
rospy.init_node("rosbridge_websocket")
rospy.on_shutdown(shutdown_hook) # register shutdown hook to stop the server
Expand Down
8 changes: 8 additions & 0 deletions rosbridge_suite/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
Changelog for package rosbridge_suite
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.7.16 (2016-08-15)
-------------------

0.7.15 (2016-04-25)
-------------------
* changelog updated
* Contributors: Russell Toris

0.7.14 (2016-02-11)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion rosbridge_suite/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package>
<name>rosbridge_suite</name>
<version>0.7.14</version>
<version>0.7.16</version>
<description>
Rosbridge provides a JSON API to ROS functionality for non-ROS programs.
There are a variety of front ends that interface with rosbridge, including
Expand Down

0 comments on commit 9be60b6

Please sign in to comment.