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

Updated the examples.

parent 0b9ffc35
No related branches found
No related tags found
1 merge request!2Solved a bug when creating a new geometry object: the sale factor is...
......@@ -13,7 +13,8 @@ int main(int argc, char *argv[])
TOpendriveWorldPose start_pose;
COpendriveLine *line_geom;
COpendriveArc *arc_geom;
unsigned int road0_index,road1_index,road2_index,road3_index,road4_index,road5_index,road6_index,road7_index,road8_index,road9_index,road10_index,road11_index,road12_index,road13_index,road14_index,road15_index,road16_index,road17_index,road18_index;
COpendriveJunction *new_junction;
unsigned int road0_index,road1_index,road2_index,road3_index,road4_index,road5_index,road6_index,road7_index,road8_index,road9_index,road10_index,connection_index;
try
{
......@@ -149,15 +150,30 @@ int main(int argc, char *argv[])
delete new_segment;
delete line_geom;
// create junction roads
road11_index=road.add_junction_by_index("road11",road0_index,-1,road1_index,-1);
road12_index=road.add_junction_by_index("road12",road1_index,1,road0_index,1);
road13_index=road.add_junction_by_index("road13",road10_index,-1,road0_index,1);
road14_index=road.add_junction_by_index("road14",road10_index,-1,road1_index,-1);
road15_index=road.add_junction_by_index("road15",road5_index,-1,road6_index,-1);
road16_index=road.add_junction_by_index("road16",road6_index,1,road5_index,1);
road17_index=road.add_junction_by_index("road17",road6_index,1,road10_index,-1);
road18_index=road.add_junction_by_index("road18",road5_index,-1,road10_index,-1);
new_junction=new COpendriveJunction("junction1");
connection_index=new_junction->add_connection(road0_index,road1_index,false);
new_junction->add_link_to_connection(connection_index,-1,-1);
connection_index=new_junction->add_connection(road1_index,road0_index,false);
new_junction->add_link_to_connection(connection_index,1,1);
connection_index=new_junction->add_connection(road10_index,road0_index,false);
new_junction->add_link_to_connection(connection_index,-1,1);
connection_index=new_junction->add_connection(road10_index,road1_index,false);
new_junction->add_link_to_connection(connection_index,-1,-1);
road.add_junction(*new_junction);
delete new_junction;
new_junction=new COpendriveJunction("junction2");
connection_index=new_junction->add_connection(road5_index,road6_index,false);
new_junction->add_link_to_connection(connection_index,-1,-1);
connection_index=new_junction->add_connection(road6_index,road5_index,false);
new_junction->add_link_to_connection(connection_index,1,1);
connection_index=new_junction->add_connection(road6_index,road10_index,false);
new_junction->add_link_to_connection(connection_index,1,-1);
connection_index=new_junction->add_connection(road5_index,road10_index,false);
new_junction->add_link_to_connection(connection_index,-1,-1);
road.add_junction(*new_junction);
delete new_junction;
road.save("./new_road.xodr");
for(unsigned int i=0;i<road.get_num_nodes();i++)
{
......
......@@ -12,9 +12,10 @@ int main(int argc, char *argv[])
std::vector<unsigned int> path,new_path,new_path2;
TOpendriveWorldPose end_pose,start_pose;
double length=100.0;
std::string xml_file="/home/shernand/Downloads/map.xodr";
// std::string xml_file="/home/shernand/Downloads/map.xodr";
// std::string xml_file="/home/shernand/Downloads/osm2xodr_old/output.xodr";
// std::string xml_file="/home/shernand/iri-lab/adc_ws/code/autonomous_driving_tools/src/xml/add.xodr";
std::string xml_file="/home/shernand/iri-lab/add_robot/add_ws/code/autonomous_driving_tools/build/new_road.xodr";
// std::string xml_file="/home/shernand/iri-lab/adc_ws/code/autonomous_driving_tools/src/xml/adc_road.xodr";
// std::string xml_file="/home/shernand/iri-lab/iri_team_ws/src/iri_adc_launch/data/adc/adc.xodr";
......@@ -24,10 +25,10 @@ int main(int argc, char *argv[])
road.set_scale_factor(1.0);
road.set_min_road_length(0.1);
road.load(xml_file);
return 0;
std::cout << road << std::endl;
// return 0;
// std::cout << road << std::endl;
return 0;
// return 0;
for(unsigned int i=0;i<road.get_num_nodes();i++)
{
const COpendriveRoadNode &node=road.get_node(i);
......
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