robot_program_interface.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # FSRobo-R Package BSDL
4 # ---------
5 # Copyright (C) 2019 FUJISOFT. All rights reserved.
6 #
7 # Redistribution and use in source and binary forms, with or without modification,
8 # are permitted provided that the following conditions are met:
9 # 1. Redistributions of source code must retain the above copyright notice,
10 # this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright notice,
12 # this list of conditions and the following disclaimer in the documentation and/or
13 # other materials provided with the distribution.
14 # 3. Neither the name of the copyright holder nor the names of its contributors
15 # may be used to endorse or promote products derived from this software without
16 # specific prior written permission.
17 #
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22 # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 # --------
29 
30 import sys
31 import rospy
32 from fsrobo_r_msgs.srv import *
33 from fsrobo_r_msgs.msg import *
34 
36  def __init__(self, robot_name=None):
37  if robot_name:
38  self.ns = '/' + robot_name + '/'
39  else:
40  self.ns = ''
41  self._execute = rospy.ServiceProxy(self.ns + 'execute_robot_program', ExecuteRobotProgram)
42 
43  def execute(self, program, param=''):
44  rospy.wait_for_service(self.ns + 'execute_robot_program', timeout=5)
45  return self._execute(program, param)
46 
47 if __name__ == '__main__':
49  print(rp.execute('/opt/ros/scripts/toolmove.py', '{"dz": 100}'))
50 


fsrobo_r_driver
Author(s): F-ROSROBO
autogenerated on Sun Feb 9 2020 03:58:29