Closed DrewBrandt closed 1 month ago
Should the Math
folder be renamed to something like Utils
if it now has utilities like the circular buffer
Before we merge I think we should have some documentation attached about how to use the unit tests somewhere, and how to setup Unity
If it doesn't build with the Arduino IDE, we may want to wait to merge it, but if the "fake" environment you mentioned works to at least avoid build errors, then it should be fine.
I agree that we should have at least some documentation on how to use the tests before this is merged. It doesn't have to be anything super detailed, just some basic steps for running the tests so that people will know how to use them.
Should the
Math
folder be renamed to something likeUtils
if it now has utilities like the circular buffer
IMO we should move the circular buffer to a Utils folder but keep all the math in a math folder. I think that will be the most logical to anyone new to the code.
_
after the name (ERROR_
, etc) because Windows included ERROR
as a macro and I couldn't find a good way to undefine that macro.SDCardStorage
, not sure how it built before without that there.read()
and init()
functions to protected
update()
to read()
like it's supposed to beDocs look good to me and tests ran without issue
Summary:
This PR does a lot of restructuring and somewhat significantly modifies the behavior of the sensors.
I've added numerous (like, 50) unit tests for various parts of the base sensor classes, the state class, and the APRS encoding. These tests are only designed to be used on PlatformIO at the moment, and uses its structure for testing. They rely on the Unity testing framework which, according to Unity, is mostly just a collection of easy-to-run asserts. I don't know enough about how the Arduino IDE handles testing to know if this would compile properly on it. I did try to make sure that the library being used in the Arduino IDE would compile properly, though. Further testing for this is required.
Tests currently include:
More testing documentation to follow.
Changes:
Major:
native
, or desktop, environment. Everything for thenative
testing environment is located in either./test/
or./lib
. This should allow Arduino IDE to properly compile the library using only./src/
Arduino functions mocked include:NativeTestHelper.h
that sets up common test variables and included files.native
environment to theplatformio.ini
to allow for testing on a desktop.[SensorType].begin()
instead of[SensorType].initialize()
Full reasoning will be made clear when more documentation is written.Math
folder. Designed to be used with the sensors for storing calibration data, but can be used by anyone to hold anything. Documentation on how to use will come later.imumaths
in favor of our ownmmfs::vector
, with the sole exception of the BNO hardware classes, where a conversion method is included.<Arduino>
is included, replacing it with a condition to possibly include the mock version if necessary.Sensor.markLiftoff()
to save the latest value and stop calibration. More documentation to come later.pos
vector of size 2 to aposition
vector of size 3, adding altitude to thez
component.ERROR
LogType toERROR_
because apparently Windows decided to makeERROR
a macro :/Minor:
TestingImplementation
folder into its ownExamples
folder outside ofsrc
.library.json
to point the repo url to TRT instead of my account (holdover from my fork and initial setup of that file).library.json
.BlinkBuzz.h
.Constants.h
.UNKNOWN_
type from SensorType and ActuatorType.+=
operator to the vector class.MMFS.h
.const
, as they are string literals.double
APRS base91 encoder to prevent int rounding or truncation.decodeBase91()
call for altitude attempting to decode only 2 of the three digits.read()
(notupdate()
anymore) function, where ONLY the hardware reading is done. This function should almost always be called ONLY internally bySensorType.update()
. More documentation to come later.getASLAlt()
andgetAGLAlt()
to barometer to differentiate between absolute altitude and the delta from power on (or launch) to now.Major Notes:
The IMU implementation in this version is currently... well... not implemented. Changes to IMU hardware brought up the fact that we need to add math to get global frame from the IMU's local frame. I can do this math, but I feel more discussion needs to happen on wwhat this looks like. I think Ezra would say to not even worry about it because you can just put the raw values into the KF and still get the values you need (at least that's my understanding, but I admittedly don't understand how Kalman Filters work).
The
State
tests are currently not implemented as the IMU is still not implemented. Once all sensors are done, state tests can begin.I will write documentation about how to both use and modify this code as I begin migrating the Avionics wiki over here. I think I may slightly change the layout so that the wiki is split into two broad categories: using the software and modifying the software. One goes over the API and the other dives into the internals to help people understand how it currently works so that they can make changes if necessary.
Updates after KF and RecordData updates:
_
after the name (ERROR_
, etc) because Windows includedERROR
as a macro and I couldn't find a good way to undefine that macro.SDCardStorage
, not sure how it built before without that there.read()
andinit()
functions toprotected
update()
toread()
like it's supposed to be