123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- import rospy
- from hinge_car_nav_msgs.msg import hinge_car_nav_msgs
- import geometry_msgs.msg
- from tf.transformations import quaternion_from_euler
- import actionlib
- def callback(data):
-
- rospy.loginfo('received move base action goal')
-
- def done_cb(data, data1):
- print("action done cb:%d,%s" % (data, data1))
- def active_cb():
- print("active_cb")
- def feedback_cb(data):
- pass
-
-
- if __name__ == '__main__':
-
-
-
-
-
- rospy.init_node('action_client', anonymous=True)
-
-
-
- client = actionlib.SimpleActionClient(
- 'hinge_car_nav', hinge_car_nav_msgs.msg.HingeCarNavAction)
-
-
-
- p0 = geometry_msgs.msg.PoseStamped()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- x = 178.045984
- y = 209.219726
- yaw = -1.608619
-
-
-
-
-
-
-
-
-
-
- roll, pitch = 0.0, 0.0
- q = quaternion_from_euler(roll, pitch, yaw)
-
- quaternion_msg = geometry_msgs.msg.Quaternion(*q)
- p0.pose.orientation = quaternion_msg
- p0.pose.position.x = x
- p0.pose.position.y = y
- print("before client connected")
- client.wait_for_server()
- print("client connected")
- goal = hinge_car_nav_msgs.msg.HingeCarNavGoal()
- path = hinge_car_nav_msgs.msg.HingeCarPath()
- goal.goal_type = goal.LOAD_SLAGPOT_IN
- goal.path.slagpot_pose = p0
- client.send_goal(goal, done_cb, active_cb, feedback_cb)
-
-
- client.wait_for_result()
- client.get_result()
- try:
-
-
- result = client.get_result()
- except rospy.ROSInterruptException:
- print("program interrupted before completion")
- rospy.sleep(5.0)
|