CogniPilot

MODELICA LIBRARY · ENGINEERING REFERENCE

function

SLAM.PoseGraph.RGBDGraphCaptureLedger.Valid

Public declarations

Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.

RoleNameTypeDimensions / attributes / defaultDescription
inputledgerState
inputcatalogRGBDKeyframes.Catalog
inputsourceRevisionInteger
inputstepInteger
outputvalidBoolean

Modelica declarations and implementation

Show parameters, interfaces and source

Parameters, inputs, outputs, defaults and equations from the source file.

function Valid
    input State ledger; input RGBDKeyframes.Catalog catalog;
    input Integer sourceRevision; input Integer step;
    output Boolean valid;
  protected Integer oldest; Integer slot; Integer previousSequence;
  algorithm
    valid := RGBDKeyframes.ValidHeader(catalog)
      and ledger.generation == catalog.generation
      and sourceRevision >= 1 and sourceRevision <= identifierLimit
      and ledger.sourceRevision == sourceRevision
      and step >= 0 and step < identifierLimit and ledger.lastStep == step
      and ledger.catalogNextId == catalog.nextId;
    oldest := 1; slot := 1; previousSequence := 0;
    if valid then
      oldest := max(1,catalog.nextId-capacity);
      for node in 1:capacity loop
        if node <= min(capacity,catalog.nextId-1) then
          slot := mod(oldest+node-2,capacity)+1;
          valid := valid and ledger.ids[slot] == catalog.ids[slot]
            and ledger.epochs[slot] == catalog.epochs[slot]
            and ledger.times[slot] == catalog.imageTimes[slot]
            and ledger.sequences[slot] > previousSequence
            and ledger.sequences[slot] <= step;
          previousSequence := ledger.sequences[slot];
        end if;
      end for;
    end if;
  end Valid;