Hexakopter

From Rsewiki
Revision as of 06:25, 24 August 2014 by Jca (Talk | contribs)

Jump to: navigation, search

How to compile and install software in hexacopter The modifications work best under windows, but some support exist for linux too.

This description is for windows (XP)

Contents

Get software

The supplier URL is http://www.mikrokopter.de/ucwiki/en/MikroKopter?action=show&redirect=FrontPage

To replace the software the following is needed:

  • the source code - using SVN
  • WinAvr with GCC compiler version 3.xx (newer compiles produce to slow code)
  • kopter-tool to install the software

SVN checkout

Install TortoiseSVN from http://sourceforge.net/projects/tortoisesvn/ if you do not have an SVN client already.

Do a SVN checkout from http://mikrokopter.de/mikrosvn/FlightCtrl/ to get the sourcevode for the flight controler (for other software - e.g. motor controller, the SVN URL is at http://www.mikrokopter.de/ucwiki/MikroKopterRepository)

WinAVR

WinAvr version WinAVR-20060421 comes with gcc version 3.4.6 - wich is OK. gcc version 4.x until at least 4.5.1 will not work (CPU will get overloaded and will - at least - no longer talk to kopter-tool.

  • Open programmers notepad and open a project for the newest branch in the flight controller repository. It already has a project file for programmers notepad. And a makefile for avr-gcc.
  • Compile the project (Tools->make_All) and it should make a *.hex file for one of the Flight-ctrl boards (currently default is version 2.0 with an atMEGA644 processor (Flight-ctrl 2.1 has an atMEGA1284p processor, and one of the first lines in the makefile needs to be changed)

Install new software

To install the newly compiled software use Kopter-tool. The copter has a bootloader installed, and the kopter-tool can switch to the bootloader while running.

Unpack the zip file, and the Kopter-tool is ready. It may be an idea to make a shortcut on the desktop.

  • Connect the helicopter to the PC (Flight-ctrl 5V rs232 port using the USB to 5v-RS232

device from Microkopter. Leave the helocopter battery off. And power the Flight-ctrl processor by connecting the two patch pins on the USB to 5v-RS232 board.

Assuming the USB-to-serial device is known to the PC. The PC now has a new com-port. Make sure this has a number less than com10, as it seems than Kopter-tool will only allow one-digit numbers.

  • Start the Kopter-tool. It will probably say "no connection".

Click on the "Firmware update and Terminal" buttom. From here change the com-port as appropriate. Now a few messages should arrive from the helicopter.

  • Press the "Software Update" and find the compiled *.hex-file.

The newly compiled software should now load.

If the load fails, then try again (at times some data is lost).

If the helicopter fails to run (totally wrong code, or upload-error), then the bootloader (most likely) still works. But the upload needs a special procedure.

Dead kopter bootload: Remove the jumper that powers the Flight-ctrl (on the USB to 5v-RS232 converter), start a new software update, and while it shown dots "...." on the terminal window, replace the jumper, and the boot-loader should be catched before it starts the faulty software. If it fails, retry.


Pixhawk

Raw pixhawk installation

From page https://pixhawk.org/dev/toolchain_installation_lin on a 64bit 14.04 ubuntu (well kubuntu, but this should not matter much)

  • installed dependencies - no problem
sudo apt-get install python-serial python-argparse openocd \
   flex bison libncurses5-dev autoconf texinfo build-essential \
   libftdi-dev libtool zlib1g-dev genromfs git-core wget
  • did not install ia32-libs, nor sudo apt-get install libc6:i386 libgcc1:i386 gcc-4.6-base:i386 libstdc++5:i386 libstdc++6:i386 , as it seems that newer version of the 32bit compiler were there already.
  • added dialout to user group (and a logout - login cycle to implement)
sudo usermod -a -G dialout $USER

Ground control

From page http://qgroundcontrol.org/dev/build_source - get source for ground control application

git clone git://github.com/mavlink/qgroundcontrol.git
cd qgroundcontrol
git submodule init
git submodule update

The last two lines allow other repositories to me in the same tree as groundcontrol.

  • QT is installed as version 4.8, but vesion 5.2+ is needed, so installed
sudo apt-get install qtcreator qttools5-dev qtbase5-dev qt5-default qtdeclarative5-dev libqt5serialport5-dev libqt5svg5-dev libqt5webkit5-dev libsdl1.2-dev build-essential libudev-dev
  • made the needed Makefile
qmake
make
  • Testrun the control application and connect the pixhawk
./release/qgroundcontrol

PX4 firmware

  • Got the px4 firmware from
git clone https://github.com/PX4/Firmware.git px4
  • tried a compile
cd px4
make
  • this fetches - it seems - NuttX (into NuttX/nuttx), but compile fails with "Unsupported version of arm-none-eabi-gcc, found: instead of 4.7.x. Stop."
  • install gcc-arm-none-eabi:
sudo apt-get install gcc-arm-none-eabi
make
  • this gave a new complaint "Unsupported version of arm-none-eabi-gcc, found: 4.8.2 instead of 4.7.x. Stop"

This seemed to be a "on the safe side" error, so I changed the required version in

kate makefiles/toolchain_gnu-arm-eabi.mk
change required version to 4.8
  # CROSSDEV_VER_SUPPORTED	 = 4.7
  CROSSDEV_VER_SUPPORTED	 = 4.8
  • Compile again
make
  • but fails after some time with an error in file px4/uavcan/libuavcan/include/uavcan/util/placement_new.hpp compiler do not understand
#include <new>

The file explained that som compilers don't implement placement new operator, define UAVCAN_IMPLEMENT_PLACEMENT_NEW to apply this workaround, so I changed - in the file

in px4/uavcan/libuavcan/include/uavcan/util/placement_new.hpp
added - as canbus anyhow is not intended to be used here
  // jca
  #define UAVCAN_IMPLEMENT_PLACEMENT_NEW 1
  // jca change end

Then it compiled.

  • Then I Made a test, using the QGroundControl to reflash the pixhawk, with the file Build/px4fmu-v2_default.build/firmware.px4

This is not the way to do it:

  • hold reset on pixhawk for a few seconds, and press "scan" on the firmware Upgrade page in QGroundControl. This will allow to reflash the default vesion.

Arduflight recipy

Log of actions to use pixhawk on hexakopter:

- follow instruction in http://dev.ardupilot.com/wiki/building-px4-for-linux-with-make/ or start with the configuration from Søren, giving the directories in

px4src/ardupilot  
px4src/PX4Firmware
px4src/PX4NuttX
cd  px4src/ardupilot

Make the version for PX

cd ArduKopter
make configure
make px4-v2

Once finished it cam be installed if the pixhawk is connected by

make px4-v2-upload

PIXHAWK (ardupilot) GUI

Get the QT4 based GUI for the (ardupilot) pixhawk by

1. Make sure these packages are installed

sudo apt-get install phonon libqt4-dev libqt4-opengl-dev \
 libphonon-dev libphonon4 phonon-backend-gstreamer \
 qtcreator libsdl1.2-dev libflite1 flite1-dev build-essential \
 libopenscenegraph-dev libssl-dev libqt4-opengl-dev libudev-dev \
 libsndfile1-dev libqt4-sql-sqlite

2. getting the software from git:

git clone https://github.com/diydrones/apm_planner.git apm_planner

3. go to this directory and configure and make

cd apm_planner
qmake

This takes some time

then go to the release directory and run

cd release
./apm_planner
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox