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
bca1a75a
Commit
bca1a75a
authored
6 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
documented addParameterPrior()
parent
fe8e637c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!243
Constraint prior sensor params
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sensor_base.cpp
+5
-1
5 additions, 1 deletion
src/sensor_base.cpp
src/sensor_base.h
+17
-3
17 additions, 3 deletions
src/sensor_base.h
with
22 additions
and
4 deletions
src/sensor_base.cpp
+
5
−
1
View file @
bca1a75a
...
@@ -145,12 +145,13 @@ void SensorBase::unfixIntrinsics()
...
@@ -145,12 +145,13 @@ void SensorBase::unfixIntrinsics()
updateCalibSize
();
updateCalibSize
();
}
}
void
SensorBase
::
addParameterPrior
(
const
StateBlockPtr
&
_sb
,
const
Eigen
::
VectorXs
&
_x
,
const
Eigen
::
MatrixXs
&
_cov
,
unsigned
int
_start_idx
=
0
,
int
_size
=
-
1
)
void
SensorBase
::
addParameterPrior
(
const
StateBlockPtr
&
_sb
,
const
Eigen
::
VectorXs
&
_x
,
const
Eigen
::
MatrixXs
&
_cov
,
unsigned
int
_start_idx
,
int
_size
)
{
{
assert
(
std
::
find
(
state_block_vec_
.
begin
(),
state_block_vec_
.
end
(),
_sb
)
!=
state_block_vec_
.
end
()
&&
"adding prior to unknown state block"
);
assert
(
std
::
find
(
state_block_vec_
.
begin
(),
state_block_vec_
.
end
(),
_sb
)
!=
state_block_vec_
.
end
()
&&
"adding prior to unknown state block"
);
assert
(
_x
.
size
()
==
_cov
.
rows
()
&&
_x
.
size
()
==
_cov
.
cols
()
&&
"covariance and prior dimension should be the same"
);
assert
(
_x
.
size
()
==
_cov
.
rows
()
&&
_x
.
size
()
==
_cov
.
cols
()
&&
"covariance and prior dimension should be the same"
);
assert
((
_size
==
-
1
&&
_start_idx
==
0
)
||
(
_size
+
_start_idx
<=
_sb
->
getSize
()));
assert
((
_size
==
-
1
&&
_start_idx
==
0
)
||
(
_size
+
_start_idx
<=
_sb
->
getSize
()));
assert
(
_size
==
-
1
||
_size
==
_x
.
size
());
assert
(
_size
==
-
1
||
_size
==
_x
.
size
());
assert
(
params_prior_map_
.
find
(
_sb
)
==
params_prior_map_
.
end
()
&&
"this parameter has already a prior"
);
// create feature
// create feature
auto
ftr_prior
=
std
::
make_shared
<
FeatureBase
>
(
_x
,
_cov
);
auto
ftr_prior
=
std
::
make_shared
<
FeatureBase
>
(
_x
,
_cov
);
...
@@ -163,6 +164,9 @@ void SensorBase::addParameterPrior(const StateBlockPtr& _sb, const Eigen::Vector
...
@@ -163,6 +164,9 @@ void SensorBase::addParameterPrior(const StateBlockPtr& _sb, const Eigen::Vector
ftr_prior
->
addConstraint
(
std
::
make_shared
<
ConstraintQuaternionAbsolute
>
(
_sb
));
ftr_prior
->
addConstraint
(
std
::
make_shared
<
ConstraintQuaternionAbsolute
>
(
_sb
));
else
else
ftr_prior
->
addConstraint
(
std
::
make_shared
<
ConstraintBlockAbsolute
>
(
_sb
,
_start_idx
,
_size
));
ftr_prior
->
addConstraint
(
std
::
make_shared
<
ConstraintBlockAbsolute
>
(
_sb
,
_start_idx
,
_size
));
// store feature in params_prior_map_
params_prior_map_
[
_sb
]
=
ftr_prior
;
}
}
void
SensorBase
::
registerNewStateBlocks
()
void
SensorBase
::
registerNewStateBlocks
()
...
...
This diff is collapsed.
Click to expand it.
src/sensor_base.h
+
17
−
3
View file @
bca1a75a
...
@@ -51,7 +51,7 @@ class SensorBase : public NodeBase, public std::enable_shared_from_this<SensorBa
...
@@ -51,7 +51,7 @@ class SensorBase : public NodeBase, public std::enable_shared_from_this<SensorBa
Eigen
::
VectorXs
noise_std_
;
// std of sensor noise
Eigen
::
VectorXs
noise_std_
;
// std of sensor noise
Eigen
::
MatrixXs
noise_cov_
;
// cov matrix of noise
Eigen
::
MatrixXs
noise_cov_
;
// cov matrix of noise
FeatureBase
List
params_prior_
list
_
;
// Priors (value and covariance) of extrinsic & intrinsic
parameters
std
::
map
<
StateBlockPtr
,
FeatureBase
Ptr
>
params_prior_
map
_
;
// Priors (value and covariance) of extrinsic & intrinsic
state blocks (multimap
public:
public:
/** \brief Constructor with noise size
/** \brief Constructor with noise size
...
@@ -93,7 +93,6 @@ class SensorBase : public NodeBase, public std::enable_shared_from_this<SensorBa
...
@@ -93,7 +93,6 @@ class SensorBase : public NodeBase, public std::enable_shared_from_this<SensorBa
const
bool
_intr_dyn
=
false
);
const
bool
_intr_dyn
=
false
);
virtual
~
SensorBase
();
virtual
~
SensorBase
();
void
remove
();
unsigned
int
id
();
unsigned
int
id
();
...
@@ -136,7 +135,21 @@ class SensorBase : public NodeBase, public std::enable_shared_from_this<SensorBa
...
@@ -136,7 +135,21 @@ class SensorBase : public NodeBase, public std::enable_shared_from_this<SensorBa
void
unfixExtrinsics
();
void
unfixExtrinsics
();
void
fixIntrinsics
();
void
fixIntrinsics
();
void
unfixIntrinsics
();
void
unfixIntrinsics
();
void
addParameterPrior
(
const
StateBlockPtr
&
_sb
,
const
Eigen
::
VectorXs
&
_x
,
const
Eigen
::
MatrixXs
&
_cov
,
unsigned
int
_start_idx
=
0
,
int
_size
=
-
1
);
/** \brief Add an absolute constraint to a parameter
*
* Add an absolute constraint to a parameter
* \param _sb state block of the parameter to be constrained
* \param _x prior value
* \param _cov covariance
* \param _start_idx state segment starting index (not used in quaternions)
* \param _size state segment size (-1: whole state) (not used in quaternions)
*
**/
void
addParameterPrior
(
const
StateBlockPtr
&
_sb
,
const
Eigen
::
VectorXs
&
_x
,
const
Eigen
::
MatrixXs
&
_cov
,
unsigned
int
_start_idx
=
0
,
int
_size
=
-
1
);
SizeEigen
getCalibSize
()
const
;
SizeEigen
getCalibSize
()
const
;
Eigen
::
VectorXs
getCalibration
()
const
;
Eigen
::
VectorXs
getCalibration
()
const
;
...
@@ -201,6 +214,7 @@ inline StateBlockPtr SensorBase::getStateBlockPtrStatic(unsigned int _i) const
...
@@ -201,6 +214,7 @@ inline StateBlockPtr SensorBase::getStateBlockPtrStatic(unsigned int _i) const
inline
void
SensorBase
::
setStateBlockPtrStatic
(
unsigned
int
_i
,
const
StateBlockPtr
_sb_ptr
)
inline
void
SensorBase
::
setStateBlockPtrStatic
(
unsigned
int
_i
,
const
StateBlockPtr
_sb_ptr
)
{
{
assert
((
params_prior_map_
.
find
(
state_block_vec_
[
_i
])
==
params_prior_map_
.
end
()
||
_sb_ptr
==
nullptr
)
&&
"overwriting a state block that has an absolute constraint"
);
state_block_vec_
[
_i
]
=
_sb_ptr
;
state_block_vec_
[
_i
]
=
_sb_ptr
;
}
}
...
...
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