I am quite new to omnet++, veins and SUMO.I am trying to send customized messages between RSU and the nodes. I am not able to understand how do I customize the message. When I want the message to be seen in the events log window while simulation.
I am tried to understand where the message string is in airframe11p.cc but I am not able to quite understand it. Where do I edit for displaying my own message?
Am I doing it wrong? Is there any other place I am missing to look at?
You send messages via OMNeT++ modules aka applications that are assigned to your agents implemented as Veins modules. So is the general schema. Take a look for example at the folder src/veins/modules/application/traci
. Here you have a) a message file TraCIDemo11pMessage.msg
, b) two modulesTraCIDemo11p.ned
and TraCIDemoRSU11p.ned
as well as their C++ source files. In veins example you use *.rsu[*].applType = "TraCIDemoRSU11p"
, here is the assignment happens. If you want to use a custom message with the same application, you should:
Create a new .msg
file and define there your message fields.
Build your project to generate source code for a message file.
Change an application to work with your new message definition appropriately. Take a look at the lines 100-102 in TraCIDemo11p.cc
:
TraCIDemo11pMessage* wsm = new TraCIDemo11pMessage();
populateWSM(wsm);
wsm->setDemoData(mobility->getRoadId().c_str());
here you create your message object and fill all its fields with your data and then send it.