I know I am supposed to ask ROS2 questions on robot stack exchange. I did, no one has answered, and no one gave a working answer in the linux one either.
As the title states I am trying to run two nodes from this systemd file:
[Unit]
Description=Turtlebot4 Auto Power Management
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu
Environment="HOME=root"
Environment=ROS_DOMAIN_ID=0
Environment=RCUTILS_LOGGING_USE_STDOUT=1
Environment=RCUTILS_COLORIZED_OUTPUT=1
Environment=RMW_IMPLEMENTATION=rmw_fastrtps_cpp
ExecStart=/bin/bash -c 'cd /home/ubuntu && \
source /opt/ros/humble/setup.bash && \
source /home/ubuntu/ros2_ws/install/local_setup.bash && \
export PYTHONUNBUFFERED=1 && \
exec ros2 launch turtlebot4_auto_power auto_power.launch.py'
# Improve startup reliability
TimeoutStartSec=180s
Restart=on-failure
RestartSec=30
[Install]
WantedBy=multi-user.target
Which launches this:
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
return LaunchDescription([
Node(
package='turtlebot4_auto_power',
executable='battery_monitor',
name='battery_monitor',
output='screen'
),
Node(
package='turtlebot4_auto_power',
executable='dock_monitor',
name='dock_monitor',
output='screen'
)
])
And in the output from
sudo journalctl -u turtlebot4_auto_power.service -f
the nodes are just constantly waiting to receive messages and for some reason running ros2 node list my two nodes do not appear.
When I run the nodes manually with just ros2 launch, everything works perfectly.