Commit 885d9dfa authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Modified the example to input point candidates.

parent 3c988839
......@@ -6,9 +6,12 @@
int main(int argc, char *argv[])
{
std::vector<double> x,y;
TOpendriveWorldPoint closest_point;
double length,x,y,heading;
// std::vector<double> x,y;
COpendriveRoad road;
std::string xml_file="/home/sergi/iri-lab/adc_ws/code/autonomous_driving_tools/src/xml/add_road_full.xodr";
// std::string xml_file="/home/sergi/iri-lab/adc_ws/code/autonomous_driving_tools/src/xml/add_road_full.xodr";
std::string xml_file="/home/sergi/iri-lab/adc_ws/code/autonomous_driving_tools/src/xml/adc_road.xodr";
try
{
......@@ -17,6 +20,7 @@ int main(int argc, char *argv[])
road.set_min_road_length(0.01);
road.load(xml_file);
// std::cout << road << std::endl;
/*
for(unsigned int i=0;i<road.get_num_nodes();i++)
{
const COpendriveRoadNode &node=road.get_node(i);
......@@ -28,6 +32,19 @@ int main(int argc, char *argv[])
std::cout << x[k] << "," << y[k] << std::endl;
}
}
*/
if(argc!=4)
{
std::cout << "Invalid number of parameters" << std::endl;
std::cout << argv[0] << " x y heading" << std::endl;
return -1;
}
x=std::stod(argv[1]);
y=std::stod(argv[2]);
heading=std::stod(argv[3]);
length=road.get_closest_point(x,y,heading,closest_point);
std::cout << "closest point to: " << x << "," << y << "," << heading << " -> " << closest_point.x << "," << closest_point.y << "," << closest_point.heading << " at " << length << " m" << std::endl;
}
catch (CException &e)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment