I am implementing a simple roslaunch file but I am getting an exit code 2 status I have pasted the exact log below any idea what would cause this and how I can rectify it. It works perfectly when used as a node via rosrun.
kshitij@Kshitij:~/catkin_ws$ roslaunch apriltag_ros apriltag.launch
... logging to /home/kshitij/.ros/log/c7672d6c-479d-11ec-bd02-c56b9aa24743/roslaunch-Kshitij-20782.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://Kshitij:38583/
SUMMARY
========
PARAMETERS
* /rosdistro: noetic
* /rosversion: 1.15.13
NODES
/
apriltag_ros (apriltag_ros/tagdetector.py)
auto-starting new master
process[master]: started with pid [20790]
ROS_MASTER_URI=http://localhost:11311
setting /run_id to c7672d6c-479d-11ec-bd02-c56b9aa24743
process[rosout-1]: started with pid [20800]
started core service [/rosout]
process[apriltag_ros-2]: started with pid [20803]
usage: tagdetector.py [-h] [-f FAMILIES] [-B N] [-t N] [-x SCALE] [-b SIGMA] [-0] [-1] [-2] [-c]
tagdetector.py: error: unrecognized arguments: __name:=apriltag_ros __log:=/home/kshitij/.ros/log/c7672d6c-479d-11ec-bd02-c56b9aa24743/apriltag_ros-2.log
[apriltag_ros-2] process has died [pid 20803, exit code 2, cmd /home/kshitij/catkin_ws/src/apriltag_ros/scripts/tagdetector.py __name:=apriltag_ros __log:=/home/kshitij/.ros/log/c7672d6c-479d-11ec-bd02-c56b9aa24743/apriltag_ros-2.log].
log file: /home/kshitij/.ros/log/c7672d6c-479d-11ec-bd02-c56b9aa24743/apriltag_ros-2*.log
The launch file code is as below
<?xml version = "1.0"?>
<launch>
<node name = "apriltag_ros" pkg = "apriltag_ros" type = "tagdetector.py" output="screen" />
</launch>
Link to the same question on the ROS Forum: https://answers.ros.org/question/391124/roslaunch-exit-code-2-error/
The output
usage: tagdetector.py [-h] [-f FAMILIES] [-BN] [-t N] [-x SCALE] [-b SIGMA] [-0] [-1] [-2] [-c]
shows, that tagdetector.py is a script which needs to be called with some specific parameters. First of all you should make sure, if the script is a rosnode to ensure launching it via roslaunch like this is correct. Secondly, have a look at the launch documentation which shows how to add arguments to the node.
So you need to add some of the mentioned parameters to your launchfile by adding
args="-h"
to the node launch entry.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.