Changeset 214 in flair-src for trunk/lib/FlairSimulator/src


Ignore:
Timestamp:
02/07/18 17:49:27 (6 years ago)
Author:
Sanahuja Guillaume
Message:

matrix

Location:
trunk/lib/FlairSimulator/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSimulator/src/Model_impl.cpp

    r202 r214  
    2525#include "SpinBox.h"
    2626#include "CheckBox.h"
    27 #include "cvmatrix.h"
     27#include "Matrix.h"
    2828#include "Euler.h"
    2929#include <math.h>
     
    134134  desc->SetElementName(17, 0, "my");
    135135  desc->SetElementName(18, 0, "mz");
    136   output = new cvmatrix(this, desc, floatType, "state");
     136  output = new Matrix(this, desc, floatType, "state");
    137137  delete desc;
    138138
  • trunk/lib/FlairSimulator/src/SimuLaserGL.cpp

    r158 r214  
    2020#include "Model.h"
    2121#include "Gui.h"
    22 #include <cvmatrix.h>
     22#include <Matrix.h>
    2323#include <SharedMem.h>
    2424#include <TabWidget.h>
  • trunk/lib/FlairSimulator/src/SimuUsGL.cpp

    r167 r214  
    1717#include "SimuUsGL.h"
    1818#include "Model.h"
    19 #include <cvmatrix.h>
     19#include <Matrix.h>
    2020#include <SharedMem.h>
    2121#include <TabWidget.h>
     
    5454#endif
    5555    // todo: utiliser le placement de l'us dans le drone et sa portée
    56     cvmatrix *input = (cvmatrix *)data;
     56    Matrix *input = (Matrix *)data;
    5757    value = input->Value(9, 0);
    5858    shmem->Write((char *)&value, sizeof(float));
  • trunk/lib/FlairSimulator/src/X4.cpp

    r167 r214  
    2020#include <Tab.h>
    2121#include <DoubleSpinBox.h>
     22#include <SpinBox.h>
    2223#include <GroupBox.h>
    2324#include <math.h>
     
    7374  j_yaw = new DoubleSpinBox(setup_tab->LastRowLastCol(), "j_yaw:", 0, 1, 0.001,
    7475                            5); // moment d'inertie d'un axe (N.m.s²/rad)
     76                           
     77  motorTimeout = new SpinBox(setup_tab->NewRow(), "motor timeout:","ms", 0, 1000, 100,100);
    7578
    7679  motors = new SimuBldc(this, name, 4, modelId,0);
     
    199202  float fl_speed, fr_speed, rl_speed, rr_speed;
    200203  float u_roll, u_pitch, u_yaw, u_thrust;
     204  Time motorTime;
    201205#ifdef GL
    202206  motor_speed_mutex->GetMutex();
    203207#endif // GL
    204   motors->GetSpeeds(motor_speed);
     208  motors->GetSpeeds(motor_speed,&motorTime);
     209  if((GetTime()-motorTime)/1000000>motorTimeout->Value()) {
     210    for(int i=0;i<4;i++) {
     211      if(motor_speed[i]!=0) {
     212         //Printf("timout\n");
     213        for(int i=0;i<4;i++) motor_speed[i]=0;
     214        break;
     215      }
     216    }
     217  }
    205218#ifdef GL
    206219  motor_speed_mutex->ReleaseMutex();
    207220#endif // GL
     221 
    208222  fl_speed = motor_speed[0];
    209223  fr_speed = motor_speed[1];
     
    212226
    213227  /*
    214       ** ===================================================================
    215       **    u roll: roll torque
    216       **
    217       ** ===================================================================
    218       */
     228  ** ===================================================================
     229  **    u roll: roll torque
     230  **
     231  ** ===================================================================
     232  */
    219233  u_roll = arm_length->Value() * k_mot->Value() *
    220234           (fl_speed * fl_speed + rl_speed * rl_speed - fr_speed * fr_speed -
  • trunk/lib/FlairSimulator/src/X4.h

    r158 r214  
    2626namespace gui {
    2727class DoubleSpinBox;
     28class SpinBox;
    2829}
    2930namespace actuator {
     
    6364  gui::DoubleSpinBox *f_air_vert, *f_air_lat;
    6465  gui::DoubleSpinBox *j_roll, *j_pitch, *j_yaw;
     66  gui::SpinBox *motorTimeout;
    6567};
    6668} // end namespace simulator
  • trunk/lib/FlairSimulator/src/X8.cpp

    r167 r214  
    2020#include <Tab.h>
    2121#include <DoubleSpinBox.h>
     22#include <SpinBox.h>
    2223#include <GroupBox.h>
    2324#include <math.h>
     
    8182      setup_tab->LastRowLastCol(), "S:", 1, 2,
    8283      0.1); // coefficient de forme des helices 1<S=1+Ss/Sprop<2 (sans unite)
     84     
     85  motorTimeout = new SpinBox(setup_tab->NewRow(), "motor timeout:","ms", 0, 1000, 100,100);
    8386
    8487  motors = new SimuBldc(this, name, 8, modelId,0);
     
    231234  float u_roll, u_pitch, u_yaw, u_thrust;
    232235  float omega;
     236  Time motorTime;
    233237#ifdef GL
    234238  motor_speed_mutex->GetMutex();
    235239#endif // GL
    236   motors->GetSpeeds(motor_speed);
     240  motors->GetSpeeds(motor_speed,&motorTime);
     241  if((GetTime()-motorTime)/1000000>motorTimeout->Value()) {
     242    for(int i=0;i<8;i++) {
     243      if(motor_speed[i]!=0) {
     244         //Printf("timout\n");
     245        for(int i=0;i<8;i++) motor_speed[i]=0;
     246        break;
     247      }
     248    }
     249  }
    237250#ifdef GL
    238251  motor_speed_mutex->ReleaseMutex();
  • trunk/lib/FlairSimulator/src/X8.h

    r158 r214  
    2626namespace gui {
    2727class DoubleSpinBox;
     28class SpinBox;
    2829}
    2930namespace actuator {
     
    6566  gui::DoubleSpinBox *j_roll, *j_pitch, *j_yaw;
    6667  gui::DoubleSpinBox *j_r, *sigma, *S;
     68  gui::SpinBox *motorTimeout;
    6769};
    6870} // end namespace simulator
  • trunk/lib/FlairSimulator/src/unexported/Model_impl.h

    r167 r214  
    2525namespace flair {
    2626namespace core {
    27 class cvmatrix;
     27class Matrix;
    2828class Mutex;
    2929class ConditionVariable;
     
    101101  flair::gui::CheckBox *enable_opti;
    102102  flair::simulator::Model *self;
    103   flair::core::cvmatrix *output;
     103  flair::core::Matrix *output;
    104104  flair::core::Mutex *states_mutex;
    105105
Note: See TracChangeset for help on using the changeset viewer.