Skip to content

Commit

Permalink
Add validation to the radarScopes
Browse files Browse the repository at this point in the history
  • Loading branch information
msz-rai committed Mar 6, 2024
1 parent 7b7cbe6 commit df1b651
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/graph/RadarPostprocessPointsNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include <algorithm>

#include <repr.hpp>
#include <graph/NodesCore.hpp>
#include <gpu/nodeKernels.hpp>

Expand All @@ -31,6 +32,19 @@ inline static std::optional<rgl_radar_scope_t> getRadarScopeWithinDistance(const
void RadarPostprocessPointsNode::setParameters(const std::vector<rgl_radar_scope_t>& radarScopes, float rayAzimuthStepRad,
float rayElevationStepRad, float frequency)
{
// radarScopes validation
for (auto&& scope : radarScopes) {
if (scope.begin_distance < 0 || scope.end_distance < 0 || scope.distance_separation_threshold < 0 ||
scope.radial_speed_separation_threshold < 0 || scope.azimuth_separation_threshold < 0) {
throw InvalidAPIArgument(fmt::format("radar scope parameters must be non-negative ('{}')", repr(&scope)));
}
if (scope.begin_distance > scope.end_distance) {
throw InvalidAPIArgument(
fmt::format("radar scope the begin distance must be greater or equal to the end distance ('{}' <= '{}')",
scope.begin_distance, scope.end_distance));
}
}

this->rayAzimuthStepRad = rayAzimuthStepRad;
this->rayElevationStepRad = rayElevationStepRad;
this->frequency = frequency;
Expand Down

0 comments on commit df1b651

Please sign in to comment.