KinematicSimulator.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 __YARP_SIMULATOR_H__
00020 #define __YARP_SIMULATOR_H__
00021 
00022 
00023 
00024 #include "GLUTApplication.h"
00025 #include "EmbodiedArticulatedTree.h"
00026 #include "SpecializedPort.h"
00027 #include "Shape.h"
00028 #include <yarp/os/all.h>
00029 #include "BodySchema.h"
00030 
00031 
00181 #define TWO_BODIES
00182 
00183 
00184 class KinematicSimulator: public GLUTBaseApplication{
00185 
00186 
00187 protected:
00188 
00189     EmbodiedKinematicTree *body;
00190     KinematicChain *arm;
00191     KinematicChain *head;
00192 
00193 #ifdef TWO_BODIES
00194     EmbodiedKinematicTree *body2;
00195     KinematicChain *arm2;
00196     KinematicChain *head2;
00197     cart_vec_t display_trans;
00198 #endif
00199     
00200     float *angles;
00201     float *arm_angles;
00202     float *head_angles;
00203   //  float *min_angles;
00204   // float *max_angles;
00205 
00206     int body_size;
00207     int arm_size;
00208     int head_size;
00209     int target_info;
00210     
00211     cart_vec_t tarpos;
00212 
00213     char tree_file[80];
00214     char shape_file[80];
00215  
00216     char port_base_name[80];
00217     
00218     JointAngleDataPort proprio_arm;//("/proprioListener");
00219     JointAngleDataPort proprio_head;
00220 
00221     CartesianDataPort targetIn;
00222     CartesianDataPort targetOut;
00223     
00224     CommandPort cmdPort;
00225  
00226     BodySchemaDataPort bodySchema;
00227     float *body_data;
00228     int body_data_size;
00229 
00230     bool m_bProprioActive;
00231     int mapping;
00232 
00233 
00234 
00235 public:
00236     KinematicSimulator();
00237     KinematicSimulator(int argc, char **argv);
00238     virtual ~KinematicSimulator();
00239     virtual void RenderTarget();
00240     virtual void Render();
00241     virtual void InputSpecialKey(int key,int x, int y);
00242     virtual void InputNormalKey(unsigned char key,int x, int y);
00243     virtual void Init();
00244     virtual void OnIdle();
00245     virtual void ClosePorts();  
00246     void InitBody();
00247     void InitOpenGL();
00248     void ListenToRobot();
00249     void Rearrange(float *angles);
00250 
00251  };
00252 
00253 
00254 #endif
 All Data Structures Functions Variables

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