'Get Receiver Vehicle Position in BSM
How do I configure Veins to get the receiving vehicle's position (x and y) in a BSM message? I am using this configuration of veins: https://github.com/josephkamel/veins-f2md.
Solution 1:[1]
When a vehicle receives a BSM, you can read the position of the current vehicle by using the mobility module:
mobility->getPositionAt(simTime()).x
mobility->getPositionAt(simTime()).y
mobility->getPositionAt(simTime()).z
It makes little sense to encode the receiver position in the message itself -- you are sending a broadcast. Apart from that, there are other reasons against the proposed procedure.
You could furthermore get the position from the Signal of a message.
signal.getReceiverPoa().pos.getPositionAt(simTime()).x
signal.getReceiverPoa().pos.getPositionAt(simTime()).y
signal.getReceiverPoa().pos.getPositionAt(simTime()).z
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | thardes2 |
