4dummy
4dummy

Reputation: 19

Omnet++ issue with getleader()

I have been trying to retrieve the data of preceding vehicle via getleader() [Calculating the distance between the current vehicle and the preceding vehicle and then send it out as wsm to other vehicles. Issue is that my Simulation stops as soon as the function sendleaderdata() is called with the following error in Mingw:

 <stderr><![CDATA[Error: Answered with error to command 0xa4: Wrong position in requestMessage after dispatching command. Expected command length was 25 but 16 Bytes were read.

My sendleaderdata() :

{      std::pair <std::string,double> leader = traciVehicle->getLeader(0.0);
       int leaderId = std::stoi (leader.first ,nullptr) ;
       double leaderpos= leader.second;
       printf ("Leaderpos %.1f" , leaderpos);
       std::string leadmsg = std::to_string(leaderpos);
       WaveShortMessage *wsm = new WaveShortMessage ("leaderdata");
       wsm-> setWsmData(leadmsg.c_str());
       sendDown(wsm->dup());
       delete wsm;
}

sendleaderdata() is being called periodically via an event with an interval of 1.0s in handleSelfMsg(). I have already tried debugging but it just doesn't go beyond the first line of sendleaderdata(). Would be nice if someone can help me. Thank you in advance :)

Edit: I am using the V 0.32.0 and here is the screenshot of command window: Cmnd win

Upvotes: 1

Views: 65

Answers (1)

user12265925
user12265925

Reputation: 11

You are most likely using code that was written for a different version of SUMO. As neither you nor the answer you are referencing are giving which SUMO version they are asking (or answering) for, this is impossible to answer.

Upvotes: 1

Related Questions