PowerCubeArmUUISRC.h
Go to the documentation of this file.
00001 /*
00002  * PowerCubeArmUUISRC.h
00003  *
00004  * Hardware specific code for the PowerCube arm at UUISRC.
00005  * Extracted from old PowerCube class at best guess.
00006  */
00007 
00008 #ifndef POWERCUBEARMUUISRC_H_
00009 #define POWERCUBEARMUUISRC_H_
00010 
00011 #include "SchunkProtocolArm.h"
00012 
00013 
00014 class PowerCubeArmUUISRC: public SchunkProtocolArm {
00015 
00016 #define GRIPPER_ID      (modules_count_-1)
00017 
00018 public:
00019         virtual void init() {
00020                 SchunkProtocolArm::init();
00021 
00022                 ackAll();
00023                 sleep(1);
00024                 refAll();
00025                 sleep(15);
00026                 ackAll();
00027                 sleep(1);
00028                 refAll();
00029                 sleep(15);
00030         }
00031 
00032         virtual int emergencyStopJoint(IDType id) {
00033                 // ignoring the gripper?
00034                 if(id == modules_count_-1) {
00035                         ROS_WARN("emergency: ignoring module %d", id + id_offset_);
00036                         return 0;
00037                 }
00038                 else {
00039                         return SchunkProtocolArm::emergencyStopJoint(id);
00040                 }
00041         }
00042 
00043         virtual int ackJoint(IDType id) {
00044                 const SCHUNKMotionManipulator::ModuleConfig *moduleConfig;
00045                 manipulator_.getModuleConfig(id + id_offset_, moduleConfig);
00046                 if (moduleConfig->error_code == 217)
00047                         // do not ack the non emergency stopped
00048                         return 0;
00049                 else
00050                         return ackJoint(id);
00051         }
00052 
00053         virtual int refJoint(IDType id) {
00054                 if(id == GRIPPER_ID) {
00055                         const SCHUNKMotionManipulator::ModuleConfig *moduleConfig;
00056                         manipulator_.getModuleConfig(id + id_offset_, moduleConfig);
00057 
00058                         if(moduleConfig->status_flags.flags.referenced) {
00059                                 // dont ref the gripper anymore
00060                                 return 0;
00061                         }
00062                 }
00063 
00064                 return ackJoint(id) + SchunkProtocolArm::refJoint(id);
00065         }
00066 
00067 };
00068 
00069 #endif /* POWERCUBEARMUUISRC_H_ */


metralabs_ros
Author(s): Yianni Gatsoulis and Chris Burbridge and Lorenzo Riano and Felix Kolbe
autogenerated on Mon Oct 6 2014 07:27:58