【问题标题】:Veins+SUMO Lane Change BehaviorVeins+SUMO 变道行为
【发布时间】:2019-02-05 17:19:35
【问题描述】:

我正在使用 Veins (4.7) 和 SUMO (0.32) 来模拟事故场景中的变道行为。我通过使用以下 .ini 配置成功创建了事故;

#Accident vehciles and details
*.node[0].veinsmobility.accidentCount = 1
*.node[0].veinsmobility.accidentStart = 80s
*.node[0].veinsmobility.accidentDuration = 100s

Vehicle-0 在 85 秒左右开始停止。现在我想通过使用 traci 命令将连接的车辆引导到特定车道(laneIndex);

traciVehicle->changeLane(laneIndex, 0.1);
void TraCICommandInterface::Vehicle::changeLane(uint8_t laneIndex, int32_t duration) {
    uint8_t variableId = CMD_CHANGELANE;
    uint8_t variableType = TYPE_COMPOUND;
    int32_t count = 2;
    uint8_t laneIndexT = TYPE_BYTE;
    uint8_t timeT = TYPE_INTEGER;
    int32_t time = duration*1000; //seconds to milliseconds
    uint8_t durationT = TYPE_INTEGER;
    TraCIBuffer buf = connection->query(CMD_SET_VEHICLE_VARIABLE, TraCIBuffer() << variableId << nodeId << variableType << count << laneIndexT << laneIndex << durationT << duration );
    ASSERT(buf.eof());
}

但是,车辆不会改变车道。我知道 SUMO 模拟非事故情况,因此如果目标车道上的车辆或正在接近,则不会执行换道。你知道我怎样才能绕过这种行为吗?此外,如果我使用 traci slowdown 命令创建随机性以打开足够的车道变换间隙,则不会发生事故。

欢迎提出任何建议。

问候。

【问题讨论】:

    标签: veins sumo


    【解决方案1】:

    根据 Python 的 TraCI 文档,持续时间是车辆在另一条车道上停留的时间,因此它不是执行实际变道所需的时间。

    如果真的是这种情况,您可能不会在 UI 中看到车道变化,因为您的持续时间是 0.1 秒,而 Veins 中的默认 SUMO 步长也是 0.1 秒。

    但是,此功能是在名为 Plexe 的 Veins 的队列扩展中实现的。这里通过 TraCI 车道的代码如下所示:

    void TraCICommandInterface::Vehicle::changeLane(int lane, int duration)
    {
        uint8_t commandType = TYPE_COMPOUND;
        int nParameters = 2;
        uint8_t variableId = CMD_CHANGELANE;
        TraCIBuffer buf = traci->connection.query(CMD_SET_VEHICLE_VARIABLE, TraCIBuffer() << variableId << nodeId << commandType << nParameters << static_cast<uint8_t>(TYPE_BYTE) << (uint8_t) lane << static_cast<uint8_t>(TYPE_INTEGER) << duration);
        ASSERT(buf.eof());
    }
    

    【讨论】:

    • 感谢您的回答。我会试一试,让你知道结果。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多