pi: use sample weight.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
This commit is contained in:
		
							parent
							
								
									5d6c3433f7
								
							
						
					
					
						commit
						32689328f1
					
				
							
								
								
									
										4
									
								
								pi.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								pi.c
									
									
									
									
									
								
							@ -137,8 +137,8 @@ static double pi_sample(struct servo *servo,
 | 
				
			|||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ki_term = s->ki * offset;
 | 
							ki_term = s->ki * offset * weight;
 | 
				
			||||||
		ppb = s->kp * offset + s->drift + ki_term;
 | 
							ppb = s->kp * offset * weight + s->drift + ki_term;
 | 
				
			||||||
		if (ppb < -servo->max_frequency) {
 | 
							if (ppb < -servo->max_frequency) {
 | 
				
			||||||
			ppb = -servo->max_frequency;
 | 
								ppb = -servo->max_frequency;
 | 
				
			||||||
		} else if (ppb > servo->max_frequency) {
 | 
							} else if (ppb > servo->max_frequency) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user