2. Software design

Back to PLOT BOT
1. Hardware design
3. Production
4. BOM and files

Goals

  1. Organize the code into abstract layers
  2. Implement linear interpolation

Embedded programming

Layers

Layer Role (abstract) Input → Output
1. G-code & Intent Describes what motion is desired, independent of hardware G1 X100 Y200 → Target pose + path type
2. Interpolation Converts geometric intent into a time-parameterized reference Target pose → Trajectory x(t), y(t), θ(t)
3. Correction Aligns reference motion with estimated actual state Trajectory + pose estimate → Body velocity (Vx, Vy, ω)
4. Mecanum kinematics Maps body motion into actuator commands → (Vx, Vy, ω) Motor commands (ω1..ω4)

Interpolation

  1. Geometric interpolation (Position-based)
    • e.g., Move 0.01 mm each update
  2. Time-based interpolation
    • e.g., Compute next position very 1 ms

Formula: Position(Time) = Start + Time * (Total change)

P0 = (x0, y0)
P1 = (x1, y1)

P(s) = (1 − s)·P0 + s·P1
P(s) = P0 + s·(P0 - P1)

x(s) = x0 + s·(x1 − x0)
y(s) = y0 + s·(y1 − y0)

Ref:

Mecanum kinematics

Application programming