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
bfa40d32
Commit
bfa40d32
authored
6 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
Added precomputed Jacobian
parent
c88ef75c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!243
Constraint prior sensor params
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/constraint_block_absolute.h
+18
-17
18 additions, 17 deletions
src/constraint_block_absolute.h
with
18 additions
and
17 deletions
src/constraint_block_absolute.h
+
18
−
17
View file @
bfa40d32
...
@@ -21,8 +21,10 @@ WOLF_PTR_TYPEDEFS(ConstraintBlockAbsolute);
...
@@ -21,8 +21,10 @@ WOLF_PTR_TYPEDEFS(ConstraintBlockAbsolute);
class
ConstraintBlockAbsolute
:
public
ConstraintAnalytic
class
ConstraintBlockAbsolute
:
public
ConstraintAnalytic
{
{
private:
private:
SizeEigen
sb_size_
;
// the size of the state block
SizeEigen
sb_constrained_start_
;
// the index of the first state element that is constrained
SizeEigen
sb_constrained_start_
;
// the index of the first state element that is constrained
SizeEigen
sb_constrained_size_
;
// the size of the state segment that is constrained
SizeEigen
sb_constrained_size_
;
// the size of the state segment that is constrained
Eigen
::
MatrixXs
J_
;
// Jacobian
public:
public:
...
@@ -35,10 +37,20 @@ class ConstraintBlockAbsolute : public ConstraintAnalytic
...
@@ -35,10 +37,20 @@ class ConstraintBlockAbsolute : public ConstraintAnalytic
*/
*/
ConstraintBlockAbsolute
(
StateBlockPtr
_sb_ptr
,
unsigned
int
_start_idx
=
0
,
int
_size
=
-
1
,
bool
_apply_loss_function
=
false
,
ConstraintStatus
_status
=
CTR_ACTIVE
)
:
ConstraintBlockAbsolute
(
StateBlockPtr
_sb_ptr
,
unsigned
int
_start_idx
=
0
,
int
_size
=
-
1
,
bool
_apply_loss_function
=
false
,
ConstraintStatus
_status
=
CTR_ACTIVE
)
:
ConstraintAnalytic
(
"BLOCK ABS"
,
_apply_loss_function
,
_status
,
_sb_ptr
),
ConstraintAnalytic
(
"BLOCK ABS"
,
_apply_loss_function
,
_status
,
_sb_ptr
),
sb_size_
(
_sb_ptr
->
getSize
()),
sb_constrained_start_
(
_start_idx
),
sb_constrained_start_
(
_start_idx
),
sb_constrained_size_
(
_size
==
-
1
?
_
sb_
ptr
->
getS
ize
()
:
_size
)
sb_constrained_size_
(
_size
==
-
1
?
sb_
s
ize
_
:
_size
)
{
{
assert
(
sb_constrained_size_
-
sb_constrained_start_
==
_sb_ptr
->
getSize
());
assert
(
sb_constrained_size_
+
sb_constrained_start_
<=
sb_size_
);
// precompute Jacobian (Identity)
if
(
sb_constrained_start_
==
0
)
J_
=
Eigen
::
MatrixXs
::
Identity
(
sb_constrained_size_
,
sb_size_
);
else
{
J_
=
Eigen
::
MatrixXs
::
Zero
(
sb_constrained_size_
,
sb_size_
);
J_
.
middleCols
(
sb_constrained_start_
,
sb_constrained_size_
)
=
Eigen
::
MatrixXs
::
Identity
(
sb_constrained_size_
,
sb_constrained_size_
);
}
}
}
virtual
~
ConstraintBlockAbsolute
()
=
default
;
virtual
~
ConstraintBlockAbsolute
()
=
default
;
...
@@ -97,30 +109,19 @@ inline void ConstraintBlockAbsolute::evaluateJacobians(
...
@@ -97,30 +109,19 @@ inline void ConstraintBlockAbsolute::evaluateJacobians(
assert
(
_st_vector
.
size
()
==
1
&&
"Wrong number of state blocks!"
);
assert
(
_st_vector
.
size
()
==
1
&&
"Wrong number of state blocks!"
);
assert
(
jacobians
.
size
()
==
1
&&
"Wrong number of jacobians!"
);
assert
(
jacobians
.
size
()
==
1
&&
"Wrong number of jacobians!"
);
assert
(
_compute_jacobian
.
size
()
==
1
&&
"Wrong number of _compute_jacobian booleans!"
);
assert
(
_compute_jacobian
.
size
()
==
1
&&
"Wrong number of _compute_jacobian booleans!"
);
assert
(
_st_vector
.
front
().
size
()
==
sb_size_
&&
"Wrong StateBlock size"
);
assert
(
_st_vector
.
front
().
size
()
>=
getMeasurement
().
size
()
&&
"StateBlock size and measurement size should match"
);
assert
(
_st_vector
.
front
().
size
()
>=
getMeasurement
().
size
()
&&
"StateBlock size and measurement size should match"
);
// normalized jacobian
// jacobian is identity -> returning sqrt information right (or upper)
if
(
_compute_jacobian
.
front
())
if
(
_compute_jacobian
.
front
())
{
jacobians
.
front
()
=
getMeasurementSquareRootInformationUpper
()
*
J_
;
// whole state constrained
if
(
sb_constrained_size_
==
_st_vector
.
front
().
size
())
jacobians
.
front
()
=
getMeasurementSquareRootInformationUpper
();
// segment of state constrained
else
{
jacobians
.
front
()
=
Eigen
::
MatrixXs
::
Zero
(
sb_constrained_size_
,
_st_vector
.
front
().
size
());
jacobians
.
front
().
middleCols
(
sb_constrained_start_
,
sb_constrained_size_
)
=
getMeasurementSquareRootInformationUpper
();
}
}
}
}
inline
void
ConstraintBlockAbsolute
::
evaluatePureJacobians
(
std
::
vector
<
Eigen
::
MatrixXs
>&
jacobians
)
const
inline
void
ConstraintBlockAbsolute
::
evaluatePureJacobians
(
std
::
vector
<
Eigen
::
MatrixXs
>&
jacobians
)
const
{
{
assert
(
jacobians
.
size
()
==
1
&&
"Wrong number of jacobians!"
);
assert
(
jacobians
.
size
()
==
1
&&
"Wrong number of jacobians!"
);
// jacobian is identity
jacobians
.
front
()
=
J_
;
jacobians
.
front
()
=
Eigen
::
MatrixXs
::
Identity
(
getMeasurement
().
size
(),
getMeasurement
().
size
());
}
}
inline
unsigned
int
ConstraintBlockAbsolute
::
getSize
()
const
inline
unsigned
int
ConstraintBlockAbsolute
::
getSize
()
const
...
...
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