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

Method addFactor

include/FactorGraphStructure.h:82–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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);
104 _Factors.emplace(CeresID, Info);
105
106 /** collect state information */
107 for(int n = 0; n < static_cast<int>(States.size()); n++)
108 {
109 if(_States.count(StatePointers.at(n)) == 0) /**< check if already existing */
110 {
111 StateInfo State;
112 State.Name = States.at(n).ID;
113 State.Timestamp = States.at(n).Timestamp;
114 State.Number = States.at(n).Number;
115 State.Type = StateTypes.at(n);
116
117 _States.emplace(StatePointers.at(n), State);
118 }
119 }
120 }
121
122 void removeFactor(const FactorID &Factor);
123 void removeFactor(const ceres::ResidualBlockId Factor);

Callers

nothing calls this directly

Calls 4

countElementMethod · 0.80
emplaceMethod · 0.80
countMethod · 0.80
addElementMethod · 0.45

Tested by

no test coverage detected