【发布时间】: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 命令创建随机性以打开足够的车道变换间隙,则不会发生事故。
欢迎提出任何建议。
问候。
【问题讨论】: