ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi,

argc refers to total number of arguments that can be passes to a node. In your case, when you run rosrun beginner_tutorials add_two_ints_client 5 6, you enter three arguments add_two_ints_client(argv[0]),5(argv[1]) and 6(argv[2]). For the node add_two_ints to function properly second and third arguments, the integers are required along with node name. The comparison, if (argc != 3) is made to check if the required number of arguments needed to run the client are obtained. If you use rosrun beginner_tutorials add_two_ints_client 5 (argc = 2)or rosrun beginner_tutorials add_two_ints_client 5 6 7 ((argc = 3), usage: add_two_ints_client X Y will appear.

Hi,

argc refers to total number of arguments that can be passes passed to a node. In your case, when you run rosrun beginner_tutorials add_two_ints_client 5 6, you enter three arguments add_two_ints_client(argv[0]),5(argv[1]) and 6(argv[2]). For the node add_two_ints to function properly second and third arguments, the integers integers, are required along with node name. The comparison, if (argc != 3) is made to check if the required number of arguments needed to run the client are obtained. If you use rosrun beginner_tutorials add_two_ints_client 5 (argc = 2)or rosrun beginner_tutorials add_two_ints_client 5 6 7 ((argc = 3), usage: add_two_ints_client X Y will appear.

Hi,

argc refers to total number of arguments that can be passed to a node. In your case, when you run rosrun beginner_tutorials add_two_ints_client 5 6, you enter three arguments add_two_ints_client(argv[0]),5(argv[1]) and 6(argv[2]). For the node add_two_ints to function properly second and third arguments, the integers, are required along with node name. The comparison, if (argc != 3) is made to check if the required number of arguments needed to run the client are obtained. If you use rosrun beginner_tutorials add_two_ints_client 5 (argc = 2)or rosrun beginner_tutorials add_two_ints_client 5 6 7 ((argc = 3), 4), usage: add_two_ints_client X Y will appear.