View Single Post
  #6   Spotlight this post!  
Unread 11-02-2016, 17:19
mmaunu's Avatar
mmaunu mmaunu is offline
Registered User
FRC #2485 (W.A.R. Lords)
Team Role: Mentor
 
Join Date: Mar 2013
Rookie Year: 2010
Location: San Diego, CA
Posts: 87
mmaunu is a jewel in the roughmmaunu is a jewel in the roughmmaunu is a jewel in the roughmmaunu is a jewel in the rough
Re: DriveTrain TankDrive Control

Quote:
Originally Posted by Kevin Zhang View Post
2) Just use the inherent PID objects inside the Talons
Problems
-When a setpoint is set through position, the drivetrain moves in the opposite direction that it should(If we set the talon to setpoint 256 ticks the drivetrain starts at 0 and goes backward so the encoder reads negative and never reads 256.
-When the setpoint is flipped(-256), the drivetrain also flips and starts reading positive.
It sounds like your encoder is "out of phase" with your motors. With a CANTalon object, you can use the reverseSensor() method, which will change the sign of the sensors output, but only if the sensor is plugged into the Talon itself. If it isn't plugged into the encoder, try switching the wiring; specifically, switch the A and B channels. If that doesn't help, you could write a wrapper class that reports the opposite of the encoder's actual value when pidGet() is called on it.

I would recommend going with pblankenbaker's suggestions. If you have an encoder that easily plugs directly into the Talon, go with the "enhanced" version; otherwise, go with the other.
__________________
2014 Las Vegas (Winners with 987, 2478; Excellence in Engineering)
2014 San Diego (Finalists with 987, 3250; Quality Award)
2013 Inland Empire (Winners with 1538, 968; Excellence in Engineering Award)
2013 San Diego (Finalists with 2984, 4322; Creativity Award)
2012 Las Vegas (Finalists with 2034, 3187; Quality Award)
Reply With Quote