![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
This program is for an autonomous robot for the competition at the Hochschule Luzern. http://cruisingcrepe.wordpress.com/ We are one of the 32 teams. http://cruisingcrepe.wordpress.com/ The postition control is based on this Documentation: Control of Wheeled Mobile Robots: An Experimental Overview from Alessandro De Luca, Giuseppe Oriolo, Marilena Vendittelli. For more information see here: http://www.dis.uniroma1.it/~labrob/pub/papers/Ramsete01.pdf
Fork of autonomous Robot Android by
Actuators/Hallsensor.h@6:48eeb41188dd, 2013-03-23 (annotated)
- Committer:
- chrigelburri
- Date:
- Sat Mar 23 13:52:48 2013 +0000
- Revision:
- 6:48eeb41188dd
- Parent:
- 3:92ba0254af87
- Child:
- 11:775ebb69d5e1
mit link und rechten Radradius
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chrigelburri | 3:92ba0254af87 | 1 | #ifndef HALLSENSOR_H |
chrigelburri | 3:92ba0254af87 | 2 | #define HALLSENSOR_H |
chrigelburri | 3:92ba0254af87 | 3 | |
chrigelburri | 3:92ba0254af87 | 4 | #include "mbed.h" |
chrigelburri | 3:92ba0254af87 | 5 | |
chrigelburri | 3:92ba0254af87 | 6 | /** |
chrigelburri | 3:92ba0254af87 | 7 | * @author Christian Burri |
chrigelburri | 3:92ba0254af87 | 8 | * |
chrigelburri | 3:92ba0254af87 | 9 | * @section LICENSE |
chrigelburri | 3:92ba0254af87 | 10 | * |
chrigelburri | 3:92ba0254af87 | 11 | * Copyright © 2013 HSLU Pren Team #1 Cruising Crêpe |
chrigelburri | 3:92ba0254af87 | 12 | * All rights reserved. |
chrigelburri | 3:92ba0254af87 | 13 | * |
chrigelburri | 3:92ba0254af87 | 14 | * @section DESCRIPTION |
chrigelburri | 3:92ba0254af87 | 15 | * |
chrigelburri | 3:92ba0254af87 | 16 | * Interface to count the Hallsensor input from a EC-Motor. |
chrigelburri | 6:48eeb41188dd | 17 | * |
chrigelburri | 3:92ba0254af87 | 18 | */ |
chrigelburri | 3:92ba0254af87 | 19 | class Hallsensor |
chrigelburri | 3:92ba0254af87 | 20 | { |
chrigelburri | 3:92ba0254af87 | 21 | |
chrigelburri | 6:48eeb41188dd | 22 | private: |
chrigelburri | 6:48eeb41188dd | 23 | |
chrigelburri | 6:48eeb41188dd | 24 | /** |
chrigelburri | 6:48eeb41188dd | 25 | * Update the pulse count. |
chrigelburri | 6:48eeb41188dd | 26 | * Called on every rising/falling edge of Hall 1-3. |
chrigelburri | 6:48eeb41188dd | 27 | * Reads the state of the channels and determines whether a pulse forward |
chrigelburri | 6:48eeb41188dd | 28 | * or backward has occured, updating the count appropriately. |
chrigelburri | 6:48eeb41188dd | 29 | */ |
chrigelburri | 6:48eeb41188dd | 30 | void encode(void); |
chrigelburri | 6:48eeb41188dd | 31 | |
chrigelburri | 6:48eeb41188dd | 32 | InterruptIn hall1_; |
chrigelburri | 6:48eeb41188dd | 33 | InterruptIn hall2_; |
chrigelburri | 6:48eeb41188dd | 34 | InterruptIn hall3_; |
chrigelburri | 6:48eeb41188dd | 35 | |
chrigelburri | 6:48eeb41188dd | 36 | int prevState_; |
chrigelburri | 6:48eeb41188dd | 37 | int currState_; |
chrigelburri | 6:48eeb41188dd | 38 | |
chrigelburri | 6:48eeb41188dd | 39 | volatile int pulses_; |
chrigelburri | 6:48eeb41188dd | 40 | |
chrigelburri | 3:92ba0254af87 | 41 | public: |
chrigelburri | 3:92ba0254af87 | 42 | |
chrigelburri | 3:92ba0254af87 | 43 | /** |
chrigelburri | 3:92ba0254af87 | 44 | * Constructor of the class <code>Hallsensor</code>. |
chrigelburri | 3:92ba0254af87 | 45 | * |
chrigelburri | 3:92ba0254af87 | 46 | * Reads the current values on Hall1 , Hall2 and Hall3 to determine the |
chrigelburri | 3:92ba0254af87 | 47 | * initial state. |
chrigelburri | 3:92ba0254af87 | 48 | * Attaches the encode function to the rise/fall interrupt edges of |
chrigelburri | 3:92ba0254af87 | 49 | * Hall1, Hall2 and Hall3. |
chrigelburri | 3:92ba0254af87 | 50 | * @param hall1 mbed pin for Hall1 input. |
chrigelburri | 3:92ba0254af87 | 51 | * @param hall2 mbed pin for Hall2 input. |
chrigelburri | 3:92ba0254af87 | 52 | * @param hall3 mbed pin for Hall3 input. |
chrigelburri | 3:92ba0254af87 | 53 | */ |
chrigelburri | 3:92ba0254af87 | 54 | Hallsensor(PinName hall1, PinName hall2, PinName hall3); |
chrigelburri | 3:92ba0254af87 | 55 | |
chrigelburri | 3:92ba0254af87 | 56 | /** |
chrigelburri | 3:92ba0254af87 | 57 | * Reset the encoder. |
chrigelburri | 3:92ba0254af87 | 58 | * Sets the pulses and revolutions count to zero. |
chrigelburri | 3:92ba0254af87 | 59 | */ |
chrigelburri | 3:92ba0254af87 | 60 | void reset(void); |
chrigelburri | 3:92ba0254af87 | 61 | |
chrigelburri | 3:92ba0254af87 | 62 | /** |
chrigelburri | 3:92ba0254af87 | 63 | * Read the number of pulses recorded by the encoder. |
chrigelburri | 3:92ba0254af87 | 64 | * @return Number of pulses which have occured, given in [count] |
chrigelburri | 3:92ba0254af87 | 65 | */ |
chrigelburri | 3:92ba0254af87 | 66 | int getPulses(void); |
chrigelburri | 3:92ba0254af87 | 67 | |
chrigelburri | 3:92ba0254af87 | 68 | /** |
chrigelburri | 3:92ba0254af87 | 69 | * Read the number of revolutions recorded by the encoder. |
chrigelburri | 3:92ba0254af87 | 70 | * @return Number of revolutions which have occured on the index channel. |
chrigelburri | 3:92ba0254af87 | 71 | */ |
chrigelburri | 3:92ba0254af87 | 72 | int getRevolutions(void); |
chrigelburri | 3:92ba0254af87 | 73 | |
chrigelburri | 3:92ba0254af87 | 74 | }; |
chrigelburri | 3:92ba0254af87 | 75 | |
chrigelburri | 3:92ba0254af87 | 76 | #endif /* Hallsensor_H */ |