I am using omnetpp 5.4.1, veins 4.7.1 and sumo-0.30.0. I want to get my neighbors and I also want to calculate (compare) direction of a vehicle with its neighbors. although I read Calculate direction of a vehicle (Veins/Omnet++/Sumo) and I know that getAngleRad() method in veins defines direction of vehicles, I do not know how to write a code that 2 car move in opposite direction. how can I write that?
Asked
Active
Viewed 280 times
0
-
If am unsure what step is giving you problems. What have you tried? – Christoph Sommer Aug 26 '19 at 14:42
-
I appreciate the time you devoted for me. First of all I want to find my neighbors and calculate what vehicles have opposite direction to each other. in fact I want to consider the vehicles that are in neighborhood of each other and have opposite direction. – sepideh Aug 27 '19 at 18:04
-
I am very unclear on what you are asking. How to simulate whether a vehicle can detect another vehicle's presence? How a vehicle can know which direction it is moving in? How it can tell other vehicles which direction it is moving in? How, given two movement directions, you can determine if they are opposite of each other? – Christoph Sommer Aug 28 '19 at 10:40
-
I do not know it is correct or not.but I read in one of your article that antenna can find neighbors. I also searched in veins and I understood that this feature exists in TraciMobility of veins and after that I tried to find out which vehicles move in opposite direction. then I read in stackoverflow that the vehicle that have opposite direction are in opposite quadrants.however I don not know how to define this opposite direction.for instant I don not know how to code it. Mobility->getAngleRad()!=neighbors->getAngleRad(); – sepideh Aug 28 '19 at 10:42
-
yeah exactly I need what you have said:first of all 1) how a vehicle can tell other vehicles which direction it is moving in. and I also want to determine which vehicles are opposite of each other. – sepideh Aug 28 '19 at 10:49
1 Answers
0
The tutorial simulation that is included in Veins 4.7.1 demonstrates how a vehicle can send information about its mobility to other vehicles. See TraCIDemo11p.cc line 89 for the code that does that; see TraCIMobility.h line 100 for a list of other methods that can be accessed via the mobility
member of the application. Here, getAngleRad
is likely to be the one you are interested in.

Christoph Sommer
- 6,893
- 1
- 17
- 35