ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Python has a nifty feature which allows you to expand a tuple into an argument list. Rather than setting all of the quaternion's fields individually, you can use the constructor as follows
q = tf.transformations.quaternion_from_euler(0, 0, th)
msg = Quaternion(*q)
This is equivalent to doing
q = tf.transformations.quaternion_from_euler(0, 0, th)
msg = Quaternion(q[0], q[1], q[2], q[3])