File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed 
nav2_mppi_controller/include/nav2_mppi_controller Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -163,14 +163,10 @@ class AckermannMotionModel : public MotionModel
163163   */  
164164  void  applyConstraints (models::ControlSequence & control_sequence) override 
165165  {
166-     const  auto  vx_ptr = control_sequence.vx .data ();
167-     auto  wz_ptr = control_sequence.wz .data ();
168-     int  steps = control_sequence.vx .size ();
169-     for (int  i = 0 ; i < steps; i++) {
170-       float  wz_constrained = fabs (*(vx_ptr + i) / min_turning_r_);
171-       float  & wz_curr = *(wz_ptr + i);
172-       wz_curr = utils::clamp (-1  * wz_constrained, wz_constrained, wz_curr);
173-     }
166+     const  auto  wz_constrained = control_sequence.vx .abs () / min_turning_r_;
167+     control_sequence.wz  = control_sequence.wz 
168+       .max ((-wz_constrained))
169+       .min (wz_constrained);
174170  }
175171
176172  /* *
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments