As explained in my previous project, MARK is a robot designed for learning about robotics and AI. It comes loaded with several object detection models, and I made a small project using the number recognition.
The robot comes with several cards for the model recognition, but I didn't have all the numbers I wanted (1 to 5), so I had to create some small cards for him to recognise, and he managed to recognise the handwritten card pretty well
Once again, I used the graphical IDE for this project, as it is quite complete and easy to use.
The program itself consists of two steps: finding the next number, and going toward it, repeating until it finds the last one.
The last number found is stored in the currentDetected variable, that we initialize at 0. The program ends when we find and get to the 5.
The camera is mounted on two servomotors, which gives it the ability to scan a large area on the sides and in front of the robot.
We set the vertical orientation to 70° so that it looks at the floor in front of the robot, and then go gradually from left to right with 10° steps, waiting 1 second between each step. I chose that time so that I could easily follow what MARK is doing when watchig him, but shorter steps works perfectly well too.
That part actually proved a bit tricky as MARK doesn't have coding wheels or such for it's enslavement, so I had to use time for that, which isn't an ideal thing, but it worked pretty well.
The first thing to do after having found the number is to face it. For that, I determined that moving the horizontal servomotor 5°/100ms allowed the camera to face a somewhat constant direction when making the robot turn in the opposite direction. We do this until the camera is looking in front of the robot, so until the robot is facing the number
Once we face the number we want to go to, all that's left is to go toward it. the easiest way to do that was to go in a straight line and use the ultrasonic sensor to detect when we get close to it, which is done as follow:
This second easy project with MARK showed that his model for number recognition works well, even with handwritten numbers, and we used a bit more of its capabilities. I originally wanted to give it a target to shoot with the rubber band slingshot at the end of the path, but realized too late that I didn't have rubber bands, so... this will be for the next time !