Quote:
Originally Posted by Canon reeves
Ok, I knew it would involve a lot of sensors, but I could also see a pre programmed autonomous being optimized quicker than a driver could.
|
I guess you *could* attempt it without any sort of feedback, but it wouldn't be accurate or precise.
You would have to record the the values being sent to the Talon/Jag/Victor (I.E. what value the motor.Set() command is recieving), and for how long each motor is receiving that command, then have your code emulate that exactly.
But the problem with doing that without feedback, is if I tell both my drive motors: motor1.set(1) and motor2.set(1) then wait for 1 second before telling them to stop, it will go a different distance every single time. There are a lot of factors that affect how fast/far the wheels will turn...the friction in the wheels, if the wheels are slipping, battery voltage, weight, phase of the moon, what you ate for breakfast...
That's why you need feedback, usually in the form of encoders and a gyro, to tell you how far you have actually gone. (And it might be a good idea to have non-powered follower wheels with encoders attached to them, rather than encoders on the driven wheels. If the driven wheels are slipping (turning but not actually driving the robot), your code will think it has gone farther than it actually has.)
If you want proof of that, write this simple autonomous.
lMotor.Set(1);
rMotor.Set(1);
Wait(2);
lMotor.Set(0);
rMotor.Set(0);
That should drive the robot "straight" for 2 seconds, then stop. (Of course, you might need to make one of those a negative value). Record how far the robot goes, and at what approximate angle. Now do that 5 times.
I'm sure each time will be a slightly different amount.
Now put in a freshly charged battery, and do it 5 times.
You now have 10 different results!