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

Hi

To answer your question lets look at the following example, I hgave the following launch file:

<?xml version="1.0"?>

<launch>
  <arg name="config_pkg" default="my_pkg"/>
  <node name="rviz" pkg="rviz" type="rviz" args="-d $(find $(arg config_pkg))/launch/my_config.rviz"/>
</launch>

This launch file will throw you an RLException since dollar signs '$' cannot be inside of substitution args like $(find ...)

You can use this to change dynamically the node package like

<?xml version="1.0"?>

<launch>
  <arg name="config_pkg" default="rviz"/>
  <node name="rviz" pkg="$(arg config_pkg)" type="rviz"/>
</launch>

However bear in mind that what you can do is using enviromental variables:

In a terminal:

export my_path="/path/to/your/config/"

An in the launch file:

<?xml version="1.0"?>

<launch>
  <arg name="config_pkg" default="rviz"/>
  <node name="rviz" pkg="rviz" type="rviz" args="-d $(optenv my_path default/path/to/config)/my_config.rviz"/>
</launch>

For more information about this you can check the following wiki page.

Hope that can help you with this problem.

Regards.