如何获取诸如 roadid 之类的信息,以便将其用作新字段,例如在来自 BaseWaveApplLayer.cc 的信标消息中?
最好的,巴甫洛斯
有一个类TraCICommandInterface
为此类数据提供访问方法,例如getRoadId()
.
在课程TraCIDemo11p
中,您可以找到如何获取此信息的示例。它基本上归结为执行以下步骤:
TraCIMobility* mobility = TraCIMobilityAccess().get(getParentModule());
TraCICommandInterface* traci = mobility->getCommandInterface();
TraCICommandInterface::Vehicle* traciVehicle = mobility->getVehicleCommandInterface();
traciVehicle->getRoadId();