HapticFormationController.hpp
Go to the documentation of this file.
00001 /*
00002  * HapticFormationController.hpp
00003  *
00004  *  Created on: Mar 4, 2012
00005  *      Author: mriedel
00006  */
00007 
00008 #ifndef HAPTICFORMATIONCONTROLLER_HPP_
00009 #define HAPTICFORMATIONCONTROLLER_HPP_
00010 
00011 #include <telekyb_defines/telekyb_defines.hpp>
00012 #include <tk_haptics_base/HapticDeviceController.hpp>
00013 
00014 #include <telekyb_base/Time.hpp>
00015 
00016 #include <telekyb_base/Options.hpp>
00017 
00018 // Send Vector3
00019 #include <geometry_msgs/Vector3Stamped.h>
00020 
00021 #include <telekyb_msgs/TKState.h>
00022 #include <telekyb_base/Messages.hpp>
00023 // QC Feedback
00024 
00025 // Generic Subscribers
00026 #include <telekyb_base/ROS/GenericSubscriber.hpp>
00027 
00028 using namespace TELEKYB_NAMESPACE;
00029 
00030 namespace telekyb_haptic {
00031 
00032 class HapticFormationControllerOptions : public OptionContainer
00033 {
00034 public:
00035         Option< std::vector<int> >* tRobotIDs;
00036         Option< double >* tSendFrequency;
00037         Option< std::string >* tInputTopicName;
00038         Option< std::string >* tOutputTopicName;
00039         Option< double >* tVelocityGain;
00040         Option< Eigen::Matrix3d >* tRotationMatrix;
00041         // Gains
00042         Option< double >* tPropGain;
00043         Option< double >* tDeriGain;
00044         Option< double >* tErrGain;
00045 
00046 
00047         HapticFormationControllerOptions(const std::string& identifier);
00048 };
00049 
00050 
00051 
00052 class HapticFormationController : public HapticDeviceController {
00053 protected:
00054         Timer frequencyTimer;
00055         HapticFormationControllerOptions* options;
00056 
00057         // Pub and Sub
00058         ros::NodeHandle nodeHandle;
00059         ros::Publisher vectorPub;
00060 
00061         std::vector< GenericSubscriber<telekyb_msgs::TKState>* > stateSubscribers;
00062 
00063         ros::Subscriber stateSub0;
00064         ros::Subscriber stateSub1;
00065 
00066         // Last Msgs
00067         TKState lastStateMsg0;
00068         TKState lastStateMsg1;
00069 
00070         void stateCB0(const telekyb_msgs::TKState::ConstPtr& stateMsg);
00071         void stateCB1(const telekyb_msgs::TKState::ConstPtr& stateMsg);
00072 
00073 
00074         //Eigen::Matrix3d rotation;
00075 
00076 
00077 
00078 public:
00079         HapticFormationController();
00080         virtual ~HapticFormationController();
00081 
00082         // Identifier (e.g. for NodeHandle)
00083         void setIdentifier(const std::string& identifier);
00084 
00085         // Get's specific Axes mapping, Set if needed
00086         void setAxesMapping(HapticAxesMapping& xAxis, HapticAxesMapping& yAxis, HapticAxesMapping& zAxis);
00087 
00088         // Get the Range of each axes
00089         void setAxesRange(const Position3D& minValues, const Position3D& maxValues);
00090 
00091         void willEnterSpinLoop();
00092 
00093         // has to be fast and should not slow down the loop
00094         void loopCB(const HapticOuput& output, HapticInput& input);
00095 
00096         void didLeaveSpinLoop();
00097 };
00098 
00099 }
00100 
00101 #endif /* HAPTICFORMATIONCONTROLLER_HPP_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Defines


tk_formation
Author(s): Martin Riedel
autogenerated on Mon Nov 11 2013 11:14:18