Ask Your Question

Revision history [back]

if __name__ == '__main__': try: rospy.init_node('turtlesim_motion_pose', anonymous=True)

    velocity_publisher = rospy.Publisher('/turtle1/cmd_vel', Twist, queue_size=10)


    position_topic = "/turtle1/pose"
    pose_subscriber = rospy.Subscriber(position_topic, Pose, poseCallback)
    time.sleep(2)
    print ('move: ')
    move (1.0, 5.0)
    time.sleep(2)
    print ('start reset: ')
    rospy.wait_for_service('reset')
    reset_turtle = rospy.ServiceProxy('reset', Empty)
    reset_turtle()
    print ('end reset: ')
    rospy.spin()
except rospy.ROSInterruptException:
    rospy.loginfo("node terminated.")