00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __CARTESIAN_GENERATOR_POS_H__
00022 #define __CARTESIAN_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 <kdl/kdl.hpp>
00036 #include <kdl/frames.hpp>
00037
00038 #include <ocl/OCL.hpp>
00039
00040 namespace OCL
00041 {
00052 class CartesianGeneratorPos : public RTT::TaskContext
00053 {
00054 public:
00060 CartesianGeneratorPos(std::string name);
00061 virtual ~CartesianGeneratorPos();
00062
00063 virtual bool configureHook();
00064 virtual bool startHook();
00065 virtual void updateHook();
00066 virtual void stopHook();
00067 virtual void cleanupHook();
00068
00069 private:
00070 bool moveTo(KDL::Frame frame, double time=0);
00071 bool moveFinished() const;
00072 void resetPosition();
00073
00074 KDL::Frame _traject_end, _traject_begin;
00075 KDL::Frame _position_desi_local;
00076 KDL::Twist _velocity_desi_local, _velocity_begin_end, _velocity_delta;
00077 std::vector<double> _maximum_velocity_local, _maximum_acceleration_local;
00078
00079 std::vector<KDL::VelocityProfile_Trap> _motion_profile;
00080 RTT::TimeService::ticks _time_begin;
00081 RTT::TimeService::Seconds _time_passed;
00082 double _max_duration;
00083
00084 bool _is_moving,once;
00085
00086 protected:
00096 RTT::Command<bool(KDL::Frame,double)> _moveTo;
00097
00102 RTT::Method<void(void)> _reset_position;
00105 RTT::ReadDataPort< KDL::Frame > _position_meas;
00109 RTT::WriteDataPort< KDL::Frame > _position_desi;
00113 RTT::WriteDataPort< KDL::Twist > _velocity_desi;
00116 RTT::Property< std::vector<double> > _maximum_velocity;
00119 RTT::Property< std::vector<double> > _maximum_acceleration;
00120
00121 };
00122 }
00123
00124 #endif // __CARTESIAN_GENERATOR_POS_H__