route.cc 2.17 KB
Newer Older
Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
1 2
#include "get_route.h"

Jean-Benoist Leger's avatar
update  
Jean-Benoist Leger committed
3
int main(int argc, char** argv)
Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
4
{
Jean-Benoist Leger's avatar
update  
Jean-Benoist Leger committed
5 6
//    if(argc<4)
//        abort();
Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
7 8 9 10
    route_db_t route_db("/home/rv/tmpfs/route_db");

    parameters_t parameters;
    parameters.mass = 90;
Jean-Benoist Leger's avatar
update  
Jean-Benoist Leger committed
11
    parameters.power = 140;
Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
12 13
    parameters.SCx = .45;
    parameters.Cr = .008;
Jean-Benoist Leger's avatar
update  
Jean-Benoist Leger committed
14 15
    parameters.velocity_nopower = 9.7;
    parameters.velocity_brake = 13.9;
Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
16
    parameters.velocity_equilibrium = 1.4;
Jean-Benoist Leger's avatar
update  
Jean-Benoist Leger committed
17 18
    parameters.criterion = RV_CRITERION_ENERGY_APPROX;
    parameters.power_walk = 140;
Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
19 20 21 22 23 24
    parameters.lateral_acceleration = .5;
    parameters.walk_penalty = 1;
    parameters.Cw = .03;

    //std::pair<double,double> ptA(-78.39191437,40.51849719);
    //std::pair<double,double> ptB(-77.86422729,40.79197912);
Jean-Benoist Leger's avatar
update  
Jean-Benoist Leger committed
25 26 27 28
//    std::pair<double,double> ptA(-76.79992676,40.88444794);
//    std::pair<double,double> ptB(-79.96948242,40.43858587);
    std::pair<double,double> ptA(atof(argv[1]),atof(argv[2]));
    std::pair<double,double> ptB(atof(argv[3]),atof(argv[4]));
Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
29 30 31 32 33 34 35 36 37 38 39 40

    std::list<std::pair<double,double> > geos;
    geos.push_back(ptA);
    geos.push_back(ptB);

    std::list<std::list<route_point_t> > res = get_routes(&route_db, parameters, geos);

    unsigned int track=0;
    for(std::list<std::list<route_point_t> >::iterator res_it = res.begin();
            res_it!=res.end();
            res_it++)
    {
Jean-Benoist Leger's avatar
update  
Jean-Benoist Leger committed
41
//        printf("# track %u\n", track);
Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
42

Jean-Benoist Leger's avatar
update  
Jean-Benoist Leger committed
43
//        printf("#nid    \tlongitud\tlatitude\televatio\tvelocity\tdistance\tenergy  \ttime    \twalk\n");
Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
44 45 46 47 48 49 50 51 52

        std::list<route_point_t> & l = *res_it;

        for(std::list<route_point_t>::iterator l_it = l.begin();
                l_it!=l.end();
                l_it++)
        {
            nid_t nid = l_it->nid;
            node_info_t* pni = route_db.get_node(nid);
Jean-Benoist Leger's avatar
update  
Jean-Benoist Leger committed
53
            printf("%8lu\t%8f\t%8f\t%8f\t%8f\t%8f\t%8f\t%8f\t%8f\t%s\n",
Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
54 55 56 57 58 59 60
                    nid,
                    pni->fixed->lon,
                    pni->fixed->lat,
                    pni->fixed->elevation,
                    l_it->velocity,
                    l_it->distance,
                    l_it->energy,
Jean-Benoist Leger's avatar
update  
Jean-Benoist Leger committed
61
                    l_it->power,
Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
62
                    l_it->time,
Jean-Benoist Leger's avatar
update  
Jean-Benoist Leger committed
63
                    (l_it->walk)?"1":"0");
Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
64 65 66 67 68 69 70 71 72 73 74
        }
        track++;
    }

    return(0);
}