You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am struggling with the behavior of the parameters. I want to add an offset calibration on an edge.
So I have added a ParameterSE3Offset to the optimizer containing the transform matrix as it is done in this example.
Then, I have used the function SetParameterId on the edge to link the edge to the calibration as it is done in the example.
However, it seems that SetParameterId always returns false because of this check. Indeed, the parameters vector is empty after the edge creation and setParameterId does not update it. I didn't find any other function updating _parameters in the examples making SetParameterId succeed...
I can make it work using this hack patch from master (warning it implies a memory leak for now):
diff --git a/g2o/core/optimizable_graph.cpp b/g2o/core/optimizable_graph.cpp
index 33ebbf89..2e635b96 100644
--- a/g2o/core/optimizable_graph.cpp
+++ b/g2o/core/optimizable_graph.cpp
@@ -132,9 +132,13 @@ const OptimizableGraph* OptimizableGraph::Edge::graph() const {
}
bool OptimizableGraph::Edge::setParameterId(int argNum, int paramId) {
- if ((int)_parameters.size() <= argNum) return false;
if (argNum < 0) return false;
- *_parameters[argNum] = 0;
+ if ((int)_parameters.size() <= argNum)
+ {
+ _parameters.resize(argNum);
+ _parameterTypes.resize(argNum);
+ _parameterIds.resize(argNum);
+ }
_parameterIds[argNum] = paramId;
return true;
}
@@ -150,6 +154,8 @@ bool OptimizableGraph::Edge::resolveParameters() {
// parameters" << endl;
for (size_t i = 0; i < _parameters.size(); i++) {
int index = _parameterIds[i];
+ if (!_parameters[i])
+ _parameters[i] = new Parameter*;
*_parameters[i] = graph()->parameter(index);
auto& aux = **_parameters[i];
if (typeid(aux).name() != _parameterTypes[i]) {
What am I doing wrong?
Thank you for your help!
The text was updated successfully, but these errors were encountered:
Thank you for your prompt response!
Oh yes, I am using a basic edge_se3 and it seems the constructor does not init the params... So edge_se3_offset seems closer to what I need. Is there a description of the available edges somewhere?
Can you confirm this setting will take care of rotating the covariance which is input?
Hello,
I am struggling with the behavior of the parameters. I want to add an offset calibration on an edge.
So I have added a
ParameterSE3Offset
to the optimizer containing the transform matrix as it is done in this example.Then, I have used the function
SetParameterId
on the edge to link the edge to the calibration as it is done in the example.However, it seems that
SetParameterId
always returnsfalse
because of this check. Indeed, the parameters vector is empty after the edge creation andsetParameterId
does not update it. I didn't find any other function updating_parameters
in the examples makingSetParameterId
succeed...I can make it work using this hack patch from master (warning it implies a memory leak for now):
What am I doing wrong?
Thank you for your help!
The text was updated successfully, but these errors were encountered: