【发布时间】:2019-09-09 11:15:54
【问题描述】:
如何根据功能改变静脉车辆图标颜色?
在 tictoc 2 示例中,这可以通过更改 ned 文件中的 @display ("i =, cyan") 来实现。
【问题讨论】:
如何根据功能改变静脉车辆图标颜色?
在 tictoc 2 示例中,这可以通过更改 ned 文件中的 @display ("i =, cyan") 来实现。
【问题讨论】:
在应用程序代码的开头添加以下行:
#define black TraCIColor(0,0,0,0)
#define red TraCIColor(255,0,0,0)
#define green TraCIColor(0,255,0,0)
#define yellow TraCIColor(255,255,0,0)
#define blue TraCIColor(0,0,255,0)
#define violet TraCIColor(255,0,255,0)
#define cyan TraCIColor(0,255,255,0)
#define white TraCIColor(255,255,255,0)
然后,要将编号为 carId 的汽车的颜色设置为绿色,请将以下行添加到您的代码中:
self = getParentModule()->getIndex();
traciVehicle = mobility->getVehicleCommandInterface();
if(self==carId) traciVehicle->setColor(green);
【讨论】:
self 未在此范围内声明 carId 是未在此范围内声明