From 576e484a89033b1b406901e19c16d509beab12d6 Mon Sep 17 00:00:00 2001 From: dan-du-car <62157949+dan-du-car@users.noreply.github.com> Date: Thu, 22 Aug 2024 08:23:36 -0400 Subject: [PATCH] Update detection classifications in MUSTSensorDriverPlugin (#631) # PR Details ## Description Update detection classifications in MUSTSensorDriverPlugin ## Related Issue https://usdot-carma.atlassian.net/browse/FCP-28 ## Motivation and Context Freight Cooperative Perception ## How Has This Been Tested? Unit test ## Types of changes - [x] Defect fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that cause existing functionality to change) ## Checklist: - [ ] I have added any new packages to the sonar-scanner.properties file - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [x] I have read the **CONTRIBUTING** document. [V2XHUB Contributing Guide](https://github.com/usdot-fhwa-OPS/V2X-Hub/blob/develop/Contributing.md) - [ ] I have added tests to cover my changes. - [ ] All new and existing tests passed. --- .../MUSTSensorDriverPlugin/src/MUSTSensorDetection.h | 8 +++++++- .../test/TestMUSTSensorDetection.cpp | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/v2i-hub/MUSTSensorDriverPlugin/src/MUSTSensorDetection.h b/src/v2i-hub/MUSTSensorDriverPlugin/src/MUSTSensorDetection.h index 37e0858ec..9140b0252 100644 --- a/src/v2i-hub/MUSTSensorDriverPlugin/src/MUSTSensorDetection.h +++ b/src/v2i-hub/MUSTSensorDriverPlugin/src/MUSTSensorDetection.h @@ -16,6 +16,9 @@ namespace MUSTSensorDriverPlugin { enum class DetectionClassification { SEDAN, TRUCK, + BUS, + PICKUP_TRUCK, + PEDESTRIAN, VAN, NA }; @@ -46,7 +49,10 @@ namespace MUSTSensorDriverPlugin { const static std::unordered_map stringToDetectionClassificationMap = { {"sedan", DetectionClassification::SEDAN}, {"truck", DetectionClassification::TRUCK}, - {"van", DetectionClassification::VAN} + {"van", DetectionClassification::VAN}, + {"bus", DetectionClassification::BUS}, + {"pickup truck", DetectionClassification::PICKUP_TRUCK}, + {"pedestrian", DetectionClassification::PEDESTRIAN} }; /** diff --git a/src/v2i-hub/MUSTSensorDriverPlugin/test/TestMUSTSensorDetection.cpp b/src/v2i-hub/MUSTSensorDriverPlugin/test/TestMUSTSensorDetection.cpp index 0f745df77..8a62e1c99 100644 --- a/src/v2i-hub/MUSTSensorDriverPlugin/test/TestMUSTSensorDetection.cpp +++ b/src/v2i-hub/MUSTSensorDriverPlugin/test/TestMUSTSensorDetection.cpp @@ -18,6 +18,9 @@ TEST(TestMUSTSensorDetection, fromStringToDetectionClassification) EXPECT_EQ(DetectionClassification::SEDAN, fromStringToDetectionClassification("sedan")); EXPECT_EQ(DetectionClassification::VAN, fromStringToDetectionClassification("van")); EXPECT_EQ(DetectionClassification::TRUCK, fromStringToDetectionClassification("truck")); + EXPECT_EQ(DetectionClassification::BUS, fromStringToDetectionClassification("bus")); + EXPECT_EQ(DetectionClassification::PICKUP_TRUCK, fromStringToDetectionClassification("pickup truck")); + EXPECT_EQ(DetectionClassification::PEDESTRIAN, fromStringToDetectionClassification("pedestrian")); EXPECT_EQ(DetectionClassification::NA, fromStringToDetectionClassification("not_a_classification")); } @@ -78,6 +81,9 @@ TEST(TestMUSTSensorDetection, detectionClassificationToSensorDetectedObjectType EXPECT_STRCASEEQ("SEDAN", detectionClassificationToSensorDetectedObjectType(DetectionClassification::SEDAN).c_str()); EXPECT_STRCASEEQ("VAN", detectionClassificationToSensorDetectedObjectType(DetectionClassification::VAN).c_str()); EXPECT_STRCASEEQ("TRUCK", detectionClassificationToSensorDetectedObjectType(DetectionClassification::TRUCK).c_str()); + EXPECT_STRCASEEQ("BUS", detectionClassificationToSensorDetectedObjectType(DetectionClassification::BUS).c_str()); + EXPECT_STRCASEEQ("PICKUP TRUCK", detectionClassificationToSensorDetectedObjectType(DetectionClassification::PICKUP_TRUCK).c_str()); + EXPECT_STRCASEEQ("PEDESTRIAN", detectionClassificationToSensorDetectedObjectType(DetectionClassification::PEDESTRIAN).c_str()); EXPECT_THROW(detectionClassificationToSensorDetectedObjectType(DetectionClassification::NA).c_str(), std::runtime_error); }