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
568a89bf
Commit
568a89bf
authored
6 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
Implementation TODO of addPriorParameterDynamic
parent
2eaa908e
No related branches found
No related tags found
1 merge request
!243
Constraint prior sensor params
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sensor_base.cpp
+42
-1
42 additions, 1 deletion
src/sensor_base.cpp
with
42 additions
and
1 deletion
src/sensor_base.cpp
+
42
−
1
View file @
568a89bf
...
@@ -144,7 +144,48 @@ void SensorBase::unfixIntrinsics()
...
@@ -144,7 +144,48 @@ void SensorBase::unfixIntrinsics()
updateCalibSize
();
updateCalibSize
();
}
}
void
SensorBase
::
addStaticParameterPrior
(
const
StateBlockPtr
&
_sb
,
const
Eigen
::
VectorXs
&
_x
,
const
Eigen
::
MatrixXs
&
_cov
,
unsigned
int
_start_idx
,
int
_size
)
void
SensorBase
::
addPriorParameterStatic
(
const
StateBlockPtr
&
_sb
,
const
Eigen
::
VectorXs
&
_x
,
const
Eigen
::
MatrixXs
&
_cov
,
unsigned
int
_start_idx
,
int
_size
)
{
bool
is_quaternion
=
(
std
::
dynamic_pointer_cast
<
StateQuaternion
>
(
_sb
)
!=
nullptr
);
assert
(
std
::
find
(
state_block_vec_
.
begin
(),
state_block_vec_
.
end
(),
_sb
)
!=
state_block_vec_
.
end
()
&&
"adding prior to unknown state block"
);
assert
(((
!
is_quaternion
&&
_x
.
size
()
==
_cov
.
rows
()
&&
_x
.
size
()
==
_cov
.
cols
())
||
(
is_quaternion
&&
_x
.
size
()
==
4
&&
_cov
.
rows
()
==
3
&&
_cov
.
cols
()
==
3
))
&&
"bad prior/covariance dimensions"
);
assert
((
_size
==
-
1
&&
_start_idx
==
0
)
||
(
_size
+
_start_idx
<=
_sb
->
getSize
()));
assert
(
_size
==
-
1
||
_size
==
_x
.
size
());
assert
(
!
(
_size
!=
-
1
&&
is_quaternion
)
&&
"prior of a segment of state not available for quaternion"
);
// set StateBlock state
if
(
_size
==
-
1
)
_sb
->
setState
(
_x
);
else
{
Eigen
::
VectorXs
new_x
=
_sb
->
getState
();
new_x
.
segment
(
_start_idx
,
_size
)
=
_x
;
_sb
->
setState
(
new_x
);
}
// remove previous prior (if any)
if
(
params_prior_map_
.
find
(
_sb
)
!=
params_prior_map_
.
end
())
params_prior_map_
[
_sb
]
->
remove
();
// create feature
FeatureBasePtr
ftr_prior
=
std
::
make_shared
<
FeatureBase
>
(
"ABSOLUTE"
,
_x
,
_cov
);
// set feature problem
ftr_prior
->
setProblem
(
getProblem
());
// create & add constraint absolute
if
(
is_quaternion
)
ftr_prior
->
addConstraint
(
std
::
make_shared
<
ConstraintQuaternionAbsolute
>
(
_sb
));
else
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
::
addPriorParameterDynamic
(
const
StateBlockPtr
&
_sb
,
const
Eigen
::
VectorXs
&
_x
,
const
Eigen
::
MatrixXs
&
_cov
,
unsigned
int
_start_idx
,
int
_size
)
{
{
bool
is_quaternion
=
(
std
::
dynamic_pointer_cast
<
StateQuaternion
>
(
_sb
)
!=
nullptr
);
bool
is_quaternion
=
(
std
::
dynamic_pointer_cast
<
StateQuaternion
>
(
_sb
)
!=
nullptr
);
...
...
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