5 from geometry_msgs.msg
import PoseStamped, TransformStamped
15 rospy.set_param(
"kalman/initialX", transform.transform.translation.x)
16 rospy.set_param(
"kalman/initialY", transform.transform.translation.y)
17 rospy.set_param(
"kalman/initialZ", transform.transform.translation.z)
18 update_params([
"kalman/initialX",
"kalman/initialY",
"kalman/initialZ"])
20 rospy.set_param(
"kalman/resetEstimation", 1)
23 firstTransform =
False 25 msg.header.frame_id = transform.header.frame_id
26 msg.header.stamp = transform.header.stamp
28 msg.pose.position.x = transform.transform.translation.x
29 msg.pose.position.y = transform.transform.translation.y
30 msg.pose.position.z = transform.transform.translation.z
31 msg.pose.orientation.x = transform.rotation.x
32 msg.pose.orientation.y = transform.rotation.y
33 msg.pose.orientation.z = transform.rotation.z
34 msg.pose.orientation.w = transform.rotation.w
38 if __name__ ==
'__main__':
39 rospy.init_node(
'publish_external_position_vicon', anonymous=
True)
40 topic = rospy.get_param(
"~topic",
"/vicon/cf/cf")
42 rospy.wait_for_service(
'update_params')
43 rospy.loginfo(
"found update_params service")
44 update_params = rospy.ServiceProxy(
'update_params', UpdateParams)
50 msg.header.stamp = rospy.Time.now()
52 pub = rospy.Publisher(
"external_pose", PoseStamped, queue_size=1)
53 rospy.Subscriber(topic, TransformStamped, onNewTransform)
def onNewTransform(transform)