How can I change the veins vehicle icon color according to its function?
In the tictoc 2 example, this was possible by changing @display ("i =, cyan") from your ned file.
Add the following lines at the beginning of your application code:
#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)
Then, to set the color to green of car with number carId, add to your code the following lines:
self = getParentModule()->getIndex();
traciVehicle = mobility->getVehicleCommandInterface();
if(self==carId) traciVehicle->setColor(green);