{
    "componentChunkName": "component---src-templates-post-js",
    "path": "/projects/flight-controller",
    "result": {"data":{"mdx":{"frontmatter":{"title":"A Quadcopter Flight Controller With a Custom RTOS","author":"Souleymane Dembele","date":"2025-03-23"},"body":"var _excluded = [\"components\"];\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nfunction _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }\nfunction _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }\n/* @jsxRuntime classic */\n/* @jsx mdx */\n\nvar _frontmatter = {\n  \"title\": \"A Quadcopter Flight Controller With a Custom RTOS\",\n  \"slug\": \"projects/flight-controller\",\n  \"author\": \"Souleymane Dembele\",\n  \"date\": \"2025-03-23\",\n  \"isDraft\": false\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n    props = _objectWithoutProperties(_ref, _excluded);\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"p\", null, \"This project is a research-grade quadcopter flight controller built from the\\nfirmware up on an STM32F405 (ARM Cortex-M4), including my own real-time\\noperating system and a model-predictive-style attitude controller.\"), mdx(\"h2\", null, \"Firmware and RTOS\"), mdx(\"p\", null, \"I wrote bare-metal drivers for the peripherals the controller needs: interrupts,\\ntimers, PWM, ADC/DAC, SPI, I2C, UART, and an ExpressLRS (LoRa) telemetry link\\nwith an interrupt-driven UART parser. On top of that sits a custom lightweight\\nRTOS with a scheduler, semaphores, and inter-task communication. PWM outputs\\ndrive the motors through the ESCs.\"), mdx(\"h2\", null, \"Control and estimation\"), mdx(\"p\", null, \"The attitude controller is a dual-rate lifted-model generalized predictive\\ncontrol (GPC) state-space design that reconciles two sensors sampled at\\ndifferent rates: an ICM20602 IMU at 1200 Hz and a BNO085 9-DOF sensor at 400 Hz.\\nA Kalman filter fuses the two, and a real-time quaternion gives attitude.\"), mdx(\"p\", null, \"I modeled the full six-degree-of-freedom UAV dynamics in MATLAB/Simulink and\\ncompared the dual-rate GPC against a double/inner-loop PID baseline. In\\nsimulation the GPC settled in 0.8 s versus 1.2 s for the PID, with 5% versus 12%\\novershoot and about half the RMS tracking error (0.03 versus 0.06), plus\\nnear-zero steady-state error across pitch, roll, and yaw. Initial hardware tests\\nvalidated the simulation behavior.\"), mdx(\"h2\", null, \"Hardware co-design\"), mdx(\"p\", null, \"I iterated hardware and software together: firmware came up first on an\\nSTM32F411 Nucleo, then on a custom v1 PCB (STM32F405) that integrates the\\nsensors, power regulation, and a 16 MB (128 Mbit) external flash.\"), mdx(\"h2\", null, \"What I took from it\"), mdx(\"p\", null, \"Real-time embedded systems end to end: deterministic scheduling and driver\\ndesign under hard timing budgets, control theory and state estimation in C, and\\nhardware/software co-design through a custom PCB bring-up.\"), mdx(\"a\", {\n    href: \"/docs/flight-controller-report.pdf\",\n    target: \"_blank\",\n    rel: \"noopener noreferrer\"\n  }, \"View the full report (PDF)\"), \" \\xA0\\xB7\\xA0 \", mdx(\"a\", {\n    href: \"/docs/flight-controller-presentation.pdf\",\n    target: \"_blank\",\n    rel: \"noopener noreferrer\"\n  }, \"View the presentation (PDF)\"), \" \\xA0\\xB7\\xA0 \", mdx(\"a\", {\n    href: \"/docs/flight-controller-components.pdf\",\n    target: \"_blank\",\n    rel: \"noopener noreferrer\"\n  }, \"View the hardware / components doc (PDF)\"));\n}\n;\nMDXContent.isMDXComponent = true;"}},"pageContext":{"slug":"projects/flight-controller"}},
    "staticQueryHashes": ["3649515864","68838506"]}