0
$\begingroup$

Rosanswers logo

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=&quot;/home/aldo/Documents/VISIONE/visual_odometry/libviso2/2010_03_09_drive_0019/I1_%06d.png&quot; index=0 num-buffers=-1  caps=&quot;image/png,framerate=\(fraction\)19/10\&quot; ! 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?


Originally posted by aldo85ita on ROS Answers with karma: 252 on 2012-10-16

Post score: 2


Original comments

Comment by Ivan Dryanovski on 2012-10-16:
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.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Your argc condition is wrong. You don't account for the additional parameters that roslaunch gives the node.

Either change your condition or call ros::init before your code, if possible. That should filter out ROS arguments.


Originally posted by dornhege with karma: 31395 on 2012-10-16

This answer was ACCEPTED on the original site

Post score: 3

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.