Set NEO Motor to turn 90 degrees in Rev Hardware Client?

This is our first year using NEO motors hooked up to the CANSparkMax. I want one NEO motor to be able to turn only 90 degrees, and then to be able to spin back to it’s starting position. Is there a way to do this with REV Hardware Client? I just need to know if this is possible and I can look into messing with the software tomorrow. Also, if this is possible, will the settings that I set the motor to with the software carry over to my code?

So, if I am able to set the motor to only turn 90 degrees, and in my java code I set an xbox controller trigger to move that motor, will that motor spin to 90 degrees and then stop, or do I have to set up code to be able to do that despite the fact that I used the REV Hardware Client? Sorry if this question is confusing.

Hiii!!

So I haven’t used a lot the rev software client but as far is I know, no you can’t do that. But if you want to do it easily you can do it on your code using a PID controller and just use a conversion factor that turns your encoder value to degrees.

If you’re not so much into PID controllers or don’t know how to do it, just let me know and I’ll get deeper in the explanation so you get what you want.

Have a nice night!!

Sounds like you really want to use the NEO as a servo (hey - that rhymes).

In the past, I’ve used some big gear driven servos sort of like this:

It’s not the same as I’ve got on hand but it’s the same concept. Controllable via PWM just like the little RC servos but much more powerful.

You could control that from your software just like any other servo and move it by specific angular amounts or move it to an absolute angular position.

Using a DC motor, regardless of brushed or not, and trying to do what it seems you are trying to do with any accuracy is probably going to be a tough road. You need to move slow enough to not to seriously overshoot your target which means you’ll have very little mechanical force. Even motor friction will be a challenge not including any friction from your mechanism.

sounds like you want a soft limit on your motor. (a servo would def work but if that isn’t powerful enough soft limits will do)**

motor.setSoftLimit(SoftLimitDirection.kForward, limit in rots (90 deg is 0.25));
motor.enableSoftLimit(SoftLimitDirection.kForward, true);

you can set a reverse limit by changing the SoftLimitDirection.kForward to SoftLimitDirection.kReverse

as for returning to center, you could set a default command to go to 0 so that if there is no input it will automatically go back to 0

** soft limits will only be consistant if your motor starts in the same position every time you boot the robot because of the fact that the built in encoder that the soft limits use is relative

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