Skip to content

Commit d5f289f

Browse files
authored
Feat/rowzaw/daemonize hearts (#92)
* daemonize hearts with systemd - cbs daemonized * onboard unit file added * some cbs cleanup * setup script update
1 parent ad3696c commit d5f289f

File tree

7 files changed

+75
-2
lines changed

7 files changed

+75
-2
lines changed

setup_scripts/env_source.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# this is for daemons and startup stuff. Assume no enviroment before this.
2+
source /opt/ros/humble/setup.bash
3+
source /home/${USER}/RoverFlake2/install/setup.bash
4+
source /home/${USER}/RoverFlake2/network_stuff/cyclonedds_env.sh
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
copy files to /etc/systemd/system/
2+
3+
then
4+
5+
sudo systemctl daemon-reload
6+
sudo systemctl enable your_service_file.service
7+
sudo systemctl start your_service_file.service
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[Unit]
2+
Description=Rover: Control Base Heart Daemon
3+
After=network.target
4+
5+
[Service]
6+
Type=simple
7+
User=rv
8+
9+
ExecStart=/bin/bash -c ' \
10+
source /opt/ros/humble/setup.bash && \
11+
source /home/rv/RoverFlake2/network_stuff/cyclonedds_env.sh && \
12+
source /home/rv/RoverFlake2/install/setup.bash && \
13+
exec ros2 launch rover_manager heart_start_control_base.launch.py \
14+
'
15+
16+
WorkingDirectory=/home/rv/RoverFlake2
17+
Restart=always
18+
RestartSec=5
19+
20+
# make sure children cant escape. Kill entire process tree, not just the parent.
21+
KillMode=control-group
22+
TimeoutStopSec=10
23+
24+
[Install]
25+
WantedBy=multi-user.target
26+
27+
28+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[Unit]
2+
Description=Rover: Control Base Heart Daemon
3+
After=network.target
4+
5+
[Service]
6+
Type=simple
7+
User=rv
8+
9+
ExecStart=/bin/bash -c ' \
10+
source /opt/ros/humble/setup.bash && \
11+
source /home/rv/RoverFlake2/network_stuff/cyclonedds_env.sh && \
12+
source /home/rv/RoverFlake2/install/setup.bash && \
13+
exec ros2 launch rover_manager heart_start_on_board_nuc.launch.py \
14+
'
15+
16+
WorkingDirectory=/home/rv/RoverFlake2
17+
Restart=always
18+
RestartSec=5
19+
20+
# make sure children cant escape. Kill entire process tree, not just the parent.
21+
KillMode=control-group
22+
TimeoutStopSec=10
23+
24+
[Install]
25+
WantedBy=multi-user.target
26+
27+
28+

src/rover_manager/config/heart.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
#! DO NOT REUSE SUBSYSTEM NAMES UNLESS YOU NEED THE SAME SUBSYSTEM RUN ON MULTIPLE MACHINES
1313

1414
#? You do not have to rebuild when making changes to this file - these params are checked when the nodes are launched. However if in doubt, clean and rebuild
15+
#! However, you must restart the heart daemons for changes to take effect
16+
#? -> sudo systemctl daemon-reload
17+
#? -> sudo systemctl restart rover_heart_<press tab here to figure out what the service name is>.service
18+
#? OR, just restart computer.
1519

1620
/dashboard_hmi_node:
1721
ros__parameters:

src/rover_manager/launch/cbs_system_bringup.launch.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from launch.substitutions import ThisLaunchFileDir
88
from ament_index_python.packages import get_package_share_directory
99

10+
# Dont start the heart from here, heart is daemonized
11+
1012
def generate_launch_description():
1113
# sensor_launch = IncludeLaunchDescription(
1214
# PythonLaunchDescriptionSource([

src/rover_manager/screenScripts/cb_env_variables.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ export cb_REFRESH_RATE=59.94
55

66
# For usb c nuc "sucs"
77
#middle screen
8-
export cb_MIDDLE_SCREEN_ID=DP-1
8+
export cb_MIDDLE_SCREEN_ID=DP-2-8
99
export cb_MIDDLE_SCREEN_RES=1920x1080
1010

1111
#left screen
1212
export cb_LEFT_SCREEN_ID=DP-2-9
1313
export cb_LEFT_SCREEN_RES=1920x1080
1414

1515
#right screen
16-
export cb_RIGHT_SCREEN_ID=DP-2-8
16+
export cb_RIGHT_SCREEN_ID=DP-1
1717
export cb_RIGHT_SCREEN_RES=1920x1080
1818

1919
export cb_scripts_PATH="${HOME}/RoverFlake2/src/rover_manager/screenScripts"

0 commit comments

Comments
 (0)