![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
DRのPS3での操作用(アームの開閉をコントローラで制御可能)
Dependencies: mbed CalPID motorout ros_lib_melodic MotorController_AbsEC
KondoServoLibrary/KondoServo.h@12:c2bb0a9587b5, 2021-07-30 (annotated)
- Committer:
- koheim
- Date:
- Fri Jul 30 11:36:46 2021 +0000
- Revision:
- 12:c2bb0a9587b5
- Parent:
- 0:83b2c6a67cce
a
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ayu13 | 0:83b2c6a67cce | 1 | #ifndef __KONDO_SERVO_H__ |
ayu13 | 0:83b2c6a67cce | 2 | #define __KONDO_SERVO_H__ |
ayu13 | 0:83b2c6a67cce | 3 | |
ayu13 | 0:83b2c6a67cce | 4 | #include "mbed.h" |
ayu13 | 0:83b2c6a67cce | 5 | #include "SerialHalfDuplex.h" |
ayu13 | 0:83b2c6a67cce | 6 | |
ayu13 | 0:83b2c6a67cce | 7 | typedef enum ServoMode{single = 0,multi = 1}s_mode; |
ayu13 | 0:83b2c6a67cce | 8 | typedef unsigned char u8; |
ayu13 | 0:83b2c6a67cce | 9 | |
ayu13 | 0:83b2c6a67cce | 10 | class KondoServo{ |
ayu13 | 0:83b2c6a67cce | 11 | protected: |
ayu13 | 0:83b2c6a67cce | 12 | unsigned int baudrate; |
ayu13 | 0:83b2c6a67cce | 13 | s_mode mode; |
ayu13 | 0:83b2c6a67cce | 14 | SerialHalfDuplex master; |
ayu13 | 0:83b2c6a67cce | 15 | |
ayu13 | 0:83b2c6a67cce | 16 | public: |
ayu13 | 0:83b2c6a67cce | 17 | void init(int baud); |
ayu13 | 0:83b2c6a67cce | 18 | void init(); |
ayu13 | 0:83b2c6a67cce | 19 | |
ayu13 | 0:83b2c6a67cce | 20 | void setSpeed(int id, u8 speed); |
ayu13 | 0:83b2c6a67cce | 21 | float readSpeed(int id); |
ayu13 | 0:83b2c6a67cce | 22 | int set_degree(int id,float degree); |
ayu13 | 0:83b2c6a67cce | 23 | void setID(u8 id); |
ayu13 | 0:83b2c6a67cce | 24 | u8 readID(); |
ayu13 | 0:83b2c6a67cce | 25 | ~KondoServo(); |
ayu13 | 0:83b2c6a67cce | 26 | KondoServo(PinName txPin,PinName rxPin, int quantity=2, unsigned int baud=115200); |
ayu13 | 0:83b2c6a67cce | 27 | |
ayu13 | 0:83b2c6a67cce | 28 | }; |
ayu13 | 0:83b2c6a67cce | 29 | #endif |