0
votes

I would like to access other vehicles' information (roadId, current position, velocity ...) in my Vehicle Application (MyVeinsApp) during the simulation, and without sending any message.

From what I know, vehicles can only get their own information in MyVeinsApp using TraCI functions. Is there a way for vehicles to access all other vehicle information in Veins 4.7.1?

Any help would be appreciated.

1

1 Answers

2
votes

Every car has an index that is unique, which can be obtained by: self = getParentModule()->getIndex(). You can use this index (self) as an array index. Basically, you create an global array for each parameter you need (e.g. roadId[], velocity[], etc.) and then each car puts its information in the respective array position. As this array is global, any car can access to the information of any other car. Instead of using multiple arrays, you can also create one array of objects, one object for each car, where each object contains all parameters of the car.