Search code examples
omnet++veinsinet

how to get the angle of movement (direction) of a car when using VeinsInetMobility


I need to get the angle of movement (direction) of a node.

In TraCIMobility this is done with getHeading() in veins-5 and with getAngleRad() in the previous versions of veins

But I can't figure out what is the equivalent of getHeading() when using VeinsInetMobility


Solution

  • Veins 5 VeinsInetMobility (for INET 4) is based on inet::MobilityBase which, in turn, implements inet::IMobility (see https://github.com/inet-framework/inet/blob/v4.2.0/src/inet/mobility/contract/IMobility.h). This interface offers getCurrentVelocity which returns a vector. Its magnitude is the speed of the vehicle, its angles are the direction.