Allow to lock safety mode to keep gm/tesla cars supported (#844)
	
		
	
				
					
				
			
							parent
							
								
									6b62dd2308
								
							
						
					
					
						commit
						069e337bea
					
				
				 4 changed files with 54 additions and 16 deletions
			
			
		| @ -0,0 +1,27 @@ | ||||
| #!/usr/bin/env python3 | ||||
| import sys | ||||
| from cereal import car | ||||
| from common.params import Params | ||||
| 
 | ||||
| # This script locks the safety model to a given value. | ||||
| # When the safety model is locked, boardd will preset panda to the locked safety model | ||||
| 
 | ||||
| # run example: | ||||
| # ./lock_safety_model.py gm | ||||
| 
 | ||||
| if __name__ == "__main__": | ||||
| 
 | ||||
|   params = Params() | ||||
| 
 | ||||
|   if len(sys.argv) < 2: | ||||
|     params.delete("SafetyModelLock") | ||||
|     print("Clear locked safety model") | ||||
| 
 | ||||
|   else: | ||||
|     safety_model = getattr(car.CarParams.SafetyModel, sys.argv[1]) | ||||
|     if type(safety_model) != int: | ||||
|       raise Exception("Invalid safety model: " + sys.argv[1]) | ||||
|     if safety_model == car.CarParams.SafetyModel.allOutput: | ||||
|       raise Exception("Locking the safety model to allOutput is not allowed") | ||||
|     params.put("SafetyModelLock", str(safety_model)) | ||||
|     print("Locked safety model: " + sys.argv[1]) | ||||
					Loading…
					
					
				
		Reference in new issue