Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bodydynamics
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
plugins
bodydynamics
Commits
c202064e
Commit
c202064e
authored
3 years ago
by
Mederic Fourmy
Browse files
Options
Downloads
Patches
Plain Diff
Factor point feet altitude
parent
ad77545d
No related branches found
No related tags found
2 merge requests
!23
After cmake and const refactor
,
!11
Resolve "Turn ProcessorPointFeetNomove into a processor tracker"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/bodydynamics/factor/factor_point_feet_altitude.h
+124
-0
124 additions, 0 deletions
include/bodydynamics/factor/factor_point_feet_altitude.h
with
124 additions
and
0 deletions
include/bodydynamics/factor/factor_point_feet_altitude.h
0 → 100644
+
124
−
0
View file @
c202064e
/**
* \file factor_point_feet_altitude.h
*
* Created on: Nov 5, 2020
* \author: mfourmy
*/
#ifndef FACTOR_POINT_FEET_ALTITUDE_H_
#define FACTOR_POINT_FEET_ALTITUDE_H_
#include
"core/factor/factor_autodiff.h"
namespace
wolf
{
WOLF_PTR_TYPEDEFS
(
FactorPointFeetAltitude
);
class
FactorPointFeetAltitude
:
public
FactorAutodiff
<
FactorPointFeetAltitude
,
1
,
3
,
4
>
{
public:
FactorPointFeetAltitude
(
const
FeatureBasePtr
&
_ftr_current_ptr
,
const
ProcessorBasePtr
&
_processor_ptr
,
bool
_apply_loss_function
,
FactorStatus
_status
=
FAC_ACTIVE
);
~
FactorPointFeetAltitude
()
override
{
/* nothing */
}
/*
Factor state blocks:
_pb: W_p_WB -> base position in world frame
_qb: W_q_B -> base orientation in world frame
*/
template
<
typename
T
>
bool
operator
()
(
const
T
*
const
_pb
,
const
T
*
const
_qb
,
T
*
_res
)
const
;
Vector1d
error
()
const
;
Vector1d
res
()
const
;
double
cost
()
const
;
};
}
/* namespace wolf */
namespace
wolf
{
FactorPointFeetAltitude
::
FactorPointFeetAltitude
(
const
FeatureBasePtr
&
_ftr_current_ptr
,
const
ProcessorBasePtr
&
_processor_ptr
,
bool
_apply_loss_function
,
FactorStatus
_status
)
:
FactorAutodiff
(
"FactorPointFeetAltitude"
,
TOP_GEOM
,
_ftr_current_ptr
,
nullptr
,
// _frame_other_ptr
nullptr
,
// _capture_other_ptr
nullptr
,
// _feature_other_ptr
nullptr
,
// _landmark_other_ptr
_processor_ptr
,
_apply_loss_function
,
_status
,
_ftr_current_ptr
->
getFrame
()
->
getP
(),
_ftr_current_ptr
->
getFrame
()
->
getO
()
)
{
}
Vector1d
FactorPointFeetAltitude
::
error
()
const
{
Vector3d
pb
=
getFrame
()
->
getP
()
->
getState
();
Vector4d
qb_vec
=
getFrame
()
->
getO
()
->
getState
();
Quaterniond
qb
(
qb_vec
);
// Measurements retrieval
Eigen
::
Matrix
<
double
,
4
,
1
>
meas
=
getMeasurement
();
Vector3d
b_p_bl
=
meas
.
topRows
(
3
);
Vector1d
z
=
meas
.
bottomRows
(
1
);
return
(
pb
+
qb
*
b_p_bl
).
block
(
2
,
0
,
1
,
1
)
-
z
;
}
Vector1d
FactorPointFeetAltitude
::
res
()
const
{
return
getMeasurementSquareRootInformationUpper
()
*
error
();
}
double
FactorPointFeetAltitude
::
cost
()
const
{
return
res
().
squaredNorm
();
}
template
<
typename
T
>
bool
FactorPointFeetAltitude
::
operator
()
(
const
T
*
const
_pb
,
const
T
*
const
_qb
,
T
*
_res
)
const
{
Map
<
Matrix
<
T
,
1
,
1
>
>
res
(
_res
);
// State variables instanciation
Map
<
const
Matrix
<
T
,
3
,
1
>
>
pb
(
_pb
);
Map
<
const
Quaternion
<
T
>
>
qb
(
_qb
);
// Measurements retrieval
Eigen
::
Matrix
<
T
,
4
,
1
>
meas
=
getMeasurement
().
cast
<
T
>
();
Matrix
<
T
,
3
,
1
>
b_p_bl
=
meas
.
topRows
(
3
);
// Bpast_p_BpastL
Matrix
<
T
,
1
,
1
>
z
=
meas
.
bottomRows
(
1
);
// altitude
Matrix
<
T
,
1
,
1
>
err
=
(
pb
+
qb
*
b_p_bl
).
block
(
2
,
0
,
1
,
1
)
-
z
;
res
=
getMeasurementSquareRootInformationUpper
()
*
err
;
return
true
;
}
}
// namespace wolf
#endif
/* FACTOR__POINT_FEET_ALTITUDE_H_ */
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