5 from crazyflie_driver.msg
import Position
6 from std_msgs.msg
import Empty
9 if __name__ ==
'__main__':
10 rospy.init_node(
'position', anonymous=
True)
11 worldFrame = rospy.get_param(
"~worldFrame",
"/world")
18 msg.header.stamp = rospy.Time.now()
19 msg.header.frame_id = worldFrame
25 pub = rospy.Publisher(name, Position, queue_size=1)
27 stop_pub = rospy.Publisher(
"cmd_stop", Empty, queue_size=1)
30 rospy.wait_for_service(
'update_params')
31 rospy.loginfo(
"found update_params service")
32 update_params = rospy.ServiceProxy(
'update_params', UpdateParams)
34 rospy.set_param(
"kalman/resetEstimation", 1)
37 rospy.set_param(
"kalman/resetEstimation", 0)
42 while not rospy.is_shutdown():
48 now = rospy.get_time()
50 msg.header.stamp = rospy.Time.now()
51 rospy.loginfo(
"sending...")
55 rospy.loginfo(msg.yaw)
65 msg.header.stamp = rospy.Time.now()
66 rospy.loginfo(
"sending...")
70 rospy.loginfo(msg.yaw)
77 start = rospy.get_time()
78 while not rospy.is_shutdown():
83 now = rospy.get_time()
84 if (now - start > 3.0):
87 msg.header.stamp = rospy.Time.now()
88 rospy.loginfo(
"sending...")
92 rospy.loginfo(msg.yaw)
97 start = rospy.get_time()
98 while not rospy.is_shutdown():
103 now = rospy.get_time()
104 if (now - start > 1.0):
107 msg.header.stamp = rospy.Time.now()
108 rospy.loginfo(
"sending...")
112 rospy.loginfo(msg.yaw)
116 stop_pub.publish(stop_msg)