Skip to content

Commit

Permalink
[flight_time] estimator_flight_time is now autopilot_flight_time
Browse files Browse the repository at this point in the history
  • Loading branch information
gautierhattenberger committed Aug 23, 2012
1 parent 04750bd commit bbdaa96
Show file tree
Hide file tree
Showing 33 changed files with 56 additions and 63 deletions.
2 changes: 1 addition & 1 deletion conf/flight_plans/EMAV2009.xml
Expand Up @@ -28,7 +28,7 @@
<block name="Takeoff" strip_button="Takeoff (wp CLIMB)" strip_icon="takeoff.png">
<exception cond="GetPosAlt() > ground_alt+25" deroute="Standby"/>
<set value="0" var="kill_throttle"/>
<set value="0" var="estimator_flight_time"/>
<set value="0" var="autopilot_flight_time"/>
<go from="HOME" pitch="15" throttle="1.0" vmode="throttle" wp="CLIMB"/>
</block>
<block name="Standby" strip_button="Standby" strip_icon="home.png">
Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/basic.xml
Expand Up @@ -38,7 +38,7 @@
<block key="t" name="Takeoff" strip_button="Takeoff (wp CLIMB)" strip_icon="takeoff.png" group="home">
<exception cond="GetPosAlt() > ground_alt+25" deroute="Standby"/>
<set value="0" var="kill_throttle"/>
<set value="0" var="estimator_flight_time"/>
<set value="0" var="autopilot_flight_time"/>
<go from="HOME" throttle="1.0" vmode="throttle" wp="CLIMB" pitch="15"/>
</block>
<block key="<Control>a" name="Standby" strip_button="Standby" strip_icon="home.png" group="home">
Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/corsica.xml
Expand Up @@ -35,7 +35,7 @@
<block name="Takeoff" strip_button="Takeoff (wp CLIMB)" strip_icon="takeoff.png">
<exception cond="GetPosAlt() > ground_alt+25" deroute="Standby Menton"/>
<set value="0" var="kill_throttle"/>
<set value="0" var="estimator_flight_time"/>
<set value="0" var="autopilot_flight_time"/>
<go throttle="1.0" vmode="throttle" wp="CLIMB" pitch="15"/>
</block>
<block name="Standby Menton" strip_button="Standby Menton" strip_icon="home.png">
Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/creidlitz.xml
Expand Up @@ -36,7 +36,7 @@
<block name="Takeoff" strip_button="Takeoff (wp CLIMB)" strip_icon="takeoff.png">
<exception cond="GetPosAlt() > ground_alt+25" deroute="Standby"/>
<set value="0" var="kill_throttle"/>
<set value="0" var="estimator_flight_time"/>
<set value="0" var="autopilot_flight_time"/>
<go from="HOME" throttle="1.0" vmode="throttle" wp="CLIMB"/>
</block>
<block name="Standby" strip_button="Standby" strip_icon="home.png">
Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/grosslobke_demo.xml
Expand Up @@ -24,7 +24,7 @@
</waypoints>
<blocks>
<block name="start">
<attitude pitch="20" roll="0" throttle="0.8" until="(estimator_flight_time > 3)" vmode="throttle"/>
<attitude pitch="20" roll="0" throttle="0.8" until="(autopilot_flight_time > 3)" vmode="throttle"/>
<go wp="START"/>
</block>
<block name="wait" strip_button="wait">
Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/grosslobke_kreise.xml
Expand Up @@ -12,7 +12,7 @@
</waypoints>
<blocks>
<block NAME="start">
<attitude roll="0" pitch="0.1" vmode="throttle" throttle="0.7" until="(estimator_flight_time > 5)"/>
<attitude roll="0" pitch="0.1" vmode="throttle" throttle="0.7" until="(autopilot_flight_time > 5)"/>
<go wp="START"/>
</block>
<block NAME="east">
Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/hsif.xml
Expand Up @@ -21,7 +21,7 @@
<block name="Takeoff">
<exception cond="GetPosAlt() > ground_alt+25" deroute="HSIF"/>
<set value="0" var="kill_throttle"/>
<set value="0" var="estimator_flight_time"/>
<set value="0" var="autopilot_flight_time"/>
<go from="HOME" pitch="15" throttle="1.0" vmode="throttle" wp="CLIMB"/>
</block>
<block name="HSIF">
Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/huit.xml
Expand Up @@ -13,7 +13,7 @@

<blocks>
<block name="init">
<while cond="(estimator_flight_time)"></while>
<while cond="(autopilot_flight_time)"></while>
<heading course="QFU" vmode="climb" climb="2.0" until="(GetPosAlt() > SECURITY_ALT)"/>
</block>

Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/ingolfsskali.xml
Expand Up @@ -23,7 +23,7 @@
<block name="start">
<set value="10" var="my_nav_roll"/>
<set value="-10" var="my_nav_pitch"/>
<attitude pitch="5" roll="0" throttle="0.7" until="(estimator_flight_time > 5)" vmode="throttle"/>
<attitude pitch="5" roll="0" throttle="0.7" until="(autopilot_flight_time > 5)" vmode="throttle"/>
<go wp="1"/>
</block>
<block name="east">
Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/joystick.xml
Expand Up @@ -36,7 +36,7 @@
<block name="Takeoff" strip_button="Takeoff (wp CLIMB)" strip_icon="takeoff.png">
<exception cond="GetPosAlt() > ground_alt+25" deroute="Standby"/>
<set value="0" var="kill_throttle"/>
<set value="0" var="estimator_flight_time"/>
<set value="0" var="autopilot_flight_time"/>
<go from="HOME" throttle="1.0" vmode="throttle" wp="CLIMB" pitch="15"/>
</block>
<block name="Standby" strip_button="Standby" strip_icon="home.png">
Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/kalscott.xml
Expand Up @@ -28,7 +28,7 @@
<block name="Takeoff" strip_button="Takeoff (wp CLIMB)" strip_icon="takeoff.png">
<exception cond="GetPosAlt() > ground_alt+25" deroute="Circle"/>
<set value="0" var="kill_throttle"/>
<set value="0" var="estimator_flight_time"/>
<set value="0" var="autopilot_flight_time"/>
<go from="HOME" throttle="1.0" vmode="throttle" wp="CLIMB" pitch="15"/>
</block>
<block name="Circle" strip_button="Circle" strip_icon="home.png">
Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/kv_svalbard.xml
Expand Up @@ -38,7 +38,7 @@
<block name="Takeoff" strip_button="Takeoff (wp CLIMB)" strip_icon="takeoff.png">
<exception cond="GetPosAlt() > ground_alt+25" deroute="Standby"/>
<set value="0" var="kill_throttle"/>
<set value="0" var="estimator_flight_time"/>
<set value="0" var="autopilot_flight_time"/>
<go from="HOME" throttle="1.0" vmode="throttle" wp="CLIMB"/>
</block>
<block name="Standby" strip_button="Standby" strip_icon="home.png">
Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/mav08.xml
Expand Up @@ -44,7 +44,7 @@
<block name="Takeoff" strip_button="Takeoff (wp CLIMB)" strip_icon="takeoff.png">
<exception cond="GetPosAlt() > ground_alt+25" deroute="Standby"/>
<set value="0" var="kill_throttle"/>
<set value="0" var="estimator_flight_time"/>
<set value="0" var="autopilot_flight_time"/>
<go from="HOME" pitch="15" throttle="1.0" vmode="throttle" wp="CLIMB"/>
</block>
<block name="Standby" strip_button="Standby" strip_icon="home.png">
Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/muret_for.xml
Expand Up @@ -9,7 +9,7 @@
<blocks>
<block name="init">
<while cond="(!launch)"/>
<heading course="QFU" throttle="0.8" pitch="10" until="(estimator_flight_time > 8)" vmode="throttle"/>
<heading course="QFU" throttle="0.8" pitch="10" until="(autopilot_flight_time > 8)" vmode="throttle"/>
<heading climb="3.0" course="QFU" pitch="10" until="(GetPosAlt() > SECURITY_ALT)" vmode="climb"/>
</block>
<block name="for">
Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/nordlys.xml
Expand Up @@ -26,7 +26,7 @@
</exceptions>
<blocks>
<block name="start">
<attitude pitch="20" roll="0" throttle="0.7" until="(estimator_flight_time > 3)" vmode="throttle"/>
<attitude pitch="20" roll="0" throttle="0.7" until="(autopilot_flight_time > 3)" vmode="throttle"/>
<go wp="START"/>
</block>
<block name="wait" strip_button="wait">
Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/poles.xml
Expand Up @@ -34,7 +34,7 @@
<block key="t" name="Takeoff" strip_button="Takeoff (wp CLIMB)" strip_icon="takeoff.png">
<exception cond="GetPosAlt() > ground_alt+25" deroute="Standby"/>
<set value="0" var="kill_throttle"/>
<set value="0" var="estimator_flight_time"/>
<set value="0" var="autopilot_flight_time"/>
<go from="HOME" pitch="15" throttle="1.0" vmode="throttle" wp="CLIMB"/>
</block>
<block key="<Control>a" name="Standby" strip_button="Standby" strip_icon="home.png">
Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/sinsat.xml
Expand Up @@ -6,7 +6,7 @@
<blocks>
<block NAME="init">
<while COND="(!launch)"/>
<heading THROTTLE="0.8" PITCH="0.15" COURSE="QFU" UNTIL="(estimator_flight_time > 8)" VMODE="throttle"/>
<heading THROTTLE="0.8" PITCH="0.15" COURSE="QFU" UNTIL="(autopilot_flight_time > 8)" VMODE="throttle"/>
<heading PITCH="0.15" CLIMB="3.0" COURSE="QFU" UNTIL="(GetPosAlt() > SECURITY_ALT)" VMODE="climb"/>
<deroute BLOCK="circlehome"/>
</block>
Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/snav.xml
Expand Up @@ -36,7 +36,7 @@
<block name="Takeoff" strip_button="Takeoff (wp CLIMB)" strip_icon="takeoff.png">
<exception cond="GetPosAlt() > ground_alt+25" deroute="Standby"/>
<set value="0" var="kill_throttle"/>
<set value="0" var="estimator_flight_time"/>
<set value="0" var="autopilot_flight_time"/>
<go from="HOME" throttle="1.0" vmode="throttle" wp="CLIMB"/>
</block>
<block name="Standby" strip_button="Standby" strip_icon="home.png">
Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/tcas.xml
Expand Up @@ -36,7 +36,7 @@
<block name="Takeoff" strip_button="Takeoff (wp CLIMB)" strip_icon="takeoff.png">
<exception cond="GetPosAlt() > ground_alt+25" deroute="Standby"/>
<set value="0" var="kill_throttle"/>
<set value="0" var="estimator_flight_time"/>
<set value="0" var="autopilot_flight_time"/>
<go from="HOME" throttle="1.0" vmode="throttle" wp="CLIMB"/>
</block>
<block name="Standby" strip_button="Standby" strip_icon="home.png">
Expand Down
2 changes: 1 addition & 1 deletion conf/flight_plans/xsens_cachejunction.xml
Expand Up @@ -26,7 +26,7 @@
<block name="Takeoff" strip_button="Takeoff (wp CLIMB)" strip_icon="takeoff.png">
<exception cond="GetPosAlt() > ground_alt+25" deroute="Standby"/>
<set value="0" var="kill_throttle"/>
<set value="0" var="estimator_flight_time"/>
<set value="0" var="autopilot_flight_time"/>
<go from="HOME" pitch="15" throttle="1.0" vmode="throttle" wp="CLIMB"/>
</block>
<block name="Standby" strip_button="Standby" strip_icon="home.png">
Expand Down
2 changes: 1 addition & 1 deletion conf/settings/fixedwing_basic.xml
Expand Up @@ -8,7 +8,7 @@
<dl_setting MAX="1000" MIN="0" STEP="10" VAR="flight_altitude" shortname="altitude"/>
<dl_setting MAX="360" MIN="0" STEP="1" VAR="nav_course"/>
<dl_setting MAX="10" MIN="-10" STEP="5" VAR="nav_shift" module="subsystems/nav" handler="IncreaseShift" shortname="inc. shift"/>
<dl_setting MAX="0" MIN="0" STEP="1" VAR="estimator_flight_time" shortname="flight time" module="autopilot" handler="ResetFlightTimeAndLaunch"/>
<dl_setting MAX="0" MIN="0" STEP="1" VAR="autopilot_flight_time" shortname="flight time" module="autopilot" handler="ResetFlightTimeAndLaunch"/>
<dl_setting MAX="200" MIN="-200" STEP="10" VAR="nav_radius" module="subsystems/nav" handler="SetNavRadius">
<strip_button icon="circle-right.png" name="Circle right" value="1" group="circle"/>
<strip_button icon="circle-left.png" name="Circle left" value="-1" group="circle"/>
Expand Down
10 changes: 0 additions & 10 deletions sw/airborne/estimator.c
Expand Up @@ -30,20 +30,10 @@
#include <math.h>

#include "estimator.h"
#include "state.h"
#include "mcu_periph/uart.h"
#include "ap_downlink.h"
#include "subsystems/gps.h"
#include "subsystems/nav.h"

/* flight time in seconds */
uint16_t estimator_flight_time;

float estimator_AOA;

void estimator_init( void ) {

estimator_flight_time = 0;

}

3 changes: 0 additions & 3 deletions sw/airborne/estimator.h
Expand Up @@ -36,9 +36,6 @@

#include "state.h"

/** flight time in seconds. */
extern uint16_t estimator_flight_time;

extern float estimator_AOA; ///< angle of attack in rad

void estimator_init( void );
Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/firmwares/fixedwing/ap_downlink.h
Expand Up @@ -63,7 +63,7 @@
&v_ctl_throttle_slewed, \
&vsupply, \
&amps, \
&estimator_flight_time, \
&autopilot_flight_time, \
&kill_throttle, \
&block_time, \
&stage_time, \
Expand Down
5 changes: 4 additions & 1 deletion sw/airborne/firmwares/fixedwing/autopilot.h
Expand Up @@ -55,6 +55,9 @@
extern uint8_t pprz_mode;
extern bool_t kill_throttle;

/** flight time in seconds. */
extern uint16_t autopilot_flight_time;


// FIXME, move to control
#define LATERAL_MODE_MANUAL 0
Expand Down Expand Up @@ -95,7 +98,7 @@ extern bool_t power_switch;
#endif // POWER_SWITCH_LED

#define autopilot_ResetFlightTimeAndLaunch(_) { \
estimator_flight_time = 0; launch = FALSE; \
autopilot_flight_time = 0; launch = FALSE; \
}

/* CONTROL_RATE will be removed in the next release
Expand Down
15 changes: 9 additions & 6 deletions sw/airborne/firmwares/fixedwing/main_ap.c
Expand Up @@ -122,6 +122,9 @@ bool_t kill_throttle = FALSE;

bool_t launch = FALSE;

/* flight time in seconds */
uint16_t autopilot_flight_time = 0;


/** Supply voltage in deciVolt.
* This the ap copy of the measurement from fbw
Expand Down Expand Up @@ -382,7 +385,7 @@ static inline void telecommand_task( void ) {
current = fbw_state->current;

#ifdef RADIO_CONTROL
if (!estimator_flight_time) {
if (!autopilot_flight_time) {
if (pprz_mode == PPRZ_MODE_AUTO2 && fbw_state->channels[RADIO_THROTTLE] > THROTTLE_THRESHOLD_TAKEOFF) {
launch = TRUE;
}
Expand Down Expand Up @@ -517,7 +520,7 @@ void attitude_loop( void ) {

h_ctl_pitch_setpoint = nav_pitch;
Bound(h_ctl_pitch_setpoint, H_CTL_PITCH_MIN_SETPOINT, H_CTL_PITCH_MAX_SETPOINT);
if (kill_throttle || (!estimator_flight_time && !launch))
if (kill_throttle || (!autopilot_flight_time && !launch))
v_ctl_throttle_setpoint = 0;
}

Expand Down Expand Up @@ -577,8 +580,8 @@ void sensors_task( void ) {

/** monitor stuff run at 1Hz */
void monitor_task( void ) {
if (estimator_flight_time)
estimator_flight_time++;
if (autopilot_flight_time)
autopilot_flight_time++;
#if defined DATALINK || defined SITL
datalink_time++;
#endif
Expand All @@ -591,9 +594,9 @@ void monitor_task( void ) {
kill_throttle |= (t >= LOW_BATTERY_DELAY);
kill_throttle |= launch && (dist2_to_home > Square(KILL_MODE_DISTANCE));

if (!estimator_flight_time &&
if (!autopilot_flight_time &&
*stateGetHorizontalSpeedNorm_f() > MIN_SPEED_FOR_TAKEOFF) {
estimator_flight_time = 1;
autopilot_flight_time = 1;
launch = TRUE; /* Not set in non auto launch */
uint16_t time_sec = sys_time.nb_sec;
DOWNLINK_SEND_TAKEOFF(DefaultChannel, DefaultDevice, &time_sec);
Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/modules/com/generic_com.c
Expand Up @@ -83,7 +83,7 @@ void generic_com_periodic( void ) {
com_trans.buf[19] = (uint8_t)(ap_state->commands[COMMAND_THROTTLE]*100/MAX_PPRZ);
com_trans.buf[20] = pprz_mode;
com_trans.buf[21] = nav_block;
FillBufWith16bit(com_trans.buf, 22, estimator_flight_time);
FillBufWith16bit(com_trans.buf, 22, autopilot_flight_time);
I2CTransmit(GENERIC_COM_I2C_DEV, com_trans, GENERIC_COM_SLAVE_ADDR, NB_DATA);

}
Expand Down
6 changes: 3 additions & 3 deletions sw/airborne/modules/gsm/gsm.c
Expand Up @@ -41,7 +41,7 @@
In: OK
Out: AT+CMGS=\"GCS_NUMBER\"
In: >
Out: gps.utm_pos.east, gps.utm_pos.north, gps.course, gps.hmsl, gps.gspeed, -gps.ned_vel.z, vsupply, estimator_flight_time, rssi CTRLZ
Out: gps.utm_pos.east, gps.utm_pos.north, gps.course, gps.hmsl, gps.gspeed, -gps.ned_vel.z, vsupply, autopilot_flight_time, rssi CTRLZ
Receiving:
In: +CMTI: ...,<number>
Expand Down Expand Up @@ -409,9 +409,9 @@ void gsm_send_report_continue(void)
uint8_t rssi = atoi(gsm_buf + strlen("+CSQ: "));

// Donnee GPS :ne sont pas envoyes gps_mode, gps.tow, gps.utm_pos.zone, gps_nb_ovrn
// Donnees batterie (seuls vsupply et estimator_flight_time sont envoyes)
// Donnees batterie (seuls vsupply et autopilot_flight_time sont envoyes)
// concatenation de toutes les infos en un seul message à transmettre
sprintf(data_to_send, "%ld %ld %d %ld %d %d %d %d %d", gps.utm_pos.east, gps.utm_pos.north, gps_course, gps.hmsl, gps.gspeed, -gps.ned_vel.z, vsupply, estimator_flight_time, rssi);
sprintf(data_to_send, "%ld %ld %d %ld %d %d %d %d %d", gps.utm_pos.east, gps.utm_pos.north, gps_course, gps.hmsl, gps.gspeed, -gps.ned_vel.z, vsupply, autopilot_flight_time, rssi);

// send the number and wait for the prompt
char buf[32];
Expand Down
2 changes: 1 addition & 1 deletion sw/ground_segment/cockpit/live.ml
Expand Up @@ -697,7 +697,7 @@ let create_ac = fun alert (geomap:G.widget) (acs_notebook:GPack.notebook) (ac_id
connect "kill_throttle" ac.strip#connect_kill;
connect "nav_shift" ac.strip#connect_shift_lateral;
connect "pprz_mode" ac.strip#connect_mode;
connect "estimator_flight_time" ac.strip#connect_flight_time;
connect "autopilot_flight_time" ac.strip#connect_flight_time;
let get_ac_unix_time = fun () -> ac.last_unix_time in
connect ~warning:false "snav_desired_tow" (ac.strip#connect_apt get_ac_unix_time);
begin (* Periodically update the appointment *)
Expand Down
6 changes: 3 additions & 3 deletions sw/ground_segment/tmtc/GSM/SMS_Ground_UDtest_final.c
Expand Up @@ -99,7 +99,7 @@ pile *MaPile = NULL;
typedef enum {INIT, AT, CMGF, SMSMODE, CNMI, CPMS, ERREUR} Etat_Liste;

// Informations extraites du SMS recu de l'avion
char extr_gps_utm_east[15], extr_gps_utm_north[15], extr_gps_course[15], extr_gps_alt[15], extr_gps_gspeed[15], extr_gps_climb[15], extr_vsupply[15], extr_estimator_flight_time[15], extr_qualite_signal_GSM[10];
char extr_gps_utm_east[15], extr_gps_utm_north[15], extr_gps_course[15], extr_gps_alt[15], extr_gps_gspeed[15], extr_gps_climb[15], extr_vsupply[15], extr_autopilot_flight_time[15], extr_qualite_signal_GSM[10];

char reponse_attendue[20];
int prompt_recu = 0;
Expand Down Expand Up @@ -472,10 +472,10 @@ void decoupage( char message_complet[])
Extraction(data_to_cut, ' ', 1, 1, ' ', 1, 0, extr_gps_gspeed);
Extraction(data_to_cut, ' ', 1, 1, ' ', 1, 0, extr_gps_climb);
Extraction(data_to_cut, ' ', 1, 1, ' ', 1, 0, extr_vsupply);
Extraction(data_to_cut, ' ', 1, 1, ' ', 1, 0, extr_estimator_flight_time);
Extraction(data_to_cut, ' ', 1, 1, ' ', 1, 0, extr_autopilot_flight_time);
Extraction(data_to_cut, ' ', 1, 1, '\r', 1, 0, extr_qualite_signal_GSM);

printf("Message :\n utm_east %s\n utm_north %s\n course %s\n alt %s\n speed %s\n climb %s\n bat %s\n flight_time %s\n signal %s\n", extr_gps_utm_east, extr_gps_utm_north, extr_gps_course, extr_gps_alt, extr_gps_gspeed, extr_gps_climb, extr_vsupply, extr_estimator_flight_time, extr_qualite_signal_GSM);
printf("Message :\n utm_east %s\n utm_north %s\n course %s\n alt %s\n speed %s\n climb %s\n bat %s\n flight_time %s\n signal %s\n", extr_gps_utm_east, extr_gps_utm_north, extr_gps_course, extr_gps_alt, extr_gps_gspeed, extr_gps_climb, extr_vsupply, extr_autopilot_flight_time, extr_qualite_signal_GSM);
fflush(stdout);
}

Expand Down

0 comments on commit bbdaa96

Please sign in to comment.