string argument roslaunch
Hi,
I am trying to pass arguments to my launch file, but I can never get the values that I sent: for instance, I declared my variables this way:
<?xml version="1.0"?>
<launch>
<arg name="my_KP" />
<arg name="my_KI" />
<arg name="my_KD" />
<arg name="my_EL" />
<arg name="my_ADT" />
<node name="en_pub" pkg="driver" type="en_repub.py" />
<node name="left_motor" pkg="driver" type="left" output="screen">
<!--
<param name="KP" type="string" value="$(arg my_KP)" />
<param name="KI" type="string" value="$(arg my_KI)"/>
<param name="KD" type="string" value="$(arg my_KD)"/>
<param name="EL" type="string" value="$(arg my_EL)"/>
<param name="ADT" type="string" value="$(arg my_ADT)"/>
-->
</node>
<node name="right_motor" pkg="driver" type="right" output="screen">
<!--
<param name="KP" type="string" value="$(arg my_KP)" />
<param name="KI" type="string" value="$(arg my_KI)"/>
<param name="KD" type="string" value="$(arg my_KD)"/>
<param name="EL" type="string" value="$(arg my_EL)"/>
<param name="ADT" type="string" value="$(arg my_ADT)"/>
-->
</node>
And on my node I did this:
ros::NodeHandle p_nh;
string KP = "1000";
string KI = "240";
string KD = "12000";
string EL = "30000";
string ADT = "1";
//This allows for setting params instead of recompile to change
p_nh.param<string>("KP", KP, "1000");
p_nh.param<string>("KI", KI, "240");
p_nh.param<string>("KD", KD, "12000");
p_nh.param<string>("EL", EL, "30000");
p_nh.param<string>("ADT", ADT, "1");
But my program does not seem to catch them. I only get the assigned default values.
What am I doing wrong?