Libbarrett  1.2.4
include/barrett/products/gimbals_hand_controller.h
00001 
00025 /*
00026  * @file gimbals_hand_controller.h
00027  * @date 1/4/2011
00028  * @author Dan Cody
00029  * 
00030  */
00031 
00032 #ifndef BARRETT_PRODUCTS_GIMBALS_HAND_CONTROLLER_H_
00033 #define BARRETT_PRODUCTS_GIMBALS_HAND_CONTROLLER_H_
00034 
00035 
00036 #include <barrett/detail/ca_macro.h>
00037 #include <barrett/products/puck.h>
00038 
00039 
00040 namespace barrett {
00041 
00042 
00043 class GimbalsHandController {
00044 public:
00046         GimbalsHandController(Puck* p6, Puck* p7);
00048         ~GimbalsHandController() {}
00050         void update();
00052         bool getThumbOpen() const { return thumbOpen; }
00054         bool getThumbClose() const { return thumbClose; }
00056         bool getPointerOpen() const { return pointerOpen; }
00058         bool getPointerClose() const { return pointerClose; }
00060         bool getMiddleOpen() const { return middleOpen; }
00062         bool getMiddleClose() const { return middleClose; }
00064         bool getRockerUp() const { return rockerUp; }
00066         bool getRockerDown() const { return rockerDown; }
00068         double getKnob() const { return knob / COUNTS_PER_RAD; }
00070         void setKnob(double value) { knob = value * COUNTS_PER_RAD; }
00071 
00072 protected:
00073         static const int SWITCH_THRESH1 = 1000;
00074         static const int SWITCH_THRESH2 = 2450;
00075 
00076         static const int KNOB_MIN_VALID = 500;
00077         static const int KNOB_MAX_VALID = 2800;
00078         static const double COUNTS_PER_RAD = 4096.0 / (2*M_PI);
00079 
00080 
00081         Puck& p6;
00082         Puck& p7;
00083 
00084         enum Puck::Property ana0, ana1;
00085 
00086         bool thumbOpen, thumbClose, pointerOpen, pointerClose, middleOpen, middleClose, rockerUp, rockerDown;
00087         int knob;  // CCW positive
00088 
00089         // knob state
00090         bool usingBrown;
00091         int brown_1, dGreen_1;
00092 
00093 private:
00094         DISALLOW_COPY_AND_ASSIGN(GimbalsHandController);
00095 };
00096 
00097 
00098 }
00099 
00100 
00101 #endif /* BARRETT_PRODUCTS_GIMBALS_HAND_CONTROLLER_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Defines