ACCalibrate.py
Go to the documentation of this file.
00001 ###############################################################################
00002 #
00003 #
00004 # Package:   RoadNarrows Robotics Hekateros Robotic Manipulator Package
00005 #
00006 # Link:      https://github.com/roadnarrows-robotics/hekateros
00007 #
00008 # ROS Node:  hek_*
00009 
00010 # File:      ACCalibrate.py
00011 #
00012 ## \file 
00013 ##
00014 ## $LastChangedDate$
00015 ## $Rev$
00016 ##
00017 ## \brief Action client calibrate class.
00018 ##
00019 ## \author Daniel Packard (daniel@roadnarrows.com)
00020 ## \author Robin Knight (robin.knight@roadnarrows.com)
00021 ##  
00022 ## \par Copyright:
00023 ##   (C) 2014.  RoadNarrows LLC.\n
00024 ##   (http://www.roadnarrows.com)\n
00025 ##   All Rights Reserved
00026 ##
00027 # @EulaBegin@
00028 # @EulaEnd@
00029 #
00030 ###############################################################################
00031 
00032 import roslib; roslib.load_manifest('hekateros_control')
00033 import rospy
00034 import actionlib
00035 
00036 import hekateros_control.msg
00037 
00038 ##
00039 ## Calibrate action client
00040 ##
00041 class ACCalibrate(object):
00042 
00043   def __init__(self):
00044     self.c = actionlib.SimpleActionClient(
00045                     'hekateros_control/calibrate_as',
00046                     hekateros_control.msg.CalibrateAction)
00047                     
00048   def exec_calib(self, feedback_handler=None, timeout=1, force_recalib=True):
00049     if self.c.wait_for_server(rospy.Duration(timeout)):
00050       rospy.loginfo("Connected to calibrate action server!")
00051     else:
00052       rospy.logwarn("Unable to connect after {} seconds.".format(timeout))
00053       rospy.logwarn("Is hekateros_control node running???")
00054       return False;
00055 
00056     rospy.loginfo("Requesting calibrate action")
00057     goal = hekateros_control.msg.CalibrateGoal()
00058     if force_recalib:
00059       goal.force_recalib = 1
00060     else:
00061       goal.force_recalib = 0
00062     self.c.send_goal(goal, feedback_cb=feedback_handler)
00063     rospy.loginfo("Calibrating - ")
00064     return True
00065 
00066   def cancel(self):
00067     self.c.cancel_goal()
00068 
00069   def get_action_state(self):
00070     return self.c.get_state()
00071 
00072   def get_result(self):
00073     return self.c.get_result()


hekateros_control
Author(s): Robin Knight , Daniel Packard
autogenerated on Mon Oct 6 2014 00:36:42