Skip to content

Commit

Permalink
fix(hesai): gracefully stop receiver thread on shutdown to prevent SE…
Browse files Browse the repository at this point in the history
…GFAULT

Signed-off-by: Max SCHMELLER <[email protected]>
  • Loading branch information
mojomex committed Nov 21, 2024
1 parent de0ded4 commit 5fd3142
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ void HesaiHwInterface::ReceiveSensorPacketCallback(const std::vector<uint8_t> &

Status HesaiHwInterface::SensorInterfaceStop()
{
return Status::ERROR_1;
udp_socket_.unsubscribe();
return Status::OK;
}

Status HesaiHwInterface::GetSensorConfiguration(
Expand Down
6 changes: 5 additions & 1 deletion nebula_ros/include/nebula_ros/hesai/hesai_ros_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ class HesaiRosWrapper final : public rclcpp::Node

public:
explicit HesaiRosWrapper(const rclcpp::NodeOptions & options);
~HesaiRosWrapper() noexcept override = default;
~HesaiRosWrapper() noexcept override
{
if (!hw_interface_wrapper_) return;
hw_interface_wrapper_->hw_interface()->SensorInterfaceStop();
};

/// @brief Get current status of this driver
/// @return Current status
Expand Down

0 comments on commit 5fd3142

Please sign in to comment.