I am trying to compute the distance between two mobile nodes in veins and i am using the following method
WaveShortMessage * pos = new WaveShortMessage();
Coord senderPosition = pos->getSenderPos();
Coord receiverPosition = traci->getPositionAt(simTime());
double distance = senderPosition.distance(receiverPosition);
I want to know if this is the correct method for computing distance between two nodes and if the given distance is in meters or centimeters because the value it returns is very large so i'm assuming that it is in centimeter. Thanks in advance.
Yes, the Coord::distance method is the right one to call for calculating how far away two points are.
Note, though, that you are not initializing the sender position before reading it. This way, you are likely getting random values when trying to read