Skip to content

Commit 8bb9357

Browse files
authored
Bug Fix
Fix for 'Your executeCallback did not set the goal to a terminal status. This is a bug in your ActionServer implementation. Fix your code!
1 parent e9a4b41 commit 8bb9357

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

chapter_1_codes/mastering_ros_demo_pkg/src/demo_action_server.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Demo_actionAction
7878
if(!as.isActive() || as.isPreemptRequested()) return;
7979
ros::Rate rate(5);
8080
ROS_INFO("%s is processing the goal %d", action_name.c_str(), goal->count);
81-
for(progress = 0 ; progress < goal->count; progress++){
81+
for(progress = 1 ; progress <= goal->count; progress++){
8282
//Check for ros
8383
if(!ros::ok()){
8484
result.final_count = progress;
@@ -92,10 +92,11 @@ class Demo_actionAction
9292
return;
9393
}
9494

95-
if(goal->count == progress){
95+
if(goal->count <= progress){
9696
ROS_INFO("%s Succeeded at getting to goal %d", action_name.c_str(), goal->count);
9797
result.final_count = progress;
9898
as.setSucceeded(result);
99+
99100
}else{
100101
ROS_INFO("Setting to goal %d / %d",feedback.current_number,goal->count);
101102
feedback.current_number = progress;

0 commit comments

Comments
 (0)