Index: trunk/lib/FlairSimulator/src/Plane.cpp
===================================================================
--- trunk/lib/FlairSimulator/src/Plane.cpp	(revision 457)
+++ trunk/lib/FlairSimulator/src/Plane.cpp	(revision 458)
@@ -17,4 +17,5 @@
 #include "Plane.h"
 #include <SimuBldc.h>
+#include <SimuServos.h>
 #include <TabWidget.h>
 #include <Tab.h>
@@ -55,4 +56,5 @@
   
   motor = new SimuBldc(this, name, 1, modelId,0);
+  servos = new SimuServos(this, name, 2, modelId,0);
   
   SetIsReady(true);
@@ -87,27 +89,34 @@
   IMesh *wing= geo->createCubeMesh (vector3df(35, 100, 2));
   IMesh *aileron= geo->createCubeMesh (vector3df(10, 90, 2));
+  IMesh *axe = geo->createCylinderMesh(.5, 100, 16);//axe pour definir l'axe de rotation en bout d'aileron (sinon l'axe est au milieu d'aileron)
+  
   //origine de l'aile en son centre
-  MeshSceneNode *l_wing = new MeshSceneNode(this, wing, vector3df(75, -20-50, 20),
-                             vector3df(0, 0, 0));
-  MeshSceneNode *r_wing = new MeshSceneNode(this, wing, vector3df(75, 20+50, 20),
-                             vector3df(0, 0, 0));
-                             
-  l_aileron = new MeshSceneNode(this, aileron, vector3df(55, -20-50, 20),
-                             vector3df(0, 0, 0));
-                             
-  r_aileron = new MeshSceneNode(this, aileron, vector3df(55, 20+50, 20),
-                             vector3df(0, 0, 0));
+  MeshSceneNode *l_wing = new MeshSceneNode(this, wing, vector3df(75, -20-50, 20),vector3df(0, 0, 0));
+  MeshSceneNode *r_wing = new MeshSceneNode(this, wing, vector3df(75, 20+50, 20),vector3df(0, 0, 0));
+                      
+       
+  l_axe_aileron = new MeshSceneNode(this, axe, vector3df(75-35/2, -20-100, 20),vector3df(0, 0, 0));
+  MeshSceneNode *l_aileron = new MeshSceneNode(l_axe_aileron, aileron, vector3df(-5, 50, 0),vector3df(0, 0, 0),texture);
+ 
+                        
+  r_axe_aileron = new MeshSceneNode(this, axe, vector3df(75-35/2, 20, 20),vector3df(0, 0, 0));
+  MeshSceneNode *r_aileron = new MeshSceneNode(r_axe_aileron, aileron, vector3df(-5, 50,0),vector3df(0, 0, 0),texture);
                                
-  motor_speed_mutex = new Mutex(this);
+  actuators_mutex = new Mutex(this);
   motor_speed = 0;
+  for (int i = 0; i < 2; i++) servos_pos[i] = 0;
   ExtraDraw();
 }
 
 void Plane::AnimateModel(void) {
-  motor_speed_mutex->GetMutex();
+  actuators_mutex->GetMutex();
   motor_speed=10;
+  servos_pos[0]=-0;
+  servos_pos[1]=0;
   f_blade->SetRotationSpeed(K_MOT *vector3df( 0,motor_speed,0));
-
-  motor_speed_mutex->ReleaseMutex();
+  l_axe_aileron->setRotation(vector3df(0,servos_pos[1]*180./3.14,0));
+  r_axe_aileron->setRotation(vector3df(0,servos_pos[0]*180./3.14,0));
+
+  actuators_mutex->ReleaseMutex();
 
   // adapt UAV size
@@ -122,44 +131,8 @@
 }
 
-void Plane::WritedbtBuf(
-    char *dbtbuf) { /*
-                       float *buf=(float*)dbtbuf;
-                       vector3df vect=getPosition();
-                       memcpy(buf,&vect.X,sizeof(float));
-                       buf++;
-                       memcpy(buf,&vect.Y,sizeof(float));
-                       buf++;
-                       memcpy(buf,&vect.Z,sizeof(float));
-                       buf++;
-                       vect=getRotation();
-                       memcpy(buf,&vect.X,sizeof(float));
-                       buf++;
-                       memcpy(buf,&vect.Y,sizeof(float));
-                       buf++;
-                       memcpy(buf,&vect.Z,sizeof(float));
-                       buf++;
-                       memcpy(buf,&motors,sizeof(rtsimu_motors));*/
-}
-
-void Plane::ReaddbtBuf(
-    char *dbtbuf) { /*
-                       float *buf=(float*)dbtbuf;
-                       vector3df vect;
-                       memcpy(&vect.X,buf,sizeof(float));
-                       buf++;
-                       memcpy(&vect.Y,buf,sizeof(float));
-                       buf++;
-                       memcpy(&vect.Z,buf,sizeof(float));
-                       buf++;
-                       setPosition(vect);
-                       memcpy(&vect.X,buf,sizeof(float));
-                       buf++;
-                       memcpy(&vect.Y,buf,sizeof(float));
-                       buf++;
-                       memcpy(&vect.Z,buf,sizeof(float));
-                       buf++;
-                       ((ISceneNode*)(this))->setRotation(vect);
-                       memcpy(&motors,buf,sizeof(rtsimu_motors));
-                       AnimateModele();*/
+void Plane::WritedbtBuf(char *dbtbuf) {
+}
+
+void Plane::ReaddbtBuf(char *dbtbuf) {
 }
 #endif // GL
@@ -170,19 +143,20 @@
 // z down
 void Plane::CalcModel(void) {
-  
   float u_roll, u_pitch, u_yaw, u_thrust;
-  Time motorTime;
-#ifdef GL
-  motor_speed_mutex->GetMutex();
+  Time motorTime,servoTime;
+  
+#ifdef GL
+  actuators_mutex->GetMutex();
 #endif // GL
   motor->GetSpeeds(&motor_speed,&motorTime);
   if((GetTime()-motorTime)/1000000>motorTimeout->Value()) {
       if(motor_speed!=0) {
-         //Printf("timout\n");
         motor_speed=0;
       }
   }
-#ifdef GL
-  motor_speed_mutex->ReleaseMutex();
+  servos->GetPositions(servos_pos,&servoTime);
+  
+#ifdef GL
+  actuators_mutex->ReleaseMutex();
 #endif // GL
   
@@ -302,4 +276,5 @@
   state[0].Vel.z = (state[0].Pos.z - state[-1].Pos.z) / dT();
 */
+
 #ifndef GL
   if (state[0].Pos.z < 0)
