I want to go to the target position with Drive, what should I do?
You’re gonna need to give more information.
Do you want to simply drive forward, or follow a path?
Completely agree with @Dan_Katzuv, more information is certainly required.
However given you’ve tagged the thread with
java, you can command a TalonSRX to move the attached motor to a setpoint (
position in the below example) based on feedback with
However this assumes that all you want to do is move the motor to that position (as opposed to path following, etc) and that you’ve already setup PID coefficients and a bunch of other stuff.
Again, more info please!
I suggest using the Motion Magic mode instead.
I would highly recommend (with Dan) that you go with MotionMagic on the Talon. It’s got some decent documentation backing how to get it setup and is extremely reliable in getting a robot to drive a certain distance, or to turn to a certain angle.
If you need some example code of that being used in a Command-based robot let me know and I’ll point you to our code from last year that had it working very smoothly.
I want to go straight for a certain distance.
The robot uses to two Talon SRX,two Victor, four motors and eight tires.
Talon also sends instructions from Roborio to one Talon and has one Victor follow Talon.