Hi, I was thinking about making a program that makes our robot follow people or make it follow a laser pointer but I have no idea where to start and could use some help.
A 120 pound robot that follows people is a bad idea for safety reasons. You might be able to track a laser pointer with vision tracking. An ultrasonic range sensor could be used to measure distance to the surface reflecting the beam.
I just noticed you were FTC, not FRC. As long as the person was the closest object to the robot, an ultrasonic sensor could be used to follow that person.
In our outreach LEGO Mindstorms camps we have an activity where we use a LEGO Mindstorms Ultrasonic Sensor and we program the robot to follow a person. The general algorithm is this:
(1) If we see something within visual range, but it’s farther away than our minimum following distance, move forward.
(2) If we don’t see something, turn the robot left and right (the ultrasonic sensor is mounted in a fixed orientation on the robot) an increasing amount until we see an object.
What will happen is someone will walk in front of the robot, and the robot will follow the person. If the person turns, the robot will “lose contact” with the person, and will begin scanning for the person. Once it finds the person again, it will continue to follow the person until the person is out of the range of the sensor, and then it will re-acquire the person. Unfortunately the Ultrasonic Sensors don’t do any phase shifting of the signal so it can determine ownership of the reflected signal, so using 2 ultrasonic sensors doesn’t give you 3D vision (and thus the ability to detect if the person is veering left or right) - using 2 ultrasonic sensors just confuses your sensors.
How would I set up the code? Like I don’t know what values or functions or anything for it? I am at a mostly complete loss trying to do this.