Helvijs Kiselis
/
MicromousePES2
main.cpp: Sensoren einlesen und Motoren ansteuern
Motion.h@8:862bf9225953, 2018-04-16 (annotated)
- Committer:
- luethale
- Date:
- Mon Apr 16 15:23:42 2018 +0000
- Revision:
- 8:862bf9225953
- Parent:
- 5:47262622a9bf
Regelung f?r Spurhaltung
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Helvis | 0:9a3e7847a4be | 1 | #ifndef MOTION_H_ |
Helvis | 0:9a3e7847a4be | 2 | #define MOTION_H_ |
Helvis | 0:9a3e7847a4be | 3 | |
Helvis | 0:9a3e7847a4be | 4 | #include <cstdlib> |
Helvis | 0:9a3e7847a4be | 5 | #include <mbed.h> |
Helvis | 1:1adf5dfcc7bb | 6 | #include "EncoderCounter.h" |
Helvis | 1:1adf5dfcc7bb | 7 | #include "Controller.h" |
Helvis | 1:1adf5dfcc7bb | 8 | #include "IRSensor.h" |
Helvis | 0:9a3e7847a4be | 9 | |
Helvis | 0:9a3e7847a4be | 10 | |
Helvis | 0:9a3e7847a4be | 11 | class Motion { |
Helvis | 0:9a3e7847a4be | 12 | |
Helvis | 1:1adf5dfcc7bb | 13 | public: |
Helvis | 1:1adf5dfcc7bb | 14 | |
Helvis | 1:1adf5dfcc7bb | 15 | Motion(Controller& controller, EncoderCounter& counterLeft, |
Helvis | 1:1adf5dfcc7bb | 16 | EncoderCounter& counterRight, IRSensor& irSensorL, |
Helvis | 5:47262622a9bf | 17 | IRSensor& irSensorC, IRSensor& irSensorR, |
Helvis | 5:47262622a9bf | 18 | DigitalOut& enableMotorDriver); |
Helvis | 1:1adf5dfcc7bb | 19 | |
Helvis | 1:1adf5dfcc7bb | 20 | virtual ~Motion(); |
Helvis | 1:1adf5dfcc7bb | 21 | void move(); |
Helvis | 1:1adf5dfcc7bb | 22 | void rotateL(); |
Helvis | 1:1adf5dfcc7bb | 23 | void rotateR(); |
Helvis | 5:47262622a9bf | 24 | void stop(); |
Helvis | 5:47262622a9bf | 25 | void rotate180(); |
Helvis | 5:47262622a9bf | 26 | void test(); |
Helvis | 0:9a3e7847a4be | 27 | |
Helvis | 1:1adf5dfcc7bb | 28 | private: |
Helvis | 0:9a3e7847a4be | 29 | |
Helvis | 4:e74c06e43485 | 30 | static const float SPEEDLEFT; |
Helvis | 4:e74c06e43485 | 31 | static const float SPEEDRIGHT; |
Helvis | 1:1adf5dfcc7bb | 32 | |
Helvis | 1:1adf5dfcc7bb | 33 | Controller& controller; |
Helvis | 1:1adf5dfcc7bb | 34 | EncoderCounter& counterLeft; |
Helvis | 1:1adf5dfcc7bb | 35 | EncoderCounter& counterRight; |
Helvis | 1:1adf5dfcc7bb | 36 | IRSensor& irSensorL; |
Helvis | 1:1adf5dfcc7bb | 37 | IRSensor& irSensorC; |
Helvis | 1:1adf5dfcc7bb | 38 | IRSensor& irSensorR; |
Helvis | 5:47262622a9bf | 39 | DigitalOut& enableMotorDriver; |
Helvis | 1:1adf5dfcc7bb | 40 | float distanceL; |
Helvis | 1:1adf5dfcc7bb | 41 | float distanceC; |
Helvis | 1:1adf5dfcc7bb | 42 | float distanceR; |
Helvis | 5:47262622a9bf | 43 | short countsL; |
Helvis | 5:47262622a9bf | 44 | short countsR; |
Helvis | 5:47262622a9bf | 45 | short countsLOld; |
Helvis | 5:47262622a9bf | 46 | short countsROld; |
Helvis | 0:9a3e7847a4be | 47 | |
Helvis | 0:9a3e7847a4be | 48 | }; |
Helvis | 0:9a3e7847a4be | 49 | |
Helvis | 0:9a3e7847a4be | 50 | #endif /* MOTION_H_ */ |