Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
laser
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
laser
Commits
89872fd4
Commit
89872fd4
authored
3 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
Delete factor_container.h not used anywhere
parent
232ecaf5
No related branches found
Branches containing commit
No related tags found
2 merge requests
!30
Release after RAL
,
!29
After 2nd RAL submission
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/laser/factor/factor_container.h
+0
-154
0 additions, 154 deletions
include/laser/factor/factor_container.h
with
0 additions
and
154 deletions
include/laser/factor/factor_container.h
deleted
100644 → 0
+
0
−
154
View file @
232ecaf5
//--------LICENSE_START--------
//
// Copyright (C) 2020,2021,2022 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
// Authors: Joan Solà Ortega (jsola@iri.upc.edu)
// All rights reserved.
//
// This file is part of WOLF
// WOLF is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
#ifndef FACTOR_CONTAINER_H_
#define FACTOR_CONTAINER_H_
//Wolf includes
#include
"core/common/wolf.h"
#include
"core/factor/factor_autodiff.h"
#include
"core/landmark/landmark_container.h"
namespace
wolf
{
WOLF_PTR_TYPEDEFS
(
FactorContainer
);
class
FactorContainer
:
public
FactorAutodiff
<
FactorContainer
,
3
,
2
,
1
,
2
,
1
>
{
protected:
LandmarkContainerWPtr
lmk_ptr_
;
unsigned
int
corner_
;
public:
FactorContainer
(
const
FeatureBasePtr
&
_ftr_ptr
,
const
LandmarkContainerPtr
&
_lmk_ptr
,
const
ProcessorBasePtr
&
_processor_ptr
,
const
unsigned
int
_corner
,
bool
_apply_loss_function
,
FactorStatus
_status
=
FAC_ACTIVE
)
:
FactorAutodiff
<
FactorContainer
,
3
,
2
,
1
,
2
,
1
>
(
"FactorContainer"
,
TOP_LMK
,
nullptr
,
nullptr
,
nullptr
,
_lmk_ptr
,
_processor_ptr
,
_apply_loss_function
,
_status
,
_ftr_ptr
->
getFrame
()
->
getP
(),
_ftr_ptr
->
getFrame
()
->
getO
(),
_lmk_ptr
->
getP
(),
_lmk_ptr
->
getO
()),
lmk_ptr_
(
_lmk_ptr
),
corner_
(
_corner
)
{
assert
(
/*_corner >= 0 &&*/
_corner
<=
3
&&
"Wrong corner id in factor container constructor"
);
std
::
cout
<<
"new factor container: corner idx = "
<<
corner_
<<
std
::
endl
;
}
virtual
~
FactorContainer
()
=
default
;
LandmarkContainerPtr
getLandmark
()
{
return
lmk_ptr_
.
lock
();
}
template
<
typename
T
>
bool
operator
()(
const
T
*
const
_robotP
,
const
T
*
const
_robotO
,
const
T
*
const
_landmarkP
,
const
T
*
const
_landmarkO
,
T
*
_residuals
)
const
{
// Mapping
Eigen
::
Map
<
const
Eigen
::
Matrix
<
T
,
2
,
1
>>
landmark_position_map
(
_landmarkP
);
Eigen
::
Map
<
const
Eigen
::
Matrix
<
T
,
2
,
1
>>
robot_position_map
(
_robotP
);
Eigen
::
Map
<
Eigen
::
Matrix
<
T
,
3
,
1
>>
residuals_map
(
_residuals
);
//std::cout << "getSensorPosition: " << std::endl;
//std::cout << getCapture()->getSensor()->getSensorPosition()->head(2).transpose() << std::endl;
//std::cout << "getSensorRotation: " << std::endl;
//std::cout << getCapture()->getSensor()->getSensorRotation()->topLeftCorner<2,2>() << std::endl;
//std::cout << "atan2: " << atan2(getCapture()->getSensor()->getSensorRotation()->transpose()(0,1),getCapture()->getSensor()->getSensorRotation()->transpose()(0,0)) << std::endl;
// sensor transformation
Eigen
::
Matrix
<
T
,
2
,
1
>
sensor_position
=
getCapture
()
->
getSensor
()
->
getP
()
->
getState
().
head
(
2
).
cast
<
T
>
();
Eigen
::
Matrix
<
T
,
2
,
2
>
inverse_R_sensor
=
Eigen
::
Rotation2D
<
T
>
(
T
(
-
getCapture
()
->
getSensorO
()
->
getState
()(
0
))).
matrix
();
// robot information
Eigen
::
Matrix
<
T
,
2
,
2
>
inverse_R_robot
=
Eigen
::
Rotation2D
<
T
>
(
-
_robotO
[
0
]).
matrix
();
Eigen
::
Matrix
<
T
,
2
,
2
>
R_landmark
=
Eigen
::
Rotation2D
<
T
>
(
_landmarkO
[
0
]).
matrix
();
Eigen
::
Matrix
<
T
,
2
,
1
>
corner_position
=
lmk_ptr_
.
lock
()
->
getCorner
(
corner_
).
head
<
2
>
().
cast
<
T
>
();
// Expected measurement
Eigen
::
Matrix
<
T
,
2
,
1
>
expected_measurement_position
=
inverse_R_sensor
*
(
inverse_R_robot
*
(
landmark_position_map
-
robot_position_map
+
R_landmark
*
corner_position
)
-
sensor_position
);
T
expected_measurement_orientation
=
_landmarkO
[
0
]
-
_robotO
[
0
]
-
T
(
getCapture
()
->
getSensor
()
->
getO
()
->
getState
()(
0
))
+
T
(
lmk_ptr_
.
lock
()
->
getCorner
(
corner_
)(
2
));
// Error
residuals_map
.
head
(
2
)
=
expected_measurement_position
-
getMeasurement
().
head
<
2
>
().
cast
<
T
>
();
residuals_map
(
2
)
=
expected_measurement_orientation
-
T
(
getMeasurement
()(
2
));
// pi 2 pi
while
(
_residuals
[
2
]
>
T
(
M_PI
))
_residuals
[
2
]
=
_residuals
[
2
]
-
T
(
2
*
M_PI
);
while
(
_residuals
[
2
]
<=
T
(
-
M_PI
))
_residuals
[
2
]
=
_residuals
[
2
]
+
T
(
2
*
M_PI
);
// Residuals
residuals_map
=
getMeasurementSquareRootInformationUpper
().
cast
<
T
>
()
*
residuals_map
;
//std::cout << "\nFACTOR: " << id() << std::endl;
//std::cout << "Feature: " << getFeature()->id() << std::endl;
//std::cout << "Landmark: " << lmk_ptr_->id() << std::endl;
//std::cout << "measurement:\n\t" << getMeasurement().transpose() << std::endl;
//
//std::cout << "robot pose:";
//for (int i=0; i < 2; i++)
// std::cout << "\n\t" << _robotP[i];
//std::cout << "\n\t" << _robotO[0];
//std::cout << std::endl;
//
//std::cout << "landmark pose:";
//for (int i=0; i < 2; i++)
// std::cout << "\n\t" << _landmarkP[i];
//std::cout << "\n\t" << _landmarkO[0];
//std::cout << std::endl;
//
//std::cout << "landmark pose (w.r.t sensor):";
//Eigen::Matrix<T,2,1> relative_landmark_position = inverse_R_sensor * (inverse_R_robot * (landmark_position - robot_position) - sensor_position);
//for (int i=0; i < 2; i++)
// std::cout << "\n\t" << relative_landmark_position.data()[i];
//std::cout << "\n\t" << _landmarkO[0] - _robotO[0] - T( *(getCapture()->getSensor()->getO()->get()) );
//std::cout << std::endl;
//
//std::cout << "expected_measurement: ";
//for (int i=0; i < 2; i++)
// std::cout << "\n\t" << expected_measurement_position.data()[i];
//std::cout << "\n\t" << expected_measurement_orientation << std::endl;
//
//std::cout << "_residuals: "<< std::endl;
//for (int i=0; i < 3; i++)
// std::cout << "\n\t" << _residuals[i] << " ";
//std::cout << std::endl;
return
true
;
}
};
}
// namespace wolf
#endif
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