Gripper code for R5 bot

Dependents:   GrabTest R5 2016 Robotics Team 1

Committer:
j_j205
Date:
Sat Apr 09 11:02:01 2016 +0000
Revision:
3:5e473aa5381f
Parent:
2:4857ea4719e1
jj

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Hypna 1:92a09a39e546 1 #ifndef GRIPPER_H
Hypna 1:92a09a39e546 2 #define GRIPPER_H
Hypna 1:92a09a39e546 3
Hypna 0:f1aeb307ab68 4 #include "mbed.h"
Hypna 0:f1aeb307ab68 5
Hypna 0:f1aeb307ab68 6 //definitions for servo PWM settings in us
j_j205 3:5e473aa5381f 7 #define GRIP_DEF 1700
j_j205 3:5e473aa5381f 8 #define GRIP_OPEN 1750
j_j205 2:4857ea4719e1 9 #define GRIP_CLOSE 1500
j_j205 3:5e473aa5381f 10 #define WRIST_DEF 1900
j_j205 2:4857ea4719e1 11 #define WRIST_UP 1900
Hypna 0:f1aeb307ab68 12 #define WRIST_DOWN 1500
Hypna 0:f1aeb307ab68 13 #define PWM_PER 20000
Hypna 0:f1aeb307ab68 14
Hypna 0:f1aeb307ab68 15 class Gripper
Hypna 0:f1aeb307ab68 16 {
Hypna 0:f1aeb307ab68 17 public:
Hypna 0:f1aeb307ab68 18 //gripPin is pwm pin connected to gripper servo, wristPin is pwm pin connected to wrist servo
Hypna 0:f1aeb307ab68 19 Gripper(PinName gripPin, PinName wristPin);
Hypna 0:f1aeb307ab68 20 //closes gripper to fit target
Hypna 0:f1aeb307ab68 21 void grip();
Hypna 0:f1aeb307ab68 22 //fully opens gripper
Hypna 0:f1aeb307ab68 23 void release();
Hypna 0:f1aeb307ab68 24 //raises wrist to target angle
Hypna 0:f1aeb307ab68 25 void lift();
Hypna 0:f1aeb307ab68 26 //lowers wrist to grabbing angle
Hypna 0:f1aeb307ab68 27 void lower();
Hypna 0:f1aeb307ab68 28
Hypna 0:f1aeb307ab68 29 private:
Hypna 0:f1aeb307ab68 30 PwmOut gripPwm;
Hypna 0:f1aeb307ab68 31 PwmOut wristPwm;
Hypna 1:92a09a39e546 32 };
Hypna 1:92a09a39e546 33 #endif