00001 #ifndef KUKA361_NAXES_VELOCITY_CONTROLLER_HPP
00002 #define KUKA361_NAXES_VELOCITY_CONTROLLER_HPP
00003
00004 #include <vector>
00005 #include <rtt/RTT.hpp>
00006
00007 #include <rtt/TaskContext.hpp>
00008 #include <rtt/Ports.hpp>
00009 #include <rtt/Event.hpp>
00010 #include <rtt/Properties.hpp>
00011 #include <rtt/Command.hpp>
00012
00013 #if defined (OROPKG_OS_LXRT)
00014 #include <rtt/dev/AnalogOutput.hpp>
00015 #include <rtt/dev/DigitalOutput.hpp>
00016
00017 #include "dev/SwitchDigitalInapci1032.hpp"
00018 #include "dev/RelayCardapci2200.hpp"
00019 #include "dev/EncoderSSIapci1710.hpp"
00020 #include "dev/ComediDevice.hpp"
00021 #include "dev/ComediSubDeviceAOut.hpp"
00022
00023 #include "dev/AbsoluteEncoderSensor.hpp"
00024 #include "dev/AnalogDrive.hpp"
00025 #include "dev/Axis.hpp"
00026 #endif
00027 #include "dev/SimulationAxis.hpp"
00028 #include <rtt/dev/AxisInterface.hpp>
00029
00030 #include <ocl/OCL.hpp>
00031
00032 namespace OCL
00033 {
00044 class Kuka361nAxesVelocityController : public RTT::TaskContext
00045 {
00046 public:
00055 Kuka361nAxesVelocityController(std::string name,std::string propertyfilename="cpf/Kuka361nAxesVelocityController.cpf");
00056 virtual ~Kuka361nAxesVelocityController();
00057
00058 protected:
00071 Method<bool(int)> _startAxis;
00072
00080 Method<bool(void)> _startAllAxes;
00081
00094 Method<bool(int)> _stopAxis;
00095
00100 Method<bool(void)> _stopAllAxes;
00101
00111 Method<bool(int)> _unlockAxis;
00112
00118 Method<bool(void)> _unlockAllAxes;
00119
00130 Method<bool(int)> _lockAxis;
00131
00137 Method<bool(void)> _lockAllAxes;
00138
00149 Command<bool(void)> _prepareForUse;
00150
00155 Command<bool(void)> _prepareForShutdown;
00156
00167 Method<bool(int,double)> _addDriveOffset;
00168
00174 std::vector<RTT::ReadDataPort<double>*> _driveValue;
00175
00182 std::vector<RTT::DataPort<double>*> _positionValue;
00183
00189 RTT::Property<std::vector <double> > _driveLimits;
00190
00194 RTT::Property<std::vector <double> > _lowerPositionLimits;
00195
00199 RTT::Property<std::vector <double> > _upperPositionLimits;
00200
00205 RTT::Property<std::vector <double> > _initialPosition;
00206
00211 RTT::Property<std::vector <double> > _driveOffset;
00212
00217 RTT::Property<bool > _simulation;
00218
00222 RTT::Constant<unsigned int> _num_axes;
00223
00229 RTT::Event< void(std::string) > _driveOutOfRange;
00230
00237 RTT::Event< void(std::string) > _positionOutOfRange;
00238
00239 private:
00240
00241 virtual bool startAxis(int axis);
00242 virtual bool startAxisCompleted(int axis) const;
00243
00244 virtual bool startAllAxes();
00245 virtual bool startAllAxesCompleted() const;
00246
00247 virtual bool stopAxis(int axis);
00248 virtual bool stopAxisCompleted(int axis) const;
00249
00250 virtual bool stopAllAxes();
00251 virtual bool stopAllAxesCompleted() const;
00252
00253 virtual bool lockAxis(int axis);
00254 virtual bool lockAxisCompleted(int axis) const;
00255
00256 virtual bool lockAllAxes();
00257 virtual bool lockAllAxesCompleted() const;
00258
00259 virtual bool unlockAxis(int axis);
00260 virtual bool unlockAxisCompleted(int axis) const;
00261
00262 virtual bool unlockAllAxes();
00263 virtual bool unlockAllAxesCompleted() const;
00264
00265 virtual bool addDriveOffset(int axis,double offset);
00266 virtual bool addDriveOffsetCompleted(int axis) const;
00267
00268
00269
00270
00271
00272
00273
00274
00275 virtual bool prepareForUse();
00276 virtual bool prepareForUseCompleted() const;
00277 virtual bool prepareForShutdown();
00278 virtual bool prepareForShutdownCompleted() const;
00279
00280
00285 const std::string _propertyfile;
00286
00290 bool _activated;
00291
00297 std::vector<double> _positionConvertFactor;
00298
00299
00305 std::vector<double> _driveConvertFactor;
00306
00307 public:
00312 virtual bool startup();
00313
00317 virtual void update();
00318
00322 virtual void shutdown();
00323
00327 unsigned int GetNumAxes();
00328
00329 private:
00330
00331
00332
00333 #if (defined (OROPKG_OS_LXRT))
00334 std::vector<RTT::Axis*> _axes_hardware;
00335
00336 RTT::ComediDevice* _comediDev;
00337 RTT::ComediSubDeviceAOut* _comediSubdevAOut;
00338 RTT::EncoderSSI_apci1710_board* _apci1710;
00339 RTT::RelayCardapci2200* _apci2200;
00340 RTT::SwitchDigitalInapci1032* _apci1032;
00341
00342 std::vector<RTT::EncoderInterface*> _encoderInterface;
00343 std::vector<RTT::AbsoluteEncoderSensor*> _encoder;
00344 std::vector<RTT::AnalogOutput*> _vref;
00345 std::vector<RTT::DigitalOutput*> _enable;
00346 std::vector<RTT::AnalogDrive*> _drive;
00347 std::vector<RTT::DigitalOutput*> _brake;
00348
00349 #endif
00350 std::vector<RTT::AxisInterface*> _axes;
00351 std::vector<RTT::SimulationAxis*> _axes_simulation;
00352
00353 };
00354 }
00355 #endif // KUKA361NAXESVELOCITYCONTROLLER