-
Notifications
You must be signed in to change notification settings - Fork 0
Software Description
Mitchell Gresham edited this page Jan 14, 2024
·
2 revisions
The following is a summarization of what each file does in the program.
- Canard.h: Is a facade placed on top of the in-built Servo.h interface that's given by Arduino. In addition to changing how angles are given to the servos from 0-180° it's -90-90° where 0° is pointed upward. Moreover it allows offsets to be placed on each servo since depending on how you mounted the servo it's 0° might be a little offset of actual 0°.
- Subsystem.h: This is an abstract class that adds error-handling into the software in case an error were to occur in a major system of the rocket. As it currently stands its only inherited by the Odometry class.
-
Odometry.h: Is a facade placed on top of configuring and reading data from the Adafruit BNO055 used for absolute orientation. It also allows offsets to be placed on the rocket that aren't from the actual sensor incase whenever you mounted the sensor it was offset by some degrees. The way in which orientation is established is through the gravity vectors that's given by the sensor determining the magnitude of gravity in any direction. In getting this signed magnitude you can then do some basic physics as show to get the angle that the rocket is off-center.
In this case theta is the angle you're looking for in both the y-axis and z-axis. Since the magnitude is signed you don't have to worry about ensuring that you can differentiate between the rocket tilted to the left or the right, which is the initial problem that I had with Euler Angles as a result of Gimbal Lock. In the code this formula will get you the offset in the y-axisacos(_sensor.gravity_vector_data.y / 9.8) * (180/PI)
. It should be known that inverse cosine will result in radians so you must convert into degrees so they can be used by the canards. - Rocket.h: This is the class that ties everything together. As it stands it only sets up the other objects and has a program that should be run in the loop for the flight program though in the future other program such as a landing or launching procedure will be included to be run in the loop.