ALEX HATTORI

View Original

Mecanum Bot Field-centric Control

I built this Mecanum robot a few months ago for fun and had it anodized in the Baby Uppercut batch, but didn’t think it was worth writing about at the time. It was controlled by an RC radio and had an arduino nano for signal mixing. Now that I’m home under quarantine, I have a lot more time to work on software upgrades for my robots, and so I decided to give this robot some time.

I bought an Adafruit sensor fusion board which uses a Bosch IC that contains a gyro, accelerometer, magnetometer, temperature sensor, and a processor on one die, and spits out Euler angles, quaternions, etc over I2C. I printed a bracket on my new SLA printer that got sandwiched between the motor and frame, and had pins to press fit into the breakout board mounting holes. I made it this way because I don’t have access to tools at home and would prefer not to damage the anodized frame.

A bit of home floor soldering later, and the IMU was all set to go.

I originally tried adding an orientation controller for the robot (so unless I used the yaw stick, the robot would maintain its angle), but because there’s no suspension on the robot, I can’t guarantee all 4 wheels are on the ground and so I basically always lose a DOF. If I control angle, then I can’t control cartesian motion as well.

So instead I did the opposite and added field-centric control (throwback to my FRC days). When the robot is powered on, it notes its orientation, and no matter what angle its at, the cartesian directions match the world frame.

In other words, no matter how the robot is oriented, forward, back, left, right on the joystick correspond to away, towards, left, right relative to the driver. I took a quick video of me spinning while controlling cartesian directions. It would be very unintuitive for me to perform this behavior manually (my cartesian stick controlling finger would have to move in consistent circles). Also, because of the lack of suspension, the robot still drifts, but it is quite easy and intuitive to correct these errors in field-centric/headless mode.