Changeset 339 in flair-src for trunk


Ignore:
Timestamp:
Nov 28, 2019, 8:59:49 AM (5 years ago)
Author:
Sanahuja Guillaume
Message:

allow all blade rotations

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

Legend:

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

    r286 r339  
    3636namespace simulator {
    3737
    38 Blade::Blade(Model *parent, const vector3df &position, bool inverted, s32 id)
     38Blade::Blade(Model *parent, const vector3df &position,const vector3df &rotation, bool inverted, s32 id)
    3939    : ISceneNode(parent->getSceneNode(), getGui()->getSceneManager(), id,
    40                  position) {
     40                 position,rotation) {
    4141  ISceneManager *mgr = getGui()->getSceneManager();
    4242
     
    6464}
    6565
    66 Blade::Blade(ISceneNode *parent, const vector3df &position, bool inverted, s32 id)
     66Blade::Blade(ISceneNode *parent, const vector3df &position,const vector3df &rotation, bool inverted, s32 id)
    6767    : ISceneNode(parent, getGui()->getSceneManager(), id,
    68                  position) {
     68                 position,rotation) {
    6969  ISceneManager *mgr = getGui()->getSceneManager();
    7070
     
    9999}
    100100
    101 void Blade::SetRotationSpeed(float value) {
     101void Blade::SetRotationSpeed(const vector3df &value) {
    102102  IAttributes *attribs =
    103103      getSceneManager()->getFileSystem()->createEmptyAttributes();
    104104
    105105  attribs->setAttribute("Type", "rotation");
    106   attribs->setAttribute("Rotation", vector3df(0.f, 0.f, value));
     106  attribs->setAttribute("Rotation", value);
    107107  anim->deserializeAttributes(attribs);
    108108
  • trunk/lib/FlairSimulator/src/Blade.h

    r286 r339  
    3535  Blade(Model *parent,
    3636        const irr::core::vector3df &position = irr::core::vector3df(0, 0, 0),
     37        const irr::core::vector3df &rotation = irr::core::vector3df(0, 0, 0),
    3738        bool inverted = false, irr::s32 id = -1);
    3839
    3940  Blade(irr::scene::ISceneNode *parent,
    4041        const irr::core::vector3df &position = irr::core::vector3df(0, 0, 0),
     42        const irr::core::vector3df &rotation = irr::core::vector3df(0, 0, 0),
    4143        bool inverted = false, irr::s32 id = -1);
    4244 
     
    4648    return Box;
    4749  }
    48   void SetRotationSpeed(float value);
     50  void SetRotationSpeed(const irr::core::vector3df &value);
    4951
    5052private:
  • trunk/lib/FlairSimulator/src/UavVrpnObject_impl.cpp

    r289 r339  
    150150
    151151  fl_blade = new Blade(this, vector3df(70.71, -70.71, 17.5));
    152   fr_blade = new Blade(this, vector3df(70.71, 70.71, 17.5), true);
    153   rl_blade = new Blade(this, vector3df(-70.71, -70.71, 17.5), true);
     152  fr_blade = new Blade(this, vector3df(70.71, 70.71, 17.5),  vector3df(0, 0, 0),true);
     153  rl_blade = new Blade(this, vector3df(-70.71, -70.71, 17.5),  vector3df(0, 0, 0),true);
    154154  rr_blade = new Blade(this, vector3df(-70.71, 70.71, 17.5));
    155155 
    156   fl_blade->SetRotationSpeed(MOTOR_SPEED);
    157   fr_blade->SetRotationSpeed(-MOTOR_SPEED);
    158   rl_blade->SetRotationSpeed(-MOTOR_SPEED);
    159   rr_blade->SetRotationSpeed(MOTOR_SPEED);
     156  fl_blade->SetRotationSpeed(vector3df(0, 0,MOTOR_SPEED));
     157  fr_blade->SetRotationSpeed(vector3df(0, 0,-MOTOR_SPEED));
     158  rl_blade->SetRotationSpeed(vector3df(0, 0,-MOTOR_SPEED));
     159  rr_blade->SetRotationSpeed(vector3df(0, 0,MOTOR_SPEED));
    160160 
    161161  setScale(vector3df(arm_length->Value(), arm_length->Value(), arm_length->Value()));
  • trunk/lib/FlairSimulator/src/X4.cpp

    r214 r339  
    124124
    125125  fl_blade = new Blade(this, vector3df(70.71, -70.71, 17.5));
    126   fr_blade = new Blade(this, vector3df(70.71, 70.71, 17.5), true);
    127   rl_blade = new Blade(this, vector3df(-70.71, -70.71, 17.5), true);
     126  fr_blade = new Blade(this, vector3df(70.71, 70.71, 17.5), vector3df(0, 0, 0),true);
     127  rl_blade = new Blade(this, vector3df(-70.71, -70.71, 17.5),  vector3df(0, 0, 0),true);
    128128  rr_blade = new Blade(this, vector3df(-70.71, 70.71, 17.5));
    129129
     
    136136void X4::AnimateModel(void) {
    137137  motor_speed_mutex->GetMutex();
    138   fl_blade->SetRotationSpeed(K_MOT * motor_speed[0]);
    139   fr_blade->SetRotationSpeed(-K_MOT * motor_speed[1]);
    140   rl_blade->SetRotationSpeed(-K_MOT * motor_speed[2]);
    141   rr_blade->SetRotationSpeed(K_MOT * motor_speed[3]);
     138  fl_blade->SetRotationSpeed(K_MOT *vector3df(0, 0, motor_speed[0]));
     139  fr_blade->SetRotationSpeed(-K_MOT *vector3df(0, 0, motor_speed[1]));
     140  rl_blade->SetRotationSpeed(-K_MOT *vector3df(0, 0, motor_speed[2]));
     141  rr_blade->SetRotationSpeed(K_MOT *vector3df(0, 0, motor_speed[3]));
    142142  motor_speed_mutex->ReleaseMutex();
    143143
  • trunk/lib/FlairSimulator/src/X8.cpp

    r214 r339  
    137137
    138138  tfl_blade = new Blade(this, vector3df(70.71, -70.71, 17.5));
    139   tfr_blade = new Blade(this, vector3df(70.71, 70.71, 17.5), true);
    140   trl_blade = new Blade(this, vector3df(-70.71, -70.71, 17.5), true);
     139  tfr_blade = new Blade(this, vector3df(70.71, 70.71, 17.5), vector3df(0, 0, 0), true);
     140  trl_blade = new Blade(this, vector3df(-70.71, -70.71, 17.5), vector3df(0, 0, 0), true);
    141141  trr_blade = new Blade(this, vector3df(-70.71, 70.71, 17.5));
    142142
    143143  bfl_blade = new Blade(this, vector3df(70.71, -70.71, -17.5));
    144   bfr_blade = new Blade(this, vector3df(70.71, 70.71, -17.5), true);
    145   brl_blade = new Blade(this, vector3df(-70.71, -70.71, -17.5), true);
     144  bfr_blade = new Blade(this, vector3df(70.71, 70.71, -17.5), vector3df(0, 0, 0), true);
     145  brl_blade = new Blade(this, vector3df(-70.71, -70.71, -17.5),  vector3df(0, 0, 0),true);
    146146  brr_blade = new Blade(this, vector3df(-70.71, 70.71, -17.5));
    147147
     
    161161void X8::AnimateModel(void) {
    162162  motor_speed_mutex->GetMutex();
    163   tfl_blade->SetRotationSpeed(K_MOT * motor_speed[0]);
    164   tfr_blade->SetRotationSpeed(-K_MOT * motor_speed[1]);
    165   trl_blade->SetRotationSpeed(-K_MOT * motor_speed[2]);
    166   trr_blade->SetRotationSpeed(K_MOT * motor_speed[3]);
    167 
    168   bfl_blade->SetRotationSpeed(-K_MOT * motor_speed[4]);
    169   bfr_blade->SetRotationSpeed(K_MOT * motor_speed[5]);
    170   brl_blade->SetRotationSpeed(K_MOT * motor_speed[6]);
    171   brr_blade->SetRotationSpeed(-K_MOT * motor_speed[7]);
     163  tfl_blade->SetRotationSpeed(K_MOT * vector3df(0, 0,motor_speed[0]));
     164  tfr_blade->SetRotationSpeed(-K_MOT * vector3df(0, 0,motor_speed[1]));
     165  trl_blade->SetRotationSpeed(-K_MOT * vector3df(0, 0,motor_speed[2]));
     166  trr_blade->SetRotationSpeed(K_MOT * vector3df(0, 0,motor_speed[3]));
     167
     168  bfl_blade->SetRotationSpeed(-K_MOT * vector3df(0, 0,motor_speed[4]));
     169  bfr_blade->SetRotationSpeed(K_MOT * vector3df(0, 0,motor_speed[5]));
     170  brl_blade->SetRotationSpeed(K_MOT * vector3df(0, 0,motor_speed[6]));
     171  brr_blade->SetRotationSpeed(-K_MOT * vector3df(0, 0,motor_speed[7]));
    172172  motor_speed_mutex->ReleaseMutex();
    173173
Note: See TracChangeset for help on using the changeset viewer.