1

In VEINS 4.4, one can access the current location of the vehicles at the application layer (e.g. TraCIDemo11p) via "Mobility" module which is defined through TraCIMobility.

I followed the same approach to access the Mobility module at the lower layer (MAC1609_4.cc), where I added following statement at the stage 0 of the initialize function:

TraCIMobility* mobility = TraCIMobilityAccess().get(getParentModule());

However, I am not getting any compilation error, but when OMNET throws errors when the simulation starts and it gives following error.

Error in Module (MAC1609_4) RSUExampleScenario.node[0].nic.mac1609_4(id=12) at event # 2, t = 0.1: Assert: condition traci false in function get, \veins/modules/mobility/traci/TraCIMobility.h line 193

I have searched around for different possible solutions, but, I am still unable to solve this problem.

Related posts are:

How to access TraCI command interface from TraCIDemoRSU11p in Veins Car2X simulator?

Transmission of vehicular status in Veins

RoadId() from the BaseWaveApplLayer.cc (VEINS, OMNET++)

How to get Coordinates of each vehicle in VEINS?

Julian Heinovski
  • 1,822
  • 3
  • 16
  • 27
Farhan
  • 11
  • 2

1 Answers1

1

You are trying to access a TraCIMobility sub-module in the parent module of the Mac1609_4. This, however, is not the Car but the Nic80211p, which has no such sub-module, hence, the failing assertion.

It should work when you go up one additional layer in the hierarchy, as you then use the Car module as root to find the corresponding sub-module:

TraCIMobility* mobility = TraCIMobilityAccess().get(getParentModule()->getParentModule());

See the Car module and the Nic80211p module for reference:

Julian Heinovski
  • 1,822
  • 3
  • 16
  • 27
  • Dear Julian, Thank you so much for your response and clarifying the issue. I now understand your point and the error. This means that we can only access the mobility module at the higher layers (specifically at App layer) only then ?? – Farhan Apr 15 '19 at 12:49
  • No. It means that you should add another call to `getParentModule()` to your expression, as shown in the code above. – Julian Heinovski May 01 '19 at 11:30