First of all install update and upgrade your system:
$ sudo apt update
$ sudo apt upgrade
Then, install required libraries:
| import numpy as np | |
| from scipy.signal import filtfilt, butter | |
| from quaternion import quaternion, from_rotation_vector, rotate_vectors | |
| def estimate_orientation(a, w, t, alpha=0.9, g_ref=(0., 0., 1.), | |
| theta_min=1e-6, highpass=.01, lowpass=.05): | |
| """ Estimate orientation with a complementary filter. | |
| Fuse linear acceleration and angular velocity measurements to obtain an |
| #!/usr/bin/env python3 | |
| import argparse | |
| import numpy as np | |
| import cv2 as cv | |
| import glob | |
| import os | |
| import sophus as sp | |
| from multiprocessing import Pool |
Instructions tested with a Raspberry Pi 2 with an 8GB memory card. Probably also works fine on a Raspberry Pi 3.
Download the latest Raspbian Jessie Light image. Earlier versions of Raspbian won't work.
Write it to a memory card using Etcher, put the memory card in the RPi and boot it up.
| #include "EventDispatcher.h" | |
| void EventDispatcher::addListener( Listener *l ) | |
| { | |
| mListeners.push_back(l); | |
| } | |
| void EventDispatcher::removeListener( Listener *l ) | |
| { | |
| mListeners.erase( std::remove( mListeners.begin(), mListeners.end(), l ), mListeners.end() ); |
| /* | |
| * Example of `bridge' design pattern | |
| * Copyright (C) 2011 Radek Pazdera | |
| * This program is free software: you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation, either version 3 of the License, or | |
| * (at your option) any later version. | |
| * This program is distributed in the hope that it will be useful, |
| /* | |
| * Example of `adapter' design pattern | |
| * Copyright (C) 2011 Radek Pazdera | |
| * This program is free software: you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation, either version 3 of the License, or | |
| * (at your option) any later version. | |
| * This program is distributed in the hope that it will be useful, |
| /* | |
| * Example of `prototype' design pattern. | |
| * Copyright (C) 2011 Radek Pazdera | |
| * This program is free software: you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation, either version 3 of the License, or | |
| * (at your option) any later version. | |
| * This program is distributed in the hope that it will be useful, |
| // Simple decorator pattern example | |
| // (c) Daniel Livingstone 2012 | |
| // CC-BY-SA | |
| #include <string> | |
| #include <iostream> | |
| using namespace std; | |
| class AbstractNPC { | |
| public: |
| #include <iostream> | |
| #include <unordered_map> | |
| #include <functional> | |
| #include <vector> | |
| // Base class | |
| class Shape { | |
| public: | |
| virtual void draw() = 0; | |
| }; |