CTRE Phoenix - Motion Profiling with Gyro questions (2)

Hi, I’m still in dire need of help and I still don’t really understand anything.

This is my previous post where I explain everything: https://www.chiefdelphi.com/forums/showthread.php?t=164416

However, can someone please explain:

  1. Why is only the final heading specified, and not the gyro yaw value specified every loop?

  2. How do I tune PID for a gyro?

  3. How would I specify the final heading, if it’s different for different trajectories?

  4. In the example code, they only have one master talon. In our code, we have the two front motors as masters and the two back as followers to their respective master. How would doing this auxiliary stuff change this? Would I need to specify one talon as master and the rest three as followers?

Hi Pringle,

I’d say you are raising a large and complex set of questions without much clarity as to what you have as an existing code/strategy and what types of code & design you want to achieve. Most notably the CTRE example contains many different SRX control modes, etc., but a navigation-path doesn’t seem to be a highlight of that example (I haven’t ran it).

So is it your goal to use PathFinder or a similar route navigation solution, or rather to establish your own CommandGroups with sequences of new AutoDrive(…distance…) & AutoSpin(…targetHeading…) segments?

P.S. there is code containing ‘gyro_heading’ usage within this PathFinder instruction, it might be helpful if the former.

For #1, I think it’s because the motion profile the Talon runs calculates the dynamic angle for you. It figures out the loop stuff. Not certain on that though, we’ll be trying things out this week.
For #2 you should tune the gyro with “turn to angle” commands, independent of the motion profile. If you track the error over a motion profile and have a good eye you can fine-tune it with the motion profile but try tuning it for just “turn 90*” and the like first.
For #3 I’m list.
For #4 I believe you have to use a single master Talon. I was told by our programmer that the Master adds up the left and right encoder readings to get distance, and uses the gyro for angle, to avoid making PID loops fight each other. So you probably want only a single master Talon.