Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
wolf_projects
wolf_lib
wolf
Commits
74332b0a
Commit
74332b0a
authored
5 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Add TD help
parent
b4cb9a90
No related branches found
No related tags found
1 merge request
!344
WIP: Resolve "Fixing and improving QR manager"
Pipeline
#5015
failed
5 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ceres_wrapper/qr_manager.cpp
+49
-27
49 additions, 27 deletions
src/ceres_wrapper/qr_manager.cpp
with
49 additions
and
27 deletions
src/ceres_wrapper/qr_manager.cpp
+
49
−
27
View file @
74332b0a
...
...
@@ -204,33 +204,55 @@ void QRManager::updateStateBlockStatus(const StateBlockPtr& _st_ptr)
void
QRManager
::
relinearizeFactor
(
FactorBasePtr
_fac_ptr
)
// FIXME consider the Jacobian 'M' of the local param of each SB in the factor
{
// // evaluate factor
// std::vector<const double*> fac_states_ptr;
// for (auto sb : _fac_ptr->getStateBlockPtrVector()){
// fac_states_ptr.push_back(sb->getStateData());
// }
//
// Eigen::VectorXd residual(_fac_ptr->getSize());
// std::vector<Eigen::MatrixXd> jacobians;
// _fac_ptr->evaluate(fac_states_ptr,residual,jacobians);
//
// // Fill jacobians
// Eigen::SparseMatrixd A_block_row(_fac_ptr->getSize(), A_.cols());
// for (auto i = 0; i < jacobians.size(); i++)
// {
// if (!_fac_ptr->getStateBlockPtrVector()[i]->isFixed())
// {
// assert(sb_2_col_.find(_fac_ptr->getStateBlockPtrVector()[i]) != sb_2_col_.end() && "factor involving a state block not added");
// assert(A_.cols() >= sb_2_col_[_fac_ptr->getStateBlockPtrVector()[i]] + jacobians[i].cols() - 1 && "bad A number of cols");
// // insert since A_block_row has just been created so it's empty for sure
// insertSparseBlock(jacobians[i], A_block_row, 0, sb_2_col_[_fac_ptr->getStateBlockPtrVector()[i]]);
// }
// }
//
// assignBlockRow(A_, A_block_row, fac_2_row_[_fac_ptr]);
//
// // Fill residual
// b_.segment(fac_2_row_[_fac_ptr], _fac_ptr->getSize()) = residual;
/* Things to do:
*
* 1. For each SB, obtain or create, then store in a vector, this data:
* - state vector
* - size, and local size
* - if local param, get Jacobian M
* - else, M = I, or set a convenient flag sb_has_jac = false
* 2. Evaluate factor, obtain residual and Jacobians
* - evaluate(fac_states_ptr,residual,jacobians)
* - for each SB i
* - if sb_has_jac[i] then J[i] = M[i] * jacobians[i]
* - else
* - J[i] = jacobians[i]
* 3. Fill A and b
* - for each SB i
* - insert J[i] in matrix A, in row A_block_row
* - insert residual in vector b
*/
// evaluate factor
std
::
vector
<
const
double
*>
fac_states_ptr
;
for
(
auto
sb
:
_fac_ptr
->
getStateBlockPtrVector
()){
fac_states_ptr
.
push_back
(
sb
->
getStateData
());
}
Eigen
::
VectorXd
residual
(
_fac_ptr
->
getSize
());
std
::
vector
<
Eigen
::
MatrixXd
>
jacobians
;
_fac_ptr
->
evaluate
(
fac_states_ptr
,
residual
,
jacobians
);
// Fill jacobians
Eigen
::
SparseMatrixd
A_block_row
(
_fac_ptr
->
getSize
(),
A_
.
cols
());
for
(
auto
i
=
0
;
i
<
jacobians
.
size
();
i
++
)
{
if
(
!
_fac_ptr
->
getStateBlockPtrVector
()[
i
]
->
isFixed
())
{
assert
(
sb_2_col_
.
find
(
_fac_ptr
->
getStateBlockPtrVector
()[
i
])
!=
sb_2_col_
.
end
()
&&
"factor involving a state block not added"
);
assert
(
A_
.
cols
()
>=
sb_2_col_
[
_fac_ptr
->
getStateBlockPtrVector
()[
i
]]
+
jacobians
[
i
].
cols
()
-
1
&&
"bad A number of cols"
);
// insert since A_block_row has just been created so it's empty for sure
insertSparseBlock
(
jacobians
[
i
],
A_block_row
,
0
,
sb_2_col_
[
_fac_ptr
->
getStateBlockPtrVector
()[
i
]]);
}
}
assignBlockRow
(
A_
,
A_block_row
,
fac_2_row_
[
_fac_ptr
]);
// Fill residual
b_
.
segment
(
fac_2_row_
[
_fac_ptr
],
_fac_ptr
->
getSize
())
=
residual
;
}
}
/* namespace wolf */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment