v01
This commit is contained in:
68
thirdparty/ros/ros_comm/tools/topic_tools/scripts/demux_add
vendored
Executable file
68
thirdparty/ros/ros_comm/tools/topic_tools/scripts/demux_add
vendored
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env python
|
||||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2008, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import string
|
||||
|
||||
import rospy
|
||||
|
||||
# imports the DemuxAdd service
|
||||
from topic_tools.srv import DemuxAdd
|
||||
|
||||
USAGE = 'USAGE: demux_add DEMUX_NAME TOPIC'
|
||||
|
||||
def call_srv(m, t):
|
||||
# There's probably a nicer rospy way of doing this
|
||||
s = m + '/add'
|
||||
print "Waiting for service \"%s\""%(s)
|
||||
rospy.wait_for_service(s)
|
||||
print "Adding \"%s\" to demux \"%s\""%(t, m)
|
||||
try:
|
||||
srv = rospy.ServiceProxy(s, DemuxAdd)
|
||||
return srv(t)
|
||||
except rospy.ServiceException, e:
|
||||
print "Service call failed: %s"%e
|
||||
|
||||
def usage():
|
||||
return "%s "%sys.argv[0]
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = rospy.myargv()
|
||||
if len(args) != 3:
|
||||
print USAGE
|
||||
sys.exit(1)
|
||||
|
||||
m = args[1]
|
||||
t = args[2]
|
||||
call_srv(m, t)
|
||||
67
thirdparty/ros/ros_comm/tools/topic_tools/scripts/demux_delete
vendored
Executable file
67
thirdparty/ros/ros_comm/tools/topic_tools/scripts/demux_delete
vendored
Executable file
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env python
|
||||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2008, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
import rospy
|
||||
|
||||
# imports the DemuxDelete service
|
||||
from topic_tools.srv import DemuxDelete
|
||||
|
||||
USAGE = 'USAGE: demux_delete DEMUX_NAME TOPIC'
|
||||
|
||||
def call_srv(m, t):
|
||||
# There's probably a nicer rospy way of doing this
|
||||
s = m + '/delete'
|
||||
print "Waiting for service \"%s\""%(s)
|
||||
rospy.wait_for_service(s)
|
||||
print "Deleting \"%s\" from demux \"%s\""%(t, m)
|
||||
try:
|
||||
srv = rospy.ServiceProxy(s, DemuxDelete)
|
||||
return srv(t)
|
||||
except rospy.ServiceException, e:
|
||||
print "Service call failed: %s"%e
|
||||
|
||||
def usage():
|
||||
return "%s "%sys.argv[0]
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = rospy.myargv()
|
||||
if len(args) != 3:
|
||||
print USAGE
|
||||
sys.exit(1)
|
||||
|
||||
m = args[1]
|
||||
t = args[2]
|
||||
call_srv(m, t)
|
||||
70
thirdparty/ros/ros_comm/tools/topic_tools/scripts/demux_list
vendored
Executable file
70
thirdparty/ros/ros_comm/tools/topic_tools/scripts/demux_list
vendored
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env python
|
||||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2008, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import string
|
||||
|
||||
import rospy
|
||||
|
||||
# imports the DemuxList service
|
||||
from topic_tools.srv import DemuxList
|
||||
|
||||
USAGE = 'USAGE: demux_list DEMUX_NAME'
|
||||
|
||||
def call_srv(m):
|
||||
# There's probably a nicer rospy way of doing this
|
||||
s = m + '/list'
|
||||
print "Waiting for service \"%s\""%(s)
|
||||
rospy.wait_for_service(s)
|
||||
print "Listing topics from demux \"%s\""%(m)
|
||||
try:
|
||||
srv = rospy.ServiceProxy(s, DemuxList)
|
||||
resp = srv()
|
||||
if resp:
|
||||
print resp.topics
|
||||
return resp
|
||||
except rospy.ServiceException, e:
|
||||
print "Service call failed: %s"%e
|
||||
|
||||
def usage():
|
||||
return "%s "%sys.argv[0]
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = rospy.myargv()
|
||||
if len(args) != 2:
|
||||
print USAGE
|
||||
sys.exit(1)
|
||||
|
||||
m = args[1]
|
||||
call_srv(m)
|
||||
68
thirdparty/ros/ros_comm/tools/topic_tools/scripts/demux_select
vendored
Executable file
68
thirdparty/ros/ros_comm/tools/topic_tools/scripts/demux_select
vendored
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env python
|
||||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2008, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import string
|
||||
|
||||
import rospy
|
||||
|
||||
# imports the DemuxSelect service
|
||||
from topic_tools.srv import DemuxSelect
|
||||
|
||||
USAGE = 'USAGE: demux_select DEMUX_NAME TOPIC'
|
||||
|
||||
def call_srv(m, t):
|
||||
# There's probably a nicer rospy way of doing this
|
||||
s = m + '/select'
|
||||
print "Waiting for service \"%s\""%(s)
|
||||
rospy.wait_for_service(s)
|
||||
print "Selecting \"%s\" at demux \"%s\""%(t, m)
|
||||
try:
|
||||
srv = rospy.ServiceProxy(s, DemuxSelect)
|
||||
return srv(t)
|
||||
except rospy.ServiceException, e:
|
||||
print "Service call failed: %s"%e
|
||||
|
||||
def usage():
|
||||
return "%s "%sys.argv[0]
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = rospy.myargv()
|
||||
if len(args) != 3:
|
||||
print USAGE
|
||||
sys.exit(1)
|
||||
|
||||
m = args[1]
|
||||
t = args[2]
|
||||
call_srv(m, t)
|
||||
68
thirdparty/ros/ros_comm/tools/topic_tools/scripts/mux_add
vendored
Executable file
68
thirdparty/ros/ros_comm/tools/topic_tools/scripts/mux_add
vendored
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env python
|
||||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2008, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import string
|
||||
|
||||
import rospy
|
||||
|
||||
# imports the MuxAdd service
|
||||
from topic_tools.srv import MuxAdd
|
||||
|
||||
USAGE = 'USAGE: mux_add MUX_NAME TOPIC'
|
||||
|
||||
def call_srv(m, t):
|
||||
# There's probably a nicer rospy way of doing this
|
||||
s = m + '/add'
|
||||
print "Waiting for service \"%s\""%(s)
|
||||
rospy.wait_for_service(s)
|
||||
print "Adding \"%s\" to mux \"%s\""%(t, m)
|
||||
try:
|
||||
srv = rospy.ServiceProxy(s, MuxAdd)
|
||||
return srv(t)
|
||||
except rospy.ServiceException as e:
|
||||
print "Service call failed: %s"%e
|
||||
|
||||
def usage():
|
||||
return "%s "%sys.argv[0]
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = rospy.myargv()
|
||||
if len(args) != 3:
|
||||
print USAGE
|
||||
sys.exit(1)
|
||||
|
||||
m = args[1]
|
||||
t = args[2]
|
||||
call_srv(m, t)
|
||||
67
thirdparty/ros/ros_comm/tools/topic_tools/scripts/mux_delete
vendored
Executable file
67
thirdparty/ros/ros_comm/tools/topic_tools/scripts/mux_delete
vendored
Executable file
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env python
|
||||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2008, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
import rospy
|
||||
|
||||
# imports the MuxDelete service
|
||||
from topic_tools.srv import MuxDelete
|
||||
|
||||
USAGE = 'USAGE: mux_delete MUX_NAME TOPIC'
|
||||
|
||||
def call_srv(m, t):
|
||||
# There's probably a nicer rospy way of doing this
|
||||
s = m + '/delete'
|
||||
print "Waiting for service \"%s\""%(s)
|
||||
rospy.wait_for_service(s)
|
||||
print "Deleting \"%s\" from mux \"%s\""%(t, m)
|
||||
try:
|
||||
srv = rospy.ServiceProxy(s, MuxDelete)
|
||||
return srv(t)
|
||||
except rospy.ServiceException as e:
|
||||
print "Service call failed: %s"%e
|
||||
|
||||
def usage():
|
||||
return "%s "%sys.argv[0]
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = rospy.myargv()
|
||||
if len(args) != 3:
|
||||
print USAGE
|
||||
sys.exit(1)
|
||||
|
||||
m = args[1]
|
||||
t = args[2]
|
||||
call_srv(m, t)
|
||||
70
thirdparty/ros/ros_comm/tools/topic_tools/scripts/mux_list
vendored
Executable file
70
thirdparty/ros/ros_comm/tools/topic_tools/scripts/mux_list
vendored
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env python
|
||||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2008, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import string
|
||||
|
||||
import rospy
|
||||
|
||||
# imports the MuxList service
|
||||
from topic_tools.srv import MuxList
|
||||
|
||||
USAGE = 'USAGE: mux_list MUX_NAME'
|
||||
|
||||
def call_srv(m):
|
||||
# There's probably a nicer rospy way of doing this
|
||||
s = m + '/list'
|
||||
print "Waiting for service \"%s\""%(s)
|
||||
rospy.wait_for_service(s)
|
||||
print "Listing topics from mux \"%s\""%(m)
|
||||
try:
|
||||
srv = rospy.ServiceProxy(s, MuxList)
|
||||
resp = srv()
|
||||
if resp:
|
||||
print resp.topics
|
||||
return resp
|
||||
except rospy.ServiceException as e:
|
||||
print "Service call failed: %s"%e
|
||||
|
||||
def usage():
|
||||
return "%s "%sys.argv[0]
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = rospy.myargv()
|
||||
if len(args) != 2:
|
||||
print USAGE
|
||||
sys.exit(1)
|
||||
|
||||
m = args[1]
|
||||
call_srv(m)
|
||||
68
thirdparty/ros/ros_comm/tools/topic_tools/scripts/mux_select
vendored
Executable file
68
thirdparty/ros/ros_comm/tools/topic_tools/scripts/mux_select
vendored
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env python
|
||||
# Software License Agreement (BSD License)
|
||||
#
|
||||
# Copyright (c) 2008, Willow Garage, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Willow Garage, Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import string
|
||||
|
||||
import rospy
|
||||
|
||||
# imports the MuxSelect service
|
||||
from topic_tools.srv import MuxSelect
|
||||
|
||||
USAGE = 'USAGE: mux_select MUX_NAME TOPIC'
|
||||
|
||||
def call_srv(m, t):
|
||||
# There's probably a nicer rospy way of doing this
|
||||
s = m + '/select'
|
||||
print "Waiting for service \"%s\""%(s)
|
||||
rospy.wait_for_service(s)
|
||||
print "Selecting \"%s\" at mux \"%s\""%(t, m)
|
||||
try:
|
||||
srv = rospy.ServiceProxy(s, MuxSelect)
|
||||
return srv(t)
|
||||
except rospy.ServiceException as e:
|
||||
print "Service call failed: %s"%e
|
||||
|
||||
def usage():
|
||||
return "%s "%sys.argv[0]
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = rospy.myargv()
|
||||
if len(args) != 3:
|
||||
print USAGE
|
||||
sys.exit(1)
|
||||
|
||||
m = args[1]
|
||||
t = args[2]
|
||||
call_srv(m, t)
|
||||
114
thirdparty/ros/ros_comm/tools/topic_tools/scripts/relay_field
vendored
Executable file
114
thirdparty/ros/ros_comm/tools/topic_tools/scripts/relay_field
vendored
Executable file
@@ -0,0 +1,114 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Allows to take a topic or one of its fields and output it on another topic
|
||||
or fields.
|
||||
|
||||
The operations are done on the message, which is taken in the variable 'm'.
|
||||
|
||||
Example:
|
||||
$ rosrun topic_tools relay_field /chatter /header std_msgs/Header
|
||||
"seq: 0
|
||||
stamp:
|
||||
secs: 0
|
||||
nsecs: 0
|
||||
frame_id: m.data"
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
import argparse
|
||||
import sys
|
||||
import copy
|
||||
|
||||
import yaml
|
||||
|
||||
import roslib
|
||||
import rospy
|
||||
import rostopic
|
||||
import genpy
|
||||
import std_msgs
|
||||
|
||||
__author__ = 'www.kentaro.wada@gmail.com (Kentaro Wada)'
|
||||
|
||||
|
||||
def _eval_in_dict_impl(dict_, globals_, locals_):
|
||||
res = copy.deepcopy(dict_)
|
||||
for k, v in res.items():
|
||||
type_ = type(v)
|
||||
if type_ is dict:
|
||||
res[k] = _eval_in_dict_impl(v, globals_, locals_)
|
||||
elif (type_ is str) or (type_ is unicode):
|
||||
try:
|
||||
res[k] = eval(v, globals_, locals_)
|
||||
except NameError:
|
||||
pass
|
||||
except SyntaxError:
|
||||
pass
|
||||
return res
|
||||
|
||||
|
||||
class RelayField(object):
|
||||
def __init__(self):
|
||||
parser = argparse.ArgumentParser(
|
||||
formatter_class=argparse.RawTextHelpFormatter,
|
||||
description=(
|
||||
'Allows to relay field data from one topic to another.\n\n'
|
||||
'Usage:\n\trosrun topic_tools relay_field '
|
||||
'<input> <output topic> <output type> '
|
||||
'<expression on m>\n\n'
|
||||
'Example:\n\trosrun topic_tools relay_field '
|
||||
'/chatter /header std_msgs/Header\n\t'
|
||||
'"seq: 0\n\t stamp:\n\t secs: 0\n\t nsecs: 0\n\t '
|
||||
'frame_id: m.data"\n\n'
|
||||
)
|
||||
)
|
||||
parser.add_argument('input', help='Input topic or topic field.')
|
||||
parser.add_argument('output_topic', help='Output topic.')
|
||||
parser.add_argument('output_type', help='Output topic type.')
|
||||
parser.add_argument(
|
||||
'expression',
|
||||
help='Python expression to apply on the input message \'m\'.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--wait-for-start', action='store_true',
|
||||
help='Wait for input messages.'
|
||||
)
|
||||
|
||||
# get and strip out ros args first
|
||||
argv = rospy.myargv()
|
||||
args = parser.parse_args(argv[1:])
|
||||
|
||||
self.expression = args.expression
|
||||
|
||||
input_class, input_topic, self.input_fn = rostopic.get_topic_class(
|
||||
args.input, blocking=args.wait_for_start)
|
||||
if input_topic is None:
|
||||
print('ERROR: Wrong input topic (or topic field): %s' % args.input,
|
||||
file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
self.output_class = roslib.message.get_message_class(args.output_type)
|
||||
|
||||
self.sub = rospy.Subscriber(input_topic, input_class, self.callback)
|
||||
self.pub = rospy.Publisher(args.output_topic, self.output_class,
|
||||
queue_size=1)
|
||||
|
||||
def callback(self, m):
|
||||
if self.input_fn is not None:
|
||||
m = self.input_fn(m)
|
||||
|
||||
msg_generation = yaml.load(self.expression)
|
||||
pub_args = _eval_in_dict_impl(msg_generation, None, {'m': m})
|
||||
|
||||
now = rospy.get_rostime()
|
||||
keys = {'now': now, 'auto': std_msgs.msg.Header(stamp=now)}
|
||||
msg = self.output_class()
|
||||
genpy.message.fill_message_args(msg, [pub_args], keys=keys)
|
||||
self.pub.publish(msg)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
rospy.init_node('relay_field', anonymous=True)
|
||||
app = RelayField()
|
||||
rospy.spin()
|
||||
110
thirdparty/ros/ros_comm/tools/topic_tools/scripts/transform
vendored
Executable file
110
thirdparty/ros/ros_comm/tools/topic_tools/scripts/transform
vendored
Executable file
@@ -0,0 +1,110 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
@author: enriquefernandez
|
||||
|
||||
Allows to take a topic or one of it fields and output it on another topic
|
||||
after performing a valid python operation.
|
||||
|
||||
The operations are done on the message, which is taken in the variable 'm'.
|
||||
|
||||
* Examples (note that numpy is imported by default):
|
||||
$ rosrun topic_tools transform /imu/orientation/x /x_str std_msgs/String 'str(m)'
|
||||
$ rosrun topic_tools transform /imu/orientation/x /x_in_degrees std_msgs/Float64 -- '-numpy.rad2deg(m)'
|
||||
$ rosrun topic_tools transform /imu/orientation /norm std_msgs/Float64 'numpy.sqrt(numpy.sum(numpy.array([m.x, m.y, m.z, m.w])))'
|
||||
$ rosrun topic_tools transform /imu/orientation /norm std_msgs/Float64 'numpy.linalg.norm([m.x, m.y, m.z, m.w])'
|
||||
$ rosrun topic_tools transform /imu/orientation /euler geometry_msgs/Vector3 'tf.transformations.euler_from_quaternion([m.x, m.y, m.z, m.w])' --import tf
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import roslib
|
||||
import rospy
|
||||
import rostopic
|
||||
|
||||
import argparse
|
||||
import importlib
|
||||
import sys
|
||||
|
||||
|
||||
class TopicOp:
|
||||
|
||||
def __init__(self):
|
||||
parser = argparse.ArgumentParser(
|
||||
formatter_class=argparse.RawTextHelpFormatter,
|
||||
description='Apply a Python operation to a topic.\n\n'
|
||||
'A node is created that subscribes to a topic,\n'
|
||||
'applies a Python expression to the topic (or topic\n'
|
||||
'field) message \'m\', and publishes the result\n'
|
||||
'through another topic.\n\n'
|
||||
'Usage:\n\trosrun topic_tools transform '
|
||||
'<input> <output topic> <output type> '
|
||||
'[<expression on m>] [--import numpy tf]\n\n'
|
||||
'Example:\n\trosrun topic_tools transform /imu/orientation '
|
||||
'/norm std_msgs/Float64 '
|
||||
'\'sqrt(sum(array([m.x, m.y, m.z, m.w])))\'')
|
||||
parser.add_argument('input', help='Input topic or topic field.')
|
||||
parser.add_argument('output_topic', help='Output topic.')
|
||||
parser.add_argument('output_type', help='Output topic type.')
|
||||
parser.add_argument(
|
||||
'expression', default='m',
|
||||
help='Python expression to apply on the input message \'m\'.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'-i', '--import', dest='modules', nargs='+', default=['numpy'],
|
||||
help='List of Python modules to import.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--wait-for-start', action='store_true',
|
||||
help='Wait for input messages.'
|
||||
)
|
||||
|
||||
# get and strip out ros args first
|
||||
argv = rospy.myargv()
|
||||
args = parser.parse_args(argv[1:])
|
||||
|
||||
self.modules = {}
|
||||
for module in args.modules:
|
||||
try:
|
||||
mod = importlib.import_module(module)
|
||||
except ImportError:
|
||||
print('Failed to import module: %s' % module, file=sys.stderr)
|
||||
else:
|
||||
self.modules[module] = mod
|
||||
|
||||
self.expression = args.expression
|
||||
|
||||
input_class, input_topic, self.input_fn = rostopic.get_topic_class(
|
||||
args.input, blocking=args.wait_for_start)
|
||||
if input_topic is None:
|
||||
print('ERROR: Wrong input topic (or topic field): %s' % args.input, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
self.output_class = roslib.message.get_message_class(args.output_type)
|
||||
|
||||
self.sub = rospy.Subscriber(input_topic, input_class, self.callback)
|
||||
self.pub = rospy.Publisher(args.output_topic, self.output_class, queue_size=1)
|
||||
|
||||
def callback(self, m):
|
||||
if self.input_fn is not None:
|
||||
m = self.input_fn(m)
|
||||
|
||||
try:
|
||||
res = eval("{}".format(self.expression), self.modules, {'m': m})
|
||||
except NameError as e:
|
||||
print("Expression using variables other than 'm': %s" % e.message, file=sys.stderr)
|
||||
except UnboundLocalError as e:
|
||||
print('Wrong expression:%s' % e.message, file=sys.stderr)
|
||||
except Exception:
|
||||
raise
|
||||
else:
|
||||
if not isinstance(res, (list, tuple)):
|
||||
res = [res]
|
||||
self.pub.publish(*res)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
rospy.init_node('transform', anonymous=True)
|
||||
app = TopicOp()
|
||||
rospy.spin()
|
||||
Reference in New Issue
Block a user