How to use <param> in launch files to change variable values in node scripts?
I'm trying to use in launch files to change variable values in node scripts but it doesn't seem to work.
Here is my launch file:
<launch>
<include file="$(find turtlebot_bringup)/launch/minimal.launch" />
<include file="$(find turtlebot_navigation)/launch/gmapping_demo.launch" />
<include file="$(find frontier_exploration)/launch/global_map.launch" />
<node name="send_exploration_goal" pkg="turtlebot_demos" type="send_exploration_goal"/>
<param name="set_linear_vel" value="0.1" />
<param name="set_angular_vel" value="0.1" />
</node>
</launch>
And here is a skeleton of the node script:
#include ...
void function()
{
....
}
int main(int arcg, char** argv)
{
....
float set_linear_vel = 0.25;
float set_angular_vel = 0.50;
....
}
- My first question is, am I doing this right?
- Second, does it matter where I define the variables in the node script? Should they be defined as global variables, defined inside int main(), or inside void function()?
Thanks!