Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I'm equally baffled by the answer in the question that you linked. Looking at the code for roslaunch I don't see how it ever would have been possible to run full fledged python script. The underlying python code for eval eventually calls the python eval function. The eval function can really only evaluate expressions (something that can resolve to a value). With the setup given I just don't see any way to launch a python script to do what you want.

https://github.com/ros/ros_comm/issues/723 and the corresponding PR: https://github.com/ros/ros_comm/pull/1993 might be of interest as it proposes a new param substitution that would do what you are interested in doing. The last update on this issues was 10/5/20 so maybe this issue will be get merged soon.

Until then the only option that I know of is to to create a script that converts params into args that then roslaunches the actual script. This might look something like this for you:

#!/bin/bash
roslaunch package_name foo.launch x:=$(rosparam get /spawn_x) y:=$(rosparam get /spawn_y) z:=$(rosparam get /spawn_z) yaw:=$(rosparam get /spawn_yaw)

You could either call this script directly or wrap in another launch file. Yes this is ugly and it would be nice if you can access the params directly like in the above mentioned PR.