sensor_filter.h
Go to the documentation of this file.
00001 #ifndef PR2_OVERHEAD_GRASPING_SENSOR_FILTER_H
00002 #define PR2_OVERHEAD_GRASPING_SENSOR_FILTER_H
00003 #include <ros/ros.h>
00004 #include "sensor_msgs/JointState.h"
00005 #include "pr2_msgs/AccelerometerState.h"
00006 #include "pr2_msgs/PressureState.h"
00007 #include "pr2_controllers_msgs/JointTrajectoryControllerState.h"
00008 #include "boost/thread/thread.hpp"
00009 //#include "sensor_msgs/Float32MultiArray.h"
00010 //#include "sensor_msgs/MultiArrayDimension.h"
00011 #include "pr2_overhead_grasping/SensorPoint.h"
00012 #include "roslib/Header.h"
00013 #include <ros/package.h>
00014 #include <math.h>
00015 #include <nodelet/nodelet.h>
00016 
00017 using namespace pr2_msgs;
00018 using namespace pr2_controllers_msgs;
00019 using namespace sensor_msgs;
00020 
00021 namespace collision_detection {
00022   float compGauss(float sigma, float x);
00023 
00024   class SensorFilter : public nodelet::Nodelet {
00025     public:
00026       virtual void onInit();
00027       float* sigmas;
00028       void startOnline();
00029       ~SensorFilter();
00030 
00031     protected:
00032       char arm_;
00033       int rate;
00034       int num_sensors;
00035       int num_scales;
00036       long buffer_len;
00037 
00038       long cur_iter;
00039       float** buffer; // holds raw data
00040       float** filters; // holds gauss filters
00041       float*** filtered_buffer; // holds raw data run through gauss filters
00042                                 // time x sensor x scale
00043       //Float32MultiArray sensor_data;
00044 
00045       //void stopOnline();
00046       //float*** runOffline(float** sensor_streams);
00047       void recordData();
00048       void zeroBuffer();
00049       void applyFilter();
00050       
00051       ros::Subscriber js_sub;
00052       ros::Subscriber acc_sub;
00053       ros::Subscriber press_sub;
00054       ros::Subscriber error_sub;
00055 
00056       // most recent messages
00057       JointState::ConstPtr js_msg;
00058       AccelerometerState::ConstPtr acc_msg;
00059       PressureState::ConstPtr press_msg;
00060       JointTrajectoryControllerState::ConstPtr error_msg;
00061 
00062       void jsCallback(JointState::ConstPtr message);
00063       void accCallback(AccelerometerState::ConstPtr message);
00064       void pressCallback(PressureState::ConstPtr message);
00065       void errorCallback(JointTrajectoryControllerState::ConstPtr message);
00066 
00067       bool js_in, acc_in, press_in, error_in;
00068 
00069       boost::thread sf_thread;
00070   };
00071 }
00072 
00073 #endif // PR2_OVERHEAD_GRASPING_SENSOR_FILTER_H


kelsey_sandbox
Author(s): kelsey
autogenerated on Wed Nov 27 2013 11:52:04