00001 /* Copyright (c) 2011, MATHE Antal Koppany <mathekoppany@yahoo.com>, All rights reserved. */ 00002 /* Copyright (c) 2010, Thomas Ruehr <ruehr@cs.tum.edu>, All rights reserved. */ 00003 00004 #ifndef __ACCELEROMETER_H__ 00005 #define __ACCELEROMETER_H__ 00006 00007 #include <ros/ros.h> 00008 #include <actionlib/client/simple_action_client.h> 00009 #include <pr2_gripper_sensor_msgs/PR2GripperEventDetectorAction.h> 00010 #include <pr2_msgs/AccelerometerState.h> 00011 00012 typedef actionlib::SimpleActionClient<pr2_gripper_sensor_msgs::PR2GripperEventDetectorAction> DetectContactAC; 00013 00014 class Accelerometer{ 00015 private: 00016 int side_; 00017 DetectContactAC *acc_client_; 00018 static Accelerometer *instance_[]; 00019 00020 Accelerometer(int side=0);//side 0 means right hand 00021 ~Accelerometer(); 00022 00023 void accelCallback(const pr2_msgs::AccelerometerState::ConstPtr& msg); 00024 00025 00026 00027 public: 00028 static Accelerometer *getInstance(int side=0); 00029 void detectContact(double magnitude=1.6); 00030 00031 }; 00032 00033 #endif