SpecializedPort.h

00001 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
00002 /* 
00003  * Copyright (C) 2008 Micha Hersch, EPFL
00004  * RobotCub Consortium, European Commission FP6 Project IST-004370
00005  * email:   micha.hersch@robotcub.org
00006  * website: www.robotcub.org
00007  * Permission is granted to copy, distribute, and/or modify this program
00008  * under the terms of the GNU General Public License, version 2 or any
00009  * later version published by the Free Software Foundation.
00010  *
00011  * A copy of the license can be found at
00012  * http://www.robotcub.org/icub/license/gpl.txt
00013  *
00014  * This program is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
00017  * Public License for more details
00018  */
00019 #ifndef __SPECIALIZED_PORT_H__
00020 #define __SPECIALIZED_PORT_H__
00021 
00022 #include "yarp/os/all.h"
00023 #include <iostream>
00024 
00025 using namespace yarp::os;
00026 using namespace std;
00027 
00028 class CartesianDataPort : public BufferedPort<Bottle>{
00029 
00030  public:
00031   //  SendPosition(float x,float y,float z);
00032   void SendPosition(const float *position,bool strict=true);
00033   void SendPositionAndOrientation(const float *position,const float *orientation,bool strict=true);
00034   bool ReadPosition(float *position);
00035   int ReadPositionAndOrientation(float *position, float *orientation);
00036   
00037 };
00038 
00039 class JointAngleDataPort : public BufferedPort<Bottle>{
00040 
00041  protected:
00042   
00043   int *mapping;
00044   bool checked;
00045   int mapping_size;
00046     int data_size;
00047     
00048 public:
00049     JointAngleDataPort();
00050     bool SetMapping(const int *map, int m_size);
00051     void SendPosition(const float *position, const int size,bool strict=true);
00052     bool ReadPosition(float *position, int max_size,bool shoudWait=false);
00053     void SendWithMapping(const float *position, const int size,bool strict=true);
00054     bool ReadWithMapping(float *position, int max_size);
00055     int GetSize(){return data_size;}
00056 };
00057 
00058 
00059 class BodySchemaDataPort : public BufferedPort<Bottle>{
00060 protected:
00061    int data_size;
00062  public:
00063     BodySchemaDataPort();
00064     void SendBodySchema(const float *data, int nb_dofs,bool strict=true);
00065     bool ReadBodySchema(float *data, int max_nb_dofs);
00066     int  GetSize(){return data_size;}
00067 };
00068 
00069 
00070 class CommandPort : public BufferedPort<Bottle>{
00071 public:
00072     void SendQuit();
00073     //   int ReadCmd();
00074     bool ShouldQuit();
00075 };
00076 
00077 class VisualRotationPort : public BufferedPort<Bottle>{
00078 public:
00079     void SendRotation(const float *rot, double t0, double t1) ;
00080     bool ReadRotation(float *rot, double *t0, double *t1) ;
00081 };
00082 
00083 #endif
00084 
 All Data Structures Functions Variables

Generated on Wed Sep 22 16:51:25 2010 for Body_Schema_Learning by  doxygen 1.6.1