Demo

For turning the motor in different modes, you will need 5 terminals and in all of them execute:

sudo -i
source /home/application/.bashrc
  • Terminal 1:

    If you are running demo with one motor:

    ros2 launch synapticon_ros2_control elevated_permissions_1_dof.launch.py
    

    If you are running demo with two motors:

    ros2 launch synapticon_ros2_control elevated_permissions_2_dof.launch.py
    
  • Terminal 2:

    If you are running demo with one motor:

    ros2 launch synapticon_ros2_control single_dof.launch.py
    

    If you are running demo with two motors:

    ros2 launch synapticon_ros2_control two_dof.launch.py
    
  • Terminal 3 - to show the running controllers

    ros2 control list_controllers
    

    (Information does not automatically refresh - it can be refreshed each M seconds using watch -n M ros2 control list_controllers, but the output format might be ugly)

  • Running the motor with different controllers:

    • CSV (Cyclic Sync Velocity) mode:

      Terminal 4 to turn on the controller:

      ros2 service call /controller_manager/switch_controller controller_manager_msgs/srv/SwitchController "{activate_controllers: ['forward_velocity_controller'], deactivate_controllers: []}"
      

      Terminal 5 to create a publisher:

      If you are running demo with one motor:

      ros2 topic pub /forward_velocity_controller/commands std_msgs/msg/Float64MultiArray data:\ [100]
      

      If you are running demo with two motors:

      ros2 topic pub /forward_velocity_controller/commands std_msgs/msg/Float64MultiArray data:\ [100,100]
      

      Stopping it: CTRL+C on Terminal 5 and in Terminal 4:

      ros2 service call /controller_manager/switch_controller controller_manager_msgs/srv/SwitchController "{activate_controllers: ['quick_stop_controller'], deactivate_controllers: ['forward_velocity_controller']}"
      
    • CSP (Cyclic Sync Position) mode:

      Terminal 4 to turn on the controller :

      ros2 service call /controller_manager/switch_controller controller_manager_msgs/srv/SwitchController "{activate_controllers: ['forward_position_controller'], deactivate_controllers: [quick_stop_controller]}"
      

      Terminal 5 to create a publisher:

      If you are running demo with one motor:

      ros2 topic pub /forward_position_controller/commands std_msgs/msg/Float64MultiArray data:\ [140]
      

      If you are running demo with two motors:

      ros2 topic pub /forward_position_controller/commands std_msgs/msg/Float64MultiArray data:\ [140,140]
      

      Stopping it: CTRL+C on Terminal 5 and in Terminal 4:

      ros2 service call /controller_manager/switch_controller controller_manager_msgs/srv/SwitchController "{activate_controllers: ['quick_stop_controller'], deactivate_controllers: ['forward_position_controller']}"
      
    • CST (Cyclic Sync Torque) mode:

      Terminal 4 to turn on the controller :

      ros2 service call /controller_manager/switch_controller controller_manager_msgs/srv/SwitchController "{activate_controllers: ['forward_torque_controller'], deactivate_controllers: [quick_stop_controller]}"
      

      Terminal 5 to create a publisher (value is in per mille of torque):

      If you are running demo with one motor:

      ros2 topic pub /forward_torque_controller/commands std_msgs/msg/Float64MultiArray data:\ [100]
      

      If you are running demo with two motors:

      ros2 topic pub /forward_torque_controller/commands std_msgs/msg/Float64MultiArray data:\ [100,100]
      

      Stopping it: CTRL+C on Terminal 5 and in Terminal 4:

      ros2 service call /controller_manager/switch_controller controller_manager_msgs/srv/SwitchController "{activate_controllers: ['quick_stop_controller'], deactivate_controllers: ['forward_torque_controller']}"