Skip to content

Commit

Permalink
Update detection classifications in MUSTSensorDriverPlugin (#631)
Browse files Browse the repository at this point in the history
<!-- Thanks for the contribution, this is awesome. -->

# PR Details
## Description
Update detection classifications in MUSTSensorDriverPlugin 
<!--- Describe your changes in detail -->

## Related Issue
https://usdot-carma.atlassian.net/browse/FCP-28
<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->

## Motivation and Context
Freight Cooperative Perception
<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested?
Unit test
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [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:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] 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.
  • Loading branch information
dan-du-car authored Aug 22, 2024
1 parent eb539af commit 576e484
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/v2i-hub/MUSTSensorDriverPlugin/src/MUSTSensorDetection.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ namespace MUSTSensorDriverPlugin {
enum class DetectionClassification {
SEDAN,
TRUCK,
BUS,
PICKUP_TRUCK,
PEDESTRIAN,
VAN,
NA
};
Expand Down Expand Up @@ -46,7 +49,10 @@ namespace MUSTSensorDriverPlugin {
const static std::unordered_map<std::string, DetectionClassification> stringToDetectionClassificationMap = {
{"sedan", DetectionClassification::SEDAN},
{"truck", DetectionClassification::TRUCK},
{"van", DetectionClassification::VAN}
{"van", DetectionClassification::VAN},
{"bus", DetectionClassification::BUS},
{"pickup truck", DetectionClassification::PICKUP_TRUCK},
{"pedestrian", DetectionClassification::PEDESTRIAN}
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));

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

}
Expand Down

0 comments on commit 576e484

Please sign in to comment.