Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
franka_description
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
CeTI
ROS
ROS Packages
franka_description
Commits
5bc0683a
Commit
5bc0683a
authored
5 years ago
by
Christoph Jähne
Browse files
Options
Downloads
Patches
Plain Diff
use lock_guards for command and state acess
parent
314b3e63
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
franka_hw/include/franka_hw/franka_combinable_hw.h
+6
-5
6 additions, 5 deletions
franka_hw/include/franka_hw/franka_combinable_hw.h
franka_hw/src/franka_combinable_hw.cpp
+11
-9
11 additions, 9 deletions
franka_hw/src/franka_combinable_hw.cpp
with
17 additions
and
14 deletions
franka_hw/include/franka_hw/franka_combinable_hw.h
+
6
−
5
View file @
5bc0683a
...
...
@@ -131,12 +131,13 @@ class FrankaCombinableHW : public FrankaHW {
throw
std
::
invalid_argument
(
error_message
);
}
checkJointLimits
();
libfranka_state_mutex_
.
lock
();
robot_state_libfranka_
=
robot_state
;
libfranka_state_mutex_
.
unlock
();
libfranka_cmd_mutex_
.
lock
();
{
std
::
lock_guard
<
std
::
mutex
>
state_lock
(
libfranka_state_mutex_
);
robot_state_libfranka_
=
robot_state
;
}
std
::
lock_guard
<
std
::
mutex
>
command_lock
(
libfranka_cmd_mutex_
);
T
current_cmd
=
command
;
libfranka_cmd_mutex_
.
unlock
();
if
(
has_error_
||
!
controller_active_
)
{
return
franka
::
MotionFinished
(
current_cmd
);
}
...
...
This diff is collapsed.
Click to expand it.
franka_hw/src/franka_combinable_hw.cpp
+
11
−
9
View file @
5bc0683a
...
...
@@ -54,12 +54,13 @@ void FrankaCombinableHW::controlLoop() {
checkJointLimits
();
ros_state_mutex_
.
lock
();
libfranka_state_mutex_
.
lock
();
robot_state_libfranka_
=
robot_
->
readOnce
();
robot_state_ros_
=
robot_
->
readOnce
();
libfranka_state_mutex_
.
unlock
();
ros_state_mutex_
.
unlock
();
{
std
::
lock_guard
<
std
::
mutex
>
ros_state_lock
(
ros_state_mutex_
);
std
::
lock_guard
<
std
::
mutex
>
libfranka_state_lock
(
libfranka_state_mutex_
);
robot_state_libfranka_
=
robot_
->
readOnce
();
robot_state_ros_
=
robot_
->
readOnce
();
}
if
(
!
ros
::
ok
())
{
return
;
}
...
...
@@ -67,9 +68,10 @@ void FrankaCombinableHW::controlLoop() {
ROS_INFO
(
"FrankaCombinableHW::%s::control_loop(): controller is active."
,
arm_id_
.
c_str
());
// Reset commands
libfranka_cmd_mutex_
.
lock
();
effort_joint_command_libfranka_
=
franka
::
Torques
({
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
});
libfranka_cmd_mutex_
.
unlock
();
{
std
::
lock_guard
<
std
::
mutex
>
command_lock
(
libfranka_cmd_mutex_
);
effort_joint_command_libfranka_
=
franka
::
Torques
({
0.
,
0.
,
0.
,
0.
,
0.
,
0.
,
0.
});
}
try
{
control
();
...
...
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