Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MustSensorDriverPlugin: Convert the classification confidence to decimal from percentage unit % #634

Merged
merged 3 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/v2i-hub/CARMAStreetsPlugin/src/CARMAStreetsPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() <<std::endl;
PLOG(logDEBUG) << "Receive sensor detected message in JSON format: " << msg.to_string() <<std::endl;
boost::regex exp("\"(null|true|false|-?[0-9]+(\\.[0-9]+)?)\"");
std::stringstream ss;
std::string rv = boost::regex_replace(msg.to_string(), exp, "$1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace MUSTSensorDriverPlugin {
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_confidence(detection.confidence/100.0);
detectedObject.set_timestamp(static_cast<long>(detection.timestamp*1000)); // convert decimal seconds to int milliseconds.
detectedObject.set_velocity(headingSpeedToVelocity(detection.heading, detection.speed));
detectedObject.set_type(detectionClassificationToSensorDetectedObjectType(detection.cl));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading