HandEyeGripper.h
Go to the documentation of this file.00001 #ifndef INCLUDED_HandEyeGripper_h
00002 #define INCLUDED_HandEyeGripper_h
00003
00004 #include <math.h>
00005 #include <iostream>
00006
00007 using namespace std;
00008
00009 #include "Shared/WorldState.h"
00010
00011 class HandEyeGripper {
00012 public:
00013 void OpenClose(int OriJoint, float gripperValue, float *gripperServo) {
00014 #ifdef TGT_HAS_ARMS
00015 float negscale = -1;
00016 float posscale = -1;
00017 unsigned int fingerOffset = 1;
00018 #ifdef TGT_HANDEYEZ
00019 negscale = -0.5f;
00020 posscale = -0.5f;
00021 std::cout << gripperValue << std::endl;
00022 #elif TGT_CALLIOPE
00023 fingerOffset = 2;
00024 #endif
00025
00026 for(unsigned int counter = ArmOffset + OriJoint + fingerOffset; counter < ArmOffset + NumArmJoints; counter++) {
00027 if (gripperValue < 0) {
00028 gripperServo[counter] = (gripperValue+1)/2 * negscale;
00029 }
00030 else {
00031 gripperServo[counter] = (gripperValue+1)/2 * posscale;
00032 }
00033 }
00034 #endif
00035 }
00036 };
00037
00038 #endif