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
dafd83e8
Commit
dafd83e8
authored
5 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Put operator<< in Eigen namespace
parent
d874a3b3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!358
WIP: Resolve "Complete state vector new data structure?"
,
!343
WIP: Resolve "Complete state vector new data structure?"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/core/state_block/state_composite.h
+11
-2
11 additions, 2 deletions
include/core/state_block/state_composite.h
src/state_block/state_composite.cpp
+13
-12
13 additions, 12 deletions
src/state_block/state_composite.cpp
test/gtest_state_composite.cpp
+8
-7
8 additions, 7 deletions
test/gtest_state_composite.cpp
with
32 additions
and
21 deletions
include/core/state_block/state_composite.h
+
11
−
2
View file @
dafd83e8
...
@@ -26,6 +26,17 @@ typedef std::unordered_map < std::string, StateBlockPtr > StateBlockMap;
...
@@ -26,6 +26,17 @@ typedef std::unordered_map < std::string, StateBlockPtr > StateBlockMap;
typedef
std
::
unordered_map
<
std
::
string
,
Eigen
::
VectorXd
>
VectorComposite
;
typedef
std
::
unordered_map
<
std
::
string
,
Eigen
::
VectorXd
>
VectorComposite
;
typedef
StateBlockMap
::
const_iterator
StateBlockMapCIter
;
typedef
StateBlockMap
::
const_iterator
StateBlockMapCIter
;
typedef
std
::
unordered_map
<
std
::
string
,
Eigen
::
VectorXd
>
VectorComposite
;
}
namespace
Eigen
{
std
::
ostream
&
operator
<<
(
std
::
ostream
&
_os
,
const
wolf
::
VectorComposite
&
_x
);
}
namespace
wolf
{
class
StateBlockComposite
class
StateBlockComposite
{
{
public:
public:
...
@@ -139,8 +150,6 @@ inline unsigned int MatrixComposite::count(const std::string &_row, const std::s
...
@@ -139,8 +150,6 @@ inline unsigned int MatrixComposite::count(const std::string &_row, const std::s
return
(
matrix_composite_
.
at
(
_row
).
count
(
_col
));
return
(
matrix_composite_
.
at
(
_row
).
count
(
_col
));
}
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
_os
,
const
VectorComposite
&
_x
);
template
<
typename
SB
,
typename
...
Args
>
template
<
typename
SB
,
typename
...
Args
>
inline
std
::
shared_ptr
<
SB
>
wolf
::
StateBlockComposite
::
emplace
(
const
std
::
string
&
_sb_type
,
inline
std
::
shared_ptr
<
SB
>
wolf
::
StateBlockComposite
::
emplace
(
const
std
::
string
&
_sb_type
,
...
...
This diff is collapsed.
Click to expand it.
src/state_block/state_composite.cpp
+
13
−
12
View file @
dafd83e8
...
@@ -4,6 +4,19 @@
...
@@ -4,6 +4,19 @@
#include
"core/state_block/state_composite.h"
#include
"core/state_block/state_composite.h"
#include
"core/state_block/state_block.h"
#include
"core/state_block/state_block.h"
namespace
Eigen
{
std
::
ostream
&
operator
<<
(
std
::
ostream
&
_os
,
const
wolf
::
VectorComposite
&
_x
)
{
for
(
const
auto
&
pair_key_vec
:
_x
)
{
const
auto
&
key
=
pair_key_vec
.
first
;
const
auto
&
vec
=
pair_key_vec
.
second
;
_os
<<
"
\n
block("
<<
key
<<
") =
\n
"
<<
vec
;
}
return
_os
;
}
}
namespace
wolf
namespace
wolf
{
{
...
@@ -135,18 +148,6 @@ std::ostream& operator <<(std::ostream &_os, const MatrixComposite &_M)
...
@@ -135,18 +148,6 @@ std::ostream& operator <<(std::ostream &_os, const MatrixComposite &_M)
return
_os
;
return
_os
;
}
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
_os
,
const
VectorComposite
&
_x
)
{
for
(
const
auto
&
pair_row_blk
:
_x
)
{
const
auto
&
row
=
pair_row_blk
.
first
;
const
auto
&
vec
=
pair_row_blk
.
second
;
_os
<<
"
\n
block("
<<
row
<<
") =
\n
"
<<
vec
;
}
return
_os
;
}
const
StateBlockMap
&
StateBlockComposite
::
getStateBlockMap
()
const
const
StateBlockMap
&
StateBlockComposite
::
getStateBlockMap
()
const
{
{
...
...
This diff is collapsed.
Click to expand it.
test/gtest_state_composite.cpp
+
8
−
7
View file @
dafd83e8
...
@@ -5,14 +5,11 @@
...
@@ -5,14 +5,11 @@
* Author: jsola
* Author: jsola
*/
*/
#include
"core/utils/utils_gtest.h"
#include
"core/utils/logging.h"
#include
"core/common/wolf.h"
#include
"core/state_block/state_composite.h"
#include
"core/state_block/state_composite.h"
#include
"core/state_block/state_quaternion.h"
#include
"core/state_block/state_quaternion.h"
#include
"core/utils/utils_gtest.h"
using
namespace
wolf
;
using
namespace
wolf
;
using
namespace
std
;
using
namespace
std
;
...
@@ -215,6 +212,8 @@ TEST(VectorComposite, operatorStream)
...
@@ -215,6 +212,8 @@ TEST(VectorComposite, operatorStream)
cout
<<
"x = "
<<
x
<<
endl
;
cout
<<
"x = "
<<
x
<<
endl
;
WOLF_DEBUG
(
"X = "
,
x
);
}
}
TEST
(
MatrixComposite
,
emplace_operatorStream
)
TEST
(
MatrixComposite
,
emplace_operatorStream
)
...
@@ -330,7 +329,9 @@ TEST(MatrixComposite, productVector)
...
@@ -330,7 +329,9 @@ TEST(MatrixComposite, productVector)
x
.
emplace
(
"P"
,
Vector2d
(
1
,
1
));
x
.
emplace
(
"P"
,
Vector2d
(
1
,
1
));
x
.
emplace
(
"O"
,
Vector3d
(
2
,
2
,
2
));
x
.
emplace
(
"O"
,
Vector3d
(
2
,
2
,
2
));
WOLF_DEBUG
(
"x = "
,
x
);
cout
<<
"x= "
<<
x
<<
endl
;
// WOLF_DEBUG("x = " , x);
MatrixComposite
M
;
MatrixComposite
M
;
...
@@ -350,7 +351,7 @@ TEST(MatrixComposite, productVector)
...
@@ -350,7 +351,7 @@ TEST(MatrixComposite, productVector)
y
=
M
*
x
;
y
=
M
*
x
;
WOLF_DEBUG
(
"y = M * x = "
,
y
);
//
WOLF_DEBUG("y = M * x = " , y);
/* M * x = y
/* M * x = y
* p o
* p o
...
...
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