route.cc 1.94 KB
Newer Older
Jean-Benoist Leger's avatar
Jean-Benoist Leger committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
#include "get_route.h"

int main()
{
    route_db_t route_db("/home/rv/tmpfs/route_db");

    parameters_t parameters;
    parameters.mass = 90;
    parameters.power = 47.6;
    parameters.SCx = .45;
    parameters.Cr = .008;
    parameters.velocity_nopower = 11.1;
    parameters.velocity_brake = 16.7;
    parameters.velocity_equilibrium = 1.4;
    parameters.criterion = RV_CRITERION_ENERGY;
    parameters.power_walk = 36.7;
    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);
    std::pair<double,double> ptA(-76.79992676,40.88444794);
    std::pair<double,double> ptB(-79.96948242,40.43858587);

    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++)
    {
        printf("# track %u\n", track);

        printf("#nid    \tlongitud\tlatitude\televatio\tvelocity\tdistance\tenergy  \ttime    \twalk\n");

        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);
            printf("%8lu\t%8f\t%8f\t%8f\t%8f\t%8f\t%8f\t%8f\t%s\n",
                    nid,
                    pni->fixed->lon,
                    pni->fixed->lat,
                    pni->fixed->elevation,
                    l_it->velocity,
                    l_it->distance,
                    l_it->energy,
                    l_it->time,
                    (l_it->walk)?"yes":"no");
        }
        track++;
    }

    return(0);
}