Add ability to restart Thunderloop from Thunderscope
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:
- Add a new button called "Restart Thunderloop" to the
RobotInfowidget. - Create a new Proto that gets sent to the robots ("RequestRestartThunderloop"). This proto needs to contain the
robot_idthat we are requesting to restart.
Thunderloop:
- 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.
- Deploy this Python scripts through an Ansible playbook (
deploy_robot_software.pb) - Add this python script as a
systemdservice
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
- [ ] Manually test with actual robots
Blocked By
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.