Changeset 339 in flair-src
- Timestamp:
- Nov 28, 2019, 8:59:49 AM (5 years ago)
- Location:
- trunk/lib/FlairSimulator/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSimulator/src/Blade.cpp
r286 r339 36 36 namespace simulator { 37 37 38 Blade::Blade(Model *parent, const vector3df &position, bool inverted, s32 id)38 Blade::Blade(Model *parent, const vector3df &position,const vector3df &rotation, bool inverted, s32 id) 39 39 : ISceneNode(parent->getSceneNode(), getGui()->getSceneManager(), id, 40 position ) {40 position,rotation) { 41 41 ISceneManager *mgr = getGui()->getSceneManager(); 42 42 … … 64 64 } 65 65 66 Blade::Blade(ISceneNode *parent, const vector3df &position, bool inverted, s32 id)66 Blade::Blade(ISceneNode *parent, const vector3df &position,const vector3df &rotation, bool inverted, s32 id) 67 67 : ISceneNode(parent, getGui()->getSceneManager(), id, 68 position ) {68 position,rotation) { 69 69 ISceneManager *mgr = getGui()->getSceneManager(); 70 70 … … 99 99 } 100 100 101 void Blade::SetRotationSpeed( floatvalue) {101 void Blade::SetRotationSpeed(const vector3df &value) { 102 102 IAttributes *attribs = 103 103 getSceneManager()->getFileSystem()->createEmptyAttributes(); 104 104 105 105 attribs->setAttribute("Type", "rotation"); 106 attribs->setAttribute("Rotation", v ector3df(0.f, 0.f, value));106 attribs->setAttribute("Rotation", value); 107 107 anim->deserializeAttributes(attribs); 108 108 -
trunk/lib/FlairSimulator/src/Blade.h
r286 r339 35 35 Blade(Model *parent, 36 36 const irr::core::vector3df &position = irr::core::vector3df(0, 0, 0), 37 const irr::core::vector3df &rotation = irr::core::vector3df(0, 0, 0), 37 38 bool inverted = false, irr::s32 id = -1); 38 39 39 40 Blade(irr::scene::ISceneNode *parent, 40 41 const irr::core::vector3df &position = irr::core::vector3df(0, 0, 0), 42 const irr::core::vector3df &rotation = irr::core::vector3df(0, 0, 0), 41 43 bool inverted = false, irr::s32 id = -1); 42 44 … … 46 48 return Box; 47 49 } 48 void SetRotationSpeed( floatvalue);50 void SetRotationSpeed(const irr::core::vector3df &value); 49 51 50 52 private: -
trunk/lib/FlairSimulator/src/UavVrpnObject_impl.cpp
r289 r339 150 150 151 151 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); 154 154 rr_blade = new Blade(this, vector3df(-70.71, 70.71, 17.5)); 155 155 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)); 160 160 161 161 setScale(vector3df(arm_length->Value(), arm_length->Value(), arm_length->Value())); -
trunk/lib/FlairSimulator/src/X4.cpp
r214 r339 124 124 125 125 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); 128 128 rr_blade = new Blade(this, vector3df(-70.71, 70.71, 17.5)); 129 129 … … 136 136 void X4::AnimateModel(void) { 137 137 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])); 142 142 motor_speed_mutex->ReleaseMutex(); 143 143 -
trunk/lib/FlairSimulator/src/X8.cpp
r214 r339 137 137 138 138 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); 141 141 trr_blade = new Blade(this, vector3df(-70.71, 70.71, 17.5)); 142 142 143 143 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); 146 146 brr_blade = new Blade(this, vector3df(-70.71, 70.71, -17.5)); 147 147 … … 161 161 void X8::AnimateModel(void) { 162 162 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])); 172 172 motor_speed_mutex->ReleaseMutex(); 173 173
Note:
See TracChangeset
for help on using the changeset viewer.