Search code examples
omnet++veins

Changing veins message


Why this program doesn't work? I just changed the message content.

Instead of sending road block id, I want to send a generic message with "MyMessage" string.

void TraCIDemoRSU11p::sendMessage(std::string blockedRoadId) 
{
    sentMessage = true;
    t_channel channel = dataOnSch ? type_SCH : type_CCH;
    WaveShortMessage* wsm = prepareWSM("data", dataLengthBits, channel, dataPriority, -1,2);
    //wsm->setWsmData(blockedRoadId.c_str());
    wsm->setWsmData("MyMessage");
    sendWSM(wsm);
}

The simulation starts but when the first message will be sent an error appears:

TraCI Server reported error executing command 0xc4:"Referenced edge 'MyMessage' is not known".

Solution

  • I am guessing you are modifying the tutorial simulation that comes with Veins 4.4.

    This simulation works as follows: if a car is stopped for more than a few seconds, it sends its current road to all vehicles in range. If a car receives such a message it will forward it to other cars and it will try to find a route to its destination that avoids the road in this message.

    I am guessing you only changed the contents of the message from a road name to some string. Thus, any car receiving the message will still try to avoid the road identified by this string. Because such a road does not exist you are getting an error.