@@ -81,29 +81,27 @@ bool SimpleSmoother::smooth(
8181 std::lock_guard<nav2_costmap_2d::Costmap2D::mutex_t > lock (*(costmap->getMutex ()));
8282
8383 for (unsigned int i = 0 ; i != path_segments.size (); i++) {
84- if (path_segments[i].end - path_segments[i].start > 9 ) {
85- // Populate path segment
86- curr_path_segment.poses .clear ();
87- std::copy (
88- path.poses .begin () + path_segments[i].start ,
89- path.poses .begin () + path_segments[i].end + 1 ,
90- std::back_inserter (curr_path_segment.poses ));
91-
92- // Make sure we're still able to smooth with time remaining
93- steady_clock::time_point now = steady_clock::now ();
94- time_remaining = max_time.seconds () - duration_cast<duration<double >>(now - start).count ();
95- refinement_ctr_ = 0 ;
96-
97- // Attempt to smooth the segment
98- // May throw SmootherTimedOut
99- smoothImpl (curr_path_segment, reversing_segment, costmap.get (), time_remaining);
100-
101- // Assemble the path changes to the main path
102- std::copy (
103- curr_path_segment.poses .begin (),
104- curr_path_segment.poses .end (),
105- path.poses .begin () + path_segments[i].start );
106- }
84+ // Populate path segment
85+ curr_path_segment.poses .clear ();
86+ std::copy (
87+ path.poses .begin () + path_segments[i].start ,
88+ path.poses .begin () + path_segments[i].end + 1 ,
89+ std::back_inserter (curr_path_segment.poses ));
90+
91+ // Make sure we're still able to smooth with time remaining
92+ steady_clock::time_point now = steady_clock::now ();
93+ time_remaining = max_time.seconds () - duration_cast<duration<double >>(now - start).count ();
94+ refinement_ctr_ = 0 ;
95+
96+ // Attempt to smooth the segment
97+ // May throw SmootherTimedOut
98+ smoothImpl (curr_path_segment, reversing_segment, costmap.get (), time_remaining);
99+
100+ // Assemble the path changes to the main path
101+ std::copy (
102+ curr_path_segment.poses .begin (),
103+ curr_path_segment.poses .end (),
104+ path.poses .begin () + path_segments[i].start );
107105 }
108106
109107 return true ;
0 commit comments