Distance between two points on the road (Veins)

528 views
Skip to first unread message

Echo

unread,
Mar 25, 2016, 11:44:55 AM3/25/16
to OMNeT++ Users
Hello Everyone,

I was wondering if I can determine the road shortest distance between two points in Veins, Omnet++. However, I know how to calculate the air distance. Thank you in advance.

Regards,

David Eckhoff

unread,
Mar 25, 2016, 3:29:51 PM3/25/16
to omn...@googlegroups.com
hi,

this can be done via traci (distance request (0x59)).

see: http://sumo.dlr.de/wiki/TraCI/Simulation_Value_Retrieval
iirc, its already implemented in veins.

-david
> --
> You received this message because you are subscribed to the Google
> Groups "OMNeT++ Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to omnetpp+u...@googlegroups.com
> <mailto:omnetpp+u...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/omnetpp.
> For more options, visit https://groups.google.com/d/optout.


--
Dr. David Eckhoff
Computer Networks and Communication Systems
University of Erlangen, Germany
http://www7.cs.fau.de/en/people/eckhoff/

Echo

unread,
Mar 29, 2016, 12:18:15 PM3/29/16
to OMNeT++ Users, d...@cs.fau.de
Hello David,

Thank you for the response.
I tried the getDistance function from traci command interface. However, I am not getting the correct road distances between two cars. BTW, I am still working on the simple veins map. For example, the distance between two cars on the same line is correct(I have implemented a function for calculating the air distance with pythagora), but when i get the distance between two cars on a different road then the distance is way bigger that it is logical to be. Do you have maybe some explanation for that? Thank you in advance.

Regards,

朱超

unread,
Mar 26, 2017, 9:16:38 AM3/26/17
to OMNeT++ Users, d...@cs.fau.de
Hi, Echo
   I also got the problem, the function getDistance() from TraCICommandInterface could not get the correct distance between two nodes. And I do not understand the reason, can someone explain this?
   However, you can use the function in Coord class. For example, if you want get the distance from Coord a to Coord b, you can use a.distance(b) to get the distance between them.
Br,
Chao

在 2016年3月29日星期二 UTC+3下午7:18:15,Echo写道:

Echo

unread,
Apr 2, 2017, 7:10:23 PM4/2/17
to OMNeT++ Users, d...@cs.fau.de
Hello Chao,

You have to make sure that the input coordinates are accurate. By accurate I mean that the input coordinates are really a coordinates from the road. The best way to do that is by getting the coordinates of the vehicles that are already driving on the map.

Cheers,

h rahmatzehi

unread,
Jun 16, 2017, 3:42:02 PM6/16/17
to OMNeT++ Users
Hi 
How I can calculate the length of the road?

در جمعه 25 مارس 2016، ساعت 20:14:55 (UTC+4:30)، Echo نوشته:

Echo

unread,
Jun 16, 2017, 4:21:51 PM6/16/17
to OMNeT++ Users
Hello,

You can determine the road length between two points by using the following function:

double getDistance(const Coord& position1, const Coord& position2, bool returnDrivingDistance);

As you can see, you input the first and the second coordinate. Next, if you set the returnDrivingDistance to true the function will return the driving distance. Otherwise, it will return the euclidean distance between the points.

I hope that helps.

Cheers,
Tomo
Reply all
Reply to author
Forward
Message has been deleted
0 new messages