Code Monkey home page Code Monkey logo

docs's Introduction

#树莓派飞控RasPilot#

###RasPilot硬件参数### 特性

  • 支持树莓派1 A+/B+;树莓派2 B+
  • STM32F103 failsafe co-processor
  • ardupilot飞控代码
  • pixhawk接口兼容
  • USB(RPi) / Servo Rail BEC / Power Module三路电源输入

传感器

  • ST Micro L3GD20H 16位陀螺仪
  • ST Micro LSM303D 14位加速度计/磁力计
  • Invensense MPU 6000 3轴陀螺仪/加速度计
  • MEAS MS5611 气压计

接口

  • 2x UART
  • 1x CAN
  • 8x PWM
  • Spektrum DSM / DSM2 / DSM-X® Satellite 兼容接收机
  • Futaba S.BUS® 兼容输入输出
  • PPM sum 接收机
  • RSSI(PWM或电压)输入
  • 1x I2C
  • 3.3V & 6.6V A/D输入
  • 安全开关
  • 蜂鸣器接口
  • 板载三色LED

###硬件安装和接线### 1 安装外壳。如下图,用铜柱和螺母将树莓派固定在底壳上。插上飞控扩展板,再用螺丝固定上壳。


2 接口说明:


3 减震安装
震动对飞控的定高性能影响很大,安装时需注意对飞控做好减震处理。

###写入系统镜像到树莓派SD卡### 树莓派官方的Linux系统实时性不适合运行飞控程序,因此要使用打了RT-patch的系统镜像。
首先下载和解压Linux系统的镜像文件。目前还没来得及自己编译,暂时借用emlid打包的镜像。

 树莓派1代
  百度网盘:http://pan.baidu.com/s/1kTEKmCv
  Mega网盘:https://mega.co.nz/#!RVJxHJpI!QVPTZaNY0AiuPbcxQjOTmZ2un6d0j7W3g1jwheuotUc
 树莓派2代
  百度网盘:http://pan.baidu.com/s/1qWsVr9y
  Mega网盘:https://mega.co.nz/#!0VZFzbwC!6tTzWFKl8jdR4Q52A9A03wYyAPghIDKtxGpavNMBKn4

然后按照树莓派的官方教程将镜像文件写入SD卡:

 Linux:https://www.raspberrypi.org/documentation/installation/installing-images/linux.md
 Mac OS:https://www.raspberrypi.org/documentation/installation/installing-images/mac.md
 Windows:https://www.raspberrypi.org/documentation/installation/installing-images/windows.md
 其它帮助文档:https://www.raspberrypi.org/documentation/

或者可以百度,有很多中文教程。

###配置树莓派WiFi连接### 编辑/etc/wpa_supplicant/wpa_supplicant.conf文件
 sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
将文件中的
 ssid = “emlidltd”
 psk = “emlidltd”
 key_mgmt = wpa-psk
改为自己WiFi的SSID和密码。

###安装和设置飞控程序### 1 下载飞控程序
 ArduCopter.elf 百度网盘下载地址:http://pan.baidu.com/s/1hqJ9ZbY (1、2代树莓派均可使用)
 下载后放到树莓派用户根目录,即/home/pi目录中。
 修改ArduCopter.elf可执行权限:
 chmod +x ArduCopter.elf

2 运行飞控程序
 sudo ./ArduCopter.elf -B /dev/ttyAMA0
 ArduCopter.elf可以带-A -B -C -E四个参数,其中:
 * -A primary数传接口
 * -B primary GPS接口
 * -C secondary数传接口
 * -E sencondary GPS接口
 raspilot中:-B 即GPS的串口使用树莓派自带的串口/dev/ttyAMA0,波特率自适应;
 -C 默认是STM32扩展的串口,作为数传接口。波特率默认为57600,可以在Mission Planner界面中进行配置。

 如果要使用WiFi的udp作为数传的话,可以输入:
 sudo ./ArduCopter.elf -A udp:192.168.1.100:14550 -B /dev/ttyAMA0
 其中192.168.1.100改为PC端的IP地址

3 设置开机自动运行
 修改/etc/rc.local文件,在exit 0前加入:
 sudo ./home/pi/ArduCopter.elf -B /dev/ttyAMA0 > /home/pi/startup_log &
 重新启动后飞控程序就会自动运行

###编译飞控代码### 从Copter-3.3开始,ardupilot的编译需要使用4.7版本以上的gcc。而树莓派系统上还是4.6版本的gcc,所以建议在Ubuntu下面交叉编译代码。 这里使用树莓派官方提供的交叉编译工具

1 下载树莓派编译工具,例如这里放到/opt目录下
 sudo git clone --depth 1 https://github.com/raspberrypi/tools.git /opt/tools

2 设置环境变量
 32位系统输入:export PATH=/opt/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin:$PATH
 64位系统输入:export PATH=/opt/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:$PATH

3 编译ardupilot

  • 从GitHub上获取源代码:
     git clone https://github.com/raspilot/ardupilot-raspilot.git
  • 进入ArduCopter目录后编译:
     cd ardupilot-raspilot/ArduCopter
     make raspilot
  • 通过WiFi同步到树莓派:
     rsync -avz /tmp/ArduCopter.build/ArduCopter.elf [email protected]:/home/pi/
     其中192.168.1.100改为树莓派的实际IP地址

###修改I2C波特率### 系统默认的I2C波特率是1MHz,可以在/etc/modprobe.d/i2c.conf中修改波特率。
 sudo nano /etc/modprobe.d/i2c.conf

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.