UBC-Thunderbots / Software

Robot Soccer Playing AI
http://www.ubcthunderbots.ca
GNU Lesser General Public License v3.0
54 stars 110 forks source link

Add ability to restart Thunderloop from Thunderscope #3334

Open itsarune opened 1 month ago

itsarune commented 1 month ago

Description of the task

When a robot isn't moving, we often SSH into the robot and restart Thunderloop using the following command sudo systemctl restart thunderloop.service. This is often quite annoying to do.

We should add a new button to the RobotInfo widget called "Restart Thunderloop" to restart that robot's Thunderloop service.

Possible implementation (likely we will need to touch both Thunderscope and the robot): Thunderscope:

  1. Add a new button called "Restart Thunderloop" to the RobotInfo widget.
  2. Create a new Proto that gets sent to the robots ("RequestRestartThunderloop"). This proto needs to contain the robot_id that we are requesting to restart.

Thunderloop:

  1. Create a Python script that receives "RequestRestartThunderloop" and executes "sudo systemctl restart thunderloop.service" if the robot id matches the robot's current ip address.
  2. Deploy this Python scripts through an Ansible playbook (deploy_robot_software.pb)
  3. Add this python script as a systemd service

If you want to test Thunderscope changes without robots (for GUI layout), run the following command: ./tbots run thunderscope_main --run_blue --disable_communication --interface lo

Acceptance criteria

Blocked By

williamckha commented 1 month ago

Alternate implementation:

No need for an additional systemd service. Instead, have the "Restart Thunderloop" button call ansible_runner from run_ansible.py to ssh into the robot and run an ansible script that restarts Thunderloop. Thunderscope should pop up with a dialog asking for the SSH password the first time the "Restart Thunderloop" button is pressed. The SSH password should then be saved so that we don't have to type in the password everytime.