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

In your C++ source code you can make a call to the parameter server, where the path to that file is stored.

In your code, with Node Handle nh write:

std::string fpath;
nh.getParam("private_param_name", fpath);

And now in your launch file add the line:

<node ...&gt;="" <param="" name="private_param_name" command="'$(find your_package)/src/your_text_file.txt'" <="" node="">

In your C++ source code you can make a call to the parameter server, where the path to that file is stored.

In your code, with Node Handle nh write:

std::string fpath;
nh.getParam("private_param_name", fpath);

And now in your launch file add the line:line (I believe this is how it works, I've never done it this way, you might need to experiment a bit with this):

<node ...>
    <param name="private_param_name" command="'$(find your_package)/src/your_text_file.txt'"
</node>

Or if you want to run from the command line

<node ...&gt;="" <param="" name="private_param_name" command="'$(find your_package)/src/your_text_file.txt'" <="" node="">rosrun your_package_name your_executable _private_param_name:="path_to_your_package/src/your_text_file.txt"

In your C++ source code you can make a call to the parameter server, where the path to that file is stored.

In your code, with Node Handle nh write:

std::string fpath;
nh.getParam("private_param_name", nh.getParam("~private_param_name", fpath);

And now in your launch file add the line (I believe this is how it works, I've never done it this way, you might need to experiment a bit with this):

<node ...>
    <param name="private_param_name" command="'$(find your_package)/src/your_text_file.txt'"
</node>

Or if you want to run from the command line

rosrun your_package_name your_executable _private_param_name:="path_to_your_package/src/your_text_file.txt"