Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iri_safe_cmd
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
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
labrobotica
ros
navigation
iri_safe_cmd
Commits
75412a73
Commit
75412a73
authored
10 years ago
by
Fernando Herrero
Browse files
Options
Downloads
Patches
Plain Diff
iri_safe_cmd: publish cmd_vel messages ONLY if new input cmd_vel msg received
parent
26e22509
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
include/safe_cmd_alg_node.h
+1
-0
1 addition, 0 deletions
include/safe_cmd_alg_node.h
src/safe_cmd_alg_node.cpp
+8
-3
8 additions, 3 deletions
src/safe_cmd_alg_node.cpp
with
9 additions
and
3 deletions
include/safe_cmd_alg_node.h
+
1
−
0
View file @
75412a73
...
@@ -63,6 +63,7 @@ class SafeCmdAlgNode : public algorithm_base::IriBaseAlgorithm<SafeCmdAlgorithm>
...
@@ -63,6 +63,7 @@ class SafeCmdAlgNode : public algorithm_base::IriBaseAlgorithm<SafeCmdAlgorithm>
bool
front_laser_received_
;
bool
front_laser_received_
;
bool
rear_laser_received_
;
bool
rear_laser_received_
;
bool
new_cmd_vel
;
// [service attributes]
// [service attributes]
...
...
This diff is collapsed.
Click to expand it.
src/safe_cmd_alg_node.cpp
+
8
−
3
View file @
75412a73
...
@@ -9,7 +9,8 @@ SafeCmdAlgNode::SafeCmdAlgNode(void) :
...
@@ -9,7 +9,8 @@ SafeCmdAlgNode::SafeCmdAlgNode(void) :
limit_vel_front_
(
1.0
),
limit_vel_front_
(
1.0
),
limit_vel_rear_
(
1.0
),
limit_vel_rear_
(
1.0
),
front_laser_received_
(
false
),
front_laser_received_
(
false
),
rear_laser_received_
(
false
)
rear_laser_received_
(
false
),
new_cmd_vel
(
false
)
{
{
//init class attributes if necessary
//init class attributes if necessary
loop_rate_
=
20
;
//in [Hz]
loop_rate_
=
20
;
//in [Hz]
...
@@ -88,7 +89,11 @@ void SafeCmdAlgNode::mainNodeThread(void)
...
@@ -88,7 +89,11 @@ void SafeCmdAlgNode::mainNodeThread(void)
// [fill action structure and make request to the action server]
// [fill action structure and make request to the action server]
// [publish messages]
// [publish messages]
cmd_vel_safe_publisher_
.
publish
(
Twist_msg_
);
if
(
this
->
new_cmd_vel
)
{
cmd_vel_safe_publisher_
.
publish
(
Twist_msg_
);
this
->
new_cmd_vel
=
false
;
}
this
->
alg_
.
unlock
();
this
->
alg_
.
unlock
();
...
@@ -119,7 +124,7 @@ void SafeCmdAlgNode::cmd_vel_callback(const geometry_msgs::Twist::ConstPtr& msg)
...
@@ -119,7 +124,7 @@ void SafeCmdAlgNode::cmd_vel_callback(const geometry_msgs::Twist::ConstPtr& msg)
last_twist_
=
*
msg
;
last_twist_
=
*
msg
;
}
else
}
else
Twist_msg_
=
*
msg
;
Twist_msg_
=
*
msg
;
this
->
new_cmd_vel
=
true
;
//unlock previously blocked shared variables
//unlock previously blocked shared variables
this
->
alg_
.
unlock
();
this
->
alg_
.
unlock
();
//cmd_vel_mutex_.exit();
//cmd_vel_mutex_.exit();
...
...
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