Skip to content

Commit

Permalink
Adding Optional fields to sdsm
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbourelly999 committed Dec 17, 2023
1 parent 15fa63c commit 42168e7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
25 changes: 25 additions & 0 deletions src/v2i-hub/CARMAStreetsPlugin/src/JsonToJ3224SDSMConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,31 @@ namespace CARMAStreetsPlugin
}
optional_data->choice.detVeh.vehAngVelConfidence = angular_velocity_confidence;
}
// Optional Vehicle Size
if (optional_data_json["detected_vehicle_data"].isMember("size")) {
auto veh_size = (VehicleSize_t*) calloc( 1, sizeof(VehicleSize_t));
veh_size->length = optional_data_json["detected_vehicle_data"]["size"]["length"].asInt64();
veh_size->width = optional_data_json["detected_vehicle_data"]["size"]["width"].asInt64();
optional_data->choice.detVeh.size = veh_size;
}
// Optional Vehicle Height
if (optional_data_json["detected_vehicle_data"].isMember("height")) {
auto veh_height = (VehicleHeight_t*)calloc(1, sizeof(VehicleHeight_t));
*veh_height = optional_data_json["detected_vehicle_data"]["height"].asInt64();
optional_data->choice.detVeh.height = veh_height;
}
// Optional Vehicle Size Confidence
if (optional_data_json["detected_vehicle_data"].isMember("vehicle_size_confidence")) {
auto veh_size_confidence = (VehicleSizeConfidence_t*)calloc(1, sizeof(VehicleSizeConfidence_t));
veh_size_confidence->vehicleLengthConfidence = optional_data_json["detected_vehicle_data"]["vehicle_size_confidence"]["vehicle_length_confidence"].asInt64();
veh_size_confidence->vehicleWidthConfidence = optional_data_json["detected_vehicle_data"]["vehicle_size_confidence"]["vehicle_width_confidence"].asInt64();
if (optional_data_json["detected_vehicle_data"]["vehicle_size_confidence"].isMember("vehicle_height_confidence")) {
auto veh_height_confidence = (SizeValueConfidence_t*)calloc(1, sizeof(SizeValueConfidence_t));
*veh_height_confidence = optional_data_json["detected_vehicle_data"]["vehicle_size_confidence"]["vehicle_height_confidence"].asInt64();
veh_size_confidence->vehicleHeightConfidence = veh_height_confidence;
}
optional_data->choice.detVeh.vehicleSizeConfidence = veh_size_confidence;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,13 @@ namespace CARMAStreetsPlugin
ASSERT_EQ(3, *sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.vehAngVelConfidence->pitchRateConfidence);
ASSERT_EQ(4, *sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.vehAngVelConfidence->rollRateConfidence);

// ASSERT_EQ(300, sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.size->width);
// ASSERT_EQ(700, sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.size->length);
// ASSERT_EQ(70, *sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.height);
ASSERT_EQ(300, sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.size->width);
ASSERT_EQ(700, sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.size->length);
ASSERT_EQ(70, *sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.height);

// ASSERT_EQ(7, sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.vehicleSizeConfidence->vehicleWidthConfidence);
// ASSERT_EQ(6, sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.vehicleSizeConfidence->vehicleLengthConfidence);
// ASSERT_EQ(5, *sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.vehicleSizeConfidence->vehicleHeightConfidence);
ASSERT_EQ(7, sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.vehicleSizeConfidence->vehicleWidthConfidence);
ASSERT_EQ(6, sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.vehicleSizeConfidence->vehicleLengthConfidence);
ASSERT_EQ(5, *sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.vehicleSizeConfidence->vehicleHeightConfidence);

// ASSERT_EQ(11, *sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.vehicleClass);
// ASSERT_EQ(75, *sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.classConf);
Expand Down

0 comments on commit 42168e7

Please sign in to comment.