# Revision history [back]

I always find topic_tools/transform very useful, but somewhat difficult to use. I always helps me to write the expressions in a text editor, so that you can experiment and jump around a little bit more. I think this is the transform you are after: I am not able to test it right now, but you'll get the idea.

rosrun topic_tools transform /ts /tsnew geometry_msgs/TwistStamped
'geometry_msgs.msg.TwistStamped(
twist=geometry_msgs.msg.Twist(
linear=geometry_msgs.msg.Vector3(
numpy.linalg.norm([m.twist.linear.x, m.twist.linear.y, m.twist.linear.z]),
0.0,
0.0)))'
--import geometry_msgs


I have split it into several lines for clarity. Few notes, the imports can be a bit finicky and it's useful to test with the python interpreter.

I always find topic_tools/transform very useful, but somewhat difficult to use. I always helps me to write the expressions in a text editor, so that you can experiment and jump around a little bit more. I think this is the transform you are after: I am not able to test it right now, but you'll get the idea.

rosrun topic_tools transform /ts /tsnew geometry_msgs/TwistStamped  \\
'geometry_msgs.msg.TwistStamped(
'geometry_msgs.msg.TwistStamped( \\
twist=geometry_msgs.msg.Twist(
twist=geometry_msgs.msg.Twist( \\
linear=geometry_msgs.msg.Vector3(
linear=geometry_msgs.msg.Vector3( \\
numpy.linalg.norm([m.twist.linear.x, m.twist.linear.y, m.twist.linear.z]),   \\
0.0,   \\
0.0)))'   \\
--import geometry_msgs


I have split it into several lines for clarity. Few notes, the imports can be a bit finicky and it's useful to test with the python interpreter.

I always find topic_tools/transform very useful, but somewhat difficult to use. I always helps me to write the expressions in a text editor, so that you can experiment and jump around a little bit more. I think this is the transform you are after: I am not able to test it right now, but you'll get the idea.

rosrun topic_tools transform /ts /tsnew geometry_msgs/TwistStamped \\
\
'geometry_msgs.msg.TwistStamped( \\
\
\
twist=geometry_msgs.msg.Twist( \\
\
linear=geometry_msgs.msg.Vector3( \\
\
numpy.linalg.norm([m.twist.linear.x, m.twist.linear.y, m.twist.linear.z]),  \\
\
0.0,  \\
\
0.0)))'  \\
\
--import geometry_msgs


I have split it into several lines for clarity. Few notes, the imports can be a bit finicky and it's useful to test with the python interpreter.