Simulating 4 wheeled mecanum robot

Hi,

I have recently started using Unity3D on Windows for robotics. My purpose of using Unity3D is to simulate a 4 wheeled robot with mecanum wheels (Mecanum wheels have rollers angled at 45 degrees to give omnidirectional kinematics for the robot).

In order to do that, I have created game object with a main body and 4 wheels with 9 rollers on each (so in total, 36 rollers). As the wheels are in contact with the rollers, I have disabled collision for the wheels but enabled for all rollers. Also, I made each roller to have the HingeJoint as in order to get an omnidirectional kinematics, they have to freely rotate around in X axis. (Each HingeJoint is attached to its respective wheel).

All in all, I got pretty decent results and my robot was able to perform omnidrectional movements but I have two problems that I cannot figure out:

  1. Kinematics are not smooth enough. Robot cannot perform straight movement, it slighlty bends to the right when all 4 wheels are driving forward and when the wheels stop, rollers that are not in a contact with the surface are contionusly rolling and it makes “shaky” movements when the wheels are stopped completely. I thought my Inertia was wrong for a roller but it looks correct. Seems like the roller movement makes my whole robot to shake like it has a big impact.

  2. My second problem is performance. When I enter into a play mode, everything is fine and I am getting good FPS. As soon as I start moving, I get sudden increase of my Physics, animation and rendering at 15FPS or lower. I do expect them to impact the performance as I have 36 rollers but is it even normal for such sudden decrease in FPS? What can I do here? (Note, I have AMD Ryzen 3950 and Nvidia GeForce 2080TI). I am attaching two images, my Profiler screenshot (you can notice that jump at the end of my CPU usage) and roller RigidBody and HingeJoint configurations.


@abylwheelme I am interested in simulating mecanum wheeled vehicles as well and came across your post here. Is this a project that is capable of being shared?

@abylwheelme

DId you ever find some solutions for this? My guess would be to used spherical colliders, for the wheels, with nested parent null object (for pitch and roll rotation), and “fake” the visual appearance of the omni rollers.

Curious what you settled on.

A Godot user has the following input:

Mechanum and Omni wheels can be 100% FAKED by just using a “normal” wheel, where the friction on the wheel is only allowed in ONE direction. So an omniwheel can slide sideways (90 deg.) friction-less. A mechanum wheel (I think) behaves like an omniwheel turned 45 deg., so you can fake that also. (Maybe it is actually a normal wheel where friction is only allowed in an angle 45 deg. to the wheel heading) Obviously, these fake wheels should not be visible, and for everything to look real, you will have to manipulate some visual wheel geometries (not affected by physics) according to some algorithm.

This is much easier for the physics engine to deal with, and you should see nothing else than the correct behaviour - and no jitter and strange things happening.

In fact omni and mechanum wheels are just physical implementations of tires with single-direction friction. That’s all their magic.