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. remap
s don't work like that.