Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
MachineState.h@0:3b748c4d0906, 2015-09-16 (annotated)
- Committer:
- DeguNaoto
- Date:
- Wed Sep 16 08:04:03 2015 +0000
- Revision:
- 0:3b748c4d0906
?? ver 0.1
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| DeguNaoto | 0:3b748c4d0906 | 1 | #ifndef MACHINE_STATE_H |
| DeguNaoto | 0:3b748c4d0906 | 2 | #define MACHINE_STATE_H |
| DeguNaoto | 0:3b748c4d0906 | 3 | |
| DeguNaoto | 0:3b748c4d0906 | 4 | /** |
| DeguNaoto | 0:3b748c4d0906 | 5 | * Includes |
| DeguNaoto | 0:3b748c4d0906 | 6 | */ |
| DeguNaoto | 0:3b748c4d0906 | 7 | #include "mbed.h" |
| DeguNaoto | 0:3b748c4d0906 | 8 | #include "QEI.h" |
| DeguNaoto | 0:3b748c4d0906 | 9 | |
| DeguNaoto | 0:3b748c4d0906 | 10 | /** |
| DeguNaoto | 0:3b748c4d0906 | 11 | * Defines |
| DeguNaoto | 0:3b748c4d0906 | 12 | */ |
| DeguNaoto | 0:3b748c4d0906 | 13 | #define PI 3.14159265359 |
| DeguNaoto | 0:3b748c4d0906 | 14 | |
| DeguNaoto | 0:3b748c4d0906 | 15 | class MachineState { |
| DeguNaoto | 0:3b748c4d0906 | 16 | |
| DeguNaoto | 0:3b748c4d0906 | 17 | public: |
| DeguNaoto | 0:3b748c4d0906 | 18 | MachineState( double wheelRadius, double halfTread, double pulsePerRev, |
| DeguNaoto | 0:3b748c4d0906 | 19 | PinName rightChannelA, PinName rightChannelB, PinName leftChannelB, PinName leftChannelA, double PERIOD, |
| DeguNaoto | 0:3b748c4d0906 | 20 | double originY = 0.0, double originY = 0.0, double originSita = 0.0 ); |
| DeguNaoto | 0:3b748c4d0906 | 21 | void reset(void); |
| DeguNaoto | 0:3b748c4d0906 | 22 | double getX(void); |
| DeguNaoto | 0:3b748c4d0906 | 23 | double getY(void); |
| DeguNaoto | 0:3b748c4d0906 | 24 | double getSita(void); |
| DeguNaoto | 0:3b748c4d0906 | 25 | double getVelocity(void); |
| DeguNaoto | 0:3b748c4d0906 | 26 | void mesureState(void); |
| DeguNaoto | 0:3b748c4d0906 | 27 | |
| DeguNaoto | 0:3b748c4d0906 | 28 | private: |
| DeguNaoto | 0:3b748c4d0906 | 29 | |
| DeguNaoto | 0:3b748c4d0906 | 30 | QEI EncoderRight; |
| DeguNaoto | 0:3b748c4d0906 | 31 | QEI EncoderLeft; |
| DeguNaoto | 0:3b748c4d0906 | 32 | |
| DeguNaoto | 0:3b748c4d0906 | 33 | double PulsesRight_; |
| DeguNaoto | 0:3b748c4d0906 | 34 | double PulsesLeft_; |
| DeguNaoto | 0:3b748c4d0906 | 35 | double PrefPulsesRight_; |
| DeguNaoto | 0:3b748c4d0906 | 36 | double PrefPulsesLeft_; |
| DeguNaoto | 0:3b748c4d0906 | 37 | double dsita_; |
| DeguNaoto | 0:3b748c4d0906 | 38 | double dx_; |
| DeguNaoto | 0:3b748c4d0906 | 39 | double dy_; |
| DeguNaoto | 0:3b748c4d0906 | 40 | double dlr_; |
| DeguNaoto | 0:3b748c4d0906 | 41 | double dll_; |
| DeguNaoto | 0:3b748c4d0906 | 42 | double vr_; |
| DeguNaoto | 0:3b748c4d0906 | 43 | double vl_; |
| DeguNaoto | 0:3b748c4d0906 | 44 | double halfTread_; |
| DeguNaoto | 0:3b748c4d0906 | 45 | double PERIOD_; |
| DeguNaoto | 0:3b748c4d0906 | 46 | double pulsePerRev_; |
| DeguNaoto | 0:3b748c4d0906 | 47 | double wheelRadius_; |
| DeguNaoto | 0:3b748c4d0906 | 48 | volatile double x_; |
| DeguNaoto | 0:3b748c4d0906 | 49 | volatile double y_; |
| DeguNaoto | 0:3b748c4d0906 | 50 | volatile double sita_; |
| DeguNaoto | 0:3b748c4d0906 | 51 | volatile double velocity_; |
| DeguNaoto | 0:3b748c4d0906 | 52 | }; |
| DeguNaoto | 0:3b748c4d0906 | 53 | |
| DeguNaoto | 0:3b748c4d0906 | 54 | |
| DeguNaoto | 0:3b748c4d0906 | 55 | #endif |