function
SLAM.PoseGraph.RGBDGraphCaptureLedger.Advance
Public declarations
Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| input | previous | State | | |
| input | previousCatalog | RGBDKeyframes.Catalog | | |
| input | nextCatalog | RGBDKeyframes.Catalog | | |
| input | sourceRevision | Integer | | |
| input | nextStep | Integer | | Accepted localization publication's actual next.steps |
| input | publicationAccepted | Boolean | | |
| input | requested | Boolean | | |
| output | result | State | | |
| output | accepted | Boolean | | |
| output | reason | Integer | |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
function Advance
input State previous;
input RGBDKeyframes.Catalog previousCatalog;
input RGBDKeyframes.Catalog nextCatalog;
input Integer sourceRevision;
input Integer nextStep "Accepted localization publication's actual next.steps";
input Boolean publicationAccepted;
input Boolean requested;
output State result; output Boolean accepted; output Integer reason;
protected
State candidate; Boolean valid; Boolean captured; Integer storedSlot;
algorithm
result := previous; accepted := false; reason := 1;
if requested then
reason := 2;
valid := publicationAccepted and Valid(previous,previousCatalog,sourceRevision,previous.lastStep)
and previous.lastStep < identifierLimit-1 and nextStep == previous.lastStep+1
and RGBDKeyframes.ValidHeader(nextCatalog)
and nextCatalog.generation == previousCatalog.generation
and nextCatalog.vocabularyVersion == previousCatalog.vocabularyVersion;
captured := false; storedSlot := 1;
if valid then
reason := 3;
valid := nextCatalog.nextId == previousCatalog.nextId
or (previousCatalog.nextId < identifierLimit and nextCatalog.nextId == previousCatalog.nextId+1);
captured := nextCatalog.nextId == previousCatalog.nextId+1;
storedSlot := previousCatalog.nextSlot;
if not captured then
valid := valid and nextCatalog.lastEpoch == previousCatalog.lastEpoch
and nextCatalog.lastTime == previousCatalog.lastTime;
else
valid := valid and nextCatalog.ids[storedSlot] == previousCatalog.nextId
and nextCatalog.epochs[storedSlot] > previousCatalog.lastEpoch
and (previousCatalog.nextId == 1 or nextCatalog.imageTimes[storedSlot] > previousCatalog.lastTime);
end if;
for slot in 1:capacity loop
if not captured or slot <> storedSlot then
valid := valid and nextCatalog.occupied[slot] == previousCatalog.occupied[slot];
if previousCatalog.occupied[slot] then
valid := valid and nextCatalog.ids[slot] == previousCatalog.ids[slot]
and nextCatalog.epochs[slot] == previousCatalog.epochs[slot]
and nextCatalog.imageTimes[slot] == previousCatalog.imageTimes[slot];
end if;
end if;
end for;
end if;
if valid then
candidate := previous; candidate.lastStep := nextStep;
candidate.catalogNextId := nextCatalog.nextId;
if captured then
candidate.ids[storedSlot] := nextCatalog.ids[storedSlot];
candidate.epochs[storedSlot] := nextCatalog.epochs[storedSlot];
candidate.times[storedSlot] := nextCatalog.imageTimes[storedSlot];
candidate.sequences[storedSlot] := nextStep;
end if;
reason := 4; valid := Valid(candidate,nextCatalog,sourceRevision,nextStep);
if valid then result := candidate; accepted := true; reason := 0; end if;
end if;
end if;
end Advance;