ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
First, your subscriber must use a callback, I suggest trying the [ROS publisher subscriber tutorial].(http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28python%29#rospy_tutorials.2BAC8-Tutorials.2BAC8-WritingPublisherSubscriber.Writing_the_Subscriber_Node)
I suppose you want to get the orientation in the Euler angle format (rotations around the x-y-z axis). Once you're able to receive the message through the callback, you can use the following code to access the angles.
import tf
orientation_euler = tf.transformations.euler_from_quaternion( odom_msg.pose.pose.orientation)
# use the angles with orientation_euler.x, orientation_euler.y, orientation_euler.z
2 | No.2 Revision |
First, your subscriber must use a callback, I suggest trying the [ROS ROS publisher subscriber tutorial].(http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28python%29#rospy_tutorials.2BAC8-Tutorials.2BAC8-WritingPublisherSubscriber.Writing_the_Subscriber_Node)tutorial.
I suppose you want to get the orientation in the Euler angle format (rotations around the x-y-z axis). Once you're able to receive the message through the callback, you can use the following code to access the angles.
import tf
orientation_euler = tf.transformations.euler_from_quaternion( odom_msg.pose.pose.orientation)
# use the angles with orientation_euler.x, orientation_euler.y, orientation_euler.z