Mecanum proto: replace cylinder wheels with physical roller hinges

Each wheel is now a hub solid + 8 passive HingeJoint rollers (capsules
tilted 45° in body xy plane at the bottom contact point) instead of
a single plain Cylinder. The rollers free-spin around their tilt axes
so the wheel exhibits mecanum X-pattern behaviour: gym-frame strafe
commands now produce body strafe in Webots, where before they
produced wrong-direction motion (the plain cylinders behaved as 4-
wheel skid-steer).

Calibration on flat field, 200 steps each:
                       gym predict      webots out         err
  vx=0.5  vy=0          1.33 m/s +x     1.19 m/s +x       10.9% +x
                        0     m/s +y    -0.10 m/s +y      ~clean
  vx=0    vy=0.5        1.33 m/s +y     0.50 m/s +y       62.1% +y
                        0     m/s +x    -0.37 m/s +x      noticeable
                                                          mecanum
                                                          coupling

Strafe is imperfect (-x bleed-through, magnitude under-shoot) but
direction is correct and the platform is now omnidirectional. Forward
motion is high-fidelity. Tilt signs assigned so diagonal pairs FL+RR
and FR+RL share the same body-frame roller orientation (the standard
X pattern). Two contact-material names "MecanumWheelA/B" are kept for
diagnostic separation; both use the same isotropic Coulomb friction
of 2.0 with forceDependentSlip 0.005.

tools/run_webots.sh ships the matching contactProperties block on
every mecanum launch (re-emitted into the temporary world copy).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Johnny Fernandes
2026-05-16 21:54:35 +00:00
parent 1c197e0ff7
commit b3cf9909a8
2 changed files with 1372 additions and 180 deletions
File diff suppressed because it is too large Load Diff
+21 -7
View File
@@ -83,21 +83,35 @@ cp "$SRC" "$DST"
if [[ "$DRIVE" == "mecanum" ]]; then
sed -i 's|"../protos/ShepherdDog.proto"|"../protos/ShepherdDogMecanum.proto"|' "$DST"
sed -i 's|^ShepherdDog {|ShepherdDogMecanum {|' "$DST"
# Inject mecanum contact properties into the contactProperties array.
# Strategy: find the closing ' ]' that ends the contactProperties block
# (it sits at 2-space indent, immediately before the WorldInfo closing brace)
# and insert just before it.
# Inject mecanum roller contact properties. The proto's rollers are
# split into two contact materials so that we can keep the friction
# axes oriented along each roller's free-spin direction — but with
# physical roller hinges (no longer plain cylinder wheels) the
# ground contact is via the capsules and standard friction works.
# Slightly bumped coulombFriction keeps the rollers gripping during
# mecanum strafing.
python3 -c "
with open('$DST', 'r') as f:
txt = f.read()
mec = ''' ContactProperties {
material1 \"MecanumWheel\"
material1 \"MecanumWheelA\"
coulombFriction [
1.0
2.0
]
bounce 0
forceDependentSlip [
0.01
0.005
]
softCFM 0.0001
}
ContactProperties {
material1 \"MecanumWheelB\"
coulombFriction [
2.0
]
bounce 0
forceDependentSlip [
0.005
]
softCFM 0.0001
}