Monster Self Drive - coloured track is black
Forums:
Dear,
We have a question about the Monsterborg track in "monster-self-drive" mode.
The code for course recognition is made for colored tracks (red, blue, green) but is not made to drive the monsterborg on a black track.
We made several attempts to modify the code in the file "monster-self-drive/Settings.py" by changing values of MinHuntColor and MaxHuntColor so that the camera can recognize the black color of the course, but we did not succeed.
Can you show us how to adapt the code to make monsterborg self-drive
on a black course?
Thanks.
piborg
Wed, 08/26/2020 - 12:57
Permalink
MonsterBorg Self-drive with a black track
Black is probably the hardest colour to tune for as shadows may also appear black to the camera.
The first thing to do is setup any lighting you will have on the track. The brightness and colour of your lighting may affect the detection. Sunlight should be fine as long as it is bright enough for the camera :)
Now you will need the script setup to show what it is detecting like this:
As the track is black the highlighting may not be very visible, so you may need to toggle
overlayOriginal
betweenTrue
andFalse
to get a clearer view:As you are looking for black you want the minimum to be 0 for all channels:
Black will hopefully show as close to "grey", so I would start with all three values the same:
If too much of the image is highlighted reduce all three values together. If too little of the image is highlighted increase all three.
When the area is roughly right I would make a note of the level and then try tweaking individual levels. You are not after a perfect match, just a rough one.
When the image looks good try placing the MonsterBorg in different positions on the track and check it is still okay.
Once it all looks good set
currentSpeed
nice and low (say0.4
) and let the script try and follow the track. If it works you can raise the speed :)