Skip to content

Commit

Permalink
Add a delay to the oakd startup to work around a bug where the camera…
Browse files Browse the repository at this point in the history
… doesn't reliably publish data after restarting the systemd job
  • Loading branch information
civerachb-cpr committed Sep 24, 2024
1 parent 374fd18 commit 4ab5cc0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
16 changes: 12 additions & 4 deletions turtlebot4_bringup/launch/lite.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from ament_index_python.packages import get_package_share_directory

from launch import LaunchContext, LaunchDescription
from launch.actions import DeclareLaunchArgument, GroupAction, IncludeLaunchDescription
from launch.actions import DeclareLaunchArgument, GroupAction, IncludeLaunchDescription, TimerAction # noqa: E501
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import EnvironmentVariable, LaunchConfiguration, PathJoinSubstitution

Expand Down Expand Up @@ -84,9 +84,17 @@ def generate_launch_description():
IncludeLaunchDescription(
PythonLaunchDescriptionSource([rplidar_launch_file])),

IncludeLaunchDescription(
PythonLaunchDescriptionSource([oakd_launch_file]),
launch_arguments=[('camera', 'oakd_lite')]),
# Delay the OAK-D startup for a bit
# This prevents spiking the current on the USB by having the lidar and camera
# start up at the same time as everything else
TimerAction(
period=30.0,
actions=[
IncludeLaunchDescription(
PythonLaunchDescriptionSource([oakd_launch_file]),
launch_arguments=[('camera', 'oakd_lite')])
]
),

IncludeLaunchDescription(
PythonLaunchDescriptionSource([description_launch_file]),
Expand Down
16 changes: 12 additions & 4 deletions turtlebot4_bringup/launch/standard.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from ament_index_python.packages import get_package_share_directory

from launch import LaunchContext, LaunchDescription
from launch.actions import DeclareLaunchArgument, GroupAction, IncludeLaunchDescription
from launch.actions import DeclareLaunchArgument, GroupAction, IncludeLaunchDescription, TimerAction # noqa: E501
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import EnvironmentVariable, LaunchConfiguration, PathJoinSubstitution

Expand Down Expand Up @@ -84,9 +84,17 @@ def generate_launch_description():
IncludeLaunchDescription(
PythonLaunchDescriptionSource([rplidar_launch_file])),

IncludeLaunchDescription(
PythonLaunchDescriptionSource([oakd_launch_file]),
launch_arguments=[('camera', 'oakd_pro')]),
# Delay the OAK-D startup for a bit
# This prevents spiking the current on the USB by having the lidar and camera
# start up at the same time as everything else
TimerAction(
period=30.0,
actions=[
IncludeLaunchDescription(
PythonLaunchDescriptionSource([oakd_launch_file]),
launch_arguments=[('camera', 'oakd_pro')])
]
),

IncludeLaunchDescription(
PythonLaunchDescriptionSource([description_launch_file]),
Expand Down

0 comments on commit 4ab5cc0

Please sign in to comment.