1 | initial version |

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(
header=m.header,
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.

2 | No.2 Revision |

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( \\
header=m.header, ~~ ~~ \\
~~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.

3 | No.3 Revision |

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( ~~\\
~~\
header=m.header, ~~\\
~~\
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.

ROS Answers is licensed under Creative Commons Attribution 3.0 Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.