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
786fdbe9
Commit
786fdbe9
authored
4 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Add Sensor::printState()
parent
56c50154
No related branches found
No related tags found
No related merge requests found
Pipeline
#6607
passed
4 years ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/core/sensor/sensor_base.h
+2
-0
2 additions, 0 deletions
include/core/sensor/sensor_base.h
src/sensor/sensor_base.cpp
+31
-0
31 additions, 0 deletions
src/sensor/sensor_base.cpp
with
33 additions
and
0 deletions
include/core/sensor/sensor_base.h
+
2
−
0
View file @
786fdbe9
...
...
@@ -244,6 +244,8 @@ class SensorBase : public NodeBase, public HasStateBlocks, public std::enable_sh
bool
state_blocks
,
std
::
ostream
&
stream
,
std
::
string
_tabs
=
""
)
const
;
void
printState
(
bool
_metric
,
bool
_state_blocks
,
std
::
ostream
&
_stream
,
std
::
string
_tabs
)
const
;
void
print
(
int
depth
,
//
bool
constr_by
,
//
bool
metric
,
//
...
...
This diff is collapsed.
Click to expand it.
src/sensor/sensor_base.cpp
+
31
−
0
View file @
786fdbe9
...
...
@@ -429,6 +429,36 @@ void SensorBase::printHeader(int _depth, bool _constr_by, bool _metric, bool _st
printState
(
_metric
,
_state_blocks
,
_stream
,
_tabs
);
}
void
SensorBase
::
printState
(
bool
_metric
,
bool
_state_blocks
,
std
::
ostream
&
_stream
,
std
::
string
_tabs
)
const
{
if
(
_metric
&&
_state_blocks
)
{
for
(
const
auto
&
key
:
getStructure
())
{
auto
sb
=
getStateBlockDynamic
(
key
);
if
(
sb
)
_stream
<<
_tabs
<<
" "
<<
key
<<
"["
<<
(
sb
->
isFixed
()
?
"Fix"
:
"Est"
)
<<
"] = ( "
<<
std
::
setprecision
(
3
)
<<
sb
->
getState
().
transpose
()
<<
" )"
<<
" @ "
<<
sb
<<
std
::
endl
;
}
}
else
if
(
_metric
)
{
_stream
<<
_tabs
<<
" "
<<
(
isFixed
()
?
"Fix"
:
"Est"
)
<<
",
\t
x = ( "
<<
std
::
setprecision
(
3
)
<<
getStateVector
().
transpose
()
<<
" )"
<<
std
::
endl
;
}
else
if
(
_state_blocks
)
{
_stream
<<
_tabs
<<
" "
<<
"sb:"
;
for
(
const
auto
&
key
:
getStructure
())
{
const
auto
&
sb
=
getStateBlockDynamic
(
key
);
if
(
sb
)
_stream
<<
" "
<<
key
<<
"["
<<
(
sb
->
isFixed
()
?
"Fix"
:
"Est"
)
<<
"] @ "
<<
sb
;
}
_stream
<<
std
::
endl
;
}
}
void
SensorBase
::
print
(
int
_depth
,
bool
_constr_by
,
bool
_metric
,
bool
_state_blocks
,
std
::
ostream
&
_stream
,
std
::
string
_tabs
)
const
{
printHeader
(
_depth
,
_constr_by
,
_metric
,
_state_blocks
,
_stream
,
_tabs
);
...
...
@@ -509,4 +539,5 @@ bool SensorBase::check(CheckLog& _log, std::shared_ptr<NodeBase> _node_ptr, bool
return
_log
.
is_consistent_
;
}
}
// namespace wolf
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