TalonSRX arm control with mag encoder? (Solved)

I’ve written some code for our arm here. I am getting the encoder values fine, but I’m really curious how I’m supposed to hard code values for the arm to go to. For instance, I could move the arm (manually) and get normal encoder values, but when the robot turns off the values then forget how many times it has rotated and just remembers how far off of 0 it is in the current rotation. This makes total sense to me, but I’m wondering how I’d work around this?

Depending on how many rotations the arm encoder does, the absolute function of the encoder will tell you where it is within one revolution, across reboots. Even if it’s more than one, say you had a 2:1 gearbox, you could know what side of the arm it would start on and guess.
However, assuming its multiple rotations, you can use a limit switch to zero the encoder when the robot is booted. ie run the motor in a known direction until the switch is triggered, then set the encoder to zero. That way you have a reference point at which to reset it.

There was a short discussion here:

Okay, that was something that came up yesterday. I wish there was another option but that makes sense. We’ll pursue that. Thanks a ton!

No problem.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.