omnet++ - Difference between getCurrentPosition() and getPositionAt(time) in Veins -
i'm using veins 4.4, omnet++ 5.0 , sumo 0.25.
i use traci->getcurrentposition() actual position of vehicle, i.e., traci->getcurrentposition().x , traci->getcurrentposition().y.
i want estimate position of vehicle @ specific time in order have positions of vehicle's trajectory.
so, use function traci->getpositionat(time) , set simtime_t time = simtime()+60 position of vehicle after 60 s. current position!
what difference between getcurrentposition() , getpositionat(time)?
how can position of vehicle's trajectory?
below have implementations of functions have mentioned. can see in first case comment getpositionat() says:
it intended passed
simtime()actualtime, returns actual position.
seems these functions not cover case @ all.
you can see how these functions work @ move.h. comments detailed enough too
/** * @brief returns position of move (host) @ specified point in time. * intended passed simtime() actualtime , returns actual position. * * assumes direction represents normalized vector (length equals 1.0). * further function not check whether given time point before * starttime of actual move pattern. in case 1 might obtain * unintended result. * */ virtual coord getpositionat(simtime_t_cref actualtime = simtime()) const { // if speed close 0.0, host practically standing still if ( fwmath::close(speed, 0.0) ) return startpos; // otherwise: actualpos = startpos + ( direction * v * t ) return startpos + ( direction * speed * simtime_dbl(actualtime - starttime) ); } virtual const coord& getcurrentposition() const { if (lastpos.z != dbl_max) return lastpos; return startpos; } getpositionat() implemented @ tracimobility.h as:
virtual coord getpositionat(const simtime_t& t) const { return move.getpositionat(t) ; } and getcurrentposition() implemented @ basemobility.h as:
/** @brief returns current position @ current simulation time. */ virtual coord getcurrentposition(/*simtime_t_cref stwhen = simtime()*/) const { //return move.getpositionat(stwhen); return move.getstartpos(); }
Comments
Post a Comment