Suggestions on a good way to get angle?

Hey guys! we need a somewhat powerful motor than can also calculate angle, we want this motor to be able to turn all the time and for infinite rotations in either direction, (so kinda like a Mini CIM or maybe even a CIM although it can measure angle of it’s rotation [0-360degress])

I’m not good at all with this sort of stuff, as in I’m not good with parts but once I know how they work I’ll program them anytime. soooooo like is it possible to use a servo? is it turn-able over and over or how would we use some sort of encoder to calculate angle? helps please :stuck_out_tongue:

Yes and no.

Servos do come in continuous-rotation variants–that is, they just keep going to get to where you want them. The problem is, FRC rules limit the max power of a servo to far lower than you’d need for most applications. If you need a CIM or Mini-CIM, sorry, not going to work. (Actually, there ARE larger servos–but cost becomes an issue, as does size, and definitely FRC legality.)

You could try a stepper motor, but you’d have no way of knowing whether or not you actually made it to the point you want to get to.

Your best bet, given the power and continuous rotation, is a quadrature encoder, with a PID loop to slow the motor down as it gets close to a set stop point. If continuous rotation wasn’t a concern, I’d suggest a potentiometer instead.

Yeah, I understand how a PID works… WAIT THE SERVO HAS UNLIMITED AMOUNT OF ROTATIONS??? So technically, if we were to have a servo that would feed data to an input by making sure that we don’t power up the servo in anyway… we can use (in Java) the .getAngle (or whatever it was) method for measuring an angle, correct? Like I know it may not have enough power but it can work side by side with a cim. Right?

EDIT

Oh and I haven’t found any servo that does that, can you like send me a link too, if possible of one that has continuous rotations? If not I can try asking one of the builders on our team :stuck_out_tongue:

Soo… does this need to be FRC legal or cheap? If you answered no to both of those questions, I would recommend Dynamixel servos :slight_smile: If it’s for the robot (for some non-competition thing), they’ll be way more trouble than they’re worth. Just had to get that out there :slight_smile:

One step at a time:

  1. Servos have unlimited rotations IFF they are Continuous Rotation (CR) servos. Example: HITEC RCD USA. Other servos on the same site may or may not be CR, and may or may not be modifiable to be CR.

  2. Servo feeding data to an input, ugh! Servos are designed to be used as motion sources, not data sources. You could use it… but for one thing.

  3. Guess what the servo’s sensor actually is? IIRC, it’s a small encoder.

  4. A CIM would exert an awful lot of force on that servo. The linked servo is only rated at 52 RPM, 46.8 oz-in rated torque. To put this in perspective, that’s 1% of the CIM free speed and 13% of the CIM stall torque. Servo might not survive more than a little time unless the motor was removed. At which point, you have a small encoder.

So, let’s go through how to read an encoder for angle:

  1. Determine how many counts it takes to go through one 360-degree turn. Divide by 360 to get counts per degree (or divide by 2*pi for counts per radian, which the computer might like better).
  2. Get the count from the encoder as to how far it’s traveled (and in which direction) from the last stop point.
  3. You now have a number of counts, and a number of counts per angle. With a little math, you can eliminate the number of counts and come up with an angle.

Speaking as an ME, I wouldn’t want to use a servo when a sturdier encoder was available, and most likely cheaper.

OH! I get it! so basically servos are encoders + motors, they’re easier to program because half the code is already there, I can use a CIM + encoder although I’d need to become a nerder nerd and nerd out nerdy maths :stuck_out_tongue: to get the answer for the value of the angle made by the CIM and basically set a value, until angle reaches approximately point A, keep making the CIM spin in 1 direction.

Thanks so much :smiley:

Getting a motor with >1000RPM to stop exactly where you want it with 1/4 of a turn of tolerance is not impossible, albeit extremely difficult, especially with various FRC-rules related constraints.

I am guessing you want to stop the output of some gearing system within that tolerance. at that point, your rpm will be significantly slower (not the 5000RPM of a CIM) and accomplishing that task will be orders of magnitude easier, but CIMS (and bag motors, and fisher price motors) are going to be hard to control so precisely unless they have a very high reduction.

We used the AndyMark am-0914 gearmotor with an additional 3:1 (roughly) reduction (total of 213:1 +/-) and only had 1 full degree of tolerance, and we were using a jaguar and PWM. The problem is, under the large load we had, the difference between stalling and running too-many RPM is so small, PWM-wise, that you will find yourself oscillating to no avail.

While only trying to get 1/4 rotation seems easier, It can lead to failure. With a system, if I told the robot to rotate (say, an arm) 2.5 rotations, It would end up very close to 2.5. However, If I told it to rotate 0.25 rotations, 10 times, It may be likely to end up closer to 2.25 or 2.75 without high precision and accuracy.

We had that problem when our robot auto targeting tried to correct when we shot basketballs (rebound rumble). Over the course of the match, the robot’s zero (what it thinks is its starting position [actually started perfectly forward]) ended up maybe 10 degrees off. Of course, it didn’t particularly matter in that case, It just thought the goal was a little further around than it was, the camera still said it was straight on (and it was).

In a FIRST setting, you don’t have all day to run a motor at 2% power until it is perfectly spot on, you have 3 seconds before that defense bot rams you again.

Unless you have a “one direction only” requirement, that’s not how it should work.

Say you’re at an angle of 85 degrees and you want to be at 80 degrees. Wouldn’t it be better to go back 5 degrees than to go forward 355 degrees?

BTW, the C++ WPILib code does exactly that:

 *  Set the PID controller to consider the input to be continuous,
 *  Rather then using the max and min in as constraints, it considers them to
 *  be the same point and **automatically calculates the shortest route to**
 *  **the setpoint.**

As soon as I read the requirements that the OP posted, I immediately thought of the US Digital MA3. It is an absolute magnetic encoder with continuous rotation (think potentiometer with unlimited turning ability). If you hook up a CIM motor and this sensor to a PID controller, you should be able to achieve your desired behavior