bmegli / ev3dev-mapping-ui

A cross-platform real-time 3D spatial data visualization
GNU General Public License v3.0
9 stars 4 forks source link

Add path backtracking #30

Closed bmegli closed 7 years ago

bmegli commented 7 years ago

Implementation of bmegli/ev3dev-mapping/issues/20

bmegli commented 7 years ago

Implementation Plan

Record drive communication in replay settings:

In other words in !ReplayAny() we record drive

When backtracking requested:

  1. Rewrite communication backwards:
    • flush pending data to dumpfile
    • open dumpfile for reading
    • read all drive data to array (@ 20 Hz, ~ 20 KB/minute, 1 MB/hour)
    • reverse array
    • iterate through packets:
      • change the direction of engine setpoints
      • rewrite backwards timestamps starting from "now" timestamp
    • save to temporary file name + "Backwards" file
  2. Initialize outbound replay:
    • record also backtracked replay
  3. Change Drive mode to Backtracking
  4. Drive in Backtracking mode:
    • if there is manual input request replay stop
    • if replay is finished change to Manual mode