Skip to content

Commit

Permalink
feat: added a diagnostics message
Browse files Browse the repository at this point in the history
Signed-off-by: Kenzo Lobos-Tsunekawa <[email protected]>
  • Loading branch information
knzo25 committed Jan 8, 2025
1 parent de1ba74 commit 9ab56a1
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions nebula_ros/src/continental/continental_ars548_decoder_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,19 @@ void ContinentalARS548DecoderWrapper::object_list_callback(
void ContinentalARS548DecoderWrapper::sensor_status_callback(
const drivers::continental_ars548::ContinentalARS548Status & sensor_status)
{
diagnostic_msgs::msg::DiagnosticArray diagnostic_array_msg;
diagnostic_array_msg.header.stamp.sec = sensor_status.timestamp_seconds;
diagnostic_array_msg.header.stamp.nanosec = sensor_status.timestamp_nanoseconds;
diagnostic_array_msg.header.frame_id = config_ptr_->frame_id;

diagnostic_array_msg.status.resize(1);
auto & status = diagnostic_array_msg.status[0];
status.values.reserve(36);
status.level = diagnostic_msgs::msg::DiagnosticStatus::OK;
status.hardware_id = config_ptr_->frame_id;
status.name = config_ptr_->frame_id;
status.message = "Diagnostic messages from ARS548";

// cSpell:ignore knzo25
// NOTE(knzo25): In the radar firmware used when developing this driver,
// corner radars are not supported. We can partially address this,
Expand All @@ -208,20 +221,12 @@ void ContinentalARS548DecoderWrapper::sensor_status_callback(
"can partially address this, but the coordinates look only spatially correct (not the "
"dynamics). so its use is the responsibility of the user. Corner radars are expected to be "
"supported in a new firmware version, but this is not yet confirmed.");
}

diagnostic_msgs::msg::DiagnosticArray diagnostic_array_msg;
diagnostic_array_msg.header.stamp.sec = sensor_status.timestamp_seconds;
diagnostic_array_msg.header.stamp.nanosec = sensor_status.timestamp_nanoseconds;
diagnostic_array_msg.header.frame_id = config_ptr_->frame_id;

diagnostic_array_msg.status.resize(1);
auto & status = diagnostic_array_msg.status[0];
status.values.reserve(36);
status.level = diagnostic_msgs::msg::DiagnosticStatus::OK;
status.hardware_id = config_ptr_->frame_id;
status.name = config_ptr_->frame_id;
status.message = "Diagnostic messages from ARS548";
status.level = diagnostic_msgs::msg::DiagnosticStatus::WARN;
status.message +=
". Unsupported mounting configuration (corner radar). This should only be used for "
"evaluation purposes.";
}

auto add_diagnostic = [&status](const std::string & key, const std::string & value) {
diagnostic_msgs::msg::KeyValue key_value;
Expand Down

0 comments on commit 9ab56a1

Please sign in to comment.