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

Revision history [back]

click to hide/show revision 1
initial version

This is something that can be done using topic_tools/transform.

One of the examples on that page does something very similar:

convert an orientation quaternion to Euler angles:

rosrun topic_tools transform /imu/orientation /euler geometry_msgs/Vector3 'tf.transformations.euler_from_quaternion([m.x, m.y, m.z, m.w])' --import tf

As to your question:

I'm wondering if this can be done in a launch file, though I'm not sure.

Something like:

<remap from="/data" to="/data" * 10 />

No, that is not possible. remaps don't work like that.

Let's say I have a node (that I didn't write) publishing an Int32 value data between 0 and 1. Is it possible to scale data so it's between 0 and 10 instead of 0 and 1?

I'm going to assume you meant to write:

Let's say I have a node (that I didn't write) publishing an Int32 value data between 0 and 1. Is it possible to scale data so it's between 0 and 10 instead of 0 and 1?

As an Int32 can only encode integer values, so it would only ever be 0 or 1, nothing in between.


This is something that can be done using topic_tools/transform.

One of the examples on that page does something very similar:

convert an orientation quaternion to Euler angles:

rosrun topic_tools transform /imu/orientation /euler geometry_msgs/Vector3 'tf.transformations.euler_from_quaternion([m.x, m.y, m.z, m.w])' --import tf

So for your specific example, it would probably be something like (haven't tested this):

rosrun topic_tools transform /input /output std_msgs/Float32 'm.data * 10.0'

As to your question:

I'm wondering if this can be done in a launch file, though I'm not sure.

Something like:

<remap from="/data" to="/data" * 10 />

No, that is not possible. remaps don't work like that.