We currently launch the camera code on nano through an ssh session that runs a bash script. However, the downside is that sometimes, passing SIGINT (Ctrl+c) to the ssh session only terminates the ssh session, and not the bash script running on nano. This results in the camera code still running, which causes an error when we re-run the robot's start script. Currently, we've been addressing this by ssh-ing into nano, listing all processes with "camera" in them (ps -aux | grep camera) and manually killing their PID (e.g., kill {pid}).
PR Change
This PR improves upon the above by adding a script for nano to run the camera within a screen session. Because it keeps using the the same screen shell to run the camera, even if the previous invokation did not properly terminate the camera, this invokation will first terminate the camera and then re-run it. Thus, you should never have multiple cameras running in parallel.
Configuring this code to run on nano
[x] Pull this branch on lovelace.
[x] Use scp to move start_nano.py and start_nano.sh to the home directory (~) of nano.
[x] Make both scripts executable:
[x] chmod +x start_nano.sh
[x] chmod +x start_nano.py
Testing procedure
[x] Test on nano:
[x] SSH into nano
[x] From the home directory, run ./start_nano.sh. Verify that the camera loads and its output appears on your terminal screen.
[x] Terminate it (Ctrl+C). Verify it cleanly terminates. Go into the screen (screen -r camera) and verify it has terminated there as well.
[x] Repeat the above steps, to verify it succesfully re-launches after the screen is already open.
[x] Test on lovelace:
[x] Start the code in real: python3 src/ada_feeding/start.py
[x] Verify the camera started (e.g., ros2 node list or checking that the camera image appears on the web app)
[x] Terminate the code: python3 src/ada_feeding_start.py -c
[x] Verify that the camera node terminated (e.g., with ros2 node list)
[x] Repeat the above steps, to verify it succesfully re-launches after having been closed.
Before opening a pull request
[x] Format your code using black formatterpython3 -m black .
[x] Run your code through pylint and address all warnings/errors. The only warnings that are acceptable to not address is TODOs that should be addressed in a future PR. From the top-level ada_feeding directory, run: pylint --recursive=y --rcfile=.pylintrc ..
Description
Current State
We currently launch the camera code on nano through an ssh session that runs a bash script. However, the downside is that sometimes, passing SIGINT (Ctrl+c) to the ssh session only terminates the ssh session, and not the bash script running on nano. This results in the camera code still running, which causes an error when we re-run the robot's start script. Currently, we've been addressing this by ssh-ing into nano, listing all processes with "camera" in them (
ps -aux | grep camera
) and manually killing their PID (e.g.,kill {pid}
).PR Change
This PR improves upon the above by adding a script for
nano
to run the camera within a screen session. Because it keeps using the the same screen shell to run the camera, even if the previous invokation did not properly terminate the camera, this invokation will first terminate the camera and then re-run it. Thus, you should never have multiple cameras running in parallel.Configuring this code to run on
nano
lovelace
.scp
to movestart_nano.py
andstart_nano.sh
to the home directory (~
) ofnano
.chmod +x start_nano.sh
chmod +x start_nano.py
Testing procedure
nano
:nano
./start_nano.sh
. Verify that the camera loads and its output appears on your terminal screen.screen -r camera
) and verify it has terminated there as well.lovelace
:python3 src/ada_feeding/start.py
ros2 node list
or checking that the camera image appears on the web app)python3 src/ada_feeding_start.py -c
ros2 node list
)Before opening a pull request
python3 -m black .
ada_feeding
directory, run:pylint --recursive=y --rcfile=.pylintrc .
.Before Merging
Squash & Merge