Best Sensor for Unlimited Rotation Swerve

Sidebar:

Before I get started, I initially titled this post “Best Sensor for Unicorn Swerve” because I THOUGHT that the term “Unicorn Swerve” was a reference to what I thought of as the “unicorn horn” i.e. shaft that drives the wheels (via a bevel gear), that is typically used on Unlimited Rotation Swerve Modules. But a little googling made me think that folks are using “unicorn swerve” to refer to 4 wheel swerve with 4 wheel independent steering (perhaps a reference to the rarity of such a beast when the term was coined?).

I like my interpretation better but since the purpose of language is communication, I suppose I had better defer to the views of others on this subject.

Preamble:

I know it will come as a shock to folks but I have fallen in love with Swerve all over again. I first used Swerve in 1998 (Ladder Logic) and I loved it then but after a number of years using it, I came to the conclusion that it was SUCH A RESOURCE HOG (no matter how you measured it: space, current, motors, weight, engineering effort, programming effort, karma,…), that I couldn’t justify it any more. BUT… …last year’s experience using Wild Swerves from Team221.com together with the navX from Kauai Labs has me rethinking this. Our Coding Team really outdid themselves; Scorpion was one of the best behaved and easiest to drive robots I’ve been associated with. I am not sure I’m ever going back to non-swerve drives.

BUT… …of course there are improvements. We want it to take up less space, weigh less, be more robust, use less power, easier to maintain, shoot freakin’ lasers out its axles, :wink:

We’ve decided to look into using a swerve with a bevel gear drive system so that we can remote the drive motors (and perhaps add a shifter or multiple motors per wheel if the spirit moves us) and also because we think that in a game with Defense (a.k.a. the 2016 FRC game – bet on it) we will certainly want to allow the steering axis to have unlimited rotation angle.

Which finally lets me get to my actual message.

In an unlimited rotation angle world, the natural thing to do is to put a quadrature encoder (like a US Robotics or a Grayhill or some such) in the swerve drive system somewhere and pretty much call it good.

But… …I hate that idea. The main reason is that then you have to zero the count when the robot wakes up (or goes brain dead*). Yes, you can get around this with training and check lists and such but it is a long season, this decision is going to bite you in the tukhus before its over.

Here is what I would like.

  • Something that can deal with unlimited rotation (obviously)
  • Something that is 1:1 with the actual steering angle and does not require the controller to be zeroed (other than a constant programmed into the robot once and only changed if there is work on the robot – if ever).
  • Something that has a resolution of under 1 degree – preferably 1/10th a degree or better.
  • Something with as little noise as possible (To get reasonable responses, we use a lot of D Gain in our PID Loop. Noise is really tough for Deriviative Feedback loops to deal with.)
  • Something with at Digital Output if possible – for two reasons. First, we had a heck of a time with noise on the 5V supply and on the GND from the RoboRIO, so it was hard to get a noise free signal out of a lot of our sensors (like pots for example). Second we ran out of analog inputs on the RoboRIO and had to add a coprocessor just to manage the extra analog signals. Not ideal. If we can put the steering position I2C or SPI, that may make our lives better – though perhaps not because we are thinking of using the Talon SRX to do our PID loop, I don’t think the Talon SRX likes getting its sensor input via anything other than Quadrature or Analog. So, I don’t really know what I want in this department.

Anyway, I would like learn from folk with unlimited rotation swerve experience. What sensor scheme did you use and what are the pros (and cons) of those choices?

Do tell.

Dr. Joe J.

*don’t get me started about FIRST’s decision to allow the NI folks to allow the RoboRIO loose its mind at just under 7V – this is something close to criminal. Really… this was a really dumb design direction given the customer base and the intended use of the RoboRIO.

I haven’t built a swerve but your requirements for the sensor scream absolute rotary encoder to me. So for instance: <http://www.cui.com/catalog/components/encoders/absolute>

Buy at Digikey for $48.65 each
http://www.digikey.com/product-detail/en/AMT203-V/102-2050-ND/2278846

Edit: Also if the encoder is 1:1 with respect to rotation you could attach a standard rotary encoder and use the index to give you a home position. Turn each wheel left until you see the index then figure out that angle relative to forward for each wheel and reset the current angel of the wheel to that known value.

On our swerve, we use absolute encoders. They use analog instead of digital output, though.
We’ve used them on our swerve for the past two years, and have been very reliable. They only require one offset constant, and then don’t need to be calibrated again. Rotates infinitely and wraps around from 360-0.

I don’t know what the model of the encoder is specifically, but maybe I can find that out.

US Digital makes some analog absolute magnetic encoders that work great for unicorn drive (2783 used them for their implementation). Forgot the model though.

I’m assuming this is the ma3?

We’ve had good and bad experience with the AS5145B contact-less magnetic sensor (also available here) used as absolute encoders. They work well if you can guarantee the distance from the sensor to the shaft does not change, and you can embed the magnet to the end of the shaft.

You should certainly include Hall-effect rotary sensors in your investigation. They offer continuous rotation and do not drift, except at the mechanical end.

Here is a link to the sensor that we have been using on our swerves. It meets all of you requests (and probably some you haven’t encountered yet) except that it has an analog output, and you can get it for ~$10 if you shop around a little.

Have you interfaced these to the Talon SRX controllers at all?

You could also use an indexing sensor such as a hall effect. The Encoder in WPILib supports indexing out of the box as does the Talon via CAN-Position Control.

My money is on the sensor Bryce listed because I’m cheap. And also lazy and don’t like wiring extra sensors.

We used indexed encoders this year. In my opinion an encoder such as the AM103 (made by cui) where the shaft goes through the encoder are much easier to deal with because you can mount them right to the gearbox plate. However each team has their own machining advantages and disadvantages.

Overall I would say its an extremely high priority to either use indexed encoders or continuous potentiometers on a swerve steering system. Though there are totally ways around it, I feel like doing it this way makes it much easier.

my team interfaced our swerve with the SRX, using these absolute encoders… http://www.andymark.com/product-p/am-2899.htm

works like a charm

+1 On the magnetic absolute analog encoders from US Digital. We calibrate them and store an offset to zero, keeping it stateless.

4-wheel independent-steering and independent-driven drivetrain, with unlimited steering rotation of the wheels and sensors, and no gaps in the sensor feedback

I have not used the US Digital MA3 in a swerve module, but I have used it in numerous other applications and it has always worked flawlessly.

Yup. I thought that was the model but it’s been nearly five years since I worked with them and I didn’t want to provide false information.


One issue that was encountered was sensor alignment… it should be a no-brainer but one ought to make sure all the sensors are aligned the same (same 0/360 position)… on can calibrate in code and account for the 0/360 transition, sure, but it is a pain and can slow the processing down if not written well.

What makes this issue common is that the input shafts of the encoders, back then at least, had no reference mark and being continuous, there is no stop to reference to. In retrospect, the fix for this is to use a DMM to find the 0/360 point, and make a mark with a scribe on the end of the shaft and on the encoder body (or reference the first mark to a known spot on the body).

We use these too. I haven’t seen anything close to the price.

We tend to get a twitch, when trying to hold a wheel at a position that crosses from 5v - 0v. It probably could be calibrated out. We just don’t set any wheels in either drive or strafe position to this position.

I would not recommend trying anything other than absolute feedback geared one to one with the wheel.

If you read the technical documents, you will find that the voltage output is not 0v to 5v. Depending on the model, I think it’s roughly 0.1v to 4.9v. It’s very simple to fix.

Why?

I second your thought expressed in the second link above:
So says JVN. So say we all.

Now a question for you Ether, two actually.

  1. “No gaps in feedback sensor feedback” Strange wording. First of all, it is inconceivable to have swerve without feedback loops controlling the steering angle. Open Loop steering control is just not Swerve in my view. So… if I have infinite steering angles, then (for me at least) that implies sensors sufficient to provide the control loops information it needs to do its job.

Are there people in the world who would design a sensor system that would have gaps? You don’t say anything about wheels that have continuous outer surfaces – why the special attention to sensor gaps?

  1. Can I get you to agree to a new definition that replaces 4 with N (N=number of drive wheels on the robot and must be >2)? If a team has 6 drive wheels then all of them have to have independent steering and infinitely turnable. Same with 3, 5, or 57.

I am torn about 2. If they had caster or omniwheels that were not powered but the 2 that were powered were independently steered and so on… Is that “Unicorn Swerve”? I say nay. “Unipony Swerve” is the best I am going to give them.

Ether, what say you?

Dr. Joe J.