diff --git a/nebula_hw_interfaces/include/nebula_hw_interfaces/nebula_hw_interfaces_hesai/hesai_hw_interface.hpp b/nebula_hw_interfaces/include/nebula_hw_interfaces/nebula_hw_interfaces_hesai/hesai_hw_interface.hpp index 9d25e2d7..b48fb636 100644 --- a/nebula_hw_interfaces/include/nebula_hw_interfaces/nebula_hw_interfaces_hesai/hesai_hw_interface.hpp +++ b/nebula_hw_interfaces/include/nebula_hw_interfaces/nebula_hw_interfaces_hesai/hesai_hw_interface.hpp @@ -172,7 +172,8 @@ class HesaiHwInterface /// @param command_id PTC command number. /// @param payload Payload bytes of the PTC command. Not including the 8-byte PTC header. /// @return The returned payload, if successful, or nullptr. - ptc_cmd_result_t send_receive(const uint8_t command_id, const std::vector & payload = {}); + ptc_cmd_result_t send_receive( + const uint8_t command_id, const std::vector & payload = {}); static std::pair unwrap_http_response(const std::string & response); @@ -318,7 +319,8 @@ class HesaiHwInterface * @param calibration The calibration file of the sensor * @return Status Resulting status of setting the FoV */ - [[nodiscard]] Status check_and_set_lidar_range(const HesaiCalibrationConfigurationBase & calibration); + [[nodiscard]] Status check_and_set_lidar_range( + const HesaiCalibrationConfigurationBase & calibration); Status set_clock_source(int clock_source); @@ -387,7 +389,8 @@ class HesaiHwInterface /// @brief Getting lidar_monitor via HTTP API /// @param str_callback Callback function for received string /// @return Resulting status - HesaiStatus get_lidar_monitor_async_http(std::function str_callback); + HesaiStatus get_lidar_monitor_async_http( + std::function str_callback); /// @brief Checking the current settings and changing the difference point /// @param sensor_configuration Current SensorConfiguration diff --git a/nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp b/nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp index 87815fc5..0efa6fb5 100644 --- a/nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp +++ b/nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp @@ -312,23 +312,28 @@ std::string HesaiHwInterface::get_lidar_calibration_string() HesaiPtpDiagStatus HesaiHwInterface::get_ptp_diag_status() { auto response_or_err = send_receive(g_ptc_command_ptp_diagnostics, {g_ptc_command_ptp_status}); - auto response = response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); + auto response = + response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); auto diag_status = check_size_and_parse(response); return diag_status; } HesaiPtpDiagPort HesaiHwInterface::get_ptp_diag_port() { - auto response_or_err = send_receive(g_ptc_command_ptp_diagnostics, {g_ptc_command_ptp_port_data_set}); - auto response = response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); + auto response_or_err = + send_receive(g_ptc_command_ptp_diagnostics, {g_ptc_command_ptp_port_data_set}); + auto response = + response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); auto diag_port = check_size_and_parse(response); return diag_port; } HesaiPtpDiagTime HesaiHwInterface::get_ptp_diag_time() { - auto response_or_err = send_receive(g_ptc_command_ptp_diagnostics, {g_ptc_command_ptp_time_status_np}); - auto response = response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); + auto response_or_err = + send_receive(g_ptc_command_ptp_diagnostics, {g_ptc_command_ptp_time_status_np}); + auto response = + response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); auto diag_time = check_size_and_parse(response); return diag_time; } @@ -337,7 +342,8 @@ HesaiPtpDiagGrandmaster HesaiHwInterface::get_ptp_diag_grandmaster() { auto response_or_err = send_receive(g_ptc_command_ptp_diagnostics, {g_ptc_command_ptp_grandmaster_settings_np}); - auto response = response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); + auto response = + response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); auto diag_grandmaster = check_size_and_parse(response); return diag_grandmaster; } @@ -345,7 +351,8 @@ HesaiPtpDiagGrandmaster HesaiHwInterface::get_ptp_diag_grandmaster() std::shared_ptr HesaiHwInterface::get_inventory() { auto response_or_err = send_receive(g_ptc_command_get_inventory_info); - auto response = response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); + auto response = + response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); switch (sensor_configuration_->sensor_model) { default: @@ -372,7 +379,8 @@ std::shared_ptr HesaiHwInterface::get_inventory() std::shared_ptr HesaiHwInterface::get_config() { auto response_or_err = send_receive(g_ptc_command_get_config_info); - auto response = response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); + auto response = + response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); switch (sensor_configuration_->sensor_model) { default: @@ -394,7 +402,8 @@ std::shared_ptr HesaiHwInterface::get_config() std::shared_ptr HesaiHwInterface::get_lidar_status() { auto response_or_err = send_receive(g_ptc_command_get_lidar_status); - auto response = response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); + auto response = + response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); switch (sensor_configuration_->sensor_model) { default: @@ -571,7 +580,8 @@ HesaiLidarRangeAll HesaiHwInterface::get_lidar_range() } auto response_or_err = send_receive(g_ptc_command_get_lidar_range); - auto response = response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); + auto response = + response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); if (response.size() < 1) { throw std::runtime_error("Response payload too short"); @@ -672,7 +682,8 @@ Status HesaiHwInterface::set_ptp_config( HesaiPtpConfig HesaiHwInterface::get_ptp_config() { auto response_or_err = send_receive(g_ptc_command_get_ptp_config); - auto response = response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); + auto response = + response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); if (response.size() < sizeof(HesaiPtpConfig)) { throw std::runtime_error("HesaiPtpConfig has unexpected payload size"); @@ -713,7 +724,8 @@ HesaiLidarMonitor HesaiHwInterface::get_lidar_monitor() } auto response_or_err = send_receive(g_ptc_command_lidar_monitor); - auto response = response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); + auto response = + response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({}))); return check_size_and_parse(response); }