Software installation: Difference between revisions

From Rsewiki
Line 84: Line 84:
  #include <core_pins.h> // <= added include line
  #include <core_pins.h> // <= added include line


====multiple main=====
===== * multiple main =====


You probably get:
You probably get:

Revision as of 09:37, 7 August 2015

Software installation

Toolchain installation

Install arduino 1.06 from

http://arduino.cc/en/Main/OldSoftwareReleases

(newer arduino versions is not supported - as of September 2014)

Then get and install the teensey tool installer from:

https://www.pjrc.com/teensy/td_download.html

Run the installer - on 32 bit linux it is:

chmod +x teensyduino.32bit  
./teensyduino.32bit

It installes (only) as a merge with the arduino installed directory (arduino-1.0.6).

From this installation we need only some hardware parts in

arduino-1.0.6/hardware/tools
arduino-1.0.6/hardware/teensy/cores/teensy3

Teensy loader and udev rules

Teensy loader: Get the loader - and udev rules - from

https://www.pjrc.com/teensy/loader.html

The teensy loader needs to be unpacked - on linux it is:

gunzip teensy.gz
chmod +x teensy

For Linux get also the udev rules, and copy them to /etc/udev/rules.d to get read-write access to the usb connection (/dev/ttyACM0) and others:

sudo cp 49-teensy.rules /etc/udev/rules.d/

Regbot software

Then get the regbot software (from SVN repository on previous page)

It consist of a series of directories but is missing the tools and teensy3 directories,

Copy (or link) the arduino-1.0.6/hardware/tools and arduino-1.0.6/hardware/teensy/cores/teensy3 directory to the regbot directory, or set the TOOLSPATH and COREPATH in the regbot Makefile.

Links: go into the regbot directory with the source

cd regbot
ln -s ~/arduino-1.0.6/hardware/tools .
ln -s ~/arduino-1.0.6/hardware/teensy/cores/teensy3 .
ln -s tools/teensy .

The last link is only for convenience to start the teensy loader application.

Compile REGBOT

Compile the source

make

Common errors

* millies()

If you get

$ make
[CXX]   src/baro180.cpp
[CXX]   src/data_logger.cpp
[CXX]   src/i2c_t3.cpp
[CXX]   src/main.cpp
[CXX]   src/mission.cpp
[CXX]   src/motor_controller.cpp
[CXX]   src/mpu9150.cpp
[CXX]   src/rbuf.cpp
[CXX]   src/robot.cpp
In file included from src/main.h:31:0,
                from src/robot.cpp:29:
./teensy3/usb_serial.h: In member function 'size_t usb_serial_class::readBytes(char*, size_t)':
./teensy3/usb_serial.h:97:38: error: 'millis' was not declared in this scope
   unsigned long startMillis = millis();

The millis() function is defined in core_pins.h, so I added this into:

nano -w ./teensy3/usb_serial.h
// line 38 39
#include <inttypes.h>
#include <core_pins.h> // <= added include line
* multiple main

You probably get:

make
...
.../regbot/teensy3/main.cpp:4: multiple definition of `main'
.../regbot/build/src/main.o:/.../regbot/src/main.cpp:434: first defined here
collect2: error: ld returned 1 exit status
make: *** [regbot.elf] Fejl 1

Then rename the teensy3 main file from the compile set

cd teensy3
mv teensy3/main.cpp teensy3/main.cpp.not_used

Library changes

In the teensy3 directory I needed to add an include to get everything to compile

in file teensy3/usb_serial.h add #include <core_pins.h> as in the list below:

...
#ifndef USBserial_h_
#define USBserial_h_

#include <core_pins.h>
#include "usb_desc.h"
...

And as there is a main.cpp file already in the teensy3 dirrectory, this need to be removed (or renamed) to avoid compilation.

mv teensy3/main.cpp teensy3/main.cpp.not

Python packages

Additional python packages used to show some graphs (if implemented)

  • python-pyqtgraph
  • python-qt4-gl
  • python-scipy

On my 14.04 32 bit ubuntu the python-pyqtgraph package was not found using apt-get, so I

downloaded from http://www.pyqtgraph.org/ the debian package python-pyqtgraph_0.9.10-1_all.deb and installed using:

sudo dpkg -i python-pyqtgraph_0.9.10-1_all.deb