My static website generator using poole https://www.xythobuz.de
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

xycontrol.md 4.8KB

title: xyControl title_de: xyControl description: AVR base Quadrocopter Flight Controller parent: projects position: 40 comments: true flattr: true github: https://github.com/xythobuz/xyControl date: 2012-11-12

update: 2014-09-01

Logo

Current Progress

Youtube Link

xyControl is a Quadrocopter Flight Controller based on Atmels Atmega2560 microcontroller. It features 512KB SRAM on-board, using the external memory interface of this processor. Also included is a switched power supply as well as a USB connection to communicate with and program the target. All I/O pins, including 3 additional UARTs, SPI, I2C (TWI) and 16 ADC Channels, are accessible via standard 2.54mm connectors. The Board can be powered from an external stable 5V supply, USB or 7V or more, via the on-board switched power supply. All voltage sources can be selected via jumpers.

Photo 1 Photo 2 Screenshot

Flight Control Software Flow

Three tasks are controlling the Quadrocopter Orientation in Space.

  • The Orientation Task reads the Gyroscope and Accelerometer and calculates the current Roll and Pitch angles. They are stored in the global struct “orientation”.
  • The PID Task is then feeding these angles into two PID controllers. Their output is then used by…
  • The Set Task, which calculates the motor speeds and gives them to…
  • The motor task, which sends the new values via TWI to the motor controllers.

Supported Hardware

External Memory (xmem.h)

The external memory consists of a 512Kx8 SRAM, bank-switched onto the 16bit avr address space. This gives us 8 memory banks, consisting of 56KB. All memory from 0x0000 to 0x21FF is the AVRs internal memory. The memory banks are switched into 0x2200 to 0xFFFF. This gives us 8 banks with 56KB each, resulting in 448KB external RAM.

The data and bss memory sections, as well as the Stack are located in the internal RAM. The external RAM is used only for dynamically allocated memory.

Orientation Calculation (orientation.h)

Calculates the current angles of the platform, using Gyroscope and Accelerometer Data with a Kalman Filter. It is using this slightly modified Kalman Filter Implementation by Linus Helgesson.

PC and Android Tools

You can find some PC Software in the tools directory. Each one should be accompanied by it’s own Readme file.

UART-Flight Status Packet Format

printf("t%.2f %.2f %.2f\n", kp, ki, kd);
printf("u%.2f %.2f\n", pid_output[1], pid_output[0]); // Pitch, Roll
printf("v%i %i %i %i\n", motorSpeed[0], ..., motorSpeed[3]);
printf("w%.2f\n", orientation.pitch);
printf("x%.2f\n", orientation.roll);
printf("y%.2f\n", orientation.yaw);
printf("z%.2f\n", getVoltage());

Software used

License

Peter Fleurys TWI Library (twi.c & twi.h) is released under the GNU GPL license.

Everything else is released under a BSD-Style license. See the accompanying COPYING file.