How Does This Rocket Know Where It Is? Active Control Flight Computer - Building DIAMOND-X Part 3

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hi everyone welcome back to Lafayette systems this video is part of a build series about this rocket Diamond X it is an actively controlled model rocket which uses these fins to steer itself through the air and we are modifying it to fly with a first stage booster for greater range and speed Parts one and two of the build series are out now Link in the description so make sure you take a look at those if you're new to the project I also have the flight videos out on the channel for flights one and two where we controlled the Rockets pitch yaw and roll and even fired it out of a hot launch Silo this video is all about the flight computer which is this stack of circuit boards here the flight computer does a bunch of important things first it does the navigation tasks making sure the rocket knows where it is at all times and figuring out where the Rocket's pointing it also runs the Guidance Software which tells the rocket where to go typically this involves pointing the rocket straight up but I'm working on a number of other techniques like flying to way points up winds to shorten the recovery distance lastly it does control moving the fins to get the rocket from where it is to where it isn't and deploying parachutes when it reaches its apy or its highest point this rocket also has a two-way data link so I can track the rocket from my laptop ground station and send it commands while it's in the air in this video we're going to go over these circuit boards in detail talking about what chips are on them and then we'll look at the requirements that I had for these pcbs and how I designed them finally we're going to look at the flight code a bit to talk about what exactly this flight computer does to guide the rocket through the air safely so I have two flight computers here you can see that the flight computer is a stack of two circuit boards stacked normally to the Rockets long axis I have one that's assembled and then a disassembled version here so this top board is the primary flight computer itself this massive IC this massive integrated circuit right here is the actual microcontroller that runs all of the math and so when I write code it's running on this chip here on the top of the board these are all of the sensors so we have a barometric pressure sensor A magnetometer and then multiple inertial measurement units with various different precisions and G ranges on the right side this is the GPS area so this is a Zoe m8q GPS we have the micro USB plug that actually programs the flight computer itself and then on the bottom you can see sticking out a little SD card this is where we store data uh from the flight we can also input things like control gains and guidance gains to these SD cards they're changeable easily there are four connectors on the bottom side here uh these do a variety of things this is a standard not really standard but standard for me iqu c Port so it has SDA 3.3 volts and ground we also have a number of other connectors here this one connects to the radio and it uses uart and this one connects to the servo so these are just four pwm outputs these two are for Servo power and you can see a little circuit right here which lets us do high side switching of these servos so these can connect to the servos and I can turn on or off the 8vt supply to the servos and that way they can save power if they're just sitting there we're not doing anything I can turn them off completely we can see big ribbon cable that connects the main flight computer to the board underneath it and this carries a variety of signals down to things like the Pyro channels um and then these six pins here carry power the ribbon cable is kind of limited in how much current it can carry so I have uh these six pins carrying two for ground two for battery voltage and then two for 5 volts that's regulated on the bottom board switching over to the top of the upper circuit board you can see a number of things first is this little chip this is the Bootloader for the primary flight computer this chip although it doesn't look like it is actually just a TC 3.6 so this is a pretty common microcontroller um this is a different pinout of the same integrated circuit but it's nonetheless the same thing and this is a standard ensc bootloader so I've basically taken the ensc schematic and then implemented it on this board so I can get it in the right form factor I have their bootloader and then when I turn it on the bootloader helps me program it and that means I can write all the code for this in actual r do we know you can see the micro SD card here this chip is memory so this is the flash memory that stores all of our data for a flight we have a 3.3 volt regulator switching over to the top of the bottom circuit board here we can see we have screw terminal connections for the battery and also if we want to power this thing from the pad itself we have that ability although it's not used on diamond X this chip here does current sensing and also measures the battery voltage and this tiny little integrated circuit let us switch power from either the pad or the battery everything on the bottom side here is all pyro channels so these are the lowside mosfets that connect the the Pyro channels themselves to ground on the circuit board these big blue resistor looking things are fuses and so if we draw too much current they'll blow and then you can also see the same six pin connector to transfer power this I see right here is a rs422 or rs485 transceiver IC so we can uh take a standard Ur output and send it to this chip and it can let us send rs422 signals so if we want to connect to a pad or a silo or something via hard wirring then this is a good way to do that and this chip right here is a uart expander so it gives us more uart channels and also has a couple IO that we're using as well on the bottom of the bottom circuit board we can see lots going on the these eight screw terminals so these four screw terminals four pairs are the Pyro outputs you can see we have indicator LEDs for pyros 0 through three and we have an arming LED this I see right here is the high side switch so this is a safety system to arm the mosfets we connect them to the the high side voltage so the positive voltage via this IC and then to fire we connect them via a lowside mosfet to ground and both of these mosfets have to be passing current for this to work this is another IO expander chip and it's connected to a number of um these same MOX 4 pin connectors and this lets me connect a bunch of LEDs so they are running through these tiny tiny little mosfets that let me draw more current and so I can run some powerful LED boards that I have uh with these connectors again these aren't used on this rocket but if I'm using this as a ground station and would like some powerful LEDs to run I can do so here this connector allows me to connect an external switch where if the switch is shorted then the rocket is turned off and when the switch is opened then the rocket turns on so that's something like a remove before flight pin for example these two connectors are for cameras so each one has um positive voltage either battery voltage or regulated 5 volts and those are selectable via a fuse ground and then TX and RX uart so I can send uart commands to cameras although typically I don't I just power their cameras up and then they run so there's two of those and they're actuated independently and I can send different uart commands to each one we have another uart expander chip uh one of the chips sends uarts to these RS 422 transceivers so there's another one on this side so I have two RS 422 transceivers and then the other one of these uart expanders is connected to the cameras so that way I'm not wasting the precious uart channels from the microcontroller itself we can see four more Servo outputs here these aren't um set up to a handy MOX connector these are the standard Servo uh three pin .1 in spacing connectors um and I don't actually have those populated because I'm not using them you can also see the same circuit here this is another high side switch so I can independently turn on the voltage to these servos this right here is a very tiny 5volt regulator that can still provide something like 3 amp although I'll never use that much and then finally we have our battery terminal blocks here these are screw terminals that connect us again to our battery and our pad so that's the flight computer that flies on diamond X and we'll fly on a lot of my future projects as well so next let's talk about how I chose what this flight computer needed to be able to do this flight computer started out as a series of PowerPoint slots oddly enough where I laid out the requirements for all of the future programs I had in mind that would use this fight computer these these include various actively controlled Rockets drones or combos of the two using Rockets to launch and then switching to an EDF instead of Deployable Wings to cruise around and film subsequent rocket launches from the air for each future project I listed the Baseline and stretch gos what we would otherwise call threshold and objective requirements then I compiled all these requirements into one master list from which I could start laying out what chips each circuit board would need now it's important to not that this process isn't always linear sometimes during the schematic or layout process I would find that it would be easy to add an LED here or a couple extra Servo outputs there alternatively I might find that I just couldn't fit a certain feature on these densely packed pcbs now this isn't a PCB design or layout tutorial I don't have a formal education in either of those so wouldn't be able to speak authoritatively on the subject I can point you to some of the resources that I found helpful when learning including Phil's lab and LTM Academy links in the description the most helpful resource for me was trial and error making pcbs failing and slowly improving my understanding of a skill which is a good mix of Art and Science plus if you're doing RF design a little mix of dark magic as well so now that we've talked about Hardware let's talk software all of my rockets fly on my common flight software stack this includes a whole bunch of libraries that I wrote to help with things like navigation guidance and control plus a bunch of utility functions because the primary flight computer was designed as a Teensy in a different form factor I write my code using the Tec framework for platform io on VSS code this may. CP P file calls the large highle functions every single frame inside of this file we can see the two standard functions we see in Arduino there is setup and loop this is basically the initialization piece and then Loop runs every single frame so as the flight computer starts up the first thing we do is initialize FC so this function sets registers it initializes all of the sensors and it turns on things like I squ C and spy buses then initialize comms is called which is a separate function that initializes the packet objects for transmitting anding data both from the radio and from the rs422 buses you'll see here that three states are set first is a flight computer State then a vehicle State and then a control State this rocket runs on a nested set of finite State machines so there is a different state for the vehicle and for the control system and for the guidance system and so in Flight the vehicle might have its control system enabled or disabled and might be in a number of different guidance modes so all of these states are set separately now in the loop function are all the things that are called every single frame first is read sensors this function as the name suggests reads our IMU reads our GPS and integrates this into a library I've written called Horizon this is a navigation library and so it does first queria navigation for our attitude figuring out where the Rocket's pointing and then it uses that with integrated accelerometer data inside of a common filter to get our position this rocket has a barometric pressure sensor and a GPS and our Imus and all that data needs to be fused properly and a common filter is a great way to do that next up is power manager this function reads the voltage and current that are running around both from the battery into the flight computer and a number of other places around the flight computer and if any of those are out of whack we can disable things like the servos or we can turn the flight computer off entirely next up is mass manager this is a super useful function so when the flight computer turns on it reads a CSV file that I put on the SD card that has whole table that lists the Rockets mass mass moment of inertia Center of mass and a number of other things as a function of time since lift off so as the motor burns the rocket becomes lighter its Center of mass shifts forward and its mass moments decrease and so our control system can take all of those things into account so that the rocket behaves the same way with a full motor and with an empty one next up is navigate this is figuring out what a rocket State Vector is so attitude position and velocity this is again inside of the Horizon library that I wrote to specifically navigation and it includes the common filter for position and then the querian which tells us where our rocket is pointing after we figure out where our rocket is in space we have to figure out where we want it to be so this is guidance again a lot of guidance functions are just point the rocket straight up I don't care where your position is but uh what might be helpful and what I'm working towards is to be able to very precisely fly the rocket to certain points up wind so that when the parish deploys the rocket fly is right back and lands really close we can also set multiple way points and have the rocket fly between them and I'm working on a number of guidance modes some of which are path independent where the rocket doesn't care how it gets from point A to point B and others are path dependent the path dependent guidance modes uh take a lot more Matrix math and coordinate Transformations uh so I need to do a lot more testing on those before they're ready to fly but path independent guidance has been verified in mat lab simulations and Hardware in the loops that's going to be the next one we try the next function here is control so this takes our uh guidance variables the guidance solution and turns them into fin deflection angles so this is where we actually move those fins in the back because of export control restrictions I can't really go into a lot of detail on the guidance or control pieces but those are easily the hardest pieces and also easily the most interesting so um it's bummer I can't talk about them a lot but they are super super cool and they take a lot of testing to get right next up is a function I call inframe com so this is the communications that are done every single frame some frames the rocket will send Telemetry packets and there's a number of different packets that it sends I could do a whole video on the Telemetry system uh if you guys are interested I could make that as a little followup to this but the rocket has to pick what Telemetry packet it needs to send and then send that down over the radio so next up is the event manager this is a class that I wrote for these rocket projects and it has become invaluable so an event is an object in software that can do a certain task when certain conditions are met and that's very abstract but an event might be something like parachute deployment parachute deployment needs to occur maybe at a certain time or when a certain function like apog detected returns true and these are very abstract but I put all of the important things that the rocket does in these event classes and therefore I can trigger them manually and I can set criteria for when they're triggered um so this is a very abstract way of handling a lot of things but I found it very very useful next up we have LED manager which makes the little lights blink very nice and then pyro manager which manages our pyro channels these are the pyrotechnic devices that either ignite upper stage Rocket Motors or deploy parachutes and pyom manager updates some pyro objects I have in software uh and make sure that if it's time for them to fire they fire and if it's time for them to stop they stop firing then there's memory manager so the rocket needs to record all of this flight data to the onboard flash memory it doesn't do this every frame and depending on the vehicle State the rate at which it logs changes so memory manager decides what frame it is and then if it's a correct frame to log data to the the flash memory then it does so and last is time step update this is how we make sure that our rocket is operating at its correct 100 frames per second so this is actually pretty simple there's no like operating system here but if we haven't taken 10 seconds to run the frame then we just wait until we have and if we have taken longer than 10 seconds uh we just deal with that I think we don't really do anything but that's the flight code for different Rockets there are different things like changes to to their fin size and aerodynamic parameters and how high I expect them to go and all of that information is stored inside of config files so when I upload the flight code I upload a certain configuration of it and then that it pre-compiled with all of the right variables for thin size and and planform area and things like that well that's it for the flight software this video has gone on long enough so I appreciate all of you who stuck it out to the end Diamond de has already flown flight test 3 and we're getting ready for flight test 4 coming up shortly I've also been working on the booster integration for Diamond de block 3 and so you guys are going to see more booster content coming up soon if you guys are out there flying Rockets Make sure everybody staying safe so thank you all for watching I appreciate all of you who are interested in this project and stay tuned for [Music] more
Info
Channel: Lafayette Systems
Views: 132,072
Rating: undefined out of 5
Keywords:
Id: nUywu65qgFY
Channel Id: undefined
Length: 17min 19sec (1039 seconds)
Published: Thu Mar 14 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.