This task will refactor the existing picar-s bang-bang controller to house the controller logic within the uobject that operates on the HMAC sensor data buffer.
The proposed sub-tasks follow:
We will be working with forks and respective branches of the following repositories:
Ensure the aforementioned forks/branches are upto date with the upstream repositories. The following gives an example of how to sync your fork of
uberspark/uberxmhf.git; the same can be applied to other repositories. Note these commands have to be applied on a local checkout of your fork.
git remote add upstream https://github.com/uberspark/uberxmhf.git git fetch -a upstream git checkout develop git pull upstream develop git push origin develop
Build and install micro-hypervisor and I2C drivers
i2c-bcm2708from the above forks/branches and ensure baseline line-following functionality works
Create a new folder within
example/bangbang_shared. This will house our refactored bang bang controller based on the existing line-following controller.
example/bangbang_shared/folder and refactor the logic to match how things are done with
example/pid_shared. i.e., we need to have
bangbang_line_follower,pywill be existing
bangbang_line_follower.pylogic to match what is found in
example/pid_shared/pid_line_follower.pyusing the template of lines 37–45 as here: uapp-SunFounder_PiCar-S/pid_line_follower.py at uobjcoll · uberspark/uapp-SunFounder_PiCar-S · GitHub
The idea with the above is that we implement the bangbang controller logic within
bangbang.cwhich will include lines 94–174 of
bangbang_line_follower.pyre-implemented in C such that all servo output routines are left outside the logic, just like how it is done with the pid controller.
bangbang_line_follower. This should follow the line as before.
The above will allow us to move
bangbang.c into a uobject as the next task.