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.
Dependencies: mbed X_NUCLEO_PLC01A1 ros_lib_melodic
ms-94bzb.h@1:ef4b86795d79, 2020-08-15 (annotated)
- Committer:
 - yamadola
 - Date:
 - Sat Aug 15 09:09:33 2020 +0000
 - Revision:
 - 1:ef4b86795d79
 - Parent:
 - 0:43eb9ccc1583
 - Child:
 - 3:ea5cfd721b53
 
whole program without debugs
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| yamadola | 0:43eb9ccc1583 | 1 | #ifndef MS94BZB_H | 
| yamadola | 0:43eb9ccc1583 | 2 | #define MS94BZB_H | 
| yamadola | 0:43eb9ccc1583 | 3 | |
| yamadola | 0:43eb9ccc1583 | 4 | #include "motor.h" | 
| yamadola | 0:43eb9ccc1583 | 5 | #include "can_controller.h" | 
| yamadola | 0:43eb9ccc1583 | 6 | |
| yamadola | 0:43eb9ccc1583 | 7 | class MS_94BZB: public Motor{ | 
| yamadola | 0:43eb9ccc1583 | 8 | private: | 
| yamadola | 0:43eb9ccc1583 | 9 | /* CAN control commands */ | 
| yamadola | 0:43eb9ccc1583 | 10 | static const uint16_t MOTOR_COMMAND = (0x03<<7); | 
| yamadola | 0:43eb9ccc1583 | 11 | static const uint8_t DRIVE = 1<<0; | 
| yamadola | 0:43eb9ccc1583 | 12 | static const uint8_t STOP = 0<<0; | 
| yamadola | 0:43eb9ccc1583 | 13 | static const uint8_t CCW = 0<<1; | 
| yamadola | 0:43eb9ccc1583 | 14 | static const uint8_t CW = 0<<1; | 
| yamadola | 0:43eb9ccc1583 | 15 | static const uint8_t SHORT = 0<<7; | 
| yamadola | 0:43eb9ccc1583 | 16 | static const uint8_t FREE = 1<<7; | 
| yamadola | 0:43eb9ccc1583 | 17 | |
| yamadola | 0:43eb9ccc1583 | 18 | static const uint16_t CTL_COMMAND = (0x09<<7); | 
| yamadola | 0:43eb9ccc1583 | 19 | static const uint8_t PWM_CTL = 0; | 
| yamadola | 0:43eb9ccc1583 | 20 | static const uint8_t CAN_CTL = 1; | 
| yamadola | 0:43eb9ccc1583 | 21 | |
| yamadola | 0:43eb9ccc1583 | 22 | /* Pointer of CAN controller */ | 
| yamadola | 0:43eb9ccc1583 | 23 | CANController *_pCanController; | 
| yamadola | 0:43eb9ccc1583 | 24 | |
| yamadola | 0:43eb9ccc1583 | 25 | /* Gear ratio of the MS-94BZB gear head */ | 
| yamadola | 0:43eb9ccc1583 | 26 | const float _gearRatio; | 
| yamadola | 0:43eb9ccc1583 | 27 | |
| yamadola | 0:43eb9ccc1583 | 28 | /* Turning speed of brush-less motor (60-3000[rmp]) */ | 
| yamadola | 0:43eb9ccc1583 | 29 | uint16_t _refMotorAngularVelocity; | 
| yamadola | 0:43eb9ccc1583 | 30 | |
| yamadola | 0:43eb9ccc1583 | 31 | /* Turning direction (CW:0x02 CCW:0x00) */ | 
| yamadola | 0:43eb9ccc1583 | 32 | uint8_t DIR; | 
| yamadola | 0:43eb9ccc1583 | 33 | |
| yamadola | 0:43eb9ccc1583 | 34 | /* Turning acceleration of brush-less motor (100-11,164[rpm/s])*/ | 
| yamadola | 0:43eb9ccc1583 | 35 | uint16_t _accel; | 
| yamadola | 0:43eb9ccc1583 | 36 | |
| yamadola | 0:43eb9ccc1583 | 37 | public: | 
| yamadola | 0:43eb9ccc1583 | 38 | MS_94BZB( uint8_t motorID, CANController *pCanController); | 
| yamadola | 0:43eb9ccc1583 | 39 | virtual void motorInit(); | 
| yamadola | 0:43eb9ccc1583 | 40 | virtual void drive(); | 
| yamadola | 0:43eb9ccc1583 | 41 | virtual void stop(); | 
| yamadola | 1:ef4b86795d79 | 42 | virtual void free(); | 
| yamadola | 0:43eb9ccc1583 | 43 | void setAngularVelocity(float avel); | 
| yamadola | 0:43eb9ccc1583 | 44 | void setAcceleration(uint16_t accel); | 
| yamadola | 0:43eb9ccc1583 | 45 | }; | 
| yamadola | 0:43eb9ccc1583 | 46 | |
| yamadola | 0:43eb9ccc1583 | 47 | #endif |