Training Simulator for Motor/Encoder pair

We have many more programmers than cRIOs and robot chassis, and I was running through some state machine training last night, using LV running on the PC. The student exercise was to create a state machine that would switch states based on a knob position and a switch setting (knob simulated an encoder position, switch emulated a proximity sensor), the students simulated the motor driving the shaft by manually moving the knob. It seems hokey, but they did all end up with accurate state machines (and got good experience in debugging the state transitions).

The problem is that you code a little differently when you have the use of encoder and motor references; without them, you need to poll the encoder position. It hard to implement code like the lovely code in the sensor fusion paper if you have to pass sensor state into the state machine, instead of passing in sensor references so it can determine sensor state whenever it wants.

Has anyone already written a VI set that provides a visual simulation of a motor controller pair (VI to set the “motor” speed, VI to read the “encoder” position)? Having this to write and debug the logic for state machines on LV on a PC before we had real robot hardware available would make training easier. I haven’t looked at the robot simulator much yet (don’t know if you can simulate encoders there), but it seems like overkill for what I want to do here.

The LabVIEW robot simulator indeed provides simulated encoders for the left and right drive wheels.

You may find this whitepaper worthwhile: