2 from geometry_msgs.msg
import Pose, PoseStamped, Point, Quaternion
3 from moveit_commander
import MoveGroupCommander, conversions
4 from tf.transformations
import quaternion_from_euler
7 from subprocess
import check_call
9 roslib.load_manifest(
"denso_pendant_publisher")
10 roslib.load_manifest(
"actionlib_msgs")
11 import denso_pendant_publisher.msg
13 import actionlib_msgs.msg
14 rospy.init_node(
"test_vs060_moveit")
21 global g_runnable, g_prev_status
23 if (
not g_prev_status.button_cancel
and msg.button_cancel)
or (
not g_prev_status.button_stop
and msg.button_stop):
26 cancel = actionlib_msgs.msg.GoalID()
28 cancel_pub.publish(cancel)
29 rospy.loginfo(
"hello")
30 running_pub.publish(std_msgs.msg.Bool(g_runnable))
31 elif not g_prev_status.button_ok
and msg.button_ok:
33 running_pub.publish(std_msgs.msg.Bool(g_runnable))
36 sub = rospy.Subscriber(
"/denso_pendant_publisher/status", denso_pendant_publisher.msg.PendantStatus, pendantCB)
37 arm = MoveGroupCommander(
"manipulator")
38 running_pub = rospy.Publisher(
"/irex_demo_running", std_msgs.msg.Bool);
40 cancel_pub = rospy.Publisher(
"/move_group/cancel", actionlib_msgs.msg.GoalID);
43 SCENE_FILE = os.path.join(os.path.dirname(__file__),
"..",
"model",
"irex_model.scene")
44 LOAD_SCENE_PROG = os.path.join(os.path.dirname(__file__),
"..",
"bin",
"publish_scene_from_text")
49 running_pub.publish(std_msgs.msg.Bool(g_runnable))
50 check_call([LOAD_SCENE_PROG, SCENE_FILE])
51 for p
in [[ 0.35, -0.35, 0.4],
56 running_pub.publish(std_msgs.msg.Bool(g_runnable))
58 print "set_pose_target(", p,
")" 59 pose = PoseStamped(header = rospy.Header(stamp = rospy.Time.now(), frame_id =
'/BASE'),
60 pose = Pose(position = Point(*p),
61 orientation = Quaternion(*quaternion_from_euler(1.57, 0, 1.57,
'sxyz'))))
63 arm.set_pose_target(pose)
64 arm.go()
or arm.go()
or rospy.logerr(
"arm.go fails")
66 if rospy.is_shutdown():
69 if __name__ ==
"__main__":
70 while not rospy.is_shutdown():