Answered with error to command 0x00

64 views
Skip to first unread message

Parishan Ismael

unread,
Apr 27, 2020, 2:16:17 PM4/27/20
to OMNeT++ Users
Hi, I am using OMNeT++-5.5.1, Veins-5.0, and SUMO-1.2.0. I am trying to stop a vehicle at a parking area through setParkingAreaStop command, but the simulation terminated with the following error:

Error: Answered with error to command 0x00: Wrong position in requestMessage after dispatching command 0. Expected command length was 70 but 2 Bytes were read.


The following is the code of my setParkingAreaStop command:

void TraCICommandInterface::Vehicle::setParkingAreaStop(std::string edgeId, double endPos, uint8_t laneInd,double duration,uint8_t flag){
    uint8_t variableId = CMD_STOP;
    uint8_t variableType = TYPE_COMPOUND;
    uint8_t Edgetype= TYPE_STRING;
    uint8_t Postype= TYPE_DOUBLE;
    uint8_t Lanetype= TYPE_BYTE;
    uint8_t Durtype= TYPE_INTEGER;
    int32_t count = 5;
    TraCIBuffer buf = connection->query(CMD_SET_VEHICLE_VARIABLE, TraCIBuffer() << variableId << nodeId << variableType << count << Edgetype << edgeId << Postype << endPos << Lanetype << laneInd  << Postype << duration << Lanetype << flag);
        ASSERT(buf.eof());
}

How can I solve this problem? please help. Thanks.

Christoph Sommer

unread,
Apr 28, 2020, 5:55:42 AM4/28/20
to OMNeT++ Users Mailinglist
On 27 Apr 2020, at 20:16, Parishan Ismael <parisha...@uod.ac> wrote:
> variableType << count << Edgetype << edgeId << Postype << endPos << Lanetype << laneInd << Postype << duration << Lanetype << flag);

Your `duration` field is introduced as type `Postype`. Maybe switching this over to `Durtype` here already fixes the problem. I did not check for others.

In general, you should be able to re-use much of the functionality of the already-implemented `TraCICommandInterface::Vehicle::stopAt` method <https://github.com/sommer/veins/blob/veins-5.0/src/veins/modules/mobility/traci/TraCICommandInterface.cc#L445>

Btw - please consider contributing this as a patch to the upstream, once it works. I am sure other people would love to have this functionality as well.

Best,

Christoph


--
Jun.-Prof. Dr.-Ing. Christoph Sommer
Cooperative Mobile Systems Group
Heinz Nixdorf Institute, Paderborn University, Germany
https://www.cms-labs.org/people/sommer/

Parishan Ismael

unread,
Apr 28, 2020, 7:14:08 AM4/28/20
to OMNeT++ Users
Thank you so much for your response. I solved the problem by setting the flag to 64 and converting the park_edge to park_ID, but the parking state of the vehicle does not change in TraCIMobility.cc. What is wrong?

Christoph Sommer

unread,
Apr 28, 2020, 7:29:38 AM4/28/20
to OMNeT++ Users Mailinglist
On 28 Apr 2020, at 13:14, Parishan Ismael <parisha...@uod.ac> wrote:
>
> the parking state of the vehicle does not change in TraCIMobility.cc. What is wrong?

I'd refer you to the SUMO mailing list for this one. My guess is that...
a) setting a vehicle to "stopped" on a parking space and
b) removing a vehicle from the running simulation because it is parking...
...is treated differently by SUMO - and only one of these will cause its state to change.

Parishan Ismael

unread,
Apr 30, 2020, 1:04:05 PM4/30/20
to OMNeT++ Users
I am referred to here by SUMO mailing list. Please i need help, I really do not know what is wrong. When I set the flags to 64 in the setParkingAreaStop command, the vehicle in the simulation stops but its parking state does not change. When I set the flags to 1, I am getting the following error:

Answered with error to command 0x00: Wrong position in requestMessage after dispatching command 0. Expected command length was 17 but 2 Bytes were read
.

Christoph Sommer

unread,
May 2, 2020, 7:48:53 AM5/2/20
to OMNeT++ Users Mailinglist
On 30 Apr 2020, at 19:04, Parishan Ismael <parisha...@uod.ac> wrote:
>
> I am referred to here by SUMO mailing list.

Of course you were. What you failed to mention in your post to the SUMO mailing list is that you neither understand SUMO's state model nor are able to write custom code for interfacing with SUMO. Rather, you claimed that SUMO must handle vehicle states incorrectly, which Jakob corrected you on. Moreover, you claimed that your use of an unmodified version of Veins results in an error. Jakob correctly pointed out that, then, the error must be in Veins.
Reply all
Reply to author
Forward
0 new messages