I am trying to simulate an overtaking scenario by editing the existing highway_overtaking.wbt in Webots to observe the indicator lights turn on/off before switching lanes. How do I use the Driver library to do so?
In the modified scenario I currently have just 3 cars in the middle lane, with the grey Lincoln car in between the other 2 cars. I used the setIndicator() function to set the Indicator lights (as shown in code snippet below) But I do not observe any change when the Lincoln car is overtaking the car in front.
Following is the modified snippet of code from the highway_overtaking.py file
if (is_vehicle_on_side("left") and
(not safeOvertake or sensors["rear left"].getValue() > 0.8 * sensors["rear left"].getMaxValue()) and
sensors["left"].getValue() > 0.8 * sensors["left"].getMaxValue() and
currentLane < 2):
driver.setIndicator(1)
currentLane += 1
overtakingSide = 'right'
lane_change = True
elif (is_vehicle_on_side("right") and
(not safeOvertake or sensors["rear right"].getValue() > 0.8 * sensors["rear right"].getMaxValue()) and
sensors["right"].getValue() > 0.8 * sensors["right"].getMaxValue() and
currentLane > 0):
driver.setIndicator(2)
currentLane -= 1
overtakingSide = 'left'
lane_change = True
I read the value of the indicator using getIndicator() function and observed that the Indicator value was changed from 0 to 1 when I set it to 1. But I do not observe the Indicator lights changing color on the window. Please help!