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
44c1b250
Commit
44c1b250
authored
5 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
WIP New class StateBlockComposite
parent
3b092975
No related branches found
No related tags found
2 merge requests
!358
WIP: Resolve "Complete state vector new data structure?"
,
!343
WIP: Resolve "Complete state vector new data structure?"
Pipeline
#5126
passed
5 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/core/state_block/has_state_blocks.h
+46
-0
46 additions, 0 deletions
include/core/state_block/has_state_blocks.h
with
46 additions
and
0 deletions
include/core/state_block/has_state_blocks.h
+
46
−
0
View file @
44c1b250
...
@@ -18,6 +18,52 @@ namespace wolf
...
@@ -18,6 +18,52 @@ namespace wolf
typedef
std
::
unordered_map
<
std
::
string
,
StateBlockPtr
>
StateBlockMap
;
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
class
HasStateBlocks
{
{
...
...
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