MCPcopy Create free account
hub / github.com/TUC-ProAut/libRSF / FactorGraphStructure

Class FactorGraphStructure

include/FactorGraphStructure.h:46–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44
45
46 class FactorGraphStructure
47 {
48 public:
49 FactorGraphStructure(ceres::Problem *GraphPointer, StateDataSet *Data);
50 virtual ~FactorGraphStructure() = default;
51
52 /** define a structure that stores all relevant information */
53 struct StateInfo
54 {
55 std::string Name;
56 double Timestamp;
57 int Number;
58 DataType Type;
59 };
60
61 struct FactorInfo
62 {
63 FactorType Type;
64 double Timestamp;
65 int Number;
66 int ErrorInputSize;
67 int ErrorOutputSize;
68 ErrorModelBase* ErrorModel = nullptr;
69 };
70
71 /** collect all informations that are required to remove the BaseState from the graph */
72 void getMarginalizationInfo(const std::vector<double*> &BaseStates,
73 std::vector<double*> &ConnectedStates,
74 std::vector<ceres::ResidualBlockId> &ConnectedFactors,
75 std::vector<int> &StateDims,
76 std::vector<int> &StateDimsLocal,
77 std::vector<StateID> &StateIDs,
78 std::vector<DataType> &StateTypes) const;
79
80
81 template <typename ErrorType>
82 void addFactor(const FactorType Type,
83 const double Timestamp,
84 const ceres::ResidualBlockId CeresID,
85 ErrorType* const ErrorModel,
86 const std::vector<StateID> &States,
87 const std::vector<double*> &StatePointers,
88 const std::vector<DataType> &StateTypes)
89 {
90 /** add to time dependent representation */
91 _FactorList.addElement(Type, Timestamp, CeresID);
92
93 /** create ID and add to unordered maps */
94 const FactorID Factor(Type, Timestamp, _FactorList.countElement(Type, Timestamp)-1);
95
96 /** collect factor information */
97 FactorInfo Info;
98 Info.Type = Type;
99 Info.Timestamp = Timestamp;
100 Info.Number = Factor.Number;
101 Info.ErrorInputSize = ErrorModel->InputDim;
102 Info.ErrorOutputSize = ErrorModel->OutputDim;
103 Info.ErrorModel = static_cast<ErrorModelBase*>(ErrorModel);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected