The source code for the perception module of individual blimps in e MochiSwarm. It has two modes that is manually selectable by changing the mode
on line 1915: mode = 0
for balloon detection based on LAB color family detection, and mode = 1
for goal detection based on blob detection. Currently, the program supports Arduino NiclaVision and OpenMV RT1062. The color family data and the thresholds are tuned for the NiclaVision board.
The program perception_subsystem.py
needs to be loaded to a NiclaVision or an opened camera using OpenMV IDE. Simply open perception_subsystem.py
in the OpenMV IDE, and click the green play button to run the program on the camera board. Saving the program to flash need an additional step that is specified in the OpenMV IDE documentation. Make sure the board is running an OpenMV firmware especially for the NiclaVision. If not, when connecting the camera to the OpenMV IDE for the first time, the IDE will prompt to flash the board with the required firmware.
After loading the perceptIon_subsystem.py
to NiclaVision or OpenMV RT1062, you may see green/pink cells blinking in the image buffer (or nothing at all on top of the camera image, depending on how much the COLOR_OATA
on line 79-92 is deviated from the actual desired color under the current lighting conditions and the individual differences of the image sensor.) Setting mode = l
will give less volatile results as the goal detection enables auto white balance.
- For color family detection (
mode = 0
), follow the steps in the color training repository, and copy the color data from the terminal to the specific color of calibration to the item inCOLOR_OATA
. You need a separate python environment that is not on the OpenMV IDE to run the training script. Enable detection of the calibrated colors by adding entries to theCOLOR_TARGET
dictionary on line 117-118. - For blob detection (
mode = 1
), check the OpenMV documentation on the find_blobs function for calibrating the colors. You need to change the 6-element array on line 178-180 for your desired color to track, and specify the target on line 181.
- 4 modes instead of 2, accounting for different target colors.
- For orange goals, the blob center is tested using the LAB color family detection to eliminate the interference from the red background and other red balloons.