Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
guidance_indi_hybrid.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Ewoud Smeur <ewoud.smeur@gmail.com>
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
30 #include "generated/airframe.h"
34 #include "state.h"
35 #include "mcu_periph/sys_time.h"
36 #include "autopilot.h"
37 #include "stdio.h"
39 #include "modules/core/abi.h"
41 
42 
43 // The acceleration reference is calculated with these gains. If you use GPS,
44 // they are probably limited by the update rate of your GPS. The default
45 // values are tuned for 4 Hz GPS updates. If you have high speed position updates, the
46 // gains can be higher, depending on the speed of the inner loop.
47 #ifndef GUIDANCE_INDI_SPEED_GAIN
48 #define GUIDANCE_INDI_SPEED_GAIN 1.8
49 #define GUIDANCE_INDI_SPEED_GAINZ 1.8
50 #endif
51 
52 #ifndef GUIDANCE_INDI_POS_GAIN
53 #define GUIDANCE_INDI_POS_GAIN 0.5
54 #define GUIDANCE_INDI_POS_GAINZ 0.5
55 #endif
56 
57 #ifndef GUIDANCE_INDI_LIFTD_ASQ
58 #define GUIDANCE_INDI_LIFTD_ASQ 0.20
59 #endif
60 
61 #ifndef GUIDANCE_INDI_MAX_PUSHER_INCREMENT
62 #define GUIDANCE_INDI_MAX_PUSHER_INCREMENT MAX_PPRZ
63 #endif
64 
65 /* If lift effectiveness at low airspeed not defined,
66  * just make one interpolation segment that connects to
67  * the quadratic part from 12 m/s onward
68  */
69 #ifndef GUIDANCE_INDI_LIFTD_P50
70 #define GUIDANCE_INDI_LIFTD_P80 (GUIDANCE_INDI_LIFTD_ASQ*12*12)
71 #define GUIDANCE_INDI_LIFTD_P50 (GUIDANCE_INDI_LIFTD_P80/2)
72 #endif
73 
76  .pos_gainz = GUIDANCE_INDI_POS_GAINZ,
77 
78  .speed_gain = GUIDANCE_INDI_SPEED_GAIN,
79  .speed_gainz = GUIDANCE_INDI_SPEED_GAINZ,
80 
81  .heading_bank_gain = GUIDANCE_INDI_HEADING_BANK_GAIN,
82  .liftd_asq = GUIDANCE_INDI_LIFTD_ASQ, // coefficient of airspeed squared
83  .liftd_p80 = GUIDANCE_INDI_LIFTD_P80,
84  .liftd_p50 = GUIDANCE_INDI_LIFTD_P50,
85 };
86 
87 #ifndef GUIDANCE_INDI_MAX_AIRSPEED
88 #error "You must have an airspeed sensor to use this guidance"
89 #endif
90 float guidance_indi_max_airspeed = GUIDANCE_INDI_MAX_AIRSPEED;
91 
92 // Quadplanes can hover at various pref pitch
94 
95 
96 // If using WLS, check that the matrix size is sufficient
97 #if GUIDANCE_INDI_HYBRID_USE_WLS
98 #if GUIDANCE_INDI_HYBRID_U > WLS_N_U_MAX
99 #error Matrix-WLS_N_U_MAX too small: increase WLS_N_U_MAX in airframe file
100 #endif
101 
102 #if GUIDANCE_INDI_HYBRID_V > WLS_N_V_MAX
103 #error Matrix-WLS_N_V_MAX too small: increase WLS_N_V_MAX in airframe file
104 #endif
105 #endif
106 
107 
108 // Tell the guidance that the airspeed needs to be zeroed.
109 // Recomended to also put GUIDANCE_INDI_NAV_SPEED_MARGIN low in this case.
110 #ifndef GUIDANCE_INDI_ZERO_AIRSPEED
111 #define GUIDANCE_INDI_ZERO_AIRSPEED FALSE
112 #endif
113 
114 /*Airspeed threshold where making a turn is "worth it"*/
115 #ifndef TURN_AIRSPEED_TH
116 #define TURN_AIRSPEED_TH 10.0
117 #endif
118 
119 /*Boolean to force the heading to a static value (only use for specific experiments)*/
120 bool take_heading_control = false;
121 
122 bool force_forward = false;
123 
125 
126 
127 struct FloatVect3 sp_accel = {0.0,0.0,0.0};
128 #ifdef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN
129 float guidance_indi_specific_force_gain = GUIDANCE_INDI_SPECIFIC_FORCE_GAIN;
130 static void guidance_indi_filter_thrust(void);
131 
132 #ifdef GUIDANCE_INDI_THRUST_DYNAMICS
133 #warning GUIDANCE_INDI_THRUST_DYNAMICS is deprecated, use GUIDANCE_INDI_THRUST_DYNAMICS_FREQ instead.
134 #warning "The thrust dynamics are now specified in continuous time with the corner frequency of the first order model!"
135 #warning "define GUIDANCE_INDI_THRUST_DYNAMICS_FREQ in rad/s"
136 #warning "Use -ln(1 - old_number) * PERIODIC_FREQUENCY to compute it from the old value."
137 #endif
138 
139 #ifndef GUIDANCE_INDI_THRUST_DYNAMICS_FREQ
140 #ifndef STABILIZATION_INDI_ACT_FREQ_P
141 #error "You need to define GUIDANCE_INDI_THRUST_DYNAMICS_FREQ to be able to use indi vertical control"
142 #else // assume that the same actuators are used for thrust as for roll (e.g. quadrotor)
143 #define GUIDANCE_INDI_THRUST_DYNAMICS_FREQ STABILIZATION_INDI_ACT_FREQ_P
144 #endif
145 #endif //GUIDANCE_INDI_THRUST_DYNAMICS_FREQ
146 
147 #endif //GUIDANCE_INDI_SPECIFIC_FORCE_GAIN
148 
149 #ifndef GUIDANCE_INDI_FILTER_CUTOFF
150 #ifdef STABILIZATION_INDI_FILT_CUTOFF
151 #define GUIDANCE_INDI_FILTER_CUTOFF STABILIZATION_INDI_FILT_CUTOFF
152 #else
153 #define GUIDANCE_INDI_FILTER_CUTOFF 3.0
154 #endif
155 #endif
156 
157 #ifndef GUIDANCE_INDI_AIRSPEED_FILT_CUTOFF
158 #define GUIDANCE_INDI_AIRSPEED_FILT_CUTOFF 0.5
159 #endif
160 
161 #ifndef GUIDANCE_INDI_CLIMB_SPEED_FWD
162 #define GUIDANCE_INDI_CLIMB_SPEED_FWD 4.0
163 #endif
164 
165 #ifndef GUIDANCE_INDI_DESCEND_SPEED_FWD
166 #define GUIDANCE_INDI_DESCEND_SPEED_FWD -4.0
167 #endif
168 
169 #ifndef GUIDANCE_INDI_MAX_LAT_ACCEL
170 #define GUIDANCE_INDI_MAX_LAT_ACCEL 9.81
171 #endif
172 
175 
176 float inv_eff[4];
177 
178 // Max bank angle in radians
181 
183 struct FloatEulers eulers_zxy;
184 
185 float thrust_dyn = 0.f;
186 float thrust_act = 0.f;
193 
195 
196 float Ga[GUIDANCE_INDI_HYBRID_V][GUIDANCE_INDI_HYBRID_U];
197 struct FloatVect3 euler_cmd;
198 
199 float du_gih[GUIDANCE_INDI_HYBRID_U]; // = {0.0f, 0.0f, 0.0f};
200 
201 #if GUIDANCE_INDI_HYBRID_USE_WLS
202 #include "math/wls/wls_alloc.h"
203 float *Bwls_gih[GUIDANCE_INDI_HYBRID_V];
204 struct WLS_t wls_guid_p = {
205  .nu = GUIDANCE_INDI_HYBRID_U,
206  .nv = GUIDANCE_INDI_HYBRID_V,
207  .gamma_sq = 100000.0,
208  .v = {0.0},
209 #ifdef GUIDANCE_INDI_WLS_PRIORITIES
210  .Wv = GUIDANCE_INDI_WLS_PRIORITIES,
211 #else // X,Y accel, Z accel
212  .Wv = { 100.f, 100.f, 1.f },
213 #endif
214 #ifdef GUIDANCE_INDI_WLS_WU
215  .Wu = GUIDANCE_INDI_WLS_WU,
216 #else
217  .Wu = {[0 ... GUIDANCE_INDI_HYBRID_U - 1] = 1.0},
218 #endif
219  .u_pref = {0.0},
220  .u_min = {0.0},
221  .u_max = {0.0},
222  .PC = 0.0,
223  .SC = 0.0,
224  .iter = 0
225 };
226 #endif
227 // The control objective
228 float v_gih[3];
229 
230 // Filters
233 
237 float thrust_in;
238 
239 struct FloatVect3 gi_speed_sp = {0.0, 0.0, 0.0};
240 
241 #ifndef GUIDANCE_INDI_VEL_SP_ID
242 #define GUIDANCE_INDI_VEL_SP_ID ABI_BROADCAST
243 #endif
245 static void vel_sp_cb(uint8_t sender_id, struct FloatVect3 *vel_sp);
246 struct FloatVect3 indi_vel_sp = {0.0, 0.0, 0.0};
247 float time_of_vel_sp = 0.0;
248 
250 
251 #if PERIODIC_TELEMETRY
253 static void send_eff_mat_guid_indi_hybrid(struct transport_tx *trans, struct link_device *dev)
254 {
255  pprz_msg_send_EFF_MAT_GUID(trans, dev, AC_ID,
256  GUIDANCE_INDI_HYBRID_U, Ga[0],
257  GUIDANCE_INDI_HYBRID_U, Ga[1],
258  GUIDANCE_INDI_HYBRID_U, Ga[2]);
259 }
260 static void send_guidance_indi_hybrid(struct transport_tx *trans, struct link_device *dev)
261 {
262  pprz_msg_send_GUIDANCE_INDI_HYBRID(trans, dev, AC_ID,
263  &sp_accel.x,
264  &sp_accel.y,
265  &sp_accel.z,
266  &euler_cmd.x,
267  &euler_cmd.y,
268  &euler_cmd.z,
269  &filt_accel_ned[0].o[0],
270  &filt_accel_ned[1].o[0],
271  &filt_accel_ned[2].o[0],
272  &gi_speed_sp.x,
273  &gi_speed_sp.y,
274  &gi_speed_sp.z);
275 }
276 
277 #if GUIDANCE_INDI_HYBRID_USE_WLS
278 static void send_wls_v_guid(struct transport_tx *trans, struct link_device *dev)
279 {
280  send_wls_v("guid", &wls_guid_p, trans, dev);
281 }
282 static void send_wls_u_guid(struct transport_tx *trans, struct link_device *dev)
283 {
284  send_wls_u("guid", &wls_guid_p, trans, dev);
285 }
286 #endif // GUIDANCE_INDI_HYBRID_USE_WLS
287 
288 #endif // PERIODIC_TELEMETRY
289 
294 {
295  /*AbiBindMsgACCEL_SP(GUIDANCE_INDI_ACCEL_SP_ID, &accel_sp_ev, accel_sp_cb);*/
296  AbiBindMsgVEL_SP(GUIDANCE_INDI_VEL_SP_ID, &vel_sp_ev, vel_sp_cb);
297 
298 #ifdef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN
299 #ifdef GUIDANCE_INDI_THRUST_DYNAMICS
300  thrust_dyn = GUIDANCE_INDI_THRUST_DYNAMICS;
301 #else
302  thrust_dyn = 1-exp(-GUIDANCE_INDI_THRUST_DYNAMICS_FREQ/PERIODIC_FREQUENCY);
303 #endif
304 #endif
305 
306  float tau = 1.0/(2.0*M_PI*filter_cutoff);
307  float sample_time = 1.0/PERIODIC_FREQUENCY;
308  for(int8_t i=0; i<3; i++) {
309  init_butterworth_2_low_pass(&filt_accel_ned[i], tau, sample_time, 0.0);
310  }
311  init_butterworth_2_low_pass(&roll_filt, tau, sample_time, 0.0);
312  init_butterworth_2_low_pass(&pitch_filt, tau, sample_time, 0.0);
313  init_butterworth_2_low_pass(&thrust_filt, tau, sample_time, 0.0);
314  init_butterworth_2_low_pass(&accely_filt, tau, sample_time, 0.0);
315 
316  float tau_guidance_indi_airspeed = 1.0/(2.0*M_PI*guidance_indi_airspeed_filt_cutoff);
317  init_butterworth_2_low_pass(&guidance_indi_airspeed_filt, tau_guidance_indi_airspeed, sample_time, 0.0);
318 
319 #if GUIDANCE_INDI_HYBRID_USE_WLS
320  for (int8_t i = 0; i < GUIDANCE_INDI_HYBRID_V; i++) {
321  Bwls_gih[i] = Ga[i];
322  }
323 #endif
324 
325 #if PERIODIC_TELEMETRY
326  register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_GUIDANCE_INDI_HYBRID, send_guidance_indi_hybrid);
328 #if GUIDANCE_INDI_HYBRID_USE_WLS
329  register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_WLS_V, send_wls_v_guid);
330  register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_WLS_U, send_wls_u_guid);
331 #endif
332 #endif
333 }
334 
340 {
341  /*Obtain eulers with zxy rotation order*/
344 
345  thrust_in = stabilization.cmd[COMMAND_THRUST];
348 
349  float tau = 1.0 / (2.0 * M_PI * filter_cutoff);
350  float sample_time = 1.0 / PERIODIC_FREQUENCY;
351  for (int8_t i = 0; i < 3; i++) {
352  init_butterworth_2_low_pass(&filt_accel_ned[i], tau, sample_time, 0.0);
353  }
354 
355  /*Obtain eulers with zxy rotation order*/
357 
361  init_butterworth_2_low_pass(&accely_filt, tau, sample_time, 0.0);
362 
363  float tau_guidance_indi_airspeed = 1.0/(2.0*M_PI*guidance_indi_airspeed_filt_cutoff);
364  init_butterworth_2_low_pass(&guidance_indi_airspeed_filt, tau_guidance_indi_airspeed, sample_time, 0.0);
365 }
366 
374 struct StabilizationSetpoint guidance_indi_run(struct FloatVect3 *accel_sp, float heading_sp)
375 {
376  // set global accel sp variable FIXME clean this
377  sp_accel = *accel_sp;
378 
379  /* Obtain eulers with zxy rotation order */
381 
382  /* Calculate the transition ratio so that the ctrl_effecitveness scheduling works */
383  stabilization.transition_ratio = eulers_zxy.theta / RadOfDeg(-75.0f);
384  Bound(stabilization.transition_ratio, 0.f, 1.f);
385 
386  // filter accel to get rid of noise and filter attitude to synchronize with accel
388 
389 #if GUIDANCE_INDI_RC_DEBUG
390 #warning "GUIDANCE_INDI_RC_DEBUG lets you control the accelerations via RC, but disables autonomous flight!"
391  // for rc control horizontal, rotate from body axes to NED
392  float psi = eulers_zxy.psi;
393  float rc_x = -(radio_control.values[RADIO_PITCH]/9600.0)*8.0;
394  float rc_y = (radio_control.values[RADIO_ROLL]/9600.0)*8.0;
395  sp_accel.x = cosf(psi) * rc_x - sinf(psi) * rc_y;
396  sp_accel.y = sinf(psi) * rc_x + cosf(psi) * rc_y;
397 
398  // for rc vertical control
399  sp_accel.z = -(radio_control.values[RADIO_THROTTLE]-4500)*8.0/9600.0;
400 #endif
401 
402  struct FloatVect3 accel_filt;
403  accel_filt.x = filt_accel_ned[0].o[0];
404  accel_filt.y = filt_accel_ned[1].o[0];
405  accel_filt.z = filt_accel_ned[2].o[0];
406 
407  struct FloatVect3 a_diff;
408  VECT3_DIFF(a_diff, sp_accel, accel_filt);
409 
410  // Bound the acceleration error so that the linearization still holds
411  Bound(a_diff.x, -6.0, 6.0);
412  Bound(a_diff.y, -6.0, 6.0);
413  Bound(a_diff.z, -9.0, 9.0);
414 
415  // If the thrust to specific force ratio has been defined, include vertical control
416  // else ignore the vertical acceleration error
417 #ifndef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN
418 #ifndef STABILIZATION_ATTITUDE_INDI_FULL
419  a_diff.z = 0.0;
420 #endif
421 #endif
422 
423  // Calculate matrix of partial derivatives and control objective
425 
426 #if GUIDANCE_INDI_HYBRID_USE_WLS
427 
428  // Calculate the maximum deflections
430 
431  float du_gih[GUIDANCE_INDI_HYBRID_U]; // = {0.0f, 0.0f, 0.0f};
432 
433  for (int i = 0; i < GUIDANCE_INDI_HYBRID_V; i++) {
434  wls_guid_p.v[i] = v_gih[i];
435  }
436  wls_alloc(&wls_guid_p, Bwls_gih, 0, 0, 10);
437  for (int i = 0; i < GUIDANCE_INDI_HYBRID_U; i++) {
438  du_gih[i] = wls_guid_p.u[i];
439  }
440  euler_cmd.x = du_gih[0];
441  euler_cmd.y = du_gih[1];
442  euler_cmd.z = du_gih[2];
443 
444 #else
445  // compute inverse matrix of Ga
446  float Ga_inv[3][3] = {};
448  // Calculate roll,pitch and thrust command
449  float_mat3_mult(&euler_cmd, Ga_inv, a_diff);
450 #endif
451 
452  // Coordinated turn
453  // feedforward estimate angular rotation omega = g*tan(phi)/v
454  float omega;
455  const float max_phi = RadOfDeg(60.0f);
456 #if GUIDANCE_INDI_ZERO_AIRSPEED
457  float airspeed_turn = 0.f;
458 #else
459  float airspeed_turn = stateGetAirspeed_f();
460 #endif
461  // We are dividing by the airspeed, so a lower bound is important
462  Bound(airspeed_turn, 10.0f, 30.0f);
463 
466 
467  //Bound euler angles to prevent flipping
470 
471  // Use the current roll angle to determine the corresponding heading rate of change.
472  float coordinated_turn_roll = eulers_zxy.phi;
473 
474  // When tilting backwards (e.g. waypoint behind the drone), we have to yaw around to face the direction
475  // of flight even when the drone is not rolling much (yet). Determine the shortest direction in which to yaw by
476  // looking at the roll angle.
477  if( (eulers_zxy.theta > 0.0f) && ( fabs(eulers_zxy.phi) < eulers_zxy.theta)) {
478  if (eulers_zxy.phi > 0.0f) {
479  coordinated_turn_roll = eulers_zxy.theta;
480  } else {
481  coordinated_turn_roll = -eulers_zxy.theta;
482  }
483  }
484 
485  if (fabsf(coordinated_turn_roll) < max_phi) {
486  omega = 9.81f / airspeed_turn * tanf(coordinated_turn_roll);
487  } else { //max 60 degrees roll
488  omega = 9.81f / airspeed_turn * 1.72305f * ((coordinated_turn_roll > 0.0f) - (coordinated_turn_roll < 0.0f));
489  }
490 
491 #ifdef FWD_SIDESLIP_GAIN
492  // Add sideslip correction
493  omega -= accely_filt.o[0]*FWD_SIDESLIP_GAIN;
494 #endif
495 
496  // We can pre-compute the required rates to achieve this turn rate:
497  // NOTE: there *should* not be any problems possible with Euler singularities here
498  struct FloatEulers *euler_zyx = stateGetNedToBodyEulers_f();
499 
500  struct FloatRates ff_rates;
501 
502  ff_rates.p = -sinf(euler_zyx->theta) * omega;
503  ff_rates.q = cosf(euler_zyx->theta) * sinf(euler_zyx->phi) * omega;
504  ff_rates.r = cosf(euler_zyx->theta) * cosf(euler_zyx->phi) * omega;
505 
506  // For a hybrid it is important to reduce the sideslip, which is done by changing the heading.
507  // For experiments, it is possible to fix the heading to a different value.
508  if (take_heading_control) {
509  // heading is fixed by nav
510  guidance_euler_cmd.psi = heading_sp;
511  }
512  else {
513  // heading is free and controlled by guidance
514  guidance_indi_hybrid_heading_sp += omega / PERIODIC_FREQUENCY;
516  // limit heading setpoint to be within bounds of current heading
517 #ifdef STABILIZATION_ATTITUDE_SP_PSI_DELTA_LIMIT
518  float delta_limit = STABILIZATION_ATTITUDE_SP_PSI_DELTA_LIMIT;
520  float delta_psi = guidance_indi_hybrid_heading_sp - heading;
521  FLOAT_ANGLE_NORMALIZE(delta_psi);
522  if (delta_psi > delta_limit) {
524  } else if (delta_psi < -delta_limit) {
526  }
528 #endif
530  }
531 
532  // compute required thrust setpoint
533 #ifdef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN
534  guidance_indi_filter_thrust();
535  // Add the increment in specific force * specific_force_to_thrust_gain to the filtered thrust
537  Bound(thrust_in, GUIDANCE_INDI_MIN_THROTTLE, 9600);
538 #if GUIDANCE_INDI_RC_DEBUG
539  if (radio_control.values[RADIO_THROTTLE] < 300) {
540  thrust_in = 0;
541  }
542 #endif
543  // return required thrust
545 
546 #else
547  float thrust_vect[3];
548 #if GUIDANCE_INDI_HYBRID_U > 3
549  thrust_vect[0] = du_gih[3];
550  if (thrust_vect[0] > GUIDANCE_INDI_MAX_PUSHER_INCREMENT*g1g2[4][GUIDANCE_INDI_PUSHER_INDEX]) {
551  thrust_vect[0] = GUIDANCE_INDI_MAX_PUSHER_INCREMENT*g1g2[4][GUIDANCE_INDI_PUSHER_INDEX];
552  }
553 #else
554  thrust_vect[0] = 0;
555 #endif
556  thrust_vect[1] = 0;
557  thrust_vect[2] = euler_cmd.z;
558  // specific force not defined, return required increment
559  thrust_sp = th_sp_from_incr_vect_f(thrust_vect);
560 #endif
561 
562  // Set the quaternion setpoint from eulers_zxy
563  struct FloatQuat sp_quat;
565  float_quat_normalize(&sp_quat);
566 
567  return stab_sp_from_quat_ff_rates_f(&sp_quat, &ff_rates);
568 }
569 
570 // compute accel setpoint from speed setpoint (use global variables ! FIXME)
571 static struct FloatVect3 compute_accel_from_speed_sp(void)
572 {
573  struct FloatVect3 accel_sp = { 0.f, 0.f, 0.f };
574 
576 
577  //for rc control horizontal, rotate from body axes to NED
578  float psi = eulers_zxy.psi;
579  float cpsi = cosf(psi);
580  float spsi = sinf(psi);
581  float speed_sp_b_x = cpsi * gi_speed_sp.x + spsi * gi_speed_sp.y;
582  float speed_sp_b_y = -spsi * gi_speed_sp.x + cpsi * gi_speed_sp.y;
583 
584  // Get airspeed or zero it
585 #if GUIDANCE_INDI_ZERO_AIRSPEED
586  float airspeed = 0.f;
587 #else
588  float airspeed = stateGetAirspeed_f();
590  airspeed = guidance_indi_airspeed_filt.o[0];
591  }
592 #endif
593  struct NedCoor_f *groundspeed = stateGetSpeedNed_f();
594  struct FloatVect2 airspeed_v = { cpsi * airspeed, spsi * airspeed };
595  struct FloatVect2 windspeed;
596  VECT2_DIFF(windspeed, *groundspeed, airspeed_v);
597 
598  VECT2_DIFF(desired_airspeed, gi_speed_sp, windspeed); // Use 2d part of gi_speed_sp
599  float norm_des_as = FLOAT_VECT2_NORM(desired_airspeed);
600 
601  // Make turn instead of straight line
602  if ((airspeed > TURN_AIRSPEED_TH) && (norm_des_as > (TURN_AIRSPEED_TH+2.0f))) {
603 
604  // Give the wind cancellation priority.
605  if (norm_des_as > guidance_indi_max_airspeed) {
606  float groundspeed_factor = 0.0f;
607 
608  // if the wind is faster than we can fly, just fly in the wind direction
609  if (FLOAT_VECT2_NORM(windspeed) < guidance_indi_max_airspeed) {
610  float av = gi_speed_sp.x * gi_speed_sp.x + gi_speed_sp.y * gi_speed_sp.y;
611  float bv = -2.f * (windspeed.x * gi_speed_sp.x + windspeed.y * gi_speed_sp.y);
612  float cv = windspeed.x * windspeed.x + windspeed.y * windspeed.y - guidance_indi_max_airspeed * guidance_indi_max_airspeed;
613 
614  float dv = bv * bv - 4.0f * av * cv;
615 
616  // dv can only be positive, but just in case
617  if (dv < 0.0f) {
618  dv = fabsf(dv);
619  }
620  float d_sqrt = sqrtf(dv);
621 
622  groundspeed_factor = (-bv + d_sqrt) / (2.0f * av);
623  }
624 
625  desired_airspeed.x = groundspeed_factor * gi_speed_sp.x - windspeed.x;
626  desired_airspeed.y = groundspeed_factor * gi_speed_sp.y - windspeed.y;
627 
628  speed_sp_b_x = guidance_indi_max_airspeed;
629  }
630 
631  // desired airspeed can not be larger than max airspeed
632  speed_sp_b_x = Min(norm_des_as, guidance_indi_max_airspeed);
633 
634  if (force_forward) {
635  speed_sp_b_x = guidance_indi_max_airspeed;
636  }
637 
638  // Calculate accel sp in body axes, because we need to regulate airspeed
639  struct FloatVect2 sp_accel_b;
640  // In turn acceleration proportional to heading diff
641  sp_accel_b.y = atan2f(desired_airspeed.y, desired_airspeed.x) - psi;
642  FLOAT_ANGLE_NORMALIZE(sp_accel_b.y);
643  sp_accel_b.y *= gih_params.heading_bank_gain;
644 
645  BoundAbs(sp_accel_b.y, GUIDANCE_INDI_MAX_LAT_ACCEL);
646 
647  // Control the airspeed
648  sp_accel_b.x = (speed_sp_b_x - airspeed) * gih_params.speed_gain;
649 
650  accel_sp.x = cpsi * sp_accel_b.x - spsi * sp_accel_b.y;
651  accel_sp.y = spsi * sp_accel_b.x + cpsi * sp_accel_b.y;
653  }
654  else { // Go somewhere in the shortest way
655 
656  if (airspeed > 10.f) {
657  // Groundspeed vector in body frame
658  float groundspeed_x = cpsi * stateGetSpeedNed_f()->x + spsi * stateGetSpeedNed_f()->y;
659  float speed_increment = speed_sp_b_x - groundspeed_x;
660 
661  // limit groundspeed setpoint to max_airspeed + (diff gs and airspeed)
662  if ((speed_increment + airspeed) > guidance_indi_max_airspeed) {
663  speed_sp_b_x = guidance_indi_max_airspeed + groundspeed_x - airspeed;
664  }
665  }
666 
667  gi_speed_sp.x = cpsi * speed_sp_b_x - spsi * speed_sp_b_y;
668  gi_speed_sp.y = spsi * speed_sp_b_x + cpsi * speed_sp_b_y;
669 
673  }
674 
675  // Bound the acceleration setpoint
676  float accelbound = 3.0f + airspeed / guidance_indi_max_airspeed * 5.0f; // FIXME remove hard coded values
677  float_vect3_bound_in_2d(&accel_sp, accelbound);
678  /*BoundAbs(sp_accel.x, 3.0 + airspeed/guidance_indi_max_airspeed*6.0);*/
679  /*BoundAbs(sp_accel.y, 3.0 + airspeed/guidance_indi_max_airspeed*6.0);*/
680  BoundAbs(accel_sp.z, 3.0);
681 
682  return accel_sp;
683 }
684 
685 static float bound_vz_sp(float vz_sp)
686 {
687  // Bound vertical speed setpoint
688  if (stateGetAirspeed_f() > 13.f) {
689  Bound(vz_sp, -climb_vspeed_fwd, -descend_vspeed_fwd);
690  } else {
691  Bound(vz_sp, -nav.climb_vspeed, -nav.descend_vspeed); // FIXME don't use nav settings
692  }
693  return vz_sp;
694 }
695 
697 {
698  struct FloatVect3 pos_err = { 0 };
699  struct FloatVect3 accel_sp = { 0 };
700 
701  // First check for velocity setpoint from module // FIXME should be called like this
702  float dt = get_sys_time_float() - time_of_vel_sp;
703  // If the input command is not updated after a timeout, switch back to flight plan control
704  if (dt < 0.5) {
708  accel_sp = compute_accel_from_speed_sp(); // compute accel sp
709  return guidance_indi_run(&accel_sp, gh->sp.heading);
710  }
711 
712  if (h_mode == GUIDANCE_INDI_HYBRID_H_POS) {
713  //Linear controller to find the acceleration setpoint from position and velocity
714  pos_err.x = POS_FLOAT_OF_BFP(gh->ref.pos.x) - stateGetPositionNed_f()->x;
715  pos_err.y = POS_FLOAT_OF_BFP(gh->ref.pos.y) - stateGetPositionNed_f()->y;
716  gi_speed_sp.x = pos_err.x * gih_params.pos_gain + SPEED_FLOAT_OF_BFP(gh->ref.speed.x);
717  gi_speed_sp.y = pos_err.y * gih_params.pos_gain + SPEED_FLOAT_OF_BFP(gh->ref.speed.y);
718  if (v_mode == GUIDANCE_INDI_HYBRID_V_POS) {
719  pos_err.z = POS_FLOAT_OF_BFP(gv->z_ref) - stateGetPositionNed_f()->z;
721  } else if (v_mode == GUIDANCE_INDI_HYBRID_V_SPEED) {
723  } else {
724  gi_speed_sp.z = 0.f;
725  }
726  accel_sp = compute_accel_from_speed_sp(); // compute accel sp
727  if (v_mode == GUIDANCE_INDI_HYBRID_V_ACCEL) {
728  accel_sp.z = (gi_speed_sp.z - stateGetSpeedNed_f()->z) * gih_params.speed_gainz + ACCEL_FLOAT_OF_BFP(gv->zdd_ref); // overwrite accel
729  }
730  return guidance_indi_run(&accel_sp, gh->sp.heading);
731  }
732  else if (h_mode == GUIDANCE_INDI_HYBRID_H_SPEED) {
733  gi_speed_sp.x = SPEED_FLOAT_OF_BFP(gh->ref.speed.x);
734  gi_speed_sp.y = SPEED_FLOAT_OF_BFP(gh->ref.speed.y);
735  if (v_mode == GUIDANCE_INDI_HYBRID_V_POS) {
736  pos_err.z = POS_FLOAT_OF_BFP(gv->z_ref) - stateGetPositionNed_f()->z;
738  } else if (v_mode == GUIDANCE_INDI_HYBRID_V_SPEED) {
740  } else {
741  gi_speed_sp.z = 0.f;
742  }
743  accel_sp = compute_accel_from_speed_sp(); // compute accel sp
744  if (v_mode == GUIDANCE_INDI_HYBRID_V_ACCEL) {
745  accel_sp.z = (gi_speed_sp.z - stateGetSpeedNed_f()->z) * gih_params.speed_gainz + ACCEL_FLOAT_OF_BFP(gv->zdd_ref); // overwrite accel
746  }
747  return guidance_indi_run(&accel_sp, gh->sp.heading);
748  }
749  else { // H_ACCEL
750  gi_speed_sp.x = 0.f;
751  gi_speed_sp.y = 0.f;
752  if (v_mode == GUIDANCE_INDI_HYBRID_V_POS) {
753  pos_err.z = POS_FLOAT_OF_BFP(gv->z_ref) - stateGetPositionNed_f()->z;
755  } else if (v_mode == GUIDANCE_INDI_HYBRID_V_SPEED) {
757  } else {
758  gi_speed_sp.z = 0.f;
759  }
760  accel_sp = compute_accel_from_speed_sp(); // compute accel sp in case z control is required
761  // overwrite accel X and Y
762  accel_sp.x = (gi_speed_sp.x - stateGetSpeedNed_f()->x) * gih_params.speed_gain + ACCEL_FLOAT_OF_BFP(gh->ref.accel.x);
763  accel_sp.y = (gi_speed_sp.y - stateGetSpeedNed_f()->y) * gih_params.speed_gain + ACCEL_FLOAT_OF_BFP(gh->ref.accel.y);
764  if (v_mode == GUIDANCE_INDI_HYBRID_V_ACCEL) {
765  accel_sp.z = (gi_speed_sp.z - stateGetSpeedNed_f()->z) * gih_params.speed_gainz + ACCEL_FLOAT_OF_BFP(gv->zdd_ref); // overwrite accel
766  }
767  return guidance_indi_run(&accel_sp, gh->sp.heading);
768  }
769 }
770 
771 #ifdef GUIDANCE_INDI_SPECIFIC_FORCE_GAIN
775 void guidance_indi_filter_thrust(void)
776 {
777  // Actuator dynamics
779 
780  // same filter as for the acceleration
782 }
783 
784 #endif
785 
793 {
794  struct NedCoor_f *accel = stateGetAccelNed_f();
798 
801 
802  // Propagate filter for sideslip correction
803  float accely = ACCEL_FLOAT_OF_BFP(stateGetAccelBody_i()->y);
805 
806  float airspeed = stateGetAirspeed_f();
808 }
809 
810 
818 float WEAK guidance_indi_get_liftd(float airspeed, float theta) {
819  float liftd = 0.0f;
820 
821  if (airspeed < 12.f) {
822  /* Assume the airspeed is too low to be measured accurately
823  * Use scheduling based on pitch angle instead.
824  * You can define two interpolation segments
825  */
826  float pitch_interp = DegOfRad(theta);
827  const float min_pitch = -80.0f;
828  const float middle_pitch = -50.0f;
829  const float max_pitch = -20.0f;
830 
831  Bound(pitch_interp, min_pitch, max_pitch);
832  if (pitch_interp > middle_pitch) {
833  float ratio = (pitch_interp - max_pitch)/(middle_pitch - max_pitch);
834  liftd = -gih_params.liftd_p50*ratio;
835  } else {
836  float ratio = (pitch_interp - middle_pitch)/(min_pitch - middle_pitch);
838  }
839  } else {
840  liftd = -gih_params.liftd_asq*airspeed*airspeed;
841  }
842 
843  //TODO: bound liftd
844  return liftd;
845 }
846 
850 static void vel_sp_cb(uint8_t sender_id __attribute__((unused)), struct FloatVect3 *vel_sp)
851 {
852  indi_vel_sp.x = vel_sp->x;
853  indi_vel_sp.y = vel_sp->y;
854  indi_vel_sp.z = vel_sp->z;
856 }
857 
858 
859 #if GUIDANCE_INDI_HYBRID_USE_AS_DEFAULT
860 // guidance indi control function is implementing the default functions of guidance
861 
862 void guidance_h_run_enter(void)
863 {
865 }
866 
867 void guidance_v_run_enter(void)
868 {
869  // nothing to do
870 }
871 
872 static struct VerticalGuidance *_gv = &guidance_v;
874 
875 struct StabilizationSetpoint guidance_h_run_pos(bool in_flight, struct HorizontalGuidance *gh)
876 {
878 }
879 
880 struct StabilizationSetpoint guidance_h_run_speed(bool in_flight, struct HorizontalGuidance *gh)
881 {
883 }
884 
885 struct StabilizationSetpoint guidance_h_run_accel(bool in_flight, struct HorizontalGuidance *gh)
886 {
888 }
889 
890 struct ThrustSetpoint guidance_v_run_pos(bool in_flight UNUSED, struct VerticalGuidance *gv)
891 {
892  _gv = gv;
894  return thrust_sp;
895 }
896 
897 struct ThrustSetpoint guidance_v_run_speed(bool in_flight UNUSED, struct VerticalGuidance *gv)
898 {
899  _gv = gv;
901  return thrust_sp;
902 }
903 
904 struct ThrustSetpoint guidance_v_run_accel(bool in_flight UNUSED, struct VerticalGuidance *gv)
905 {
906  _gv = gv;
908  return thrust_sp;
909 }
910 
911 #endif
912 
Main include for ABI (AirBorneInterface).
Event structure to store callbacks in a linked list.
Definition: abi_common.h:67
Core autopilot interface common to all firmwares.
uint8_t last_wp UNUSED
#define Min(x, y)
Definition: esc_dshot.c:109
float phi
in radians
float p
in rad/s
float theta
in radians
float psi
in radians
static void float_quat_normalize(struct FloatQuat *q)
#define FLOAT_ANGLE_NORMALIZE(_a)
void float_mat3_mult(struct FloatVect3 *vect_out, float mat[3][3], struct FloatVect3 vect_in)
Multiply 3D matrix with vector.
void float_vect3_bound_in_2d(struct FloatVect3 *vect3, float bound)
void float_quat_of_eulers_zxy(struct FloatQuat *q, struct FloatEulers *e)
quat from euler rotation 'ZXY' This rotation order is useful if you need 90 deg pitch
void float_eulers_of_quat_zxy(struct FloatEulers *e, struct FloatQuat *q)
euler rotation 'ZXY' This rotation order is useful if you need 90 deg pitch
bool float_mat_inv_3d(float inv_out[3][3], float mat_in[3][3])
3x3 matrix inverse
#define FLOAT_VECT2_NORM(_v)
euler angles
Roation quaternion.
angular rates
#define VECT2_DIFF(_c, _a, _b)
Definition: pprz_algebra.h:92
#define VECT3_DIFF(_c, _a, _b)
Definition: pprz_algebra.h:182
#define POS_FLOAT_OF_BFP(_ai)
#define SPEED_FLOAT_OF_BFP(_ai)
#define ACCEL_FLOAT_OF_BFP(_ai)
static struct NedCoor_f * stateGetAccelNed_f(void)
Get acceleration in NED coordinates (float).
Definition: state.h:1038
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
Definition: state.h:1143
static struct FloatQuat * stateGetNedToBodyQuat_f(void)
Get vehicle body attitude quaternion (float).
Definition: state.h:1131
static struct NedCoor_f * stateGetPositionNed_f(void)
Get position in local NED coordinates (float).
Definition: state.h:710
static struct NedCoor_f * stateGetSpeedNed_f(void)
Get ground speed in local NED coordinates (float).
Definition: state.h:908
static struct Int32Vect3 * stateGetAccelBody_i(void)
Get acceleration in Body coordinates (int).
Definition: state.h:953
static float stateGetAirspeed_f(void)
Get airspeed (float).
Definition: state.h:1407
struct FloatMat33 Ga_inv
float guidance_indi_specific_force_gain
struct FloatVect3 indi_vel_sp
bool force_forward
forward flight for hybrid nav
Butterworth2LowPass accely_filt
static void vel_sp_cb(uint8_t sender_id, struct FloatVect3 *vel_sp)
ABI callback that obtains the velocity setpoint from a module.
float time_of_vel_sp
Butterworth2LowPass roll_filt
#define GUIDANCE_INDI_SPEED_GAINZ
#define GUIDANCE_INDI_CLIMB_SPEED_FWD
struct guidance_indi_hybrid_params gih_params
float thrust_in
#define GUIDANCE_INDI_MAX_LAT_ACCEL
struct FloatVect3 gi_speed_sp
float guidance_indi_min_pitch
float guidance_indi_max_bank
float climb_vspeed_fwd
struct StabilizationSetpoint guidance_indi_run_mode(bool in_flight UNUSED, struct HorizontalGuidance *gh, struct VerticalGuidance *gv, enum GuidanceIndiHybrid_HMode h_mode, enum GuidanceIndiHybrid_VMode v_mode)
float inv_eff[4]
float descend_vspeed_fwd
struct FloatVect3 sp_accel
struct FloatEulers guidance_euler_cmd
float guidance_indi_pitch_pref_deg
#define GUIDANCE_INDI_LIFTD_ASQ
float guidance_indi_airspeed_filt_cutoff
float thrust_act
void guidance_indi_enter(void)
Call upon entering indi guidance.
Butterworth2LowPass guidance_indi_airspeed_filt
Butterworth2LowPass pitch_filt
#define GUIDANCE_INDI_POS_GAIN
bool take_heading_control
float guidance_indi_hybrid_heading_sp
float WEAK guidance_indi_get_liftd(float airspeed, float theta)
Get the derivative of lift w.r.t.
struct ThrustSetpoint thrust_sp
#define GUIDANCE_INDI_LIFTD_P50
static void send_guidance_indi_hybrid(struct transport_tx *trans, struct link_device *dev)
void guidance_indi_init(void)
Init function.
float filter_cutoff
#define GUIDANCE_INDI_FILTER_CUTOFF
#define GUIDANCE_INDI_DESCEND_SPEED_FWD
#define GUIDANCE_INDI_MAX_PUSHER_INCREMENT
float Ga[GUIDANCE_INDI_HYBRID_V][GUIDANCE_INDI_HYBRID_U]
struct FloatVect3 euler_cmd
static float bound_vz_sp(float vz_sp)
struct FloatEulers eulers_zxy
state eulers in zxy order
Butterworth2LowPass filt_accel_ned[3]
#define GUIDANCE_INDI_AIRSPEED_FILT_CUTOFF
#define GUIDANCE_INDI_POS_GAINZ
#define TURN_AIRSPEED_TH
float guidance_indi_max_airspeed
float thrust_dyn
static void send_eff_mat_guid_indi_hybrid(struct transport_tx *trans, struct link_device *dev)
static struct FloatVect3 compute_accel_from_speed_sp(void)
#define GUIDANCE_INDI_VEL_SP_ID
struct StabilizationSetpoint guidance_indi_run(struct FloatVect3 *accel_sp, float heading_sp)
float v_gih[3]
void guidance_indi_propagate_filters(void)
Low pass the accelerometer measurements to remove noise from vibrations.
bool guidance_indi_airspeed_filtering
#define GUIDANCE_INDI_LIFTD_P80
abi_event vel_sp_ev
Butterworth2LowPass thrust_filt
#define GUIDANCE_INDI_SPEED_GAIN
float du_gih[GUIDANCE_INDI_HYBRID_U]
struct FloatVect2 desired_airspeed
A guidance mode based on Incremental Nonlinear Dynamic Inversion Come to ICRA2016 to learn more!
void guidance_indi_calcg_wing(float Gmat[GUIDANCE_INDI_HYBRID_V][GUIDANCE_INDI_HYBRID_U], struct FloatVect3 a_diff, float v_body[GUIDANCE_INDI_HYBRID_V])
Perform WLS.
GuidanceIndiHybrid_VMode
@ GUIDANCE_INDI_HYBRID_V_POS
@ GUIDANCE_INDI_HYBRID_V_SPEED
@ GUIDANCE_INDI_HYBRID_V_ACCEL
GuidanceIndiHybrid_HMode
@ GUIDANCE_INDI_HYBRID_H_SPEED
@ GUIDANCE_INDI_HYBRID_H_ACCEL
@ GUIDANCE_INDI_HYBRID_H_POS
void WEAK guidance_indi_hybrid_set_wls_settings(float body_v[3], float roll_angle, float pitch_angle)
#define GUIDANCE_INDI_MAX_PITCH
#define GUIDANCE_INDI_MIN_PITCH
static enum GuidanceOneloop_VMode _v_mode
void guidance_v_run_enter(void)
static struct VerticalGuidance * _gv
struct ThrustSetpoint guidance_v_run_pos(bool in_flight UNUSED, struct VerticalGuidance *gv)
struct ThrustSetpoint guidance_v_run_speed(bool in_flight UNUSED, struct VerticalGuidance *gv)
struct ThrustSetpoint guidance_v_run_accel(bool in_flight UNUSED, struct VerticalGuidance *gv)
Simple first order low pass filter with bilinear transform.
float o[2]
output history
static void init_butterworth_2_low_pass(Butterworth2LowPass *filter, float tau, float sample_time, float value)
Init a second order Butterworth filter.
static float update_butterworth_2_low_pass(Butterworth2LowPass *filter, float value)
Update second order Butterworth low pass filter state with a new value.
Second order low pass filter structure.
float z
in meters
float x
in meters
float y
in meters
vector in North East Down coordinates Units: meters
struct RadioControl radio_control
Definition: radio_control.c:33
Generic interface for radio control modules.
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
Definition: radio_control.h:67
Some helper functions to check RC sticks.
void guidance_h_run_enter(void)
struct StabilizationSetpoint guidance_h_run_pos(bool in_flight, struct HorizontalGuidance *gh)
struct StabilizationSetpoint guidance_h_run_speed(bool in_flight, struct HorizontalGuidance *gh)
struct StabilizationSetpoint guidance_h_run_accel(bool in_flight, struct HorizontalGuidance *gh)
#define GUIDANCE_H_MAX_BANK
Max bank controlled by guidance.
Definition: guidance_h.h:64
struct VerticalGuidance guidance_v
Definition: guidance_v.c:60
int32_t z_ref
altitude reference in meters.
Definition: guidance_v.h:62
int32_t zd_ref
vertical speed reference in meter/s.
Definition: guidance_v.h:68
int32_t zdd_ref
vertical acceleration reference in meter/s^2.
Definition: guidance_v.h:74
struct RotorcraftNavigation nav
Definition: navigation.c:51
Rotorcraft navigation functions.
float descend_vspeed
descend speed setting, mostly used in flight plans
Definition: navigation.h:146
float heading
heading setpoint (in radians)
Definition: navigation.h:133
float climb_vspeed
climb speed setting, mostly used in flight plans
Definition: navigation.h:145
struct Stabilization stabilization
Definition: stabilization.c:41
struct ThrustSetpoint th_sp_from_incr_vect_f(float th_increment[3])
struct StabilizationSetpoint stab_sp_from_quat_ff_rates_f(struct FloatQuat *quat, struct FloatRates *rates)
struct ThrustSetpoint th_sp_from_thrust_i(int32_t thrust, uint8_t axis)
#define THRUST_AXIS_Z
float transition_ratio
transition percentage for hybrids (0.: hover; 1.: forward)
int32_t cmd[COMMANDS_NB]
output command vector, range from [-MAX_PPRZ:MAX_PPRZ] (store for messages)
float stabilization_attitude_get_heading_f(void)
Get attitude heading as float (avoiding jumps)
float g1g2[INDI_OUTPUTS][INDI_NUM_ACT]
API to get/set the generic vehicle states.
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:74
Stabilization setpoint.
Definition: stabilization.h:53
union StabilizationSetpoint::@278 sp
Thrust setpoint // TODO to a setpoint header Structure to store the desired thrust vector with differ...
Definition: stabilization.h:82
Architecture independent timing functions.
static float get_sys_time_float(void)
Get the time in seconds since startup.
Definition: sys_time.h:138
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Definition: telemetry.c:51
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
Definition: telemetry.h:66
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
signed char int8_t
Typedef defining 8 bit char type.
Definition: vl53l1_types.h:103
float heading
Definition: wedgebug.c:258
void send_wls_v(char *name, struct WLS_t *WLS_p, struct transport_tx *trans, struct link_device *dev)
Definition: wls_alloc.c:61
void wls_alloc(struct WLS_t *WLS_p, float **B, float *u_guess, float *W_init, int imax)
active set algorithm for control allocation
Definition: wls_alloc.c:119
void send_wls_u(char *name, struct WLS_t *WLS_p, struct transport_tx *trans, struct link_device *dev)
Definition: wls_alloc.c:71
float u[WLS_N_U_MAX]
Definition: wls_alloc.h:71
float v[WLS_N_V_MAX]
Definition: wls_alloc.h:70
int nu
Definition: wls_alloc.h:67