Can the quadrature encoders that we got in the KOP last year measure absolute angle of a robot very well? I was wondering what the best sensor for measuring absolute angle would be.
the best sensor for measuring angles would be a gyro
What do you mean by “absolute angle”? What is that relative to?
For measuring the angle of an arm, by all means those encoders are the best. For measuring the total rotation of the robot, a gyro coupled with the encoder inputs through a Kalman filter (or something of the sort) would be best. But it’s hard to say without understanding what it is exactly you’re trying to measure.
How do you know that would be best ?
What do you mean by “absolute angle”? What is that relative to?
He said the angle of the “robot” so I figured he was talking about the angle of the robot instead of a shaft. I think we need some clarification from him.
Multiple inputs from multiple sensors couple together should give the best possible approximation of measured phenomena, right? Therefore, following that logic, a gyro and encoder inputs (from the wheels, if that wasn’t clear) should give you a fairly good approximation of which direction you are pointed on the field. A gyro won’t care about being slammed, but won’t (I don’t think) have the stability and resolution that you could get from examining the encoder input from the wheels, which would be useless when hit and somewhat useless when skidding.
But oh, this wouldn’t work for WCDs or tank treads, only robots with omniwheels, or perhaps swerve drives (and I have absolutely no idea about mecanum). I see your point.
I guess I’ve just proved that it really depends on what you’re measuring and the nature of measured phenomena.
If by “absolute angle” you are referring to the angular position of the robot with respect to field boundaries, then the answer is that no, you cannot directly measure the robot’s angular velocity with an encoder. The quadrature encoders distributed in the KoP measure the angular velocity of a rotating shaft relative to the encoder’s mount.
In other words, because you can only use the encoder to measure the angular velocity of one object relative to another, you can’t use it to measure that of the robot relative to the field, because you can’t mount it on the field.
A better option would be to use a gyro sensor.
I’m not going to argue that you can measure directly a location on the field. I’m simply stating that by comparing the drivetrain rotation values, you can determine the total rotation of the robot, ignoring skidding and pushing. I know it’s not that simple, but it can be done, and the results may or may not be pretty. But, the OP does need to clearly state his intent of “absolute angle”.
From experience in years past, the gyro won’t drift too much to notice during the match, unless you exceed its rated value in degrees / second (I remember in 2008 the gyro in the kit was limited to something along the lines of 70 degrees / second, which was too easy to exceed).
In mission critical applications such as autonomous, 15 seconds isn’t too much and you should be absolutely fine.
By “absolute angle”, I was using the terminology that is in this document found on the FIRST website. It says “For example, the gyroscope is very good at finding rate of angular change, but poor at finding absolute angle. The accelerometer can determine absolute angle when the robot is stable, but is easily confused when the robot moves.” I understood this to mean that “absolute angle” is the actual angle that one piece is at relative to another, not the rate at which an object is turning. For example, I thought that “absolute angle” would mean the angle of the robot heading in relation to the field.
Why do you need to measure the absolute angle? A compass could work perhaps, but you would need to calibrate it on a per-field basis.
I was going to use a gyro to look at the angle of our frisbee shooter, and another to see the angle of the robot in relation to the floor. However, as I understood it, the Gyro is bad at telling what angle something is at if that thing is not moving. Was that an incorrect interpretation?
Yes.
The gyro is the most-used sensor for determining the orientation of your robot with respect to the field.
It is not perfect though. Notable drawbacks are
-
it can be knocked out of calibration if your robot is hit by another robot
-
some of the KoP units have a slow drift (the angle becomes inaccurate over time)
Both of the above can be mitigated somewhat by providing the driver with a button that re-calibrates the gyro when the driver turns the robot back to the zero position.
In this case, “absolute angle” means the tilt of the robot in relation to the floor. It can tell you when you’ve fallen over, or how steep a sloping ramp is. It can’t tell you which compass direction you are facing.
To keep track of the direction of the robot, use a yaw rate sensor (i.e. “gyro”). It’ll tell you how quickly you’re turning, and the software can integrate that information to tell you what direction you’ve turned to. The accuracy will get worse over time as the integration bias “drifts”, and you will lose accuracy if you ever turn faster than the sensor is capable of tracking. For the first fifteen seconds of a match, that should not be a great problem.
To measure the angle of a robot component, use an absolute sensor such as a potentiometer (easy, inexpensive, but prone to becoming electrically “noisy” as it wears out) or a magnetic angular sensor (easy, more expensive, durable, but possible to damage with static electricity if mishandled).
Ooh boy. Inertial sensor topic. This ought to be good…
Alan Anderson’s comment regarding accelerometers and tilt is dead on, with the aforementioned caveat that accelerometers are ‘easily confused’ - when an accelerometer attempting to measure attitude, it is actually measuring is the gravity vector. Since inertial sensors don’t have a way to tell the difference between acceleration due to gravity and acceleration due to motion, once the robot starts moving, it’s going to skew the acceleration vector off the gravity norm. They are very good for finding which way is down in a scenario with little motion - if you want to get clever, integrating gyroscopes (or, more properly, angular rate sensors) into the system with either a Kalman or an complimentary filter can give a fair approximation of which way is down in the presence of motion. But, it sounds like the bigger question is not which way is down, but what direction am I pointing. This is where the encoders coupled with gyros might help you out - again, with some form of sensor fusion, with the assumption that the gyros will drift if left to their own devices, and the difference in encoder ticks (left and right) won’t be able to capture the motion of a turn at high speeds. Efoote868 is right in that with a very carefully tuned inertial loop relying on gyros alone can give you a fair approximation for the 15 seconds of autonomous, but assuming you want a heading lock to last longer than that, either Ether’s heading reset button or locking onto a known field landmark (like a vision target) and resetting the heading angle is required. Traditional INSes knock out heading errors with magnetic field sensors (digital compasses), but there are too many stray mag fields in and around a robot to be trusted. One method I’d always wanted to try was to put two ultrasonic sensors on the side of a robot, as far apart as I could, and try to range to the wall to get an idea of angle, within reason.
Generally speaking, if you want to heading-lock your frisbee shooter (or measure the azimuth, if we’re going to be proper about this), I’d use a vision system first and foremost, and a complimentary-filtered gyro-encoder scheme for when it went out of view. If you want to know the vertical angle of the shooter (inclination), unless your robot is really strange, I’d recommend just using a potentiometer and assuming the robot is level - it’s simple, it’s direct, and it doesn’t drift. Dunno if that covers your question, but figured I’ve give my $0.02 and then some.
Sparks
I would agree with using a potentiometer for “elevation” tracking of an arm. Personally I think they are easier to program because utilizing the voltage (based on analog input) works just find to track its current “elevation”. They also use just one analog input instead of the two digital inputs if that matters at all. And from my experience, have very little interference and usually never have to be reset. From our past robots, I would encourage the potentiometer based on its performance for us so far. The only year we had trouble with it was 2011 on our telescoping arm… Many of you may have noticed due to the terrible sound it made when rotating at the state championship…