From b3cf9909a8fe2261f22540a8d961ec69b7c94ea6 Mon Sep 17 00:00:00 2001 From: Johnny Fernandes Date: Sat, 16 May 2026 21:54:35 +0000 Subject: [PATCH] Mecanum proto: replace cylinder wheels with physical roller hinges MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- protos/ShepherdDogMecanum.proto | 1524 +++++++++++++++++++++++++++---- tools/run_webots.sh | 28 +- 2 files changed, 1372 insertions(+), 180 deletions(-) diff --git a/protos/ShepherdDogMecanum.proto b/protos/ShepherdDogMecanum.proto index dd3ead6..6ada0a5 100644 --- a/protos/ShepherdDogMecanum.proto +++ b/protos/ShepherdDogMecanum.proto @@ -478,10 +478,10 @@ PROTO ShepherdDogMecanum [ translation 0.14 -0.14 0.038 rotation 0 -1 0 1.570796 children [ - DEF WHEEL_VIS Pose { + # Visual hub only — the rollers below provide ground contact. + Pose { rotation 1 0 0 -1.5708 children [ - # Hub drum Shape { appearance PBRAppearance { baseColor 0.5 0.5 0.5 @@ -490,11 +490,10 @@ PROTO ShepherdDogMecanum [ } geometry Cylinder { height 0.018 - radius 0.022 + radius 0.018000000000000002 subdivision 16 } } - # Axle boss Shape { appearance PBRAppearance { baseColor 0.6 0.6 0.6 @@ -507,175 +506,334 @@ PROTO ShepherdDogMecanum [ subdivision 8 } } - # Mecanum roller 1 (top, +y) - DEF ROLLER_1 Pose { - translation 0 0.031 0 - rotation 0 0 1 0.7854 - children [ - Shape { - appearance PBRAppearance { - baseColor 0.12 0.12 0.12 - roughness 0.7 - metalness 0.1 - } - geometry Capsule { - height 0.020 - radius 0.007 - subdivision 8 - } - } - ] - } - # Mecanum roller 2 (right, +x) - DEF ROLLER_2 Pose { - translation 0.031 0 0 - rotation 0 0 1 0.7854 - children [ - Shape { - appearance PBRAppearance { - baseColor 0.12 0.12 0.12 - roughness 0.7 - metalness 0.1 - } - geometry Capsule { - height 0.020 - radius 0.007 - subdivision 8 - } - } - ] - } - # Mecanum roller 3 (bottom, -y) - DEF ROLLER_3 Pose { - translation 0 -0.031 0 - rotation 0 0 1 0.7854 - children [ - Shape { - appearance PBRAppearance { - baseColor 0.12 0.12 0.12 - roughness 0.7 - metalness 0.1 - } - geometry Capsule { - height 0.020 - radius 0.007 - subdivision 8 - } - } - ] - } - # Mecanum roller 4 (left, -x) - DEF ROLLER_4 Pose { - translation -0.031 0 0 - rotation 0 0 1 0.7854 - children [ - Shape { - appearance PBRAppearance { - baseColor 0.12 0.12 0.12 - roughness 0.7 - metalness 0.1 - } - geometry Capsule { - height 0.020 - radius 0.007 - subdivision 8 - } - } - ] - } - # Mecanum roller 5 (diagonal +x+y) - DEF ROLLER_5 Pose { - translation 0.022 0.022 0 - rotation 0 0 1 0.7854 - children [ - Shape { - appearance PBRAppearance { - baseColor 0.12 0.12 0.12 - roughness 0.7 - metalness 0.1 - } - geometry Capsule { - height 0.020 - radius 0.007 - subdivision 8 - } - } - ] - } - # Mecanum roller 6 (diagonal +x-y) - DEF ROLLER_6 Pose { - translation 0.022 -0.022 0 - rotation 0 0 1 0.7854 - children [ - Shape { - appearance PBRAppearance { - baseColor 0.12 0.12 0.12 - roughness 0.7 - metalness 0.1 - } - geometry Capsule { - height 0.020 - radius 0.007 - subdivision 8 - } - } - ] - } - # Mecanum roller 7 (diagonal -x-y) - DEF ROLLER_7 Pose { - translation -0.022 -0.022 0 - rotation 0 0 1 0.7854 - children [ - Shape { - appearance PBRAppearance { - baseColor 0.12 0.12 0.12 - roughness 0.7 - metalness 0.1 - } - geometry Capsule { - height 0.020 - radius 0.007 - subdivision 8 - } - } - ] - } - # Mecanum roller 8 (diagonal -x+y) - DEF ROLLER_8 Pose { - translation -0.022 0.022 0 - rotation 0 0 1 0.7854 - children [ - Shape { - appearance PBRAppearance { - baseColor 0.12 0.12 0.12 - roughness 0.7 - metalness 0.1 - } - geometry Capsule { - height 0.020 - radius 0.007 - subdivision 8 - } - } - ] - } ] } + # Mecanum roller 1 (θ=0°) + HingeJoint { + jointParameters HingeJointParameters { + axis 0.707107 0.707107 0.000000 + anchor 0.000000 0.000000 -0.031000 + } + endPoint Solid { + translation 0.000000 0.000000 -0.031000 + rotation 0.000000 0.000000 -1.000000 0.785398 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "front right roller 1" + contactMaterial "MecanumWheelA" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 2 (θ=45°) + HingeJoint { + jointParameters HingeJointParameters { + axis 0.500000 0.707107 0.500000 + anchor 0.021920 0.000000 -0.021920 + } + endPoint Solid { + translation 0.021920 0.000000 -0.021920 + rotation 0.707107 0.000000 -0.707107 0.785398 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "front right roller 2" + contactMaterial "MecanumWheelA" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 3 (θ=90°) + HingeJoint { + jointParameters HingeJointParameters { + axis 0.000000 0.707107 0.707107 + anchor 0.031000 0.000000 -0.000000 + } + endPoint Solid { + translation 0.031000 0.000000 -0.000000 + rotation 1.000000 0.000000 -0.000000 0.785398 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "front right roller 3" + contactMaterial "MecanumWheelA" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 4 (θ=135°) + HingeJoint { + jointParameters HingeJointParameters { + axis -0.500000 0.707107 0.500000 + anchor 0.021920 0.000000 0.021920 + } + endPoint Solid { + translation 0.021920 0.000000 0.021920 + rotation 0.707107 0.000000 0.707107 0.785398 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "front right roller 4" + contactMaterial "MecanumWheelA" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 5 (θ=180°) + HingeJoint { + jointParameters HingeJointParameters { + axis -0.707107 0.707107 0.000000 + anchor 0.000000 0.000000 0.031000 + } + endPoint Solid { + translation 0.000000 0.000000 0.031000 + rotation 0.000000 0.000000 1.000000 0.785398 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "front right roller 5" + contactMaterial "MecanumWheelA" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 6 (θ=225°) + HingeJoint { + jointParameters HingeJointParameters { + axis -0.500000 0.707107 -0.500000 + anchor -0.021920 0.000000 0.021920 + } + endPoint Solid { + translation -0.021920 0.000000 0.021920 + rotation -0.707107 0.000000 0.707107 0.785398 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "front right roller 6" + contactMaterial "MecanumWheelA" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 7 (θ=270°) + HingeJoint { + jointParameters HingeJointParameters { + axis -0.000000 0.707107 -0.707107 + anchor -0.031000 0.000000 0.000000 + } + endPoint Solid { + translation -0.031000 0.000000 0.000000 + rotation -1.000000 0.000000 0.000000 0.785398 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "front right roller 7" + contactMaterial "MecanumWheelA" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 8 (θ=315°) + HingeJoint { + jointParameters HingeJointParameters { + axis 0.500000 0.707107 -0.500000 + anchor -0.021920 0.000000 -0.021920 + } + endPoint Solid { + translation -0.021920 0.000000 -0.021920 + rotation -0.707107 0.000000 -0.707107 0.785398 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "front right roller 8" + contactMaterial "MecanumWheelA" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } ] name "front right wheel" - contactMaterial "MecanumWheel" boundingObject Pose { rotation 1 0 0 -1.5708 children [ Cylinder { height 0.022 - radius 0.038 + radius 0.02 } ] } physics Physics { density -1 - mass 0.06 + mass 0.045 centerOfMass [ 0 0 0 ] @@ -702,24 +860,364 @@ PROTO ShepherdDogMecanum [ ] endPoint Solid { translation 0.14 0.14 0.038 - rotation 0.707105 0 0.707109 -3.14159 + rotation 0 -1 0 1.570796 children [ - USE WHEEL_VIS + # Visual hub only — the rollers below provide ground contact. + Pose { + rotation 1 0 0 -1.5708 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.5 0.5 0.5 + roughness 0.3 + metalness 0.7 + } + geometry Cylinder { + height 0.018 + radius 0.018000000000000002 + subdivision 16 + } + } + Shape { + appearance PBRAppearance { + baseColor 0.6 0.6 0.6 + roughness 0.2 + metalness 0.8 + } + geometry Cylinder { + height 0.022 + radius 0.008 + subdivision 8 + } + } + ] + } + # Mecanum roller 1 (θ=0°) + HingeJoint { + jointParameters HingeJointParameters { + axis 0.707107 -0.707107 0.000000 + anchor 0.000000 0.000000 -0.031000 + } + endPoint Solid { + translation 0.000000 0.000000 -0.031000 + rotation 0.000000 0.000000 -1.000000 2.356194 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "front left roller 1" + contactMaterial "MecanumWheelB" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 2 (θ=45°) + HingeJoint { + jointParameters HingeJointParameters { + axis 0.500000 -0.707107 0.500000 + anchor 0.021920 0.000000 -0.021920 + } + endPoint Solid { + translation 0.021920 0.000000 -0.021920 + rotation 0.707107 0.000000 -0.707107 2.356194 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "front left roller 2" + contactMaterial "MecanumWheelB" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 3 (θ=90°) + HingeJoint { + jointParameters HingeJointParameters { + axis 0.000000 -0.707107 0.707107 + anchor 0.031000 0.000000 -0.000000 + } + endPoint Solid { + translation 0.031000 0.000000 -0.000000 + rotation 1.000000 0.000000 -0.000000 2.356194 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "front left roller 3" + contactMaterial "MecanumWheelB" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 4 (θ=135°) + HingeJoint { + jointParameters HingeJointParameters { + axis -0.500000 -0.707107 0.500000 + anchor 0.021920 0.000000 0.021920 + } + endPoint Solid { + translation 0.021920 0.000000 0.021920 + rotation 0.707107 0.000000 0.707107 2.356194 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "front left roller 4" + contactMaterial "MecanumWheelB" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 5 (θ=180°) + HingeJoint { + jointParameters HingeJointParameters { + axis -0.707107 -0.707107 0.000000 + anchor 0.000000 0.000000 0.031000 + } + endPoint Solid { + translation 0.000000 0.000000 0.031000 + rotation 0.000000 0.000000 1.000000 2.356194 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "front left roller 5" + contactMaterial "MecanumWheelB" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 6 (θ=225°) + HingeJoint { + jointParameters HingeJointParameters { + axis -0.500000 -0.707107 -0.500000 + anchor -0.021920 0.000000 0.021920 + } + endPoint Solid { + translation -0.021920 0.000000 0.021920 + rotation -0.707107 0.000000 0.707107 2.356194 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "front left roller 6" + contactMaterial "MecanumWheelB" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 7 (θ=270°) + HingeJoint { + jointParameters HingeJointParameters { + axis -0.000000 -0.707107 -0.707107 + anchor -0.031000 0.000000 0.000000 + } + endPoint Solid { + translation -0.031000 0.000000 0.000000 + rotation -1.000000 0.000000 0.000000 2.356194 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "front left roller 7" + contactMaterial "MecanumWheelB" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 8 (θ=315°) + HingeJoint { + jointParameters HingeJointParameters { + axis 0.500000 -0.707107 -0.500000 + anchor -0.021920 0.000000 -0.021920 + } + endPoint Solid { + translation -0.021920 0.000000 -0.021920 + rotation -0.707107 0.000000 -0.707107 2.356194 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "front left roller 8" + contactMaterial "MecanumWheelB" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } ] name "front left wheel" - contactMaterial "MecanumWheel" boundingObject Pose { rotation 1 0 0 -1.5708 children [ Cylinder { height 0.022 - radius 0.038 + radius 0.02 } ] } physics Physics { density -1 - mass 0.06 + mass 0.045 centerOfMass [ 0 0 0 ] @@ -748,22 +1246,362 @@ PROTO ShepherdDogMecanum [ translation -0.14 -0.14 0.038 rotation 0 -1 0 1.570796 children [ - USE WHEEL_VIS + # Visual hub only — the rollers below provide ground contact. + Pose { + rotation 1 0 0 -1.5708 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.5 0.5 0.5 + roughness 0.3 + metalness 0.7 + } + geometry Cylinder { + height 0.018 + radius 0.018000000000000002 + subdivision 16 + } + } + Shape { + appearance PBRAppearance { + baseColor 0.6 0.6 0.6 + roughness 0.2 + metalness 0.8 + } + geometry Cylinder { + height 0.022 + radius 0.008 + subdivision 8 + } + } + ] + } + # Mecanum roller 1 (θ=0°) + HingeJoint { + jointParameters HingeJointParameters { + axis 0.707107 -0.707107 0.000000 + anchor 0.000000 0.000000 -0.031000 + } + endPoint Solid { + translation 0.000000 0.000000 -0.031000 + rotation 0.000000 0.000000 -1.000000 2.356194 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "rear right roller 1" + contactMaterial "MecanumWheelB" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 2 (θ=45°) + HingeJoint { + jointParameters HingeJointParameters { + axis 0.500000 -0.707107 0.500000 + anchor 0.021920 0.000000 -0.021920 + } + endPoint Solid { + translation 0.021920 0.000000 -0.021920 + rotation 0.707107 0.000000 -0.707107 2.356194 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "rear right roller 2" + contactMaterial "MecanumWheelB" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 3 (θ=90°) + HingeJoint { + jointParameters HingeJointParameters { + axis 0.000000 -0.707107 0.707107 + anchor 0.031000 0.000000 -0.000000 + } + endPoint Solid { + translation 0.031000 0.000000 -0.000000 + rotation 1.000000 0.000000 -0.000000 2.356194 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "rear right roller 3" + contactMaterial "MecanumWheelB" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 4 (θ=135°) + HingeJoint { + jointParameters HingeJointParameters { + axis -0.500000 -0.707107 0.500000 + anchor 0.021920 0.000000 0.021920 + } + endPoint Solid { + translation 0.021920 0.000000 0.021920 + rotation 0.707107 0.000000 0.707107 2.356194 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "rear right roller 4" + contactMaterial "MecanumWheelB" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 5 (θ=180°) + HingeJoint { + jointParameters HingeJointParameters { + axis -0.707107 -0.707107 0.000000 + anchor 0.000000 0.000000 0.031000 + } + endPoint Solid { + translation 0.000000 0.000000 0.031000 + rotation 0.000000 0.000000 1.000000 2.356194 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "rear right roller 5" + contactMaterial "MecanumWheelB" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 6 (θ=225°) + HingeJoint { + jointParameters HingeJointParameters { + axis -0.500000 -0.707107 -0.500000 + anchor -0.021920 0.000000 0.021920 + } + endPoint Solid { + translation -0.021920 0.000000 0.021920 + rotation -0.707107 0.000000 0.707107 2.356194 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "rear right roller 6" + contactMaterial "MecanumWheelB" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 7 (θ=270°) + HingeJoint { + jointParameters HingeJointParameters { + axis -0.000000 -0.707107 -0.707107 + anchor -0.031000 0.000000 0.000000 + } + endPoint Solid { + translation -0.031000 0.000000 0.000000 + rotation -1.000000 0.000000 0.000000 2.356194 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "rear right roller 7" + contactMaterial "MecanumWheelB" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 8 (θ=315°) + HingeJoint { + jointParameters HingeJointParameters { + axis 0.500000 -0.707107 -0.500000 + anchor -0.021920 0.000000 -0.021920 + } + endPoint Solid { + translation -0.021920 0.000000 -0.021920 + rotation -0.707107 0.000000 -0.707107 2.356194 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "rear right roller 8" + contactMaterial "MecanumWheelB" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } ] name "rear right wheel" - contactMaterial "MecanumWheel" boundingObject Pose { rotation 1 0 0 -1.5708 children [ Cylinder { height 0.022 - radius 0.038 + radius 0.02 } ] } physics Physics { density -1 - mass 0.06 + mass 0.045 centerOfMass [ 0 0 0 ] @@ -790,24 +1628,364 @@ PROTO ShepherdDogMecanum [ ] endPoint Solid { translation -0.14 0.14 0.038 - rotation 0.707105 0 0.707109 -3.14159 + rotation 0 -1 0 1.570796 children [ - USE WHEEL_VIS + # Visual hub only — the rollers below provide ground contact. + Pose { + rotation 1 0 0 -1.5708 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.5 0.5 0.5 + roughness 0.3 + metalness 0.7 + } + geometry Cylinder { + height 0.018 + radius 0.018000000000000002 + subdivision 16 + } + } + Shape { + appearance PBRAppearance { + baseColor 0.6 0.6 0.6 + roughness 0.2 + metalness 0.8 + } + geometry Cylinder { + height 0.022 + radius 0.008 + subdivision 8 + } + } + ] + } + # Mecanum roller 1 (θ=0°) + HingeJoint { + jointParameters HingeJointParameters { + axis 0.707107 0.707107 0.000000 + anchor 0.000000 0.000000 -0.031000 + } + endPoint Solid { + translation 0.000000 0.000000 -0.031000 + rotation 0.000000 0.000000 -1.000000 0.785398 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "rear left roller 1" + contactMaterial "MecanumWheelA" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 2 (θ=45°) + HingeJoint { + jointParameters HingeJointParameters { + axis 0.500000 0.707107 0.500000 + anchor 0.021920 0.000000 -0.021920 + } + endPoint Solid { + translation 0.021920 0.000000 -0.021920 + rotation 0.707107 0.000000 -0.707107 0.785398 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "rear left roller 2" + contactMaterial "MecanumWheelA" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 3 (θ=90°) + HingeJoint { + jointParameters HingeJointParameters { + axis 0.000000 0.707107 0.707107 + anchor 0.031000 0.000000 -0.000000 + } + endPoint Solid { + translation 0.031000 0.000000 -0.000000 + rotation 1.000000 0.000000 -0.000000 0.785398 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "rear left roller 3" + contactMaterial "MecanumWheelA" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 4 (θ=135°) + HingeJoint { + jointParameters HingeJointParameters { + axis -0.500000 0.707107 0.500000 + anchor 0.021920 0.000000 0.021920 + } + endPoint Solid { + translation 0.021920 0.000000 0.021920 + rotation 0.707107 0.000000 0.707107 0.785398 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "rear left roller 4" + contactMaterial "MecanumWheelA" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 5 (θ=180°) + HingeJoint { + jointParameters HingeJointParameters { + axis -0.707107 0.707107 0.000000 + anchor 0.000000 0.000000 0.031000 + } + endPoint Solid { + translation 0.000000 0.000000 0.031000 + rotation 0.000000 0.000000 1.000000 0.785398 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "rear left roller 5" + contactMaterial "MecanumWheelA" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 6 (θ=225°) + HingeJoint { + jointParameters HingeJointParameters { + axis -0.500000 0.707107 -0.500000 + anchor -0.021920 0.000000 0.021920 + } + endPoint Solid { + translation -0.021920 0.000000 0.021920 + rotation -0.707107 0.000000 0.707107 0.785398 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "rear left roller 6" + contactMaterial "MecanumWheelA" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 7 (θ=270°) + HingeJoint { + jointParameters HingeJointParameters { + axis -0.000000 0.707107 -0.707107 + anchor -0.031000 0.000000 0.000000 + } + endPoint Solid { + translation -0.031000 0.000000 0.000000 + rotation -1.000000 0.000000 0.000000 0.785398 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "rear left roller 7" + contactMaterial "MecanumWheelA" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } + # Mecanum roller 8 (θ=315°) + HingeJoint { + jointParameters HingeJointParameters { + axis 0.500000 0.707107 -0.500000 + anchor -0.021920 0.000000 -0.021920 + } + endPoint Solid { + translation -0.021920 0.000000 -0.021920 + rotation -0.707107 0.000000 -0.707107 0.785398 + children [ + Shape { + appearance PBRAppearance { + baseColor 0.12 0.12 0.12 + roughness 0.7 + metalness 0.1 + } + geometry Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + } + ] + name "rear left roller 8" + contactMaterial "MecanumWheelA" + boundingObject Capsule { + height 0.02 + radius 0.007 + subdivision 8 + } + physics Physics { + density -1 + mass 0.003 + centerOfMass [ + 0 0 0 + ] + } + } + } ] name "rear left wheel" - contactMaterial "MecanumWheel" boundingObject Pose { rotation 1 0 0 -1.5708 children [ Cylinder { height 0.022 - radius 0.038 + radius 0.02 } ] } physics Physics { density -1 - mass 0.06 + mass 0.045 centerOfMass [ 0 0 0 ] diff --git a/tools/run_webots.sh b/tools/run_webots.sh index 3263a86..9f68ee7 100755 --- a/tools/run_webots.sh +++ b/tools/run_webots.sh @@ -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 }