Can roslaunch get colon-separated environment variables?
In a launch file, I have the following line
<arg name="venv" value="$(env CMAKE_PREFIX_PATH)/../src/environment_identification/venv/bin/python3" />
The problem is that CMAKE_PREFIX_PATH
evaluates to /home/vpetrone/catkin_ws/devel:/opt/ros/noetic
, where two paths are separated by a colon. I want to find from the launch file the path to my workspace, namely /home/vpetrone/catkin_ws/devel
, which is the first element in CMAKE_PREFIX_PATH
.
Is there a way to use the env
tag to get only the first element of this colon-separated environment variable? Is there perhaps another way to get the workspace path in a launch file?
I am using ROS Noetic.
There is no single "workspace path" in ros. Perhaps if you tell us what information you are looking for, we could suggest a cleaner way to get it?
My goal is to find an automatic way to get the path under which my packages are built, which in my case is
/home/vpetrone/catkin_ws/devel
. To do this, I was thinking of using the tag$(env CMAKE_PREFIX_PATH)
, but it evaluates to multiple paths separated by colons, so I was also asking if there for was a way to separate the paths by using other tags or commands.catkin locate can do something which the OP seems to be asking for, but I agree with @Mike Scheutzow that it would be good to know why that would be something you'd want to do in a
.launch
file.Using
$(dirname)
(docs) might be a more portable / less brittle approach, but without knowing the motivation, it's hard to suggest anything.@vipetrone wrote:
yes, but why do you want to do that.
I have a feeling it has something to do with the Python venv reference in the path there.