forked from 4am-robotics/cob_command_tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7bf355
commit bfadecb
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
cmake_minimum_required(VERSION 2.8.3) | ||
project(service_tools) | ||
|
||
find_package(catkin REQUIRED | ||
COMPONENTS | ||
) | ||
|
||
catkin_package() | ||
|
||
|
||
catkin_install_python(PROGRAMS scripts/service_relay | ||
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<package format="2"> | ||
<name>service_tools</name> | ||
<version>0.6.4</version> | ||
<description> | ||
Service tools | ||
</description> | ||
|
||
<maintainer email="[email protected]">Florian Weisshardt</maintainer> | ||
<author email="[email protected]">Mathias Lüdtke</author> | ||
|
||
<license>LGPL</license> | ||
|
||
<buildtool_depend>catkin</buildtool_depend> | ||
|
||
<exec_depend>rospy</exec_depend> | ||
<exec_depend>rosservice</exec_depend> | ||
|
||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python | ||
|
||
import rospy | ||
import rosservice | ||
|
||
if __name__ == "__main__": | ||
argv = rospy.myargv() | ||
if len(argv) != 3: | ||
rospy.logerr("service_relay IN OUT") | ||
|
||
rospy.init_node("service_relay") | ||
|
||
local_name, remote_name = argv[1], argv[2] | ||
|
||
rospy.wait_for_service(remote_name) | ||
srv_def = rosservice.get_service_class_by_name(remote_name) | ||
remote = rospy.ServiceProxy(remote_name, srv_def) | ||
|
||
local = rospy.Service(local_name,srv_def, remote.call) | ||
rospy.loginfo("Started relay from %s to %s (%s)" % (local_name, remote_name, srv_def._type)) | ||
rospy.spin() |