Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shutdown when can not connect to sensor on startup in ROS2 (foxy/galactic) #214

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7da1a96
Merge pull request #51 from ouster-lidar/SW-4342-prototype-ros-2-driver
Samahu Feb 20, 2023
fd76cc9
Remove the duplicate sensor_info object
Samahu Mar 1, 2023
7a10d2c
SW-4747: update the ros 2 driver(s) to the 20230403 sdk release (#94)
Samahu Apr 4, 2023
592e316
Explicity set cxx compile standard if the env isn't (#99)
Samahu Apr 12, 2023
175a197
SW-4837: replace the use of ros service to retrieve sensor metadata w…
Samahu Apr 19, 2023
8a9edfb
SW-4924: Replace tf_prefix by sensor_frame lidar_frame and imu_frame …
Samahu Apr 28, 2023
513c826
Drop service_msgs dep (#117)
Samahu Apr 30, 2023
0363daf
SW-4859: enable having multiple components of same-type under same pr…
Samahu May 2, 2023
f2ee73d
SW-4972: merge switching to static transform publisher contribution (…
Samahu May 5, 2023
29f8be3
SW-4997: Switch from using ROS timers to thread for polling lidar dat…
Samahu May 17, 2023
7191da6
ROS2 compatibility mode (#146)
Samahu Jun 23, 2023
0226f4b
ROS compatibility mode dual returns fix (#156)
Samahu Jun 28, 2023
6c9b3f5
Fix a typo in README.md: params_files
Samahu Jul 3, 2023
9cbb840
SW-5167: follow ups from SW-5167-fix-black-columns-when-recording-und…
Samahu Jul 14, 2023
556dbd0
SW-5345: merge-ouster-srvs into ouster-msgs (#176)
Samahu Jul 28, 2023
13171a8
SW-5396: publish point cloud in destaggered form (#182)
Samahu Aug 9, 2023
19071eb
SW-5459: add a parameter for utc/tai time offset (#195)
Samahu Aug 25, 2023
ba8382e
Shutdown when can not connect to sensor on startup
Samahu Sep 8, 2023
d246c3d
Apply same behavior to independent launch file
Samahu Sep 9, 2023
7cdecee
formatting
Samahu Sep 9, 2023
0cdafc8
Update changelog and package version
Samahu Sep 12, 2023
7748405
Merge remote-tracking branch 'origin/ROS-209-process-hangs-on-failure…
Samahu Sep 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Changelog
to be applied to all ROS messages the driver generates when ``TIME_FROM_PTP_1588`` timestamp mode
is used.
* fix: destagger columns timestamp when generating destaggered point clouds.
* shutdown the driver when unable to connect to the sensor on startup


ouster_ros v0.10.0
Expand Down
32 changes: 15 additions & 17 deletions ouster-ros/launch/driver.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import launch
import lifecycle_msgs.msg
from ament_index_python.packages import get_package_share_directory
from launch_ros.actions import Node, LifecycleNode
from launch_ros.actions import LifecycleNode
from launch.actions import (DeclareLaunchArgument, IncludeLaunchDescription,
RegisterEventHandler, EmitEvent, LogInfo)
from launch.conditions import IfCondition
Expand Down Expand Up @@ -40,7 +40,8 @@ def generate_launch_description():
rviz_enable_arg = DeclareLaunchArgument('viz', default_value='True')

os_driver_name = LaunchConfiguration('os_driver_name')
os_driver_name_arg = DeclareLaunchArgument('os_driver_name', default_value='os_driver')
os_driver_name_arg = DeclareLaunchArgument(
'os_driver_name', default_value='os_driver')

os_driver = LifecycleNode(
package='ouster_ros',
Expand Down Expand Up @@ -72,20 +73,17 @@ def generate_launch_description():
)
)

# TODO: figure out why registering for on_shutdown event causes an exception
# and error handling
# shutdown_event = RegisterEventHandler(
# OnShutdown(
# on_shutdown=[
# EmitEvent(event=ChangeState(
# lifecycle_node_matcher=matches_node_name(node_name=F"/ouster/os_sensor"),
# transition_id=lifecycle_msgs.msg.Transition.TRANSITION_ACTIVE_SHUTDOWN,
# )),
# LogInfo(msg="os_sensor node exiting..."),
# ],
# )
# )

sensor_finalized_event = RegisterEventHandler(
OnStateTransition(
target_lifecycle_node=os_driver, goal_state='finalized',
entities=[
LogInfo(
msg="Failed to communicate with the sensor in a timely manner."),
EmitEvent(event=launch.events.Shutdown(
reason="Couldn't communicate with sensor"))
],
)
)

rviz_launch_file_path = \
Path(ouster_ros_pkg_dir) / 'launch' / 'rviz.launch.py'
Expand All @@ -103,5 +101,5 @@ def generate_launch_description():
os_driver,
sensor_configure_event,
sensor_activate_event,
# shutdown_event
sensor_finalized_event
])
2 changes: 1 addition & 1 deletion ouster-ros/launch/sensor.composite.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pathlib import Path
import launch
from ament_index_python.packages import get_package_share_directory
from launch_ros.actions import Node, ComposableNodeContainer
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode
from launch.actions import (DeclareLaunchArgument, IncludeLaunchDescription,
ExecuteProcess, TimerAction)
Expand Down
29 changes: 14 additions & 15 deletions ouster-ros/launch/sensor.independent.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def generate_launch_description():
"""
ouster_ros_pkg_dir = get_package_share_directory('ouster_ros')
default_params_file = \
Path(ouster_ros_pkg_dir) / 'config' / 'os_sensor_cloud_image_params.yaml'
Path(ouster_ros_pkg_dir) / 'config' / \
'os_sensor_cloud_image_params.yaml'
params_file = LaunchConfiguration('params_file')
params_file_arg = DeclareLaunchArgument('params_file',
default_value=str(
Expand Down Expand Up @@ -69,19 +70,17 @@ def generate_launch_description():
)
)

# TODO: figure out why registering for on_shutdown event causes an exception
# and error handling
# shutdown_event = RegisterEventHandler(
# OnShutdown(
# on_shutdown=[
# EmitEvent(event=ChangeState(
# lifecycle_node_matcher=matches_node_name(node_name=F"/ouster/os_sensor"),
# transition_id=lifecycle_msgs.msg.Transition.TRANSITION_ACTIVE_SHUTDOWN,
# )),
# LogInfo(msg="os_sensor node exiting..."),
# ],
# )
# )
sensor_finalized_event = RegisterEventHandler(
OnStateTransition(
target_lifecycle_node=os_sensor, goal_state='finalized',
entities=[
LogInfo(
msg="Failed to communicate with the sensor in a timely manner."),
EmitEvent(event=launch.events.Shutdown(
reason="Couldn't communicate with sensor"))
],
)
)

os_cloud = Node(
package='ouster_ros',
Expand Down Expand Up @@ -118,5 +117,5 @@ def generate_launch_description():
os_image,
sensor_configure_event,
sensor_activate_event,
# shutdown_event
sensor_finalized_event
])
2 changes: 1 addition & 1 deletion ouster-ros/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>ouster_ros</name>
<version>0.10.2</version>
<version>0.10.3</version>
<description>Ouster ROS2 driver</description>
<maintainer email="[email protected]">ouster developers</maintainer>
<license file="LICENSE">BSD</license>
Expand Down