00001 /* 00002 * Experiment.hpp 00003 * 00004 * Created on: Oct 26, 2011 00005 * Author: mriedel 00006 */ 00007 00008 #ifndef EXPERIMENT_HPP_ 00009 #define EXPERIMENT_HPP_ 00010 00011 #include "ExperimentDefines.hpp" 00012 #include "ExperimentOptions.hpp" 00013 00014 #include <sensor_msgs/Joy.h> 00015 #include <geometry_msgs/TransformStamped.h> 00016 00017 #include "udpraw.h" 00018 00019 #include <telekyb_base/Spaces.hpp> 00020 00021 namespace telekyb { 00022 00023 class Experiment { 00024 protected: 00025 State currState; 00026 ExperimentOptions* options; 00027 00028 ros::NodeHandle nodeHandle; 00029 ros::Subscriber joySub; 00030 ros::Subscriber inputTransformSub; 00031 ros::Publisher inputTransformPub; 00032 00033 // UDP Socket 00034 Udpraw udp; 00035 00036 Position3D neutralPosition; 00037 double maxInputOffset; 00038 00039 void joystickCB(const sensor_msgs::Joy::ConstPtr& msg); 00040 void inputCB(const geometry_msgs::TransformStamped::Ptr& msg); 00041 00042 bool setNextNeutralPosition; 00043 00044 // state functions 00045 void init(); 00046 void ready(); 00047 void liftoff(); 00048 void user(); 00049 void touchdown(); 00050 void flyto(); 00051 00052 void error(); 00053 00054 public: 00055 Experiment(); 00056 virtual ~Experiment(); 00057 00058 // read 00059 void readSpin(); 00060 00061 00062 00063 }; 00064 00065 } 00066 00067 #endif /* EXPERIMENT_HPP_ */