So up until this year, our team has either used Victor SPs or used TalonSRXs for no more than passing them into a Differential Drive arcade drive. I spent the summer and most of the pre-season reading up on the talons and everything they can do and was super excited to jump into using them to their full ability (rip auton ). I have struggled all of this week, however, to wrap my head around motion magic. Our end goal is to use motion magic to drive forward using the mag encoders we’ve attached to the talons. We’ve double and triple checked all of the encoders and talons to make sure they are working as expected. I have read and re-read the Phoenix docs and even created a plain project with the motion magic example code, but I cannot seem to get it to work. As it is, my code does not move the robot. If I change where I call driveToDistance() to initialize() to only run once, the drive train starts and just keeps moving without stopping. I mainly have a couple of questions:
- Should this code (assuming all phases are correct) drive forward 10 rotations and then stop?
- If not, is motion magic supposed to stop the drive train on its own? Or am I supposed to be checking getErrorDerivative() == 0 to stop the drive train (as it is right now, the command never ends…I figure I’ll have to use it to end that, but do I have to tell the drive train to stop with that too?).
- Is set() for motion magic supposed to be called continuously or only once? The way I’m thinking of it is I tell it what it needs to go to and then it should just go to that…therefore it should only be called once. In the example code, however, it is called continuously.
- (And final, sorry for the ultra long post) What are the counts that I pass into set() in respect to? By putting in 4096, am I saying go 4096 counts forward, or go forward or backward until I get to 4096 counts. Or, I’m thinking of this as I’m writing this, does that depend on whether I have the feedback device set relative vs. positive?
I’d really love to understand this more I realize it is well documented, but I am not fully understanding the documentation