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
Merge requests
!343
WIP: Resolve "Complete state vector new data structure?"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
WIP: Resolve "Complete state vector new data structure?"
287-complete-state-vector-new-data-structure
into
devel
Overview
1
Commits
37
Pipelines
23
Changes
1
Closed
Joan Solà Ortega
requested to merge
287-complete-state-vector-new-data-structure
into
devel
5 years ago
Overview
1
Commits
37
Pipelines
23
Changes
1
Expand
Closes
#287 (closed)
Continues in
!358 (closed)
Edited
5 years ago
by
Joan Solà Ortega
0
0
Merge request reports
Viewing commit
44c1b250
Prev
Next
Show latest version
1 file
+
46
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
44c1b250
WIP New class StateBlockComposite
· 44c1b250
Joan Solà Ortega
authored
5 years ago
include/core/state_block/has_state_blocks.h
+
46
−
0
Options
@@ -18,6 +18,52 @@ namespace wolf
typedef
std
::
unordered_map
<
std
::
string
,
StateBlockPtr
>
StateBlockMap
;
class
StateBlockComposite
{
public:
StateBlockComposite
()
=
default
;
virtual
~
StateBlockComposite
()
=
default
;
const
StateBlockMap
&
getStateBlockMap
()
const
;
// These act on all state blocks. Per-block action must be done through state_block.fix() or through extended API in derived classes of this.
virtual
void
fix
();
virtual
void
unfix
();
virtual
bool
isFixed
()
const
;
virtual
StateBlockPtr
emplace
(
const
std
::
string
&
_sb_type
,
const
StateBlockPtr
&
_sb
);
virtual
unsigned
int
erase
(
const
std
::
string
&
_sb_type
);
virtual
unsigned
int
erase
(
const
char
_sb_type
);
unsigned
int
count
(
const
std
::
string
&
_sb_type
)
const
{
return
state_block_map_
.
count
(
_sb_type
);
}
unsigned
int
count
(
const
StateBlockPtr
&
_sb
)
const
;
StateBlockPtr
at
(
const
std
::
string
&
_sb_type
)
const
;
bool
set
(
const
std
::
string
_sb_type
,
const
StateBlockPtr
&
_sb
);
bool
key
(
const
StateBlockPtr
&
_sb
,
std
::
string
&
_key
)
const
;
StateBlockMap
::
const_iterator
find
(
const
StateBlockPtr
&
_sb
)
const
;
// Emplace derived state blocks (angle, quaternion, etc).
template
<
typename
SB
,
typename
...
Args
>
std
::
shared_ptr
<
SB
>
emplace
(
const
std
::
string
&
_sb_type
,
ProblemPtr
_problem
,
Args
&&
...
_args_of_derived_state_block_constructor
);
// Emplace base state blocks.
template
<
typename
...
Args
>
inline
StateBlockPtr
emplace
(
const
std
::
string
&
_sb_type
,
ProblemPtr
_problem
,
Args
&&
...
_args_of_base_state_block_constructor
);
// Perturb state with noise
void
perturb
(
double
amplitude
=
0.01
);
// Plus operator
void
plus
(
const
VectorComposite
&
_dx
);
// Get composite of state vectors (not blocks)
VectorComposite
getStateComposite
()
const
;
bool
getStateComposite
(
VectorComposite
&
_state
)
const
;
void
setStateComposite
(
const
VectorComposite
&
_state
);
private
:
StateBlockMap
state_block_map_
;
};
class
HasStateBlocks
{
Loading