8000 758 add guard rails and barriers as lane boundaries to osi by ClemensLinnhoff · Pull Request #792 · esmini/esmini · GitHub
[go: up one dir, main page]

Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ int OSIReporter::UpdateOSIStationaryObjectODR(roadmanager::RMObject *object, roa
obj_osi_internal.sobj->mutable_classification()->set_type(
osi3::StationaryObject_Classification_Type::StationaryObject_Classification_Type_TYPE_VEGETATION);
}
else if (obj_type == roadmanager::RMObject::ObjectType::BARRIER)
else if (obj_type == roadmanager::RMObject::ObjectType::BARRIER || obj_type == roadmanager::RMObject::ObjectType::RAILING)
{
obj_osi_internal.sobj->mutable_classification()->set_type(
osi3::StationaryObject_Classification_Type::StationaryObject_Classification_Type_TYPE_BARRIER);
Expand Down Expand Up @@ -990,11 +990,11 @@ int OSIReporter::UpdateOSIStationaryObjectODR(roadmanager::RMObject *object, roa
{
obj_osi_internal.sobj->mutable_classification()->set_type(osi_type);
}
else if (obj_type == roadmanager::RMObject::ObjectType::OBSTACLE || obj_type == roadmanager::RMObject::ObjectType::RAILING ||
obj_type == roadmanager::RMObject::ObjectType::PATCH || obj_type == roadmanager::RMObject::ObjectType::TRAFFICISLAND ||
obj_type == roadmanager::RMObject::ObjectType::CROSSWALK || obj_type == roadmanager::RMObject::ObjectType::STREETLAMP ||
obj_type == roadmanager::RMObject::ObjectType::GANTRY || obj_type == roadmanager::RMObject::ObjectType::SOUNDBARRIER ||
obj_type == roadmanager::RMObject::ObjectType::WIND || obj_type == roadmanager::RMObject::ObjectType::ROADMARK)
else if (obj_type == roadmanager::RMObject::ObjectType::OBSTACLE || obj_type == roadmanager::RMObject::ObjectType::PATCH ||
obj_type == roadmanager::RMObject::ObjectType::TRAFFICISLAND || obj_type == roadmanager::RMObject::ObjectType::CROSSWALK ||
obj_type == roadmanager::RMObject::ObjectType::STREETLAMP || obj_type == roadmanager::RMObject::ObjectType::GANTRY ||
obj_type == roadmanager::RMObject::ObjectType::SOUNDBARRIER || obj_type == roadmanager::RMObject::ObjectType::WIND ||
obj_type == roadmanager::RMObject::ObjectType::ROADMARK)
{
// if subtype not matched, but the object type is one of the known types, classify as TYPE_OTHER
obj_osi_internal.sobj->mutable_classification()->set_type(
Expand Down Expand Up @@ -1247,7 +1247,7 @@ int OSIReporter::UpdateOSIStationaryObject(Object &obj)
obj_osi_internal.sobj->mutable_classification()->set_type(
osi3::StationaryObject_Classification_Type::StationaryObject_Classification_Type_TYPE_VEGETATION);
}
else if (obj.category_ == MiscObject::Category::BARRIER)
else if (obj.category_ == MiscObject::Category::BARRIER || obj.category_ == MiscObject::Category::RAILING)
{
obj_osi_internal.sobj->mutable_classification()->set_type(
osi3::StationaryObject_Classification_Type::StationaryObject_Classification_Type_TYPE_BARRIER);
Expand All @@ -1258,11 +1258,10 @@ int OSIReporter::UpdateOSIStationaryObject(Object &obj)
osi3::StationaryObject_Classification_Type::StationaryObject_Classification_Type_TYPE_BUILDING);
}
else if (obj.category_ == MiscObject::Category::OBSTACLE || obj.category_ == MiscObject::Category::PARKINGSPACE ||
obj.category_ == MiscObject::Category::RAILING || obj.category_ == MiscObject::Category::PATCH ||
obj.category_ == MiscObject::Category::TRAFFICISLAND || obj.category_ == MiscObject::Category::CROSSWALK ||
obj.category_ == MiscObject::Category::STREETLAMP || obj.category_ == MiscObject::Category::GANTRY ||
obj.category_ == MiscObject::Category::SOUNDBARRIER || obj.category_ == MiscObject::Category::WIND ||
obj.category_ == MiscObject::Category::ROADMARK)
obj.category_ == MiscObject::Category::PATCH || obj.category_ == MiscObject::Category::TRAFFICISLAND ||
obj.category_ == MiscObject::Category::CROSSWALK || obj.category_ == MiscObject::Category::STREETLAMP ||
obj.category_ == MiscObject::Category::GANTRY || obj.category_ == MiscObject::Category::SOUNDBARRIER ||
obj.category_ == MiscObject::Category::WIND || obj.category_ == MiscObject::Category::ROADMARK)
{
obj_osi_internal.sobj->mutable_classification()->set_type(
osi3::StationaryObject_Classification_Type::StationaryObject_Classification_Type_TYPE_OTHER);
Expand Down Expand Up @@ -2705,6 +2704,57 @@ int OSIReporter::UpdateOSILaneBoundary()
}
}

// set barriers as lane boundaries
for (unsigned int i = 0; i < opendrive->GetNumOfRoads(); i++)
{
roadmanager::Road *road = opendrive->GetRoadByIdx(i);
if (road)
{
for (unsigned int j = 0; j < road->GetNumberOfObjects(); j++)
{
roadmanager::RMObject *object = road->GetRoadObject(j);
if (object)
{
auto obj_type = object->GetType();
if (obj_type == roadmanager::RMObject::ObjectType::BARRIER || obj_type == roadmanager::RMObject::ObjectType::RAILING)
{
osi3::LaneBoundary *osi_laneboundary = obj_osi_internal.static_gt->add_lane_boundary();

// set id and points
osi_laneboundary->mutable_id()->set_value(object->GetGlobalId());
osi_laneboundary->mutable_classification()->set_type(
osi3::LaneBoundary_Classification_Type::LaneBoundary_Classification_Type_TYPE_BARRIER); // todo: differentiate between
// barrier and guard rail
if (object->GetNumberOfOutlines() > 0)
{
for (unsigned int k = 0; k < object->GetNumberOfOutlines(); k++)
{
roadmanager::Outline *outline = object->GetOutline(k);
if (outline)
{
for (size_t l = 0; l < outline->corner_.size() / 2;
l++) // todo: only use one side of the outline for the lane boundary, but it is not clear, if this is always
// the case.
{
double x, y, z;
outline->corner_[l]->GetPos(x, y, z);
osi3::LaneBoundary::BoundaryPoint *boundary_point = osi_laneboundary->add_boundary_line();
boundary_point->mutable_position()->set_x(x);
boundary_point->mutable_position()->set_y(y);
boundary_point->mutable_position()->set_z(z);
boundary_point->set_height(outline->corner_[l]->GetHeight());
boundary_point->set_width(0.1); // todo: come up with solution to specify the width
}
}
}
}
obj_osi_internal.lnb.push_back(osi_laneboundary);
}
}
}
}
}

return 0;
}

Expand Down
0