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

Updated the examples.

parent 08ee76d7
No related branches found
No related tags found
1 merge request!2Solved a bug when creating a new geometry object: the sale factor is...
...@@ -11,6 +11,7 @@ int main(int argc, char *argv[]) ...@@ -11,6 +11,7 @@ int main(int argc, char *argv[])
CJunction *junction0,*junction1; CJunction *junction0,*junction1;
Eigen::MatrixXi connectivity; Eigen::MatrixXi connectivity;
std::vector<unsigned int> id_map; std::vector<unsigned int> id_map;
std::vector<double> x,y,heading;
road0=new CRoad(); road0=new CRoad();
road0->set_num_lanes(1); road0->set_num_lanes(1);
...@@ -110,6 +111,12 @@ int main(int argc, char *argv[]) ...@@ -110,6 +111,12 @@ int main(int argc, char *argv[])
junction1->link_roads_by_id(road4->get_id(),road1->get_id()); junction1->link_roads_by_id(road4->get_id(),road1->get_id());
junction1->link_lanes_by_id(road4->get_id(),0,road1->get_id(),0); junction1->link_lanes_by_id(road4->get_id(),0,road1->get_id(),0);
map.get_lane_geometry(x,y,heading);
for(unsigned int i=0;i<x.size();i++)
std::cout << x[i] << "," << y[i] << "," << heading[i] << std::endl;
return 0;
map.get_segment_connectivity(connectivity,id_map); map.get_segment_connectivity(connectivity,id_map);
for(unsigned int i=0;i<id_map.size();i++) for(unsigned int i=0;i<id_map.size();i++)
std::cout << i << " -> " << id_map[i] << " "; std::cout << i << " -> " << id_map[i] << " ";
......
...@@ -8,13 +8,26 @@ const std::string opendrive_file="/home/sergi/iri-lab/add_robot/add_ws/code/auto ...@@ -8,13 +8,26 @@ const std::string opendrive_file="/home/sergi/iri-lab/add_robot/add_ws/code/auto
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
try{ try{
CRoadMap map; CRoadMap map,new_map;
Eigen::MatrixXi connectivity; Eigen::MatrixXi connectivity;
std::vector<unsigned int> id_map; std::vector<unsigned int> id_map,new_path,old_path;
std::vector<double> x,y,heading;
map.load_opendrive(opendrive_file); map.load_opendrive(opendrive_file);
map.get_segment_connectivity(connectivity,id_map); map.get_lane_geometry(x,y,heading);
for(unsigned int i=0;i<x.size();i++)
std::cout << x[i] << "," << y[i] << "," << heading[i] << std::endl;
return 0;
old_path.push_back(3);
old_path.push_back(4);
old_path.push_back(22);
old_path.push_back(10);
new_path=map.get_path_sub_roadmap(old_path,new_map);
new_map.get_segment_connectivity(connectivity,id_map);
for(unsigned int i=0;i<id_map.size();i++) for(unsigned int i=0;i<id_map.size();i++)
std::cout << i << " -> " << id_map[i] << " "; std::cout << i << " -> " << id_map[i] << " ";
std::cout << std::endl; std::cout << std::endl;
......
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