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
f24ce367
Commit
f24ce367
authored
6 years ago
by
Joan Vallvé Navarro
Browse files
Options
Downloads
Patches
Plain Diff
removed useless constructor and added save/load for LandmarkBase
parent
53664abd
No related branches found
No related tags found
1 merge request
!278
Resolve "Revisit demos (formerly called examples) and update them"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/core/landmark/landmark_base.h
+6
-2
6 additions, 2 deletions
include/core/landmark/landmark_base.h
src/landmark/landmark_base.cpp
+41
-16
41 additions, 16 deletions
src/landmark/landmark_base.cpp
test/CMakeLists.txt
+0
-2
0 additions, 2 deletions
test/CMakeLists.txt
with
47 additions
and
20 deletions
include/core/landmark/landmark_base.h
+
6
−
2
View file @
f24ce367
...
@@ -44,8 +44,7 @@ class LandmarkBase : public NodeBase, public std::enable_shared_from_this<Landma
...
@@ -44,8 +44,7 @@ class LandmarkBase : public NodeBase, public std::enable_shared_from_this<Landma
* \param _o_ptr StateBlock pointer to the orientation (default: nullptr)
* \param _o_ptr StateBlock pointer to the orientation (default: nullptr)
*
*
**/
**/
LandmarkBase
(
const
std
::
string
&
_type
,
StateBlockPtr
_p_ptr
,
StateBlockPtr
_o_ptr
=
nullptr
);
LandmarkBase
(
const
std
::
string
&
_type
,
StateBlockPtr
_p_ptr
,
StateBlockPtr
_o_ptr
=
nullptr
);
LandmarkBase
(
MapBaseWPtr
_ptr
,
const
std
::
string
&
_type
,
StateBlockPtr
_p_ptr
,
StateBlockPtr
_o_ptr
=
nullptr
);
virtual
~
LandmarkBase
();
virtual
~
LandmarkBase
();
virtual
void
remove
();
virtual
void
remove
();
virtual
YAML
::
Node
saveToYaml
()
const
;
virtual
YAML
::
Node
saveToYaml
()
const
;
...
@@ -96,6 +95,11 @@ class LandmarkBase : public NodeBase, public std::enable_shared_from_this<Landma
...
@@ -96,6 +95,11 @@ class LandmarkBase : public NodeBase, public std::enable_shared_from_this<Landma
template
<
typename
classType
,
typename
...
T
>
template
<
typename
classType
,
typename
...
T
>
static
std
::
shared_ptr
<
LandmarkBase
>
emplace
(
MapBasePtr
_map_ptr
,
T
&&
...
all
);
static
std
::
shared_ptr
<
LandmarkBase
>
emplace
(
MapBasePtr
_map_ptr
,
T
&&
...
all
);
/** \brief Creator for Factory<LandmarkBase, YAML::Node>
* Caution: This creator does not set the landmark's anchor frame and sensor.
* These need to be set afterwards.
*/
static
LandmarkBasePtr
create
(
const
YAML
::
Node
&
_node
);
};
};
}
}
...
...
This diff is collapsed.
Click to expand it.
src/landmark/landmark_base.cpp
+
41
−
16
View file @
f24ce367
...
@@ -3,17 +3,19 @@
...
@@ -3,17 +3,19 @@
#include
"core/factor/factor_base.h"
#include
"core/factor/factor_base.h"
#include
"core/map/map_base.h"
#include
"core/map/map_base.h"
#include
"core/state_block/state_block.h"
#include
"core/state_block/state_block.h"
#include
"core/state_block/state_quaternion.h"
#include
"core/common/factory.h"
#include
"core/yaml/yaml_conversion.h"
#include
"core/yaml/yaml_conversion.h"
namespace
wolf
{
namespace
wolf
{
unsigned
int
LandmarkBase
::
landmark_id_count_
=
0
;
unsigned
int
LandmarkBase
::
landmark_id_count_
=
0
;
LandmarkBase
::
LandmarkBase
(
const
std
::
string
&
_type
,
StateBlockPtr
_p_ptr
,
StateBlockPtr
_o_ptr
)
:
LandmarkBase
::
LandmarkBase
(
const
std
::
string
&
_type
,
StateBlockPtr
_p_ptr
,
StateBlockPtr
_o_ptr
)
:
NodeBase
(
"LANDMARK"
,
_type
),
NodeBase
(
"LANDMARK"
,
_type
),
map_ptr_
(),
map_ptr_
(),
state_block_vec_
(
2
),
// allow for 2 state blocks by default. Resize in derived constructors if needed.
state_block_vec_
(
2
),
// allow for 2 state blocks by default. Resize in derived constructors if needed.
landmark_id_
(
++
landmark_id_count_
)
landmark_id_
(
++
landmark_id_count_
)
{
{
state_block_vec_
[
0
]
=
_p_ptr
;
state_block_vec_
[
0
]
=
_p_ptr
;
state_block_vec_
[
1
]
=
_o_ptr
;
state_block_vec_
[
1
]
=
_o_ptr
;
...
@@ -21,17 +23,6 @@ unsigned int LandmarkBase::landmark_id_count_ = 0;
...
@@ -21,17 +23,6 @@ unsigned int LandmarkBase::landmark_id_count_ = 0;
// std::cout << "constructed +L" << id() << std::endl;
// std::cout << "constructed +L" << id() << std::endl;
}
}
LandmarkBase
::
LandmarkBase
(
MapBaseWPtr
_ptr
,
const
std
::
string
&
_type
,
StateBlockPtr
_p_ptr
,
StateBlockPtr
_o_ptr
)
:
NodeBase
(
"LANDMARK"
,
_type
),
map_ptr_
(
_ptr
),
state_block_vec_
(
2
),
// allow for 2 state blocks by default. Resize in derived constructors if needed.
landmark_id_
(
++
landmark_id_count_
)
{
state_block_vec_
[
0
]
=
_p_ptr
;
state_block_vec_
[
1
]
=
_o_ptr
;
// std::cout << "constructed +L" << id() << std::endl;
}
LandmarkBase
::~
LandmarkBase
()
LandmarkBase
::~
LandmarkBase
()
{
{
removeStateBlocks
();
removeStateBlocks
();
...
@@ -170,6 +161,7 @@ YAML::Node LandmarkBase::saveToYaml() const
...
@@ -170,6 +161,7 @@ YAML::Node LandmarkBase::saveToYaml() const
}
}
return
node
;
return
node
;
}
}
void
LandmarkBase
::
link
(
MapBasePtr
_map_ptr
)
void
LandmarkBase
::
link
(
MapBasePtr
_map_ptr
)
{
{
if
(
_map_ptr
)
if
(
_map_ptr
)
...
@@ -192,4 +184,37 @@ FactorBasePtr LandmarkBase::addConstrainedBy(FactorBasePtr _fac_ptr)
...
@@ -192,4 +184,37 @@ FactorBasePtr LandmarkBase::addConstrainedBy(FactorBasePtr _fac_ptr)
return
_fac_ptr
;
return
_fac_ptr
;
}
}
LandmarkBasePtr
LandmarkBase
::
create
(
const
YAML
::
Node
&
_node
)
{
unsigned
int
id
=
_node
[
"id"
]
.
as
<
unsigned
int
>
();
Eigen
::
VectorXs
pos
=
_node
[
"position"
]
.
as
<
Eigen
::
VectorXs
>
();
bool
pos_fixed
=
_node
[
"position fixed"
]
.
as
<
bool
>
();
std
::
string
type
=
_node
[
"type"
]
.
as
<
std
::
string
>
();
StateBlockPtr
pos_sb
=
std
::
make_shared
<
StateBlock
>
(
pos
,
pos_fixed
);
StateBlockPtr
ori_sb
=
nullptr
;
if
(
!
_node
[
"orientation"
].
as
<
std
::
string
>
().
empty
())
{
Eigen
::
VectorXs
ori
=
_node
[
"orientation"
].
as
<
Eigen
::
VectorXs
>
();
bool
ori_fixed
=
_node
[
"orientation fixed"
].
as
<
bool
>
();
if
(
ori
.
size
()
==
4
)
ori_sb
=
std
::
make_shared
<
StateQuaternion
>
(
ori
,
ori_fixed
);
else
ori_sb
=
std
::
make_shared
<
StateBlock
>
(
ori
,
ori_fixed
);
}
LandmarkBasePtr
lmk
=
std
::
make_shared
<
LandmarkBase
>
(
type
,
pos_sb
,
ori_sb
);
lmk
->
setId
(
id
);
return
lmk
;
}
// Register landmark creator
namespace
{
const
bool
WOLF_UNUSED
registered_lmk_ahp
=
LandmarkFactory
::
get
().
registerCreator
(
"BASE"
,
LandmarkBase
::
create
);
}
}
// namespace wolf
}
// namespace wolf
This diff is collapsed.
Click to expand it.
test/CMakeLists.txt
+
0
−
2
View file @
f24ce367
...
@@ -175,12 +175,10 @@ target_link_libraries(gtest_make_posdef ${PROJECT_NAME})
...
@@ -175,12 +175,10 @@ target_link_libraries(gtest_make_posdef ${PROJECT_NAME})
wolf_add_gtest
(
gtest_param_prior gtest_param_prior.cpp
)
wolf_add_gtest
(
gtest_param_prior gtest_param_prior.cpp
)
target_link_libraries
(
gtest_param_prior
${
PROJECT_NAME
}
)
target_link_libraries
(
gtest_param_prior
${
PROJECT_NAME
}
)
# ProcessorFrameNearestNeighborFilter class test
# ProcessorFrameNearestNeighborFilter class test
wolf_add_gtest
(
gtest_processor_frame_nearest_neighbor_filter_2D gtest_processor_frame_nearest_neighbor_filter_2D.cpp
)
wolf_add_gtest
(
gtest_processor_frame_nearest_neighbor_filter_2D gtest_processor_frame_nearest_neighbor_filter_2D.cpp
)
target_link_libraries
(
gtest_processor_frame_nearest_neighbor_filter_2D
${
PROJECT_NAME
}
)
target_link_libraries
(
gtest_processor_frame_nearest_neighbor_filter_2D
${
PROJECT_NAME
}
)
# ProcessorMotion in 2D
# ProcessorMotion in 2D
wolf_add_gtest
(
gtest_odom_2D gtest_odom_2D.cpp
)
wolf_add_gtest
(
gtest_odom_2D gtest_odom_2D.cpp
)
target_link_libraries
(
gtest_odom_2D
${
PROJECT_NAME
}
)
target_link_libraries
(
gtest_odom_2D
${
PROJECT_NAME
}
)
...
...
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