00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __N_AXES_GENERATOR_POS_H__
00022 #define __N_AXES_GENERATOR_POS_H__
00023
00024 #include <rtt/RTT.hpp>
00025
00026 #include <rtt/TaskContext.hpp>
00027 #include <rtt/Properties.hpp>
00028 #include <rtt/Ports.hpp>
00029 #include <rtt/Command.hpp>
00030 #include <rtt/Method.hpp>
00031
00032 #include <kdl/velocityprofile_trap.hpp>
00033 #include <rtt/TimeService.hpp>
00034
00035 #include <ocl/OCL.hpp>
00036
00037 namespace OCL
00038 {
00052 class nAxesGeneratorPos : public RTT::TaskContext
00053 {
00054 public:
00060 nAxesGeneratorPos(std::string name);
00061 virtual ~nAxesGeneratorPos();
00062
00074 virtual bool configureHook();
00082 virtual bool startHook();
00087 virtual void updateHook();
00088
00089 virtual void stopHook();
00090
00091 private:
00092 bool moveTo(const std::vector<double>& position, double time=0);
00093 bool moveFinished() const;
00094 void resetPosition();
00095
00096 unsigned int num_axes;
00097 std::vector<double> p_m, p_d, v_d, v_max, a_max;
00098 protected:
00113 RTT::Command<bool(std::vector<double>,double)> moveTo_cmd;
00118 RTT::Method<void(void)> reset_position_mtd;
00120 RTT::ReadDataPort< std::vector<double> > p_m_port;
00122 RTT::WriteDataPort< std::vector<double> > p_d_port;
00124 RTT::WriteDataPort< std::vector<double> > v_d_port;
00125 private:
00126 std::vector<KDL::VelocityProfile_Trap> motion_profile;
00127 RTT::TimeService::ticks time_begin;
00128 RTT::TimeService::Seconds time_passed;
00129 double max_duration;
00130
00131 bool is_moving;
00132 protected:
00134 RTT::Property< std::vector<double> > v_max_prop;
00136 RTT::Property< std::vector<double> > a_max_prop;
00138 RTT::Property< unsigned int > num_axes_prop;
00139 };
00140 }
00141 #endif // __N_AXES_GENERATOR_POS_H__