Motor to work like a servo...what's the best method?

When we push a joystick button we would like a motor to spin forward 90deg, reverse direction, and stop when it returns to home.

Currently we have limit switches to reverse the direction of the motor and indicated when it is back to home position, but with the code we wrote it only operates when the button is pushed. If we take our finger of the button the motor stops and does not return home. Should we set up a State Machine?

Can we use the limit switches on the Jaguars to make this happen?

Where do we get good basic information on CAN? CAN looks interesting but we don’t understand what the advantages and uses of CAN are.

That’s the difference between a motor and a servo motor. A motor just rotates as long as power is applied. A Servo motor turns to a specific angle.

Currently we have limit switches to reverse the direction of the motor and indicated when it is back to home poisition, but with the code we wrote only operates when the button is pushed. If we take our finger of the button the motor stops and does not return home. Should we set up a State Machine?

That would be a good way to do it. Ben Zimmer has a good tutorial on that at his FRCMastery site.

Can we use the limit switches on the Jaguars to make this happen?

You could. I believe that is allowed if you are using CAN. It’s not allowed in the rules for PWM driven motor controllers.

One thing about limit switches in general, a switch is not a positive stop. I’ve replaced hundreds - if not thousands - of limit switches in industry because they were destroyed when a machine overtravelled. A switch can only tell a controller that something is at a position. If the processor gets hung up in a loop, or the motor coasts, something needs to stop the mechanical motion besides the switch until the processor catches up.

For that reason, always have a mechanical stop and always put the switch out of the path of the motion!

Where do we get good basic information on CAN? CAN looks interesting but we don’t understand what the advantages and uses of CAN are.

There were a couple good presentations on CAN bus but since my team is not using it, I don’t have the links. You’ll probably be able to find them with the search, though.