Raspberry pi 5 support
Please fill out the following before requesting review on this PR
Description
In tbots.py, do -pl or --platform = NANO or PI to differentiate between platforms. In bazel build/run, do --//shared:platform=NANO or PI to differentiate between platforms.
Different platforms use different GPIO interfaces.
Additionally, robot setup scripts were split in two.
Testing Done
Tested flashing onto a robot and running diagnostics
Resolved Issues
Length Justification and Key Files to Review
Review Checklist
It is the reviewers responsibility to also make sure every item here has been covered
- [x] Function & Class comments: All function definitions (usually in the
.hfile) should have a javadoc style comment at the start of them. For examples, see the functions defined inthunderbots/software/geom. Similarly, all classes should have an associated Javadoc comment explaining the purpose of the class. - [x] Remove all commented out code
- [x] Remove extra print statements: for example, those just used for testing
- [x] Resolve all TODO's: All
TODO(or similar) statements should either be completed or associated with a github issue
@mkhlb Could you look at the various errors in CI? One of which is that the workflows need to be updated to use the embedded directory: https://github.com/UBC-Thunderbots/Software/blob/master/.github/workflows/main.yml
Though there does seem to be other issues regarding the new platform flag as well:
(22:12:37) ERROR: /home/runner/work/Software/Software/src/shared/BUILD:24:12: in string_flag rule //shared:platform:
Traceback (most recent call last):
File "/home/runner/.cache/bazel/_bazel_runner/03719[42](https://github.com/UBC-Thunderbots/Software/actions/runs/9882116786/job/27294359396?pr=3253#step:4:43)fc78bc9dd17ddd44f09c210b6/external/bazel_skylib/rules/common_settings.bzl", line 78, column 13, in _string_impl
fail("Error setting " + str(ctx.label) + ": invalid value '" + value + "'. Allowed values are " + str(allowed_values))
Error in fail: Error setting //shared:platform: invalid value ''. Allowed values are ["PI", "NANO"]
(22:12:37) ERROR: /home/runner/work/Software/Software/src/shared/BUILD:24:12: Analysis of target '//shared:platform' failed
(22:12:37) ERROR: Analysis of target '//shared:platform' failed; build aborted:
The Jetson Nano build should also be updated to confirm that compilation for both platforms works: https://github.com/UBC-Thunderbots/Software/blob/dea10f841ad24ef8ac8da743416e4c9495f9e83b/.github/workflows/main.yml#L85-L88
To save CI time, I think you could have both bazel build commands as part of the same run: in the yaml file.
@mkhlb I moved the config settings you added to //software/embedded + adjusted the ifdef macros in motor.cpp.
The shared/ directory is reserved for files we'd like to share between AI and the robot. Here, pi_constants or jetson_constants are only used by the robot, so it fits best in software/embedded
I've just found the path in raspberry pi:
https://github.com/UBC-Thunderbots/Software/blob/2b916894500433799bb35e5ec4a074d5ea367fc5/src/software/jetson_nano/thunderloop.cpp#L401
In raspberry pi, the path is at /sys/class/thermal/thermal_zone0/temp
see here: https://www.cyberciti.biz/faq/linux-find-out-raspberry-pi-gpu-and-arm-cpu-temperature-command/
nice catch vincent -- updated the temperature path for Pis. Someone should test this and let us know if it works
Let's just merge it in and deal with it later as trouble comes up