Skip to content

Commit

Permalink
ci(pre-commit): autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Nov 26, 2024
1 parent 8275762 commit cc8d563
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint8_t> & payload = {});
ptc_cmd_result_t send_receive(
const uint8_t command_id, const std::vector<uint8_t> & payload = {});

static std::pair<HesaiStatus, std::string> unwrap_http_response(const std::string & response);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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<void(const std::string & str)> str_callback);
HesaiStatus get_lidar_monitor_async_http(
std::function<void(const std::string & str)> str_callback);

/// @brief Checking the current settings and changing the difference point
/// @param sensor_configuration Current SensorConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,23 +312,28 @@ std::string HesaiHwInterface::get_lidar_calibration_string()
HesaiPtpDiagStatus HesaiHwInterface::get_ptp_diag_status()

Check warning on line 312 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L312

Added line #L312 was not covered by tests
{
auto response_or_err = send_receive(g_ptc_command_ptp_diagnostics, {g_ptc_command_ptp_status});

Check warning on line 314 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L314

Added line #L314 was not covered by tests
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<HesaiPtpDiagStatus>(response);

Check warning on line 317 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L316-L317

Added lines #L316 - L317 were not covered by tests
return diag_status;
}

HesaiPtpDiagPort HesaiHwInterface::get_ptp_diag_port()

Check warning on line 321 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L321

Added line #L321 was not covered by tests
{
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});

Check warning on line 324 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L324

Added line #L324 was not covered by tests
auto response =
response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({})));
auto diag_port = check_size_and_parse<HesaiPtpDiagPort>(response);

Check warning on line 327 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L326-L327

Added lines #L326 - L327 were not covered by tests
return diag_port;
}

HesaiPtpDiagTime HesaiHwInterface::get_ptp_diag_time()

Check warning on line 331 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L331

Added line #L331 was not covered by tests
{
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});

Check warning on line 334 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L334

Added line #L334 was not covered by tests
auto response =
response_or_err.value_or_throw(pretty_print_ptc_error(response_or_err.error_or({})));
auto diag_time = check_size_and_parse<HesaiPtpDiagTime>(response);

Check warning on line 337 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L336-L337

Added lines #L336 - L337 were not covered by tests
return diag_time;
}
Expand All @@ -337,15 +342,17 @@ HesaiPtpDiagGrandmaster HesaiHwInterface::get_ptp_diag_grandmaster()
{
auto response_or_err =
send_receive(g_ptc_command_ptp_diagnostics, {g_ptc_command_ptp_grandmaster_settings_np});

Check warning on line 344 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L344

Added line #L344 was not covered by tests
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<HesaiPtpDiagGrandmaster>(response);

Check warning on line 347 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L346-L347

Added lines #L346 - L347 were not covered by tests
return diag_grandmaster;
}

std::shared_ptr<HesaiInventoryBase> HesaiHwInterface::get_inventory()

Check warning on line 351 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L351

Added line #L351 was not covered by tests
{
auto response_or_err = send_receive(g_ptc_command_get_inventory_info);

Check warning on line 353 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L353

Added line #L353 was not covered by tests
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({})));

Check warning on line 355 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L355

Added line #L355 was not covered by tests

switch (sensor_configuration_->sensor_model) {
default:
Expand All @@ -372,7 +379,8 @@ std::shared_ptr<HesaiInventoryBase> HesaiHwInterface::get_inventory()
std::shared_ptr<HesaiConfigBase> HesaiHwInterface::get_config()

Check warning on line 379 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L379

Added line #L379 was not covered by tests
{
auto response_or_err = send_receive(g_ptc_command_get_config_info);

Check warning on line 381 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L381

Added line #L381 was not covered by tests
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({})));

Check warning on line 383 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L383

Added line #L383 was not covered by tests

switch (sensor_configuration_->sensor_model) {
default:
Expand All @@ -394,7 +402,8 @@ std::shared_ptr<HesaiConfigBase> HesaiHwInterface::get_config()
std::shared_ptr<HesaiLidarStatusBase> HesaiHwInterface::get_lidar_status()

Check warning on line 402 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L402

Added line #L402 was not covered by tests
{
auto response_or_err = send_receive(g_ptc_command_get_lidar_status);

Check warning on line 404 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L404

Added line #L404 was not covered by tests
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({})));

Check warning on line 406 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L406

Added line #L406 was not covered by tests

switch (sensor_configuration_->sensor_model) {
default:
Expand Down Expand Up @@ -571,7 +580,8 @@ HesaiLidarRangeAll HesaiHwInterface::get_lidar_range()
}

auto response_or_err = send_receive(g_ptc_command_get_lidar_range);

Check warning on line 582 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L582

Added line #L582 was not covered by tests
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({})));

Check warning on line 584 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L584

Added line #L584 was not covered by tests

if (response.size() < 1) {
throw std::runtime_error("Response payload too short");
Expand Down Expand Up @@ -672,7 +682,8 @@ Status HesaiHwInterface::set_ptp_config(
HesaiPtpConfig HesaiHwInterface::get_ptp_config()

Check warning on line 682 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L682

Added line #L682 was not covered by tests
{
auto response_or_err = send_receive(g_ptc_command_get_ptp_config);

Check warning on line 684 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L684

Added line #L684 was not covered by tests
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({})));

Check warning on line 686 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L686

Added line #L686 was not covered by tests

if (response.size() < sizeof(HesaiPtpConfig)) {
throw std::runtime_error("HesaiPtpConfig has unexpected payload size");
Expand Down Expand Up @@ -713,7 +724,8 @@ HesaiLidarMonitor HesaiHwInterface::get_lidar_monitor()
}

auto response_or_err = send_receive(g_ptc_command_lidar_monitor);

Check warning on line 726 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L726

Added line #L726 was not covered by tests
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<HesaiLidarMonitor>(response);

Check warning on line 729 in nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_hw_interfaces/src/nebula_hesai_hw_interfaces/hesai_hw_interface.cpp#L728-L729

Added lines #L728 - L729 were not covered by tests
}

Expand Down

0 comments on commit cc8d563

Please sign in to comment.