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


Ignore:
Timestamp:
Jun 10, 2021, 4:35:17 PM (5 months ago)
Author:
Sanahuja Guillaume
Message:

add accelerometer to simulation

File:
1 edited

Legend:

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

    r375 r428  
    314314    states_mutex->GetMutex();
    315315    self->CalcModel();
     316   
     317    Vector3Df acc(self->state[0].Vel.x-self->state[-1].Vel.x,
     318                    self->state[0].Vel.y-self->state[-1].Vel.y,
     319                    self->state[0].Vel.z-self->state[-1].Vel.z);
     320    acc=acc/dT->Value()+Vector3Df(0,0,-9.81);           
     321    acc.Rotate(self->state[0].Quat.GetConjugate());
    316322
    317323    output->GetMutex();
     
    329335    output->SetValueNoMutex(11, 0, self->state[0].Vel.y);
    330336    output->SetValueNoMutex(12, 0, self->state[0].Vel.z);
    331     //todo: put acc and mag
    332     output->SetValueNoMutex(13, 0, 0);
    333     output->SetValueNoMutex(14, 0, 0);
    334     output->SetValueNoMutex(15, 0, 0);
     337    output->SetValueNoMutex(13, 0, acc.x);
     338    output->SetValueNoMutex(14, 0, acc.y);
     339    output->SetValueNoMutex(15, 0, acc.z);
     340    //todo: put mag
    335341    output->SetValueNoMutex(16, 0, 0);
    336342    output->SetValueNoMutex(17, 0, 0);
Note: See TracChangeset for help on using the changeset viewer.