@@ -405,3 +405,92 @@ def test_force_mode_and_trajectory_passthrough_controller_are_compatible(self):
405405 ],
406406 ).ok
407407 )
408+
409+ def test_tool_contact_compatibility (self ):
410+ # Deactivate all writing controllers
411+ self .assertTrue (
412+ self ._controller_manager_interface .switch_controller (
413+ strictness = SwitchController .Request .BEST_EFFORT ,
414+ deactivate_controllers = [
415+ "scaled_joint_trajectory_controller" ,
416+ "joint_trajectory_controller" ,
417+ "forward_position_controller" ,
418+ "forward_velocity_controller" ,
419+ "passthrough_trajectory_controller" ,
420+ "force_mode_controller" ,
421+ "tool_contact_controller" ,
422+ ],
423+ ).ok
424+ )
425+
426+ time .sleep (3 )
427+ # Start tool contact controller and JTC
428+ self .assertTrue (
429+ self ._controller_manager_interface .switch_controller (
430+ strictness = SwitchController .Request .STRICT ,
431+ activate_controllers = [
432+ "scaled_joint_trajectory_controller" ,
433+ "tool_contact_controller" ,
434+ ],
435+ ).ok
436+ )
437+ self .assertTrue (
438+ self ._controller_manager_interface .switch_controller (
439+ strictness = SwitchController .Request .STRICT ,
440+ deactivate_controllers = [
441+ "scaled_joint_trajectory_controller" ,
442+ "tool_contact_controller" ,
443+ ],
444+ ).ok
445+ )
446+
447+ # Start tool contact controller and passthrough trajectory
448+ self .assertTrue (
449+ self ._controller_manager_interface .switch_controller (
450+ strictness = SwitchController .Request .STRICT ,
451+ activate_controllers = [
452+ "passthrough_trajectory_controller" ,
453+ "tool_contact_controller" ,
454+ ],
455+ ).ok
456+ )
457+ self .assertTrue (
458+ self ._controller_manager_interface .switch_controller (
459+ strictness = SwitchController .Request .STRICT ,
460+ deactivate_controllers = [
461+ "passthrough_trajectory_controller" ,
462+ "tool_contact_controller" ,
463+ ],
464+ ).ok
465+ )
466+
467+ # tool contact should not start with force_mode
468+ self .assertFalse (
469+ self ._controller_manager_interface .switch_controller (
470+ strictness = SwitchController .Request .STRICT ,
471+ activate_controllers = [
472+ "force_mode_controller" ,
473+ "tool_contact_controller" ,
474+ ],
475+ ).ok
476+ )
477+ self .assertFalse (
478+ self ._controller_manager_interface .switch_controller (
479+ strictness = SwitchController .Request .STRICT ,
480+ activate_controllers = [
481+ "tool_contact_controller" ,
482+ "force_mode_controller" ,
483+ ],
484+ ).ok
485+ )
486+
487+ # tool contact should not start with freedrive
488+ self .assertFalse (
489+ self ._controller_manager_interface .switch_controller (
490+ strictness = SwitchController .Request .STRICT ,
491+ activate_controllers = [
492+ "tool_contact_controller" ,
493+ "freedrive_mode_controller" ,
494+ ],
495+ ).ok
496+ )
0 commit comments