Gripper code for R5 bot
Dependents: GrabTest R5 2016 Robotics Team 1
Gripper.h@0:f1aeb307ab68, 2016-02-24 (annotated)
- Committer:
- Hypna
- Date:
- Wed Feb 24 16:31:12 2016 +0000
- Revision:
- 0:f1aeb307ab68
- Child:
- 1:92a09a39e546
Adding Gripper
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Hypna | 0:f1aeb307ab68 | 1 | #include "mbed.h" |
Hypna | 0:f1aeb307ab68 | 2 | |
Hypna | 0:f1aeb307ab68 | 3 | //definitions for servo PWM settings in us |
Hypna | 0:f1aeb307ab68 | 4 | #define GRIP_DEF 1500 |
Hypna | 0:f1aeb307ab68 | 5 | #define GRIP_OPEN 1700 |
Hypna | 0:f1aeb307ab68 | 6 | #define GRIP_CLOSE 1120 |
Hypna | 0:f1aeb307ab68 | 7 | #define WRIST_DEF 1500 |
Hypna | 0:f1aeb307ab68 | 8 | #define WRIST_UP 2000 |
Hypna | 0:f1aeb307ab68 | 9 | #define WRIST_DOWN 1500 |
Hypna | 0:f1aeb307ab68 | 10 | #define PWM_PER 20000 |
Hypna | 0:f1aeb307ab68 | 11 | |
Hypna | 0:f1aeb307ab68 | 12 | class Gripper |
Hypna | 0:f1aeb307ab68 | 13 | { |
Hypna | 0:f1aeb307ab68 | 14 | public: |
Hypna | 0:f1aeb307ab68 | 15 | //gripPin is pwm pin connected to gripper servo, wristPin is pwm pin connected to wrist servo |
Hypna | 0:f1aeb307ab68 | 16 | Gripper(PinName gripPin, PinName wristPin); |
Hypna | 0:f1aeb307ab68 | 17 | //closes gripper to fit target |
Hypna | 0:f1aeb307ab68 | 18 | void grip(); |
Hypna | 0:f1aeb307ab68 | 19 | //fully opens gripper |
Hypna | 0:f1aeb307ab68 | 20 | void release(); |
Hypna | 0:f1aeb307ab68 | 21 | //raises wrist to target angle |
Hypna | 0:f1aeb307ab68 | 22 | void lift(); |
Hypna | 0:f1aeb307ab68 | 23 | //lowers wrist to grabbing angle |
Hypna | 0:f1aeb307ab68 | 24 | void lower(); |
Hypna | 0:f1aeb307ab68 | 25 | |
Hypna | 0:f1aeb307ab68 | 26 | private: |
Hypna | 0:f1aeb307ab68 | 27 | PwmOut gripPwm; |
Hypna | 0:f1aeb307ab68 | 28 | PwmOut wristPwm; |
Hypna | 0:f1aeb307ab68 | 29 | }; |