如何在静脉中插入moveToXY()方法?

时间:2018-09-06 04:51:24

标签: omnet++ veins sumo

首先,我分享我的操作和错误报告。

我的动作

1.我将以下代码添加到TraCIDemo11p.cc文件中:

 std::string edgeId ="1i";
 traciVehicle->moveToXY(edgeId, 0,mobility->getCurrentPosition().x+2,mobility->getCurrentPosition().y,mobility->getAngleRad());

2。我将以下代码添加到TraCICommandInterface.cc文件中:

void TraCICommandInterface::Vehicle::moveToXY(std::string edgeId,int32_t laneid,double x,double y,double angle){
    uint8_t variableId = CMD_MOVEXY;
    uint8_t variableType = TYPE_COMPOUND;
    int32_t count = 5;
    uint8_t edgeType = TYPE_STRING;
    uint8_t lanidType = TYPE_INTEGER;
    uint8_t postionType = TYPE_DOUBLE;
    uint8_t routeType = TYPE_BYTE;
    uint8_t route = 1;
    TraCIBuffer buf = connection->query(CMD_SET_VEHICLE_VARIABLE, TraCIBuffer() << variableId << nodeId << variableType <<
               count <<edgeType << edgeId << lanidType << laneid << postionType << x << postionType << y <<postionType <<
               angle << routeType << route );
    ASSERT(buf.eof());
}

错误报告:

然后,当我运行静脉模拟时,Traci Server出现以下错误:

  

错误:回答命令0xc4时出错:分派命令后requestMessage中的位置错误。预期的命令长度为61,但读取了59个字节。

有人可以帮助我解决此错误吗?

0 个答案:

没有答案