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_VEL_H__
00022 #define __N_AXES_GENERATOR_VEL_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 {
00051 class nAxesGeneratorVel : public RTT::TaskContext
00052 {
00053 public:
00059 nAxesGeneratorVel(std::string name);
00060 virtual ~nAxesGeneratorVel();
00072 virtual bool configureHook();
00080 virtual bool startHook();
00085 virtual void updateHook();
00086 virtual void stopHook();
00087
00088 private:
00089 bool setInitVelocity(const unsigned int axis, const double velocity);
00090 bool setInitVelocities(const std::vector<double>& velocity);
00091 bool velocityFinished(const unsigned int axis) const;
00092 bool velocitiesFinished() const;
00093 bool applyVelocity(const unsigned int axis, const double velocity, double duration=0);
00094 bool applyVelocities(const std::vector<double>& velocity, double duration=0);
00095 bool gotoVelocity(const int unsigned axis, const double velocity, double duration=0);
00096 bool gotoVelocities(const std::vector<double>& velocity, double duration=0);
00097
00098 unsigned int num_axes;
00099
00100 std::vector<double> duration_desired, duration_trajectory, v_d, a_max, j_max;
00101 std::vector<bool> maintain_velocity;
00102 std::vector<RTT::TimeService::ticks> time_begin;
00103 std::vector<RTT::TimeService::Seconds> time_passed;
00104 std::vector<KDL::VelocityProfile_Trap> vel_profile;
00105 protected:
00116 RTT::Command<bool(int,double,double)> applyVelocity_cmd;
00117
00127 RTT::Command<bool(std::vector<double>,double)> applyVelocities_cmd;
00128
00140 RTT::Command<bool(int,double,double)> gotoVelocity_cmd;
00141
00152 RTT::Command<bool(std::vector<double>,double)> gotoVelocities_cmd;
00153
00162 RTT::Method<void(int,double)> setInitVelocity_mtd;
00163
00173 RTT::Method<void(std::vector<double>)> setInitVelocities_mtd;
00174
00176 RTT::WriteDataPort< std::vector<double> > v_d_port;
00179 RTT::Property<std::vector<double> > a_max_prop;
00182 RTT::Property<std::vector<double> > j_max_prop;
00184 RTT::Property< unsigned int > num_axes_prop;
00185
00186 };
00187 }
00188
00189 #endif // __N_AXES_GENERATOR_VEL_H__