|
From: <hsu...@us...> - 2008-09-18 15:27:23
|
Revision: 4441
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=4441&view=rev
Author: hsujohnhsu
Date: 2008-09-18 22:27:30 +0000 (Thu, 18 Sep 2008)
Log Message:
-----------
added wait_for_service for controller and mechanism control python scripts.
Modified Paths:
--------------
pkg/trunk/controllers/generic_controllers/src/generic_controllers/controllers.py
pkg/trunk/mechanism/mechanism_control/src/mechanism_control/mechanism.py
Modified: pkg/trunk/controllers/generic_controllers/src/generic_controllers/controllers.py
===================================================================
--- pkg/trunk/controllers/generic_controllers/src/generic_controllers/controllers.py 2008-09-18 22:21:16 UTC (rev 4440)
+++ pkg/trunk/controllers/generic_controllers/src/generic_controllers/controllers.py 2008-09-18 22:27:30 UTC (rev 4441)
@@ -8,36 +8,43 @@
from generic_controllers.srv import *
def list_controllers():
+ rospy.wait_for_service('list_controllers')
s = rospy.ServiceProxy('list_controllers', ListControllers)
resp = s.call(ListControllersRequest())
for t in resp.controllers:
print t
def set_controller(controller, command):
+ rospy.wait_for_service(controller + '/set_command')
s = rospy.ServiceProxy(controller + '/set_command', SetCommand)
resp = s.call(SetCommandRequest(command))
print resp.command
def set_controller_vector(controller, command):
+ rospy.wait_for_service(controller + '/set_command')
s = rospy.ServiceProxy(controller + '/set_command', SetVectorCommand)
resp = s(*command)
def get_controller(controller):
+ rospy.wait_for_service(controller + '/get_actual')
s = rospy.ServiceProxy(controller + '/get_actual', GetActual)
resp = s.call(GetActualRequest())
print str(resp.time) + ": " + str(resp.command)
def set_position(controller, command):
+ rospy.wait_for_service(controller + '/set_position')
s = rospy.ServiceProxy(controller + '/set_position', SetPosition)
resp = s.call(SetPositionRequest(command))
print resp.command
def get_position(controller):
+ rospy.wait_for_service(controller + '/get_position')
s = rospy.ServiceProxy(controller + '/get_position', GetPosition)
resp = s.call(GetPositionRequest())
print str(resp.time) + ": " + str(resp.command)
def set_profile(controller, upper_turnaround, lower_turnaround, upper_decel_buffer, lower_decel_buffer):
+ rospy.wait_for_service(controller + '/set_profile')
s = rospy.ServiceProxy(controller + '/set_profile', SetProfile)
resp = s.call(SetProfileRequest(upper_turnaround, lower_turnaround, upper_decel_buffer, lower_decel_buffer))
print str(resp.time)
Modified: pkg/trunk/mechanism/mechanism_control/src/mechanism_control/mechanism.py
===================================================================
--- pkg/trunk/mechanism/mechanism_control/src/mechanism_control/mechanism.py 2008-09-18 22:21:16 UTC (rev 4440)
+++ pkg/trunk/mechanism/mechanism_control/src/mechanism_control/mechanism.py 2008-09-18 22:27:30 UTC (rev 4441)
@@ -16,6 +16,7 @@
print t
def list_controllers():
+ rospy.wait_for_service('list_controllers')
s = rospy.ServiceProxy('list_controllers', ListControllers)
resp = s.call(ListControllersRequest())
for c in resp.controllers:
@@ -31,6 +32,7 @@
print "Error when spawning", resp.ok
def kill_controller(name):
+ rospy.wait_for_service('kill_controller')
s = rospy.ServiceProxy('kill_controller', KillController)
resp = s.call(KillControllerRequest(name))
if resp.ok == 1:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|