HandJoystick.hpp
Go to the documentation of this file.
00001 /*
00002  * HandJoystick.hpp
00003  *
00004  *  Created on: Nov 12, 2011
00005  *      Author: mriedel
00006  */
00007 
00008 #ifndef JOYSTICK_HPP_
00009 #define JOYSTICK_HPP_
00010 
00011 #include <telekyb_defines/telekyb_defines.hpp>
00012 #include <tk_behavior/Behavior.hpp>
00013 
00014 #include <telekyb_base/Spaces/Angle.hpp>
00015 
00016 // plugin stuff
00017 #include <pluginlib/class_list_macros.h>
00018 
00019 // sensormsgs
00020 #include <sensor_msgs/Joy.h>
00021 
00022 using namespace TELEKYB_NAMESPACE;
00023 
00024 namespace telekyb_behavior {
00025 
00026 class HandJoystick : public Behavior {
00027 protected:
00028         Option<std::string>* tHandJoystickTopic;
00029         Option<bool>* tHandJoystickUsePositionMode;
00030         Option<double>* tHandJoystickMinHeight;
00031         Option<double>* tHandJoystickScale;
00032         //Option<double>* tHandJoystickYawRateScale;
00033 
00034         // ROS
00035         ros::NodeHandle nodeHandle;
00036         ros::Subscriber joySub;
00037 
00038         void joystickCB(const sensor_msgs::Joy::ConstPtr& msg);
00039 
00040         Velocity3D lastVelocityInput;
00041         //double lastYawRateInput;
00042 
00043         // Integrated Position for Velocity Mode
00044         Position3D posModeCurPosition;
00045         Angle posModeCurYawAngle;
00046         Time posModeLastInputTime;
00047 
00048         // Outputfield
00049         //bool isValid;
00050 
00051 public:
00052         HandJoystick();
00053 
00054         virtual void initialize();
00055         virtual void destroy();
00056 
00057         // Called directly after Change Event is registered.
00058         virtual bool willBecomeActive(const TKState& currentState, const Behavior& previousBehavior);
00059         // Called after actual Switch. Note: During execution trajectoryStepCreation is used
00060         virtual void didBecomeActive(const TKState& currentState, const Behavior& previousBehavior);
00061         // Called directly after Change Event is registered: During execution trajectoryStepTermination is used
00062         virtual void willBecomeInActive(const TKState& currentState, const Behavior& nextBehavior);
00063         // Called after actual Switch. Runs in seperate Thread.
00064         virtual void didBecomeInActive(const TKState& currentState, const Behavior& nextBehavior);
00065 
00066         // called everytime a new TKState is available AND it is the NEW Behavior of an active Switch
00067         virtual void trajectoryStepCreation(const TKState& currentState, TKTrajInput& generatedTrajInput);
00068 
00069         // called everytime a new TKState is available. Should return false if invalid (swtich to next behavior, or Hover if undef).
00070         virtual void trajectoryStepActive(const TKState& currentState, TKTrajInput& generatedTrajInput);
00071 
00072         // called everytime a new TKState is available AND it is the OLD Behavior of an active Switch
00073         virtual void trajectoryStepTermination(const TKState& currentState, TKTrajInput& generatedTrajInput);
00074 
00075         // Return true if the active Behavior is (still) valid. Initiate Switch otherwise
00076         virtual bool isValid(const TKState& currentState) const;
00077 };
00078 
00079 }
00080 
00081 #endif /* JOYSTICK_HPP_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


tk_vrqc2011
Author(s): Martin Riedel
autogenerated on Wed Apr 24 2013 11:26:17