Update kuukar_motion.py
This commit is contained in:
		
							parent
							
								
									c49f940ca0
								
							
						
					
					
						commit
						e615010ce7
					
				
					 1 changed files with 15 additions and 4 deletions
				
			
		| 
						 | 
					@ -100,6 +100,17 @@ class motion:
 | 
				
			||||||
        if speed>99: speed=99
 | 
					        if speed>99: speed=99
 | 
				
			||||||
        elif speed<-99: speed= -99
 | 
					        elif speed<-99: speed= -99
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (rightSpeed - leftSpeed) > 0:     
 | 
				
			||||||
 | 
					            self.motor_write(MOTOR_FL_F, MOTOR_FL_R, -1*abs(leftSpeed))
 | 
				
			||||||
 | 
					            self.motor_write(MOTOR_FR_F, MOTOR_FR_R, abs(rightSpeed))
 | 
				
			||||||
 | 
					            self.motor_write(MOTOR_RL_F, MOTOR_RL_R, speed)
 | 
				
			||||||
 | 
					            self.motor_write(MOTOR_RR_F, MOTOR_RR_R, speed)
 | 
				
			||||||
 | 
					        elif (rightSpeed - leftSpeed) < 0:
 | 
				
			||||||
 | 
					            self.motor_write(MOTOR_FL_F, MOTOR_FL_R, abs(leftSpeed))
 | 
				
			||||||
 | 
					            self.motor_write(MOTOR_FR_F, MOTOR_FR_R, -1*abs(rightSpeed))
 | 
				
			||||||
 | 
					            self.motor_write(MOTOR_RL_F, MOTOR_RL_R, speed)
 | 
				
			||||||
 | 
					            self.motor_write(MOTOR_RR_F, MOTOR_RR_R, speed)
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
            self.motor_write(MOTOR_FL_F, MOTOR_FL_R, abs(leftSpeed))
 | 
					            self.motor_write(MOTOR_FL_F, MOTOR_FL_R, abs(leftSpeed))
 | 
				
			||||||
            self.motor_write(MOTOR_FR_F, MOTOR_FR_R, abs(rightSpeed))
 | 
					            self.motor_write(MOTOR_FR_F, MOTOR_FR_R, abs(rightSpeed))
 | 
				
			||||||
            self.motor_write(MOTOR_RL_F, MOTOR_RL_R, speed)
 | 
					            self.motor_write(MOTOR_RL_F, MOTOR_RL_R, speed)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue