- First search for the "Enum-TrafficLightsState" in the Content Browser the USCityBlock map, then modify it to add a new Enum for an All Lights Off state.
- Then, in a few places in the Level Blueprint where this enum is used, you need to replicate the logic used for the other colors for this new enum. In one of the places, you can specify the color used for this enum as well.
- Finally, you'll need to either hard code or modify the logic in the "Simulation 3D Traffic Light Controller" block to send the new enum to Unreal during simulation.
How can I change the traffic light state in Traffic light Negotiation model to not display any colours (no state)?
3 views (last 30 days)
Show older comments
I am trying to train a detector to recongise a traffic light that is broken and doesn't display any colours, Green, Red or, Yellow. Is it possible to change the state to no state in the Traffic Light Negotiation with Unreal Engine Visualization Simulink model so I can use this model to train and test my detector?
0 Comments
Answers (1)
Nishan Nekoo
on 18 Sep 2023
Hi Meg,
Unfortunately, doing this is not a trivial process but I have been able to do it on my end.
The existing traffic light enumeration in the Level Blueprint of the US City Block Scene only has three states, 0,1, and 2 corresponding to the three states of Red, Yellow and Green respectively. You need to use the Unreal Editor to customize the scene and add a fourth enumeration where all the lights are off. Please follow all the steps closely at the link I sent you above (they are broken down into 4 different pages).
At a high level, these are the steps:
Hope this helps and please reach out if you need more help.
Nishan
5 Comments
Nishan Nekoo
on 20 Sep 2023
Hi Meg,
None of this is my area of expertise :) I am just figuring things out as I go. Unfortunately, I do not know the answer to your question about needing one video vs multiple videos. However, from a cursory search, it appears you can "Resume Training a Detector" which seems to imply that you can train it on multiple different data sets: https://www.mathworks.com/help/vision/ref/trainyolov2objectdetector.html#mw_a47a1ef1-9d20-4624-8ceb-597c96e690b6
Coming back to the Blueprint modifications, I modified the blueprint at only the places shown in my screenshots here. I did not edit any logic in the Traffic Lights Group (Blueprint Class). I have not taken the time to fully understand why this wasn't necessary to get it to work for me, but perhaps that is something you can look into. I am not saying this is the only way or best way to do this, it is simply one way that I did it.
One thing I didn't mention -- after modifying the blueprints, you need to use the Simulation 3D Scene Configuration block to switch the Scene Source to "Unreal Editor" since it is now a modified scene. Then when you press Run, wait for Simulink to enter "initialize" phase, then press play in Unreal Editor -- the video will then play in Unreal Editor. I attached a screenshot of the blank traffic lights for me.
Regarding your question is about whether it is possible to simulate one state after the other, I am sure that it is and your workflow seems reasonable to me. Again I don't know exactly how to implement it but I can tell you that it seems like a reasonable approach. However, I am not implementing any logic in the Traffic Lights Group (Blueprint Class) and I am not sure how that might affect a simulation where you want to change the traffic light colors during the simulation. I have only tried it with the color hard coded.
I do not know what you did incorrectly that led to an error, but I'd recommend taking a close look at the error and trying to understand what it is saying, and whether you can debug it yourself.
Unfortunately, I have provided all the information I have so please Accept my answer if you think this helped! If you need anything more, please reach out to support@mathworks.com.
Thanks,
Nishan
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!