Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbourelly999 committed Sep 3, 2024
1 parent 9bdf571 commit 904e31e
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/v2i-hub/CDASimAdapter/src/CDASimConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ namespace CDASimAdapter{
}
sensor["location"] = sensor_configuration[index]["ref"]["location"];
sensor["orientation"] =sensor_configuration[index]["ref"]["orientation"];
sensors_registration[index] = sensor;
sensors_registration.append(sensor);
}
/** Sensor Registration JSON Format
[
Expand Down
2 changes: 2 additions & 0 deletions src/v2i-hub/CDASimAdapter/src/include/CDASimConnection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ namespace CDASimAdapter {
FRIEND_TEST(TestCDASimConnection, get_handshake_json_no_sensor_config);
FRIEND_TEST(TestCDASimConnection, read_json_file);
FRIEND_TEST(TestCDASimConnection, string_to_json);
FRIEND_TEST(TestCDASimConnection, read_sensor_configuration_file);



};
Expand Down
8 changes: 8 additions & 0 deletions src/v2i-hub/CDASimAdapter/test/TestCDASimConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,12 @@ namespace CDASimAdapter {
{
EXPECT_THROW(connection->string_to_json("Invalid Json"), std::invalid_argument);
}

TEST_F(TestCDASimConnection, read_sensor_configuration_file) {
auto sensor_registration = connection->read_sensor_configuration_file("../../CDASimAdapter/test/sensors_including_invalid_entries.json");
EXPECT_EQ(2, sensor_registration.size());
EXPECT_EQ("SomeID", sensor_registration[0]["sensorId"].asString());
EXPECT_EQ("SomeID2", sensor_registration[1]["sensorId"].asString());

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[
{
"sensorId": "SomeID",
"type": "SemanticLidar",
"ref": {
"type": "CARTESIAN",
"location": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"orientation": {
"yaw": 0.0,
"pitch": 0.0,
"roll": 0.0
}
}
},
{
"sensorId": "sensor_1",
"type": "SemanticLidar",
"ref": {
"type": "WGS84",
"location": {
"latitude": 38.9549716548523,
"longitude": -77.14935313519123,
"altitude": 5.5
}
}
},
{
"sensorId": "SomeID2",
"type": "SemanticLidar",
"ref": {
"type": "CARTESIAN",
"location": {
"x": 1.0,
"y": 2.0,
"z": 0.0
},
"orientation": {
"yaw": 23.0,
"pitch": 0.0,
"roll": 0.0
}
}
}
]

0 comments on commit 904e31e

Please sign in to comment.