Skip to content
Snippets Groups Projects
Commit 7dfb764d authored by Lars Jonsson's avatar Lars Jonsson
Browse files

Further writing of the flight controller parts

parent 1a99ab04
No related branches found
No related tags found
No related merge requests found
Pictures/copter_1.jpg

3.52 MiB

Pictures/copter_1.png

1.13 MiB | W: | H:

Pictures/copter_1.png

1.25 MiB | W: | H:

Pictures/copter_1.png
Pictures/copter_1.png
Pictures/copter_1.png
Pictures/copter_1.png
  • 2-up
  • Swipe
  • Onion skin
Pictures/fc_communication_1.png

1.56 MiB

File moved
Pictures/msp_ppm.png

1.55 MiB

\subsection{Flight Controller} \subsection{Flight Controller}
%Behov av städning efter flytt %Behov av städning efter flytt
To get the copter flying up and down through the shaft without crashing into the walls, we need to take away as much human interaction as possible. % To get the copter flying up and down through the shaft without crashing into the walls, we need to take away as much human interaction as possible.
Therefore we will only use high level commands to fly this copter. % Therefore we will only use high level commands to fly this copter.
Only a couple of commands for controlling the copter like "go up", "go down" or "manual control" will be available in the final product. % Only a couple of commands for controlling the copter like "go up", "go down" or "manual control" will be available in the final product.
When you send the commands up/down the copter will start to navigate its own way up or down through the shaft using Infrared, Sonar and LIDAR. % When you send the commands up/down the copter will start to navigate its own way up or down through the shaft using Infrared, Sonar and LIDAR.
If you set the copter to manual mode, you will be controlling the Copter using a radio transmitter/receiver, and no sensors will be there to guide you. % If you set the copter to manual mode, you will be controlling the Copter using a radio transmitter/receiver, and no sensors will be there to guide you.
A flight controller is needed to keep the quad copter stable while it's in the air. A flight controller is needed to keep the quad copter stable while it's in the air.
To be able to do this the flight controller uses an on-board IMU that measures the acceleration and the angular velocity of the copter. To be able to do this the flight controller uses an on-board IMU that measures the acceleration and the angular velocity of the copter.
The angular velocity is measured around the three axis x,y,z and in flight dynamics often called roll, pitch and yaw, see figure \ref{fig:roll_pitch_yaw}. The angular velocity is measured around the three axis x,y,z and in flight dynamics often called roll, pitch and yaw, see figure \ref{fig:roll_pitch_yaw}.
In Cleanflight and in many other flight controller software the controlling part is implemented as three individual PID controllers, where each PID controls one angle, e.g yaw, pitch and roll. In most flight controller software the controlling part is implemented as three individual PID controllers, where each PID controls one angle, e.g yaw, pitch and roll.
By controlling the throttle of each motor, it will get a stable copter, with the angles minimized. By controlling the throttle of each motor, the flight controller will give you a steady flight.
\begin{figure}[H] \begin{figure}[H]
\centering \centering
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
\begin{figure}[H] \begin{figure}[H]
\centering \centering
\includegraphics[width=0.3\textwidth]{Pictures/flip32.jpg} \includegraphics[width=0.25\textwidth]{Pictures/flip32.jpg}
\caption{FLIP32 F3 AIO-Lite.} \caption{FLIP32 F3 AIO-Lite.}
\label{fig:flightcontroller} \label{fig:flightcontroller}
\end{figure} \end{figure}
......
\subsection{Flight Controller} \subsection{Flight Controller}
% Håller på att städa här efter omflytt. % Håller på att städa här efter omflytt.
% Verkar vara problem att köra "return" för nytt stycke, blir typ 10 radhopp istället för 1.
After some reading on the web we chose to flash a software called Cleanflight to the flight controller. To be able to start up the flight controller for the first time you will need to flash the flight controller with some sort of software.
We chose Cleanflight because of its has a well documented source code, gets regularly firmware updates and has a broad hardware support. There are many flight controller softwares on the market, a couple of them are open source.
The main GUI is nice and easy to start out with, it's straight forward on how the change parameter values, and how to setup the board before your first flight. After some reading around on the web we decided to flash a software called \href{http://cleanflight.com/}{Cleanflight} to the flight controller.
We chose Cleanflight because of it has a well documented source code, gets regularly firmware updates and has a broad hardware support.
The main GUI looks nice and is easy to start out with, it's straight forward how to change parameter values, and how to setup the board before your first flight.
The firmware that we flashed our flight controller with is the cleanflight\_SPRACINGF3.hex v$1.13.0$.
Which was the newest stable version of Cleanflight at the time.\\\\
Normally a quad copter or any other RC vehicle is controlled by a radio transmitter. Normally a quad copter or any other RC vehicle is controlled by a radio transmitter.
For a quad copter the radio transmitter must have at least 4 channels. For a quad copter the radio transmitter must have at least 4 channels.
The four channels that is necessary to have is the three rotation axis yaw, pitch and roll plus the absolute throttle to all the motors. The four channels that is necessary to have is the three rotation axis yaw, pitch and roll plus the absolute throttle to all the motors.
In this project we are going to use another approach to control the copter. In this project we are going to use another approach to control the copter.
Instead of having full control of the copter using the radio transmitter you will only be able to maneuver the copter with high level commands. Instead of having full control of the copter using the radio transmitter you will only be able to maneuver the copter with high level commands.\\\\
To be able to do this we need to interact with the flight controller from our MCU. To be able to do this we need to interact with the flight controller from our MCU.
The flight controller has support for four different communication protocols. The flight controller has support for four different communication protocols.
It can take PWM inputs, where one PWM controls one channel. It can take PWM inputs, where one PWM controls one channel.
It have PPM support, which is quite the same as a PWM but it has support for 8 PWM signals on one line. It have PPM support, which is quite the same as a PWM but it has support for 8 PWM signals on one line.
% Kanske förklara tydligare?
It do support sBUS, which is some sort of secure serial protocol with inverted signals. It do support sBUS, which is some sort of secure serial protocol with inverted signals.
The last protocol it supports is called MSP (MultiWii Serial Protocol), which also is a serial protocol. The last protocol it supports is called MSP (MultiWii Serial Protocol), which also is a serial protocol.\\\\
Our first thought was that we wanted to implement both the MSP and PPM protocols to control the copter. Our first thought was that we wanted to implement both the MSP and PPM protocols to control the copter.
We wanted PPM to be able to maneuver the copter with the RC transmitter, and MSP to control the copter with our MCU. We wanted PPM to be able to maneuver the copter with the RC transmitter, and MSP to control the copter with our MCU.
We also hoped that we will be able to have a 2-way communication wth the flight controller using MSP. We also hoped that we will be able to have a 2-way communication with the flight controller using MSP.
This so we could be able to not only send commands to the flight controller, but also retrieve information from the flight controller aswell. This so we could be able to not only send commands to the flight controller, but also retrieve information from the flight controller as well, which can be seenn in Figure~\ref{fig:fc_communication_1}.
This communication scheme is shown in fig \ref{fig:fc_communication_first}.
\begin{figure}[H]
\includegraphics[width=0.7\textwidth]{Pictures/fc_communication_1}
\caption{This shows how the intended communication between the radio-transmitter, MCU and flight controller was going to be implemented.}
\label{fig:fc_communication_1}
\end{figure}
The hard part with this approach was how to be able to switch between these two protocols mid air. The hard part with this approach was how to be able to switch between these two protocols mid air.
We did have some thought how we could do this, but we didn't manage to get this working without rewriting some code in the flight controller. We did have some thought how we could do this, but we didn't manage to get this working without rewriting some code in the flight controller.
So the easiest way to solve this problem was to decode the PPM signal from the transmitter
With this approach the transmitter will send a radio signal to the receiver that converts this into a PPM signal, the PPM signal is then read by the MCU and is then converted into a MSP frame that will be send over UART to the flight controller, which is shown in figure \ref{fig:fc_communication}. With this approach the transmitter will send a radio signal to the receiver that converts this into a PPM signal, the PPM signal is then read by the MCU and is then converted into a MSP frame that will be send over UART to the flight controller, which is shown in figure \ref{fig:fc_communication_2}.
\begin{figure}[H] \begin{figure}[H]
\includegraphics[width=0.7\textwidth]{Pictures/fc_communication} \includegraphics[width=0.7\textwidth]{Pictures/fc_communication_2}
\caption{This shows how the communication between the radio-transmitter, MCU and flight controller works.} \caption{This shows how the communication between the radio-transmitter, MCU and flight controller works.}
\label{fig:fc_communication} \label{fig:fc_communication_2}
\end{figure} \end{figure}
With this approach we won't have any control of the copter if something goes wrong with the MCU, but it can work without rewriting any code in the flight controller. With this approach we won't have any control of the copter if something goes wrong with the MCU, but it can work without rewriting any code in the flight controller.
......
...@@ -91,23 +91,14 @@ ...@@ -91,23 +91,14 @@
\newpage \newpage
\section{Components and Peripherals} \section{Components and Peripherals}
\input{./components/usart} \input{./components/usart}
\input{./components/ethernet} \input{./components/ethernet}
\input{./components/lidar} \input{./components/lidar}
\input{./components/timer} \input{./components/timer}
\input{./components/sonar} \input{./components/sonar}
\input{./components/spi} \input{./components/spi}
\input{./components/uwb} \input{./components/uwb}
\input{./components/adc} \label{sec:adc} \input{./components/adc} \label{sec:adc}
\input{./components/ir} \label{sec:IR} \input{./components/ir} \label{sec:IR}
\input{./components/flightcontroller} \input{./components/flightcontroller}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment