How to set arg to a node from launch file?
Hi everybody, I can't set the args of my gscam node by launch file (this node is different from the original,because I modified it). This is the most important piece of source of my modified gscam node:
int main(int argc, char** argv) {
if (argc != 2)
{
ROS_WARN("WARNING: you should specify camera info properties!");
}else{
ROS_INFO("INFO: you have set camera properties file: %s\n",argv[1]);
camera_info_file=g_string_new(argv[1]);
}
This is a piece of my launch file:
<node pkg="gscam" type="gscam"
name="gscam"
cwd="node"
args="/home/aldo/Projects/4thRC/BergamoComponents/services_caller/camera_parameters_to_set.txt">
<env name="GSCAM_CONFIG"
value="multifilesrc location="/home/aldo/Documents/VISIONE/visual_odometry/libviso2/2010_03_09_drive_0019/I1_%06d.png" index=0 num-buffers=-1 caps="image/png,framerate=\(fraction\)19/10\" ! videorate framerate=19/10 ! pngdec ! ffmpegcolorspace"/>
</node>
this is the got message when I run "roslaunch my_file.launch --screen" :
[ WARN] [1350399215.805837395]: WARNING: you should specify camera info properties!
Note: If I run my gscam node without launch file it works properly (the argument is recognized):
rosrun gscam gscam /home/aldo/Projects/4thRC/BergamoComponents/services_caller/camera_parameters_to_set.txt
[ INFO] [1350399865.086125707]: INFO: you have set camera properties file: /home/aldo/Projects/4thRC/BergamoComponents/services_caller/camera_parameters_to_set.txt
How to fix it?
Have you tried printing out how many and what arguments are passed? It might be that you're receiving more than 2 arguments from the launch file.