Changeset 167 in flair-src for trunk/demos


Ignore:
Timestamp:
04/12/17 13:59:38 (7 years ago)
Author:
Sanahuja Guillaume
Message:

modifs pour template vectors

Location:
trunk/demos
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/demos/CircleFollower/uav/src/CircleFollower.cpp

    r147 r167  
    8989    //get roll, pitch and w from imu
    9090    Quaternion ahrsQuaternion;
    91     Vector3D ahrsAngularSpeed;
     91    Vector3Df ahrsAngularSpeed;
    9292    GetDefaultOrientation()->GetQuaternionAndAngularRates(ahrsQuaternion, ahrsAngularSpeed);
    9393
     
    101101}
    102102
    103 void CircleFollower::AltitudeValues(float &z,float &dz) {
    104     Vector3D uav_pos,uav_vel;
     103void CircleFollower::AltitudeValues(float &z,float &dz) const{
     104    Vector3Df uav_pos,uav_vel;
    105105
    106106    uavVrpn->GetPosition(uav_pos);
     
    112112
    113113AhrsData *CircleFollower::GetReferenceOrientation(void) {
    114     Vector2D pos_err, vel_err; // in Uav coordinate system
     114    Vector2Df pos_err, vel_err; // in Uav coordinate system
    115115    float yaw_ref;
    116116    Euler refAngles;
     
    128128    refAngles.roll=-uY->Output();
    129129
    130     customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3D(0,0,0));
     130    customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3Df(0,0,0));
    131131
    132132    return customReferenceOrientation;
    133133}
    134134
    135 void CircleFollower::PositionValues(Vector2D &pos_error,Vector2D &vel_error,float &yaw_ref) {
    136     Vector3D uav_pos,uav_vel; // in VRPN coordinate system
    137     Vector2D uav_2Dpos,uav_2Dvel; // in VRPN coordinate system
     135void CircleFollower::PositionValues(Vector2Df &pos_error,Vector2Df &vel_error,float &yaw_ref) {
     136    Vector3Df uav_pos,uav_vel; // in VRPN coordinate system
     137    Vector2Df uav_2Dpos,uav_2Dvel; // in VRPN coordinate system
    138138
    139139    uavVrpn->GetPosition(uav_pos);
     
    148148        yaw_ref=yawHold;
    149149    } else { //Circle
    150         Vector3D target_pos;
    151         Vector2D circle_pos,circle_vel;
    152         Vector2D target_2Dpos;
     150        Vector3Df target_pos;
     151        Vector2Df circle_pos,circle_vel;
     152        Vector2Df target_2Dpos;
    153153
    154154        targetVrpn->GetPosition(target_pos);
     
    238238        return;
    239239    }
    240     Vector3D uav_pos,target_pos;
    241     Vector2D uav_2Dpos,target_2Dpos;
     240    Vector3Df uav_pos,target_pos;
     241    Vector2Df uav_2Dpos,target_2Dpos;
    242242
    243243    targetVrpn->GetPosition(target_pos);
     
    265265                yawHold=vrpnQuaternion.ToEuler().yaw;
    266266
    267     Vector3D vrpnPosition;
     267    Vector3Df vrpnPosition;
    268268    uavVrpn->GetPosition(vrpnPosition);
    269269    vrpnPosition.To2Dxy(posHold);
  • trunk/demos/CircleFollower/uav/src/CircleFollower.h

    r122 r167  
    5454        void ExtraCheckJoystick(void);
    5555        const flair::core::AhrsData *GetOrientation(void) const;
    56         void AltitudeValues(float &z,float &dz);
    57         void PositionValues(flair::core::Vector2D &pos_error,flair::core::Vector2D &vel_error,float &yaw_ref);
     56        void AltitudeValues(float &z,float &dz) const;
     57        void PositionValues(flair::core::Vector2Df &pos_error,flair::core::Vector2Df &vel_error,float &yaw_ref);
    5858        flair::core::AhrsData *GetReferenceOrientation(void);
    5959        void SignalEvent(Event_t event);
     
    6161        flair::filter::Pid *uX, *uY;
    6262
    63         flair::core::Vector2D posHold;
     63        flair::core::Vector2Df posHold;
    6464        float yawHold;
    6565
  • trunk/demos/Gps/uav/src/DemoGps.cpp

    r159 r167  
    7979
    8080AhrsData* DemoGps::GetReferenceOrientation(void) {
    81   Vector2D pos_err, vel_err; // in Uav coordinate system
     81  Vector2Df pos_err, vel_err; // in Uav coordinate system
    8282  float yaw_ref;
    8383  Euler refAngles;
     
    9595  refAngles.roll = -uY->Output();
    9696
    97   customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(), Vector3D(0, 0, 0));
     97  customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(), Vector3Df(0, 0, 0));
    9898
    9999  return customReferenceOrientation;
    100100}
    101101
    102 void DemoGps::PositionValues(Vector2D& pos_error, Vector2D& vel_error, float& yaw_ref) {
    103   Vector3D uav_pos, uav_vel;
    104   Vector2D uav_2Dpos, uav_2Dvel;
     102void DemoGps::PositionValues(Vector2Df& pos_error, Vector2Df& vel_error, float& yaw_ref) {
     103  Vector3Df uav_pos, uav_vel;
     104  Vector2Df uav_2Dpos, uav_2Dvel;
    105105
    106106  // TODO GPS position and circle center
     
    116116    yaw_ref = yawHold;
    117117  } else { // Circle
    118     Vector2D circle_pos, circle_vel;
    119     Vector2D target_2Dpos;
     118    Vector2Df circle_pos, circle_vel;
     119    Vector2Df target_2Dpos;
    120120
    121121    circle->SetCenter(target_2Dpos);
     
    190190    return;
    191191  }
    192   Vector3D uav_pos;
    193   Vector2D uav_2Dpos, target_2Dpos;
     192  Vector3Df uav_pos;
     193  Vector2Df uav_2Dpos, target_2Dpos;
    194194
    195195  circle->SetCenter(target_2Dpos);
  • trunk/demos/Gps/uav/src/DemoGps.h

    r122 r167  
    5151        void ExtraCheckPushButton(void);
    5252        void ExtraCheckJoystick(void);
    53         void PositionValues(flair::core::Vector2D &pos_error,flair::core::Vector2D &vel_error,float &yaw_ref);
     53        void PositionValues(flair::core::Vector2Df &pos_error,flair::core::Vector2Df &vel_error,float &yaw_ref);
    5454        flair::core::AhrsData *GetReferenceOrientation(void);
    5555        void SignalEvent(Event_t event);
     
    5757        flair::filter::Pid *uX, *uY;
    5858
    59         flair::core::Vector2D posHold;
     59        flair::core::Vector2Df posHold;
    6060        float yawHold;
    6161
  • trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp

    r165 r167  
    178178
    179179    // /!\ in this demo, the target value is a speed (in m/s). As a consequence the error is the difference between the current speed and the target speed
    180     Vector2D error, errorVariation; // in Uav coordinate system
     180    Vector2Df error, errorVariation; // in Uav coordinate system
    181181
    182182    error.x=opticalFlowRealSpeed->Value(0,0)-opticalFlowReference->Value(0,0);
     
    194194    refAngles.roll=-u_y->Output();
    195195
    196     customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3D(0,0,0));
     196    customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3Df(0,0,0));
    197197
    198198    return customReferenceOrientation;
  • trunk/demos/SimpleFleet/uav/src/SimpleFleet.cpp

    r136 r167  
    111111    //get roll, pitch and w from imu
    112112    Quaternion ahrsQuaternion;
    113     Vector3D ahrsAngularSpeed;
     113    Vector3Df ahrsAngularSpeed;
    114114    GetDefaultOrientation()->GetQuaternionAndAngularRates(ahrsQuaternion, ahrsAngularSpeed);
    115115
     
    124124
    125125void SimpleFleet::AltitudeValues(float &z,float &dz) const {
    126     Vector3D uav_pos,uav_vel;
     126    Vector3Df uav_pos,uav_vel;
    127127
    128128    uavVrpn->GetPosition(uav_pos);
     
    134134
    135135const AhrsData *SimpleFleet::GetReferenceOrientation(void) {
    136     Vector2D pos_err, vel_err; // in uav coordinate system
     136    Vector2Df pos_err, vel_err; // in uav coordinate system
    137137    float yaw_ref;
    138138    Euler refAngles;
     
    150150    refAngles.roll=-u_y->Output();
    151151
    152     customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3D(0,0,0));
     152    customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3Df(0,0,0));
    153153
    154154    return customReferenceOrientation;
    155155}
    156156
    157 void SimpleFleet::PositionValues(Vector2D &pos_error,Vector2D &vel_error,float &yaw_ref) {
    158     Vector3D uav_pos,uav_vel; // in VRPN coordinate system
    159     Vector2D uav_2Dpos,uav_2Dvel; // in VRPN coordinate system
     157void SimpleFleet::PositionValues(Vector2Df &pos_error,Vector2Df &vel_error,float &yaw_ref) {
     158    Vector3Df uav_pos,uav_vel; // in VRPN coordinate system
     159    Vector2Df uav_2Dpos,uav_2Dvel; // in VRPN coordinate system
    160160
    161161    uavVrpn->GetPosition(uav_pos);
     
    171171        yaw_ref=yawHold;
    172172    } else { //Circle
    173         Vector2D circle_pos,circle_vel;
    174         Vector2D target_2Dpos;
     173        Vector2Df circle_pos,circle_vel;
     174        Vector2Df target_2Dpos;
    175175
    176176        //circle center
     
    318318        return;
    319319    }
    320     Vector3D uav_pos;
    321     Vector2D uav_2Dpos,target_2Dpos;
     320    Vector3Df uav_pos;
     321    Vector2Df uav_2Dpos,target_2Dpos;
    322322
    323323    //circle center
     
    352352                yawHold=vrpnQuaternion.ToEuler().yaw;
    353353
    354                 Vector3D vrpnPosition;
     354                Vector3Df vrpnPosition;
    355355    uavVrpn->GetPosition(vrpnPosition);
    356356    vrpnPosition.To2Dxy(posHold);
  • trunk/demos/SimpleFleet/uav/src/SimpleFleet.h

    r135 r167  
    6363        const flair::core::AhrsData *GetOrientation(void) const;
    6464        void AltitudeValues(float &z,float &dz) const;
    65         void PositionValues(flair::core::Vector2D &pos_error,flair::core::Vector2D &vel_error,float &yaw_ref);
     65        void PositionValues(flair::core::Vector2Df &pos_error,flair::core::Vector2Df &vel_error,float &yaw_ref);
    6666        const flair::core::AhrsData *GetReferenceOrientation(void);
    6767        void SignalEvent(Event_t event);
     
    7070        flair::filter::Pid *u_x, *u_y;
    7171
    72         flair::core::Vector2D posHold;
     72        flair::core::Vector2Df posHold;
    7373        float yawHold;
    7474        flair::core::Socket *message;
  • trunk/demos/Skeletons/CustomReferenceAngles/src/MyApp.cpp

    r122 r167  
    5151    //refAngles.yaw=;
    5252
    53     customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3D(0,0,0));
     53    customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3Df(0,0,0));
    5454
    5555    return customReferenceOrientation;
Note: See TracChangeset for help on using the changeset viewer.