00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "Kuka361DWHConvertor.hpp"
00021 #include <ocl/ComponentLoader.hpp>
00022
00023 ORO_LIST_COMPONENT_TYPE( OCL::Kuka361DWHConvertor )
00024
00025 namespace OCL{
00026 using namespace std;
00027 using namespace RTT;
00028
00029 Kuka361DWHConvertor::Kuka361DWHConvertor(const std::string& name):
00030 TaskContext(name,Stopped),
00031 naxes_positions_local(6,0.0),
00032 geometric_positions_local(6,0.0),
00033 naxes_velocities_local(6,0.0),
00034 geometric_velocities_local(6,0.0),
00035 naxes_positions("nAxesSensorPosition",naxes_positions_local),
00036 geometric_positions("GeometricSensorPosition",geometric_positions_local),
00037 naxes_velocities("nAxesOutputVelocity",naxes_velocities_local),
00038 geometric_velocities("GeometricOutputVelocity",geometric_velocities_local)
00039 {
00040 ports()->addPort(&naxes_positions);
00041 ports()->addPort(&geometric_positions);
00042 ports()->addPort(&naxes_velocities);
00043 ports()->addPort(&geometric_velocities);
00044 }
00045
00046 void Kuka361DWHConvertor::updateHook()
00047 {
00048 if((naxes_positions.Get().size()==6)&&
00049 (geometric_velocities.Get().size()==6)){
00050 Kuka361DWH::convertGeometric(naxes_positions.Get(),geometric_velocities.Get(),
00051 geometric_positions_local,naxes_velocities_local);
00052 naxes_velocities.Set(naxes_velocities_local);
00053 geometric_positions.Set(geometric_positions_local);
00054 }else{
00055 naxes_velocities.Set(vector<double>(6,0.0));
00056 geometric_positions.Set(vector<double>(6,0.0));
00057 this->error();
00058 }
00059 }
00060
00061
00062 void Kuka361DWHConvertor::errorHook()
00063 {
00064 if((naxes_positions.Get().size()==6)&&
00065 (geometric_velocities.Get().size()==6)){
00066 this->recovered();
00067 }
00068 }
00069
00070 }
00071
00072
00073