I successfully tested the computer vision code on the actual system, and it worked flawlessly. Here's a summary of the process:
Camera Calibration: Initially, I calibrated the camera to accurately track the ArUco markers. This step ensures that all subsequent operations use the calibrated frame for precise computations.
Coordinate Transformation: After camera calibration, I transformed the coordinate system to align with the calibrated frame, which is crucial for accurate tracking and positioning.
Motor Calibration: I then calibrated the motors connected to the Arduino. This involves sending commands to move Motor 0 or Motor 1 up or down until it reaches its edge limit. Upon reaching this limit, I send a 'stop' command to the Arduino, which then records this position as the maximum or minimum boundary. The motors are prevented from moving beyond these set limits.
Boundary Definition: Once all four corners have their boundaries saved, the system is ready to track the ball's coordinates.
Ball Tracking and Motor Control: Based on the ball's position, I send commands to each motor to adjust its position to hit the ball effectively.
Goal Detection System: In parallel, I implemented a system to detect goals. If the ball is close enough to a paddle and then disappears from view for three consecutive frames, the system sends a 'goal 0' or 'goal 1' signal to the Arduino.
This entire setup performed perfectly during my tests.
I successfully tested the computer vision code on the actual system, and it worked flawlessly. Here's a summary of the process:
Camera Calibration: Initially, I calibrated the camera to accurately track the ArUco markers. This step ensures that all subsequent operations use the calibrated frame for precise computations.
Coordinate Transformation: After camera calibration, I transformed the coordinate system to align with the calibrated frame, which is crucial for accurate tracking and positioning.
Motor Calibration: I then calibrated the motors connected to the Arduino. This involves sending commands to move Motor 0 or Motor 1 up or down until it reaches its edge limit. Upon reaching this limit, I send a 'stop' command to the Arduino, which then records this position as the maximum or minimum boundary. The motors are prevented from moving beyond these set limits.
Boundary Definition: Once all four corners have their boundaries saved, the system is ready to track the ball's coordinates.
Ball Tracking and Motor Control: Based on the ball's position, I send commands to each motor to adjust its position to hit the ball effectively.
Goal Detection System: In parallel, I implemented a system to detect goals. If the ball is close enough to a paddle and then disappears from view for three consecutive frames, the system sends a 'goal 0' or 'goal 1' signal to the Arduino.
This entire setup performed perfectly during my tests.