Skip to content

Commit

Permalink
chore: refactored
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 17, 2025
1 parent e48c43c commit 99ccb0f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ namespace drivers
namespace continental_ars548
{

inline bool is_corner_radar(float yaw)
{
return std::abs(yaw) > deg2rad(5.0) && std::abs(yaw) < deg2rad(90.0);
}

/// @brief struct for ARS548 sensor configuration
struct ContinentalARS548SensorConfiguration : EthernetSensorConfigurationBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,7 @@ bool ContinentalARS548Decoder::parse_objects_list_packet(
// NOTE(knzo25): In the radar firmware used when developing this driver,
// corner radars were not supported. When a new firmware addresses this,
// the driver will be updated.
if (
std::abs(radar_status_.yaw) > 5.0 * M_PI / 180.0 &&
std::abs(radar_status_.yaw) < 90.0 * M_PI / 180.0) {
if (nebula::drivers::continental_ars548::is_corner_radar(radar_status_.yaw)) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,7 @@ void ContinentalARS548DecoderWrapper::sensor_status_callback(
// NOTE(knzo25): In the radar firmware used when developing this driver,
// corner radars were not supported. When a new firmware addresses this,
// the driver will be updated.
if (
std::abs(sensor_status.yaw) > 5.0 * M_PI / 180.0 &&
std::abs(sensor_status.yaw) < 90.0 * M_PI / 180.0) {
if (nebula::drivers::continental_ars548::is_corner_radar(sensor_status.yaw)) {
rclcpp::Clock clock{RCL_ROS_TIME};
RCLCPP_WARN_THROTTLE(

Check warning on line 213 in nebula_ros/src/continental/continental_ars548_decoder_wrapper.cpp

View check run for this annotation

Codecov / codecov/patch

nebula_ros/src/continental/continental_ars548_decoder_wrapper.cpp#L212-L213

Added lines #L212 - L213 were not covered by tests
logger_, clock, 5000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void ContinentalARS548HwInterfaceWrapper::set_sensor_mounting_request_callback(
// NOTE(knzo25): In the radar firmware used when developing this driver,
// corner radars were not supported. When a new firmware addresses this,
// the driver will be updated.
if (std::abs(yaw) > 5.0 * M_PI / 180.0 && std::abs(yaw) < 90.0 * M_PI / 180.0) {
if (nebula::drivers::continental_ars548::is_corner_radar(yaw)) {
RCLCPP_WARN(
logger_,
"You are attempting to configure the device as a corner radar, which is not supported so "
Expand Down

0 comments on commit 99ccb0f

Please sign in to comment.