@@ -323,6 +323,8 @@ def control_wait_for(self, goal, interval_sec=1):
323323
324324 if robot_state == RobotState .ERROR :
325325 eva_error ('Eva is in error control state' )
326+ if robot_state == RobotState .COLLISION :
327+ eva_error ('Eva has encountered a collision. Please acknowledge collision.' )
326328 elif robot_state == parsed_goal :
327329 return
328330
@@ -413,6 +415,30 @@ def control_reset_errors(self, wait_for_ready=True):
413415 time .sleep (0.1 ) # sleep for small period to avoid race condition between updating cache and reading state
414416 self .control_wait_for (RobotState .READY )
415417
418+ # COLLISION DETECTION
419+ def control_configure_collision_detection (self , enabled , sensitivity ):
420+ """
421+ Allows toggling on/off and setting the sensitivity of collision detection
422+ """
423+ if sensitivity not in ['low' , 'medium' , 'high' ]:
424+ raise ValueError ('collision_detection error, no such sensitivity ' + sensitivity )
425+ if enabled not in [True , False ]:
426+ raise ValueError ('collision_detection error, must be True/False' )
427+ r = self .api_call_with_auth ('POST' , 'controls/collision_detection' ,
428+ json .dumps ({'enabled' : enabled , 'sensitivity' : sensitivity }))
429+ if r .status_code != 204 :
430+ eva_error ('control_collision_detection error' , r )
431+
432+ def control_acknowledge_collision (self , wait_for_ready = True ):
433+ """
434+ When a collision is encountered, it must be acknowledged before the robot can be reset
435+ """
436+ r = self .api_call_with_auth ('POST' , 'controls/acknowledge_collision' )
437+ if r .status_code != 204 :
438+ eva_error ('control_acknowledge_collision error' , r )
439+ elif wait_for_ready :
440+ time .sleep (0.1 ) # sleep for small period to avoid race condition between updating cache and reading state
441+ self .control_wait_for (RobotState .READY )
416442
417443 # CALCULATIONS
418444 def calc_forward_kinematics (self , joints , fk_type = 'both' , tcp_config = None ):
0 commit comments