00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __KUKA361NAXESACCELERATIONCONTROLLER__
00019 #define __KUKA361NAXESACCELERATIONCONTROLLER__
00020
00021 #include <rtt/RTT.hpp>
00022
00023 #include <rtt/TaskContext.hpp>
00024 #include <rtt/Properties.hpp>
00025 #include <rtt/Ports.hpp>
00026 #include <rtt/Command.hpp>
00027 #include <rtt/TimeService.hpp>
00028
00029 #include "kuka361InvDynnf.hpp"
00030 #include "kuka361FwDynnf.hpp"
00031
00032 #include <ocl/OCL.hpp>
00033
00034 namespace OCL
00035 {
00044 class Kuka361nAxesAccelerationController : public RTT::TaskContext
00045 {
00046 public:
00053 Kuka361nAxesAccelerationController(const std::string& name);
00054 virtual ~Kuka361nAxesAccelerationController();
00055
00056 virtual bool configureHook();
00057 virtual bool startHook();
00058 virtual void updateHook();
00059 virtual void stopHook();
00060 virtual void cleanupHook();
00061
00062 private:
00063 bool startCalibration(double duration, double vmin, double vmax);
00064 bool finishedCalibration() const;
00065 void startMonitoring();
00066 void stopMonitoring();
00067 void Calculate();
00068 std::vector<double> Filter(vector<double>& x);
00069
00070 unsigned int num_axes;
00071 std::vector<double> q;
00072 std::vector<double> qdot;
00073 std::vector<double> qdot_des;
00074 std::vector<double> qddot_con;
00075 std::vector<double> driveValue;
00076
00077 kuka361InvDynnf* kuka361INVDYN;
00078 kuka361FwDynnf kuka361FWDYN;
00079 protected:
00080
00081 RTT::DataPort< std::vector<double> > q_meas_Port;
00082 RTT::DataPort< std::vector<double> > qdot_meas_Port, qdot_des_Port;
00083 RTT::DataPort< std::vector<double> > q_con_Port;
00084 RTT::WriteDataPort< bool > saturationPort;
00085 RTT::WriteDataPort<std::vector<double> > drives;
00086 RTT::ReadDataPort<std::vector<double> > torque_meas_Port;
00087 std::vector<double>torque_meas_local;
00088
00090 RTT::Property< double > dqm;
00091 RTT::Property< bool > UseDesVel;
00092 RTT::Property< std::vector<double> > torque_offset;
00093 RTT::Property< std::vector<double> > torque_scale;
00094 RTT::Property<double> Ts;
00095
00096 private:
00097 bool saturated, ReportedSaturation;
00098 std::vector<double> Km;
00099 unsigned int num_samples, samplenumber, initDataVecSize, dataVecSize;
00100 double time_sleep;
00101 RTT::TimeService::ticks time_begin;
00102
00103 bool isCalibrating, isMonitoring;
00104 std::vector<double> time_data;
00105 std::vector< std::vector<double> > q_data, qdot_data, qddot_data, tau_meas_data, tau_model_data;
00106 RTT::Command<bool(double,double,double)> _Calibrate;
00107
00108 };
00109 }
00110 #endif // __N_AXES_EFFECTOR_H__