Hello Chief Delphi, we were doing some testing yesterday and getting some unexpected results so I was hoping to see if anyone has done what we’re trying to do, or understands TalonSRX complicated things better than we do.
We have implemented MotionMagic in the Command-Based framework successfully. We have tuned our kp, ki, kd, and kf and all that good stuff. Everything works, the DriveMotionMagic command drives the distance accurately to within small fractions of an inch…with one giant caveat. It doesn’t do it perfectly straight like we’d like.
Our robot is a west coast drive with 4 cims into a ball shifting gear box.
My thought was that we could use the auxiliary pid with the difference in the encoders to correct the crookedness, but either A) it doesn’t work the way we thought it might, or B) it does work and we did it wrong.
Unfortunately, we forgot to push the code to github so I don’t have access to it, but we basically just tried to convert the CTRE auxiliary pid example to our command based project.
What we tried to do was the following:
// Configure the talons for normal driving, setup the leader/follow for each side
// of the drive train, set the encoder and motor phase, etc.
// Configure the talons kf,p,i,d for MotionMagic driving straight
// Configure the talons for remote sensors and the difference etc
left_talon.follow(right_talon, FollowerType.AuxOutput1);
Then, when it's time to drive we did:
// This feels wrong, and wasn't working
left_talon.set(ControlMode.MotionMagic, setpoint);
right_talon.set(ControlMode.MotionMagic, setpoint);
So basically, what I was wondering is am I spiritually correct in that this can be done the way I think it can be done?
Secondly, if I set the left_talon to follow the right_talon for MotionMagic, how do I set it to unfollow? I couldn’t find any API that seemed to reset that. Any other advice you guys have would be great as we are competing in week 1 and need to get this 100% very soon.