1 from geometry_msgs.msg
import Pose, Pose2D, Quaternion, Point
2 from nav_2d_msgs.msg
import Twist2D, Path2D, Pose2DStamped, Point2D
3 from nav_msgs.msg
import Path
4 from geometry_msgs.msg
import Twist, PoseStamped
7 from tf.transformations
import euler_from_quaternion, quaternion_from_euler
10 rpy = euler_from_quaternion((orientation.x, orientation.y, orientation.z, orientation.w))
15 q.x, q.y, q.z, q.w = quaternion_from_euler(0, 0, yaw)
18 from math
import sin, cos, atan2
28 siny_cosp = +2.0 * (q.w * q.z + q.x * q.y)
29 cosy_cosp = +1.0 - 2.0 * (q.y * q.y + q.z * q.z)
30 return atan2(siny_cosp, cosy_cosp)
35 cmd_vel.linear.x = cmd_vel_2d.x
36 cmd_vel.linear.y = cmd_vel_2d.y
37 cmd_vel.angular.z = cmd_vel_2d.theta
42 cmd_vel_2d = Twist2D()
43 cmd_vel_2d.x = cmd_vel.linear.x
44 cmd_vel_2d.y = cmd_vel.linear.y
45 cmd_vel_2d.theta = cmd_vel.angular.z
65 pose2d.x = pose.position.x
66 pose2d.y = pose.position.y
67 pose2d.theta =
get_yaw(pose.orientation)
72 pose2d = Pose2DStamped()
73 pose2d.header = pose.header
79 pose2d = Pose2DStamped()
80 pose2d.header.frame_id = frame
81 pose2d.header.stamp = stamp
88 pose.position.x = pose2d.x
89 pose.position.y = pose2d.y
90 pose.orientation =
from_yaw(pose2d.theta)
96 pose.header = pose2d.header
103 pose.header.frame_id = frame
104 pose.header.stamp = stamp
105 pose.pose.position.x = pose2d.x
106 pose.pose.position.y = pose2d.y
107 pose.pose.orientation =
from_yaw(pose2d.theta)
113 if len(path.poses) == 0:
115 path2d.header.frame_id = path.poses[0].header.frame_id
116 path2d.header.stamp = path.poses[0].header.stamp
117 for pose
in path.poses:
119 path2d.poses.append(stamped.pose)
125 path.header = path2d.header
126 for pose2d
in path2d.poses:
128 pose.header = path2d.header
130 path.poses.append(pose)