ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The solution is to change if condition as the following:
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]);
}
Because when ROS add 2 further arguments to the node if you start it from the launch file. (I mean two arguments more than the basic rosnode command).
Note: the added arguments are put at the end of the other arguments, see the following example:
ARGUMENT 0: /home/aldo/Projects/4thRC/BergamoComponents/gscam/bin/gscam
ARGUMENT 1: /home/aldo/Projects/4thRC/BergamoComponents/services_caller/camera_parameters_to_set.txt
ARGUMENT 2: __name:=gscam
ARGUMENT 3: __log:=/home/aldo/.ros/log/a197a76e-178d-11e2-aec0-00225f3a69a4/gscam-6.log
2 | No.2 Revision |
The solution is to change if condition as count the following:
number of arguments after ros::init :
ros::init(argc, argv, "gscam_publisher");
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]);
}
} Because when ROS add 2 further arguments to the node if you start it from the launch file. (I mean two arguments more than the basic rosnode command).
Note: the added arguments are put at the end of the other arguments, see the following example:
ARGUMENT 0: /home/aldo/Projects/4thRC/BergamoComponents/gscam/bin/gscam
ARGUMENT 1: /home/aldo/Projects/4thRC/BergamoComponents/services_caller/camera_parameters_to_set.txt
ARGUMENT 2: __name:=gscam
ARGUMENT 3: __log:=/home/aldo/.ros/log/a197a76e-178d-11e2-aec0-00225f3a69a4/gscam-6.log
3 | No.3 Revision |
The solution is to count the number of arguments after ros::init :
:
ros::init(argc, argv, "gscam_publisher");
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]);
}}
Because ROS add 2 further arguments to the node if you start it from the launch file. (I mean two arguments more than the basic rosnode command).