Skip to content
Snippets Groups Projects
Commit 70f1beab authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Keep the whole last/first geometry when getting a subroad/sublane.

parent b55773c0
No related branches found
No related tags found
1 merge request!2Solved a bug when creating a new geometry object: the sale factor is...
...@@ -971,14 +971,27 @@ COpendriveRoadSegment *COpendriveRoadSegment::get_sub_segment(node_up_ref_t &new ...@@ -971,14 +971,27 @@ COpendriveRoadSegment *COpendriveRoadSegment::get_sub_segment(node_up_ref_t &new
length=geom_it->spline->find_closest_point(end_pose->x,end_pose->y,new_point);//,pow(this->resolution,2.0)); length=geom_it->spline->find_closest_point(end_pose->x,end_pose->y,new_point);//,pow(this->resolution,2.0));
if(length<std::numeric_limits<double>::max()) if(length<std::numeric_limits<double>::max())
{ {
// geom_it->spline->set_end_point(new_point); /*
// geom_it->spline->generate(this->resolution,length); if(geom_it->spline->get_length()>10.0)
// geom_it->opendrive->set_max_s(geom_it->opendrive->get_min_s()+length); {
new_pose=this->get_pose_at(removed_length+10.0,-1);
new_point.x=new_pose.x;
new_point.y=new_pose.y;
new_point.heading=new_pose.heading;
new_point.curvature=this->get_curvature_at(removed_length+10.0,-1);
geom_it->spline->set_end_point(new_point);
geom_it->spline->generate(this->resolution,10.0);
geom_it->opendrive->set_max_s(geom_it->opendrive->get_min_s()+10.0);
}
*/
geom_it=new_segment->geometries.erase(++geom_it,new_segment->geometries.end()); geom_it=new_segment->geometries.erase(++geom_it,new_segment->geometries.end());
break; break;
} }
else else
{
removed_length+=geom_it->spline->get_length();
geom_it++; geom_it++;
}
} }
} }
...@@ -1319,6 +1332,7 @@ void COpendriveRoadSegment::save(OpenDRIVE::road_type **road_info) ...@@ -1319,6 +1332,7 @@ void COpendriveRoadSegment::save(OpenDRIVE::road_type **road_info)
for(unsigned int i=0;i<this->geometries.size();i++) for(unsigned int i=0;i<this->geometries.size();i++)
{ {
::geometry new_geometry; ::geometry new_geometry;
/*
if(this->geometries[i].opendrive->get_name()=="arc") if(this->geometries[i].opendrive->get_name()=="arc")
{ {
double start_curv,end_curv; double start_curv,end_curv;
...@@ -1348,9 +1362,10 @@ void COpendriveRoadSegment::save(OpenDRIVE::road_type **road_info) ...@@ -1348,9 +1362,10 @@ void COpendriveRoadSegment::save(OpenDRIVE::road_type **road_info)
} }
else else
{ {
*/
this->geometries[i].opendrive->save(new_geometry); this->geometries[i].opendrive->save(new_geometry);
plan_view.geometry().push_back(new_geometry); plan_view.geometry().push_back(new_geometry);
} // }
} }
(*road_info)=new OpenDRIVE::road_type(plan_view,lanes); (*road_info)=new OpenDRIVE::road_type(plan_view,lanes);
(*road_info)->name(this->name); (*road_info)->name(this->name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment