Coding TalonSRX for Elevator

So our team is new this year, and we are having some trouble coding. We are planning to use an arm with a elevator. Our arm design makes it hard to mount limit switches, so we are opting in for Motion Magic Control Mode with our Talon SRX’s. Any ideas or example code on how to do this? Any better recommendations? If you need more information, I can provide it.

So far, we are thinking of having 3 different heights (for the rocket pods) on the elevator.

I found this manual really helpful in walking through MotionMagic:

We struggled a bit because we didn’t realize the sensor and motor were out of phase. Aside from that, that code served us well. You’ll have to manually determine the setpoints through testing.

You can check out our code for this season if you’d like.

We use CommandBased programming paradigm, here is our code for this year. That link goes to our Arm Subsystem, that is using motion magic to move around (and sometimes use arbitrary feed forward to hold against gravity) in order to do it’s thing.

See the ArmSetPositionMM command for how we use the command framework to get it done.

The best bet to simplify this for you is to use a CTRE quadrature encoder on the drive shaft for the elevator. This can be plugged directly into the Talon SRX and give you the data you need to make Motion Magic work. They are designed to work together. Our programmers love this and we’re using it on our own elevator to give it three set positions very effectively.

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