From 1615eb5dcf61e3bb34fe58b20e23eab7fe8a2816 Mon Sep 17 00:00:00 2001 From: dan-du-car <62157949+dan-du-car@users.noreply.github.com> Date: Wed, 28 Aug 2024 11:37:25 -0400 Subject: [PATCH] MustSensorDriverPlugin: Convert the classification confidence to decimal from percentage unit % (#634) # PR Details ## Description The MUST Sensor provides classification confidence as a decimal value between 0 and 100 % while the Sensor Detected Object message expects confidence as a decimal value between 0 and 1. PR includes appropriate conversion logic ## Related Issue [FCP-30](https://usdot-carma.atlassian.net/browse/FCP-30) ## Motivation and Context Provide correct data translation between MUST sensor output and Sensor Detected Object message for data accuracy in the SDMS Pipeline ## How Has This Been Tested? Unit Testing and Local Integration Testing ## 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. - [x] All new and existing tests passed. [FCP-30]: https://usdot-carma.atlassian.net/browse/FCP-30?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --- src/v2i-hub/CARMAStreetsPlugin/src/CARMAStreetsPlugin.cpp | 2 +- src/v2i-hub/MUSTSensorDriverPlugin/src/MUSTSensorDetection.cpp | 2 +- .../MUSTSensorDriverPlugin/test/TestMUSTSensorDetection.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/v2i-hub/CARMAStreetsPlugin/src/CARMAStreetsPlugin.cpp b/src/v2i-hub/CARMAStreetsPlugin/src/CARMAStreetsPlugin.cpp index 9a23f0324..ab5d3d71f 100755 --- a/src/v2i-hub/CARMAStreetsPlugin/src/CARMAStreetsPlugin.cpp +++ b/src/v2i-hub/CARMAStreetsPlugin/src/CARMAStreetsPlugin.cpp @@ -711,7 +711,7 @@ void CARMAStreetsPlugin::HandleSimulatedSensorDetectedMessage(SensorDetectedObje // is currently out of scope. TMX Messages should be correctly serialize to // and from json. This temporary fix simply using regex to look for numeric, // null, and bool values and removes the quotations around them. - PLOG(logDEBUG) << "Produce sensor detected message in JSON format: " << msg.to_string() <(detection.timestamp*1000)); // convert decimal seconds to int milliseconds. detectedObject.set_velocity(headingSpeedToVelocity(detection.heading, detection.speed)); detectedObject.set_type(detectionClassificationToSensorDetectedObjectType(detection.cl)); diff --git a/src/v2i-hub/MUSTSensorDriverPlugin/test/TestMUSTSensorDetection.cpp b/src/v2i-hub/MUSTSensorDriverPlugin/test/TestMUSTSensorDetection.cpp index 8a62e1c99..d065d31a3 100644 --- a/src/v2i-hub/MUSTSensorDriverPlugin/test/TestMUSTSensorDetection.cpp +++ b/src/v2i-hub/MUSTSensorDriverPlugin/test/TestMUSTSensorDetection.cpp @@ -66,7 +66,7 @@ TEST(TestMUSTSensorDetection, mustDetectionToSensorDetectedObject ) { auto sensorDetectedObject = mustDetectionToSensorDetectedObject(detection, "MUSTSensor1", "PROJ String"); EXPECT_EQ(detection.trackID, sensorDetectedObject.get_objectId()); - EXPECT_DOUBLE_EQ(detection.confidence, sensorDetectedObject.get_confidence()); + EXPECT_DOUBLE_EQ(detection.confidence/100.0, sensorDetectedObject.get_confidence()); EXPECT_DOUBLE_EQ(detection.position_x, sensorDetectedObject.get_position().x); EXPECT_DOUBLE_EQ(detection.position_y, sensorDetectedObject.get_position().y); EXPECT_NEAR(4.33, sensorDetectedObject.get_velocity().y, 0.001);