Changeset 167 in flair-src for trunk/demos
- Timestamp:
- Apr 12, 2017, 1:59:38 PM (8 years ago)
- Location:
- trunk/demos
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/demos/CircleFollower/uav/src/CircleFollower.cpp
r147 r167 89 89 //get roll, pitch and w from imu 90 90 Quaternion ahrsQuaternion; 91 Vector3D ahrsAngularSpeed;91 Vector3Df ahrsAngularSpeed; 92 92 GetDefaultOrientation()->GetQuaternionAndAngularRates(ahrsQuaternion, ahrsAngularSpeed); 93 93 … … 101 101 } 102 102 103 void CircleFollower::AltitudeValues(float &z,float &dz) {104 Vector3D uav_pos,uav_vel;103 void CircleFollower::AltitudeValues(float &z,float &dz) const{ 104 Vector3Df uav_pos,uav_vel; 105 105 106 106 uavVrpn->GetPosition(uav_pos); … … 112 112 113 113 AhrsData *CircleFollower::GetReferenceOrientation(void) { 114 Vector2D pos_err, vel_err; // in Uav coordinate system114 Vector2Df pos_err, vel_err; // in Uav coordinate system 115 115 float yaw_ref; 116 116 Euler refAngles; … … 128 128 refAngles.roll=-uY->Output(); 129 129 130 customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3D (0,0,0));130 customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3Df(0,0,0)); 131 131 132 132 return customReferenceOrientation; 133 133 } 134 134 135 void CircleFollower::PositionValues(Vector2D &pos_error,Vector2D&vel_error,float &yaw_ref) {136 Vector3D uav_pos,uav_vel; // in VRPN coordinate system137 Vector2D uav_2Dpos,uav_2Dvel; // in VRPN coordinate system135 void 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 138 138 139 139 uavVrpn->GetPosition(uav_pos); … … 148 148 yaw_ref=yawHold; 149 149 } 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; 153 153 154 154 targetVrpn->GetPosition(target_pos); … … 238 238 return; 239 239 } 240 Vector3D uav_pos,target_pos;241 Vector2D uav_2Dpos,target_2Dpos;240 Vector3Df uav_pos,target_pos; 241 Vector2Df uav_2Dpos,target_2Dpos; 242 242 243 243 targetVrpn->GetPosition(target_pos); … … 265 265 yawHold=vrpnQuaternion.ToEuler().yaw; 266 266 267 Vector3D vrpnPosition;267 Vector3Df vrpnPosition; 268 268 uavVrpn->GetPosition(vrpnPosition); 269 269 vrpnPosition.To2Dxy(posHold); -
trunk/demos/CircleFollower/uav/src/CircleFollower.h
r122 r167 54 54 void ExtraCheckJoystick(void); 55 55 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); 58 58 flair::core::AhrsData *GetReferenceOrientation(void); 59 59 void SignalEvent(Event_t event); … … 61 61 flair::filter::Pid *uX, *uY; 62 62 63 flair::core::Vector2D posHold;63 flair::core::Vector2Df posHold; 64 64 float yawHold; 65 65 -
trunk/demos/Gps/uav/src/DemoGps.cpp
r159 r167 79 79 80 80 AhrsData* DemoGps::GetReferenceOrientation(void) { 81 Vector2D pos_err, vel_err; // in Uav coordinate system81 Vector2Df pos_err, vel_err; // in Uav coordinate system 82 82 float yaw_ref; 83 83 Euler refAngles; … … 95 95 refAngles.roll = -uY->Output(); 96 96 97 customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(), Vector3D (0, 0, 0));97 customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(), Vector3Df(0, 0, 0)); 98 98 99 99 return customReferenceOrientation; 100 100 } 101 101 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;102 void DemoGps::PositionValues(Vector2Df& pos_error, Vector2Df& vel_error, float& yaw_ref) { 103 Vector3Df uav_pos, uav_vel; 104 Vector2Df uav_2Dpos, uav_2Dvel; 105 105 106 106 // TODO GPS position and circle center … … 116 116 yaw_ref = yawHold; 117 117 } else { // Circle 118 Vector2D circle_pos, circle_vel;119 Vector2D target_2Dpos;118 Vector2Df circle_pos, circle_vel; 119 Vector2Df target_2Dpos; 120 120 121 121 circle->SetCenter(target_2Dpos); … … 190 190 return; 191 191 } 192 Vector3D uav_pos;193 Vector2D uav_2Dpos, target_2Dpos;192 Vector3Df uav_pos; 193 Vector2Df uav_2Dpos, target_2Dpos; 194 194 195 195 circle->SetCenter(target_2Dpos); -
trunk/demos/Gps/uav/src/DemoGps.h
r122 r167 51 51 void ExtraCheckPushButton(void); 52 52 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); 54 54 flair::core::AhrsData *GetReferenceOrientation(void); 55 55 void SignalEvent(Event_t event); … … 57 57 flair::filter::Pid *uX, *uY; 58 58 59 flair::core::Vector2D posHold;59 flair::core::Vector2Df posHold; 60 60 float yawHold; 61 61 -
trunk/demos/OpticalFlow/uav/src/DemoOpticalFlow.cpp
r165 r167 178 178 179 179 // /!\ 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 system180 Vector2Df error, errorVariation; // in Uav coordinate system 181 181 182 182 error.x=opticalFlowRealSpeed->Value(0,0)-opticalFlowReference->Value(0,0); … … 194 194 refAngles.roll=-u_y->Output(); 195 195 196 customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3D (0,0,0));196 customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3Df(0,0,0)); 197 197 198 198 return customReferenceOrientation; -
trunk/demos/SimpleFleet/uav/src/SimpleFleet.cpp
r136 r167 111 111 //get roll, pitch and w from imu 112 112 Quaternion ahrsQuaternion; 113 Vector3D ahrsAngularSpeed;113 Vector3Df ahrsAngularSpeed; 114 114 GetDefaultOrientation()->GetQuaternionAndAngularRates(ahrsQuaternion, ahrsAngularSpeed); 115 115 … … 124 124 125 125 void SimpleFleet::AltitudeValues(float &z,float &dz) const { 126 Vector3D uav_pos,uav_vel;126 Vector3Df uav_pos,uav_vel; 127 127 128 128 uavVrpn->GetPosition(uav_pos); … … 134 134 135 135 const AhrsData *SimpleFleet::GetReferenceOrientation(void) { 136 Vector2D pos_err, vel_err; // in uav coordinate system136 Vector2Df pos_err, vel_err; // in uav coordinate system 137 137 float yaw_ref; 138 138 Euler refAngles; … … 150 150 refAngles.roll=-u_y->Output(); 151 151 152 customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3D (0,0,0));152 customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3Df(0,0,0)); 153 153 154 154 return customReferenceOrientation; 155 155 } 156 156 157 void SimpleFleet::PositionValues(Vector2D &pos_error,Vector2D&vel_error,float &yaw_ref) {158 Vector3D uav_pos,uav_vel; // in VRPN coordinate system159 Vector2D uav_2Dpos,uav_2Dvel; // in VRPN coordinate system157 void 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 160 160 161 161 uavVrpn->GetPosition(uav_pos); … … 171 171 yaw_ref=yawHold; 172 172 } else { //Circle 173 Vector2D circle_pos,circle_vel;174 Vector2D target_2Dpos;173 Vector2Df circle_pos,circle_vel; 174 Vector2Df target_2Dpos; 175 175 176 176 //circle center … … 318 318 return; 319 319 } 320 Vector3D uav_pos;321 Vector2D uav_2Dpos,target_2Dpos;320 Vector3Df uav_pos; 321 Vector2Df uav_2Dpos,target_2Dpos; 322 322 323 323 //circle center … … 352 352 yawHold=vrpnQuaternion.ToEuler().yaw; 353 353 354 Vector3D vrpnPosition;354 Vector3Df vrpnPosition; 355 355 uavVrpn->GetPosition(vrpnPosition); 356 356 vrpnPosition.To2Dxy(posHold); -
trunk/demos/SimpleFleet/uav/src/SimpleFleet.h
r135 r167 63 63 const flair::core::AhrsData *GetOrientation(void) const; 64 64 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); 66 66 const flair::core::AhrsData *GetReferenceOrientation(void); 67 67 void SignalEvent(Event_t event); … … 70 70 flair::filter::Pid *u_x, *u_y; 71 71 72 flair::core::Vector2D posHold;72 flair::core::Vector2Df posHold; 73 73 float yawHold; 74 74 flair::core::Socket *message; -
trunk/demos/Skeletons/CustomReferenceAngles/src/MyApp.cpp
r122 r167 51 51 //refAngles.yaw=; 52 52 53 customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3D (0,0,0));53 customReferenceOrientation->SetQuaternionAndAngularRates(refAngles.ToQuaternion(),Vector3Df(0,0,0)); 54 54 55 55 return customReferenceOrientation;
Note:
See TracChangeset
for help on using the changeset viewer.