0

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".
pb772
  • 539
  • 1
  • 3
  • 14

1 Answers1

2

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.

Christoph Sommer
  • 6,893
  • 1
  • 17
  • 35
  • Ok, thanks. So in fact the message ("MyMessage") is being sent, but because the cars don't know what to do with this message the error appears, got it. – pb772 Feb 20 '17 at 08:30