ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

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])