Software icon indicating copy to clipboard operation
Software copied to clipboard

Raspberry pi 5 support

Open mkhlb opened this issue 1 year ago • 5 comments

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 .h file) should have a javadoc style comment at the start of them. For examples, see the functions defined in thunderbots/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 avatar Jul 10 '24 21:07 mkhlb

@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:

nimazareian avatar Jul 11 '24 06:07 nimazareian

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.

nimazareian avatar Jul 11 '24 06:07 nimazareian

@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

itsarune avatar Jul 12 '24 07:07 itsarune

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/

Mr-Anyone avatar Jul 15 '24 13:07 Mr-Anyone

nice catch vincent -- updated the temperature path for Pis. Someone should test this and let us know if it works

itsarune avatar Jul 16 '24 02:07 itsarune

Let's just merge it in and deal with it later as trouble comes up

Mr-Anyone avatar Oct 04 '24 22:10 Mr-Anyone