From 3e7c0d3e3ead1aacf3cc68ef528f1d56995cf0dd Mon Sep 17 00:00:00 2001 From: dan-du-car Date: Mon, 12 Aug 2024 21:37:08 +0000 Subject: [PATCH] fix must sensor --- .../src/MUSTSensorDetection.cpp | 16 +++++++-------- .../test/TestMUSTSensorDetection.cpp | 20 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/v2i-hub/MUSTSensorDriverPlugin/src/MUSTSensorDetection.cpp b/src/v2i-hub/MUSTSensorDriverPlugin/src/MUSTSensorDetection.cpp index b193f82b8..8d37af661 100644 --- a/src/v2i-hub/MUSTSensorDriverPlugin/src/MUSTSensorDetection.cpp +++ b/src/v2i-hub/MUSTSensorDriverPlugin/src/MUSTSensorDetection.cpp @@ -31,15 +31,15 @@ namespace MUSTSensorDriverPlugin { tmx::messages::SensorDetectedObject mustDetectionToSensorDetectedObject(const MUSTSensorDetection &detection, std::string_view sensorId, std::string_view projString) { tmx::messages::SensorDetectedObject detectedObject; - detectedObject.set_ObjectId(detection.trackID); + detectedObject.set_objectId(detection.trackID); tmx::messages::Position pos(detection.position_x, detection.position_y, 0); - detectedObject.set_Position(pos); - detectedObject.set_Confidence(detection.confidence); - detectedObject.set_Timestamp(static_cast(detection.timestamp*1000)); // convert decimal seconds to int milliseconds. - detectedObject.set_Velocity(headingSpeedToVelocity(detection.heading, detection.speed)); - detectedObject.set_Type(detectionClassificationToSensorDetectedObjectType(detection.cl)); - detectedObject.set_SensorId(std::string(sensorId)); - detectedObject.set_ProjString(std::string(projString)); + detectedObject.set_position(pos); + detectedObject.set_confidence(detection.confidence); + detectedObject.set_timestamp(static_cast(detection.timestamp*1000)); // convert decimal seconds to int milliseconds. + detectedObject.set_velocity(headingSpeedToVelocity(detection.heading, detection.speed)); + detectedObject.set_type(detectionClassificationToSensorDetectedObjectType(detection.cl)); + detectedObject.set_sensorId(std::string(sensorId)); + detectedObject.set_projString(std::string(projString)); return detectedObject; } DetectionClassification fromStringToDetectionClassification(const std::string &str) noexcept { diff --git a/src/v2i-hub/MUSTSensorDriverPlugin/test/TestMUSTSensorDetection.cpp b/src/v2i-hub/MUSTSensorDriverPlugin/test/TestMUSTSensorDetection.cpp index 0d8fb0e22..0f745df77 100644 --- a/src/v2i-hub/MUSTSensorDriverPlugin/test/TestMUSTSensorDetection.cpp +++ b/src/v2i-hub/MUSTSensorDriverPlugin/test/TestMUSTSensorDetection.cpp @@ -62,16 +62,16 @@ 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.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); - EXPECT_NEAR(2.5, sensorDetectedObject.get_Velocity().x, 0.001); - EXPECT_STRCASEEQ("SEDAN", sensorDetectedObject.get_Type().c_str()); - EXPECT_EQ(1719506355400, sensorDetectedObject.get_Timestamp()); - EXPECT_EQ("MUSTSensor1", sensorDetectedObject.get_SensorId()); - EXPECT_EQ("PROJ String", sensorDetectedObject.get_ProjString()); + EXPECT_EQ(detection.trackID, sensorDetectedObject.get_objectId()); + EXPECT_DOUBLE_EQ(detection.confidence, 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); + EXPECT_NEAR(2.5, sensorDetectedObject.get_velocity().x, 0.001); + EXPECT_STRCASEEQ("SEDAN", sensorDetectedObject.get_type().c_str()); + EXPECT_EQ(1719506355400, sensorDetectedObject.get_timestamp()); + EXPECT_EQ("MUSTSensor1", sensorDetectedObject.get_sensorId()); + EXPECT_EQ("PROJ String", sensorDetectedObject.get_projString()); } TEST(TestMUSTSensorDetection, detectionClassificationToSensorDetectedObjectType ) {