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
e65badd3
There was a problem fetching the pipeline metadata.
Commit
e65badd3
authored
7 years ago
by
Jeremie Deray
Browse files
Options
Downloads
Patches
Plain Diff
mutex StateBlock state vector
parent
c02e6721
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!205
Mutex state block
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/state_block.h
+16
-3
16 additions, 3 deletions
src/state_block.h
with
16 additions
and
3 deletions
src/state_block.h
+
16
−
3
View file @
e65badd3
...
@@ -14,6 +14,7 @@ class LocalParametrizationBase;
...
@@ -14,6 +14,7 @@ class LocalParametrizationBase;
//std includes
//std includes
#include
<iostream>
#include
<iostream>
#include
<mutex>
namespace
wolf
{
namespace
wolf
{
...
@@ -50,7 +51,10 @@ public:
...
@@ -50,7 +51,10 @@ public:
bool
fixed_
;
///< Key to indicate whether the state is fixed or not
bool
fixed_
;
///< Key to indicate whether the state is fixed or not
std
::
atomic
<
int
>
state_size_
;
///< State vector size
Eigen
::
VectorXs
state_
;
///< State vector storing the state values
Eigen
::
VectorXs
state_
;
///< State vector storing the state values
mutable
std
::
mutex
mut_state_
;
///< State vector mutex
LocalParametrizationBasePtr
local_param_ptr_
;
///< Local parametrization useful for optimizing in the tangent space to the manifold
LocalParametrizationBasePtr
local_param_ptr_
;
///< Local parametrization useful for optimizing in the tangent space to the manifold
public
:
public
:
...
@@ -132,6 +136,7 @@ inline StateBlock::StateBlock(const Eigen::VectorXs& _state, bool _fixed, LocalP
...
@@ -132,6 +136,7 @@ inline StateBlock::StateBlock(const Eigen::VectorXs& _state, bool _fixed, LocalP
// notifications_{Notification::ADD},
// notifications_{Notification::ADD},
node_ptr_
(),
// nullptr
node_ptr_
(),
// nullptr
fixed_
(
_fixed
),
fixed_
(
_fixed
),
state_size_
(
_state
.
size
()),
state_
(
_state
),
state_
(
_state
),
local_param_ptr_
(
_local_param_ptr
)
local_param_ptr_
(
_local_param_ptr
)
{
{
...
@@ -142,6 +147,7 @@ inline StateBlock::StateBlock(const unsigned int _size, bool _fixed, LocalParame
...
@@ -142,6 +147,7 @@ inline StateBlock::StateBlock(const unsigned int _size, bool _fixed, LocalParame
// notifications_{Notification::ADD},
// notifications_{Notification::ADD},
node_ptr_
(),
// nullptr
node_ptr_
(),
// nullptr
fixed_
(
_fixed
),
fixed_
(
_fixed
),
state_size_
(
_size
),
state_
(
Eigen
::
VectorXs
::
Zero
(
_size
)),
state_
(
Eigen
::
VectorXs
::
Zero
(
_size
)),
local_param_ptr_
(
_local_param_ptr
)
local_param_ptr_
(
_local_param_ptr
)
{
{
...
@@ -156,26 +162,33 @@ inline StateBlock::~StateBlock()
...
@@ -156,26 +162,33 @@ inline StateBlock::~StateBlock()
inline
Eigen
::
VectorXs
StateBlock
::
getState
()
const
inline
Eigen
::
VectorXs
StateBlock
::
getState
()
const
{
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mut_state_
);
return
state_
;
return
state_
;
}
}
inline
void
StateBlock
::
setState
(
const
Eigen
::
VectorXs
&
_state
)
inline
void
StateBlock
::
setState
(
const
Eigen
::
VectorXs
&
_state
)
{
{
assert
(
_state
.
size
()
==
state_
.
size
());
assert
(
_state
.
size
()
==
state_
.
size
());
state_
=
_state
;
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mut_state_
);
state_
=
_state
;
state_size_
=
state_
.
size
();
}
addNotification
(
Notification
::
STATE_UPDATE
);
addNotification
(
Notification
::
STATE_UPDATE
);
}
}
inline
unsigned
int
StateBlock
::
getSize
()
const
inline
unsigned
int
StateBlock
::
getSize
()
const
{
{
return
state_
.
size
();
return
state_size
_
.
load
();
}
}
inline
Size
StateBlock
::
getLocalSize
()
const
inline
Size
StateBlock
::
getLocalSize
()
const
{
{
if
(
local_param_ptr_
)
if
(
local_param_ptr_
)
return
local_param_ptr_
->
getLocalSize
();
return
local_param_ptr_
->
getLocalSize
();
return
state_
.
s
ize
();
return
getS
ize
();
}
}
inline
bool
StateBlock
::
isFixed
()
const
inline
bool
StateBlock
::
isFixed
()
const
...
...
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