Project scenario:
During the face recognition process, add the python file in launch so that the recognition program can be started directly
Question 1 Description
How to add python files to launch
Cause analysis & solution:
Add the following statements in the launch file:
<node pkg="face_recognizer" type="FaceRecognition.py" name="FaceRecognition" />
pkg: function package name
type: python file name
name: custom name
Question 2 Description
RLException: Unable to launch [face_detect-3].
If it is a script, you may be missing a '#!' declaration at the top.
Cause analysis & solution:
1. There is no source environment
cd to the workspace and enter source devel/setup.bash in the terminal
2. There is no statement written in the python file
Add #!/usr/bin/python3 to the python file
Question 3 Description
RLException: Roslaunch got a 'No such file or directory' error while attempting to run:
/home/spark/spark_noetic/src/spark_app/face_recognizer/script/FaceRecognition.py __name:=FaceRecognition __log:=/home/spark/.ros/log/fbf2d3a2-b646-11ec-aee2-9373a792b0e2/FaceRecognition-3.log
Please make sure that all the executables in this command exist and have
executable permission. This is often caused by a bad launch-prefix.
The traceback for the exception was written to the log file
Cause analysis & solution:
1. The python file does not have modified executable permissions
Modify the attributes of the python file and check exclude as shown in the figure
2. The reason why there is no source
cd to the workspace and enter source devel/setup.bash in the terminal
3. I tried the above methods, but none of them worked. Then I created a new python file, copied the code into it, modified the execution permissions, and executed it again. If anyone knows why, please tell me in the message area. Thank you very much.