Outdoor Height Keeping Flying.
Gazebo HITL simulating
Msh shell system
Integrated Development Environment(IDE)
- Main Control:STM32F427 + STM32F100
- IDE: Keil MDK5.23
- RT-Thread Open-Source Embedded Real-Time Operating System: V2.1.0
Hardware Design
The hardware uses the open source project Pixhawk, as shown in the following image. Pixhawk is also the most widely used and supported open source flight control hardware in the world.
Main Features are as follows:
- 168MHz / 256 MIPS Cortex M4F
- 14 PWM/Servo output
- Extended bus interface (I2C, CAN, UART)
- Redundant power input
- External safety switch
- Multi-color LED
- External microSD card slot
Sensor:
- ST Micro L3GD20 16-bit gyroscope
- ST Micro LSM303D 16-bit accelerometer/magnetometer
- Invensense MPU 6000 three-axis accelerometer/gyroscope
- MEAS MS5611 air pressure meter
Interface:
- 5x UART, 2x CAN, I2C, SPI
- DSM/DSM2/DSM-X satellite compatible input
- PPWM, S-BUS
- 3.3 & 6.6V ADC Inputs
- microUSB
In addition to the Pixhawk, the entire system also has a number of external electronic devices, such as brushless motor, GPS, electronic speed control, radio modem, RC receiver, Lidar-Lite lidar and so on. The overall system framework is shown below:
Software Design
1. Driver Layer
The Driver layer enables the driver of all hardware devices on board Pixhawk, such as sensor devices (gyroscopes, accelerometers, magnetometers, air pressure meters, etc.), bus devices (UART, I2C, SPI, etc.), USB, motor driver, SD card driver, GPS driver, LED, and some on-board devices. Each driver registers with RT-Thread in the form of Device and provides its own init(), read(), write, ioctrl() functions for upper-level calls. Here we are taking the driver of the hmc5883 magnetometer to illustrate the general design steps of the driver.
- Device Initialization Function
The following is the initialization function of hmc5883. First, the Functions of the device functionality are assigned a function pointer, init(), read() and ioctrl() are defined. A driver device named hmc5883 is then registered with RT-Thread, and the upper layer can obtain the driver device by looking for the device name. Next is to set up the corresponding bus device for hmc5883. hmc5883 uses i2c communication, so the corresponding i2c device is found in the initialization.
- init()
The Init() function does some initialization for chips, including register configuration.
- read()
The read() function enables the reading of device data, such as raw magnetic field data and reading the magnetic field data after calibration.
- ioctrl()
The Ioctrl() function mainly implements the configuration functionalities of some devices, such as setting the range of magnetic field measurement, sampling frequency, etc.
2. RTOS Layer
In this project, I'm using RT-Thread opensource embedded operating system, it is powerful by providing basic thread scheduling, memory management, synchronization and other basic functions, as well as providing msh shell system, device drive system, making the overall architecture of the system more clear and with more complete functions....
Read more »