topic_tools transform works in console but not in launch file
Hello all!
I'm still quite new to ROS, and is getting stuck at something that is most likely a syntax error. I have a /imu
topic, and I want to send the imu.orientation.y
into a pid
. I cannot remap
the pid
to look at the imu's y
field. Therefore, I want to use topic_tools transform
function. I can get it to work by typing it into the console, but when I attempt to put it in a launch file the 'transform' dies immediately.
I created a minimal example showing the case where it works, and where it doesn't.
Working example using console
For this case I run the following launch file
<launch>
<node name="pub" pkg="rostopic" type="rostopic" args="pub /foo std_msgs/Float64 0.5 -r 1" />
</launch>
and then run the following command to start the transform node:
rosrun topic_tools transform /foo /bar std_msgs/Float64 'm'
To prove this works I ran the command rostopic echo \bar
and the value 0.5
is printed once per second as expected.
Broken example using launch file
I run the following launch file
<launch>
<node name="pub" pkg="rostopic" type="rostopic" args="pub /foo std_msgs/Float64 0.5 -r 1" />
<node name="foobar" pkg="topic_tools" type="transform" args="/foo /bar std_msgs/Float64 'm'"/>
</launch>
This then throws an error upon launching showing that the foobar
node died:
... logging to /home/hein/.ros/log/97930396-806f-11ea-85fc-84c5a6fcae4a/roslaunch-hein-Latitude-5500-4511.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://hein-Latitude-5500:39487/
SUMMARY
========
PARAMETERS
* /rosdistro: melodic
* /rosversion: 1.14.5
NODES
/
foobar (topic_tools/transform)
pub (rostopic/rostopic)
auto-starting new master
process[master]: started with pid [4522]
ROS_MASTER_URI=http://localhost:11311
setting /run_id to 97930396-806f-11ea-85fc-84c5a6fcae4a
process[rosout-1]: started with pid [4533]
started core service [/rosout]
process[pub-2]: started with pid [4536]
process[foobar-3]: started with pid [4537]
ERROR: Wrong input topic (or topic field): /foo
[foobar-3] process has died [pid 4537, exit code 1, cmd /opt/ros/melodic/lib/topic_tools/transform /foo /bar std_msgs/Float64 m __name:=foobar __log:=/home/hein/.ros/log/97930396-806f-11ea-85fc-84c5a6fcae4a/foobar-3.log].
log file: /home/hein/.ros/log/97930396-806f-11ea-85fc-84c5a6fcae4a/foobar-3*.log
Looking at the log file shows the following:
[rospy.client][INFO] 2020-04-16 19:49:16,485: init_node, name[/foobar], pid[2211]
[xmlrpc][INFO] 2020-04-16 19:49:16,485: XML-RPC server binding to 0.0.0.0:0
[xmlrpc][INFO] 2020-04-16 19:49:16,486: Started XML-RPC server [http://hein-Latitude-5500:37033/]
[rospy.init][INFO] 2020-04-16 19:49:16,486: ROS Slave URI: [http://hein-Latitude-5500:37033/]
[rospy.impl.masterslave][INFO] 2020-04-16 19:49:16,486: _ready: http://hein-Latitude-5500:37033/
[rospy.registration][INFO] 2020-04-16 19:49:16,486: Registering with master node http://localhost:11311
[xmlrpc][INFO] 2020-04-16 19:49:16,486: xml rpc node: starting XML-RPC server
[rospy.init][INFO] 2020-04-16 19:49:16,586: registered with master
[rospy.rosout][INFO] 2020-04-16 19:49:16 ...
It's likely there are more lines to the error you show, as what we see here is only the summary (as in: the process exited unexpectedly). It'd be very helpful to see those additional lines.
@gvdhoorn, now that you mention it, it does say
ERROR: Wrong input topic (or topic field): /foo
. Updated the question, and I will do some more research.Please post a verbatim copy-paste of the entire output that appears when you
roslaunch
your.launch
file.Updated the question as per your request.
It's most likely related to the transform namespace bug. Link
Where are the namespaces in your example
.launch
files?I didn't define any namespaces. What's shown in the question is the complete
.launch
file. Could that be a problem?what is the solution?