Overview
Mecanum wheels allow omnidirectional locomotion through specialized configurations of diagonal rollers integrated along their circumferences. By carefully controlling the relative speed and direction of the individual motors driving each corner, a vehicle can move forward, backward, slide laterally (strafe), drive diagonally, or rotate in place.
This application simulates the physics and kinematics of a 4-wheel mecanum chassis, specifically mirroring a custom physical hardware setup using an Arduino Uno R4 WiFi and a **Duinotech Motor Shield (XC4472)**. A major bottleneck of robotic assembly is random motor wiring. Swapping polarity or wiring the left-rear motor into a front driver terminal is easy to do by accident. This simulator behaves as a visual sandbox, demonstrating exactly what occurs when your motors are incorrectly assigned, and provides a direct, zero-effort software solution by rendering custom-tailored correction code ready for deployment on PlatformIO.
How to Use
- Select Target Commands: Use the Manual Drive Pad to command the robot to move in various direction vectors. Note how the wheels rotate (represented by green speed arrows on each wheel corner).
- Introduce Wiring Anomalies: Go to the Hardware Wiring Map. Try swapping port selections (e.g., mapping Right Front to M3) or inverting the polarities. Drive the robot again. You will observe that a simple "Forward" command now forces the robot to rotate or drift irregularly.
- Implement Software Calibration: Toggle the Enable Software Calibration checkbox. This forces the microcontroller's control program to dynamically route motor speed outputs to their corrected channels before writing commands to the shield's physical registers, resolving the random assembly layout.
- Export to Hardware: View the auto-updating code panel. Your custom ports and inversions are embedded into clean C++ functions utilizing the classic
AFMotor.hlibrary compatible with the Duinotech XC4472 module. Click **Copy Code** and compile directly within VSCode via PlatformIO. - Interact with Sensors: Click and drag the red obstacle target on the canvas. Place it in the path of the robot's front ultrasonic sensor cone to view distance measurements. Use the microphone "Sound Trigger" to simulate noise alerts.
Technical Details
The Mecanum wheel kinematic engine maps the input movement vector $(V_x, V_y, \omega)$ (representing lateral strafe, forward travel, and rotational velocity) to individual wheel angular velocities using standard structural equations:
- $$V_{\text{LeftFront}} = V_y + V_x + \omega$$
- $$V_{\text{RightFront}} = V_y - V_x - \omega$$
- $$V_{\text{LeftRear}} = V_y - V_x + \omega$$
- $$V_{\text{RightRear}} = V_y + V_x - \omega$$
When standard uncalibrated firmware drives the shield, it commands ports $M_1 \rightarrow LF$, $M_2 \rightarrow RF$, $M_3 \rightarrow LR$, and $M_4 \rightarrow RR$. If physical connections mismatch, the simulator remaps the visual wheel outputs directly based on the user's calibration configuration:
physicalLF_Speed = ports[config.lf_port].val * config.lf_polarity_multiplier; physicalRF_Speed = ports[config.rf_port].val * config.rf_polarity_multiplier; //...and so on for rear wheels
Audio Capabilities: An integrated sound synthesis loop leverages the Web Audio API. It remains suspended until user activation via the Sound Toggle. Once unlocked, it generates a real-time dynamic pitch representing DC motor frequency loads, combined with periodic ultrasonic pings that shift in frequency as the obstacle approaches.
Future Directions
- ROS Integration Nodes: Developing a lightweight WebSocket transceiver block inside the Arduino Uno R4 WiFi firmware to bridge the physical robot's sensor data back to this simulator GUI in real-time.
- Autonomous Pathing Algorithms: Visualizing SLAM (Simultaneous Localization and Mapping) paths and vector grids directly onto the canvas, utilizing feedback from simulated LiDAR sensors.
- 3D Kinematics Translation: Upgrading the visual renderer to Three.js to show suspension compression, surface friction slip, and rolling resistance profiles under uneven load balances.
BioniChaos Modality & Simulators Directory
Explore our external collection of interactive biological, signal processing, and medical simulators hosted across the BioniChaos network:
- Hodgkin-Huxley Action Potential Simulator: An interactive laboratory solving the differential equations of neural membrane potential, sodium activation gating, and potassium conductance.
- Medical Ultrasound Simulation: A dual-panel clinical sandbox visualizing acoustic pulse-echo sweeps, echogenicity reflection factors, and interactive grayscale reconstruction.
- Cochlear Implant Simulator: Audio signal-processing utility that takes direct microphone input, simplifies it through a frequency-division filter bank, and visualizes spiral electrode stimulation paths.