mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-05 23:49:00 +08:00
Merge branch 'esden-master'
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@
|
|||||||
SRC_ARCH = arch/lpc21
|
SRC_ARCH = arch/lpc21
|
||||||
|
|
||||||
# Define programs and commands.
|
# Define programs and commands.
|
||||||
HAVE_ARM_NONE_EABI_GCC := $(wildcard /usr/bin/arm-none-eabi-gcc)
|
HAVE_ARM_NONE_EABI_GCC := $(shell which arm-none-eabi-gcc)
|
||||||
ifeq ($(strip $(HAVE_ARM_NONE_EABI_GCC)),)
|
ifeq ($(strip $(HAVE_ARM_NONE_EABI_GCC)),)
|
||||||
CC = arm-elf-gcc
|
CC = arm-elf-gcc
|
||||||
LD = $(CC)
|
LD = $(CC)
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ OPT = s
|
|||||||
#OPT = 0
|
#OPT = 0
|
||||||
|
|
||||||
# Programs location
|
# Programs location
|
||||||
TOOLCHAIN_DIR=/opt/paparazzi/stm32
|
TOOLCHAIN_DIR=$(shell find -L /opt/paparazzi/stm32 ~/sat -maxdepth 1 -type d -name arm-none-eabi 2>/dev/null | head -n 1 | xargs dirname )
|
||||||
GCC_BIN_DIR=$(TOOLCHAIN_DIR)/bin
|
GCC_BIN_DIR=$(TOOLCHAIN_DIR)/bin
|
||||||
GCC_LIB_DIR=$(TOOLCHAIN_DIR)/arm-none-eabi/lib
|
GCC_LIB_DIR=$(TOOLCHAIN_DIR)/arm-none-eabi/lib
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/local/bin/ocamlrun /usr/local/bin/ocaml
|
#!/opt/local/bin/ocamlrun /opt/local/bin/ocaml
|
||||||
#load "unix.cma";;
|
#load "unix.cma";;
|
||||||
let (//) = Filename.concat
|
let (//) = Filename.concat
|
||||||
let dirname = Filename.dirname Sys.argv.(0)
|
let dirname = Filename.dirname Sys.argv.(0)
|
||||||
|
|||||||
@@ -33,16 +33,16 @@
|
|||||||
// I2C Automaton //
|
// I2C Automaton //
|
||||||
///////////////////
|
///////////////////
|
||||||
|
|
||||||
static inline void I2cSendStart(struct i2c_periph* p) {
|
__attribute__ ((always_inline)) static inline void I2cSendStart(struct i2c_periph* p) {
|
||||||
p->status = I2CStartRequested;
|
p->status = I2CStartRequested;
|
||||||
((i2cRegs_t *)(p->reg_addr))->conset = _BV(STA);
|
((i2cRegs_t *)(p->reg_addr))->conset = _BV(STA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void I2cSendAck(void* reg) {
|
__attribute__ ((always_inline)) static inline void I2cSendAck(void* reg) {
|
||||||
((i2cRegs_t *)reg)->conset = _BV(AA);
|
((i2cRegs_t *)reg)->conset = _BV(AA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void I2cEndOfTransaction(struct i2c_periph* p) {
|
__attribute__ ((always_inline)) static inline void I2cEndOfTransaction(struct i2c_periph* p) {
|
||||||
// handle fifo here
|
// handle fifo here
|
||||||
p->trans_extract_idx++;
|
p->trans_extract_idx++;
|
||||||
if (p->trans_extract_idx >= I2C_TRANSACTION_QUEUE_LEN)
|
if (p->trans_extract_idx >= I2C_TRANSACTION_QUEUE_LEN)
|
||||||
@@ -56,18 +56,18 @@ static inline void I2cEndOfTransaction(struct i2c_periph* p) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void I2cFinished(struct i2c_periph* p, struct i2c_transaction* t) {
|
__attribute__ ((always_inline)) static inline void I2cFinished(struct i2c_periph* p, struct i2c_transaction* t) {
|
||||||
// transaction finished with success
|
// transaction finished with success
|
||||||
t->status = I2CTransSuccess;
|
t->status = I2CTransSuccess;
|
||||||
I2cEndOfTransaction(p);
|
I2cEndOfTransaction(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void I2cSendStop(struct i2c_periph* p, struct i2c_transaction* t) {
|
__attribute__ ((always_inline)) static inline void I2cSendStop(struct i2c_periph* p, struct i2c_transaction* t) {
|
||||||
((i2cRegs_t *)(p->reg_addr))->conset = _BV(STO);
|
((i2cRegs_t *)(p->reg_addr))->conset = _BV(STO);
|
||||||
I2cFinished(p,t);
|
I2cFinished(p,t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void I2cFail(struct i2c_periph* p, struct i2c_transaction* t) {
|
__attribute__ ((always_inline)) static inline void I2cFail(struct i2c_periph* p, struct i2c_transaction* t) {
|
||||||
((i2cRegs_t *)(p->reg_addr))->conset = _BV(STO);
|
((i2cRegs_t *)(p->reg_addr))->conset = _BV(STO);
|
||||||
t->status = I2CTransFailed;
|
t->status = I2CTransFailed;
|
||||||
p->status = I2CFailed;
|
p->status = I2CFailed;
|
||||||
@@ -75,24 +75,24 @@ static inline void I2cFail(struct i2c_periph* p, struct i2c_transaction* t) {
|
|||||||
I2cEndOfTransaction(p);
|
I2cEndOfTransaction(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void I2cSendByte(void* reg, uint8_t b) {
|
__attribute__ ((always_inline)) static inline void I2cSendByte(void* reg, uint8_t b) {
|
||||||
((i2cRegs_t *)reg)->dat = b;
|
((i2cRegs_t *)reg)->dat = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void I2cReceive(void* reg, bool_t ack) {
|
__attribute__ ((always_inline)) static inline void I2cReceive(void* reg, bool_t ack) {
|
||||||
if (ack) ((i2cRegs_t *)reg)->conset = _BV(AA);
|
if (ack) ((i2cRegs_t *)reg)->conset = _BV(AA);
|
||||||
else ((i2cRegs_t *)reg)->conclr = _BV(AAC);
|
else ((i2cRegs_t *)reg)->conclr = _BV(AAC);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void I2cClearStart(void* reg) {
|
__attribute__ ((always_inline)) static inline void I2cClearStart(void* reg) {
|
||||||
((i2cRegs_t *)reg)->conclr = _BV(STAC);
|
((i2cRegs_t *)reg)->conclr = _BV(STAC);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void I2cClearIT(void* reg) {
|
__attribute__ ((always_inline)) static inline void I2cClearIT(void* reg) {
|
||||||
((i2cRegs_t *)reg)->conclr = _BV(SIC);
|
((i2cRegs_t *)reg)->conclr = _BV(SIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void I2cAutomaton(int32_t state, struct i2c_periph* p) {
|
__attribute__ ((always_inline)) static inline void I2cAutomaton(int32_t state, struct i2c_periph* p) {
|
||||||
struct i2c_transaction* trans = p->trans[p->trans_extract_idx];
|
struct i2c_transaction* trans = p->trans[p->trans_extract_idx];
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case I2C_START:
|
case I2C_START:
|
||||||
|
|||||||
@@ -59,13 +59,13 @@ void supervision_init(void) {
|
|||||||
supervision.nb_failure = 0;
|
supervision.nb_failure = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void offset_commands(int32_t offset) {
|
__attribute__ ((always_inline)) static inline void offset_commands(int32_t offset) {
|
||||||
uint8_t j;
|
uint8_t j;
|
||||||
for (j=0; j<SUPERVISION_NB_MOTOR; j++)
|
for (j=0; j<SUPERVISION_NB_MOTOR; j++)
|
||||||
supervision.commands[j] += (offset);
|
supervision.commands[j] += (offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void bound_commands(void) {
|
__attribute__ ((always_inline)) static inline void bound_commands(void) {
|
||||||
uint8_t j;
|
uint8_t j;
|
||||||
for (j=0; j<SUPERVISION_NB_MOTOR; j++)
|
for (j=0; j<SUPERVISION_NB_MOTOR; j++)
|
||||||
Bound(supervision.commands[j],
|
Bound(supervision.commands[j],
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ void guidance_h_run(bool_t in_flight) {
|
|||||||
//#define MAX_BANK (65536)
|
//#define MAX_BANK (65536)
|
||||||
#define MAX_BANK (98000)
|
#define MAX_BANK (98000)
|
||||||
|
|
||||||
static inline void guidance_h_hover_run(void) {
|
__attribute__ ((always_inline)) static inline void guidance_h_hover_run(void) {
|
||||||
|
|
||||||
/* compute position error */
|
/* compute position error */
|
||||||
VECT2_DIFF(guidance_h_pos_err, ins_ltp_pos, guidance_h_pos_sp);
|
VECT2_DIFF(guidance_h_pos_err, ins_ltp_pos, guidance_h_pos_sp);
|
||||||
@@ -279,7 +279,7 @@ static inline void guidance_h_hover_run(void) {
|
|||||||
#define NAV_MAX_BANK BFP_OF_REAL(0.35,REF_ANGLE_FRAC)
|
#define NAV_MAX_BANK BFP_OF_REAL(0.35,REF_ANGLE_FRAC)
|
||||||
#define HOLD_DISTANCE POS_BFP_OF_REAL(10.)
|
#define HOLD_DISTANCE POS_BFP_OF_REAL(10.)
|
||||||
|
|
||||||
static inline void guidance_h_nav_run(bool_t in_flight) {
|
__attribute__ ((always_inline)) static inline void guidance_h_nav_run(bool_t in_flight) {
|
||||||
|
|
||||||
/* convert our reference to generic representation */
|
/* convert our reference to generic representation */
|
||||||
#ifdef GUIDANCE_H_USE_REF
|
#ifdef GUIDANCE_H_USE_REF
|
||||||
@@ -368,7 +368,7 @@ static inline void guidance_h_nav_run(bool_t in_flight) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void guidance_h_hover_enter(void) {
|
__attribute__ ((always_inline)) static inline void guidance_h_hover_enter(void) {
|
||||||
|
|
||||||
VECT2_COPY(guidance_h_pos_sp, ins_ltp_pos);
|
VECT2_COPY(guidance_h_pos_sp, ins_ltp_pos);
|
||||||
|
|
||||||
@@ -378,7 +378,7 @@ static inline void guidance_h_hover_enter(void) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void guidance_h_nav_enter(void) {
|
__attribute__ ((always_inline)) static inline void guidance_h_nav_enter(void) {
|
||||||
|
|
||||||
INT32_VECT2_NED_OF_ENU(guidance_h_pos_sp, navigation_carrot);
|
INT32_VECT2_NED_OF_ENU(guidance_h_pos_sp, navigation_carrot);
|
||||||
struct Int32Vect2 pos,speed,zero;
|
struct Int32Vect2 pos,speed,zero;
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ int32_t guidance_v_z_sum_err;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void run_hover_loop(bool_t in_flight);
|
__attribute__ ((always_inline)) static inline void run_hover_loop(bool_t in_flight);
|
||||||
|
|
||||||
|
|
||||||
void guidance_v_init(void) {
|
void guidance_v_init(void) {
|
||||||
@@ -232,7 +232,7 @@ void guidance_v_run(bool_t in_flight) {
|
|||||||
|
|
||||||
#define MAX_BANK_COEF (BFP_OF_REAL(RadOfDeg(30.),INT32_TRIG_FRAC))
|
#define MAX_BANK_COEF (BFP_OF_REAL(RadOfDeg(30.),INT32_TRIG_FRAC))
|
||||||
|
|
||||||
static inline void run_hover_loop(bool_t in_flight) {
|
__attribute__ ((always_inline)) static inline void run_hover_loop(bool_t in_flight) {
|
||||||
|
|
||||||
/* convert our reference to generic representation */
|
/* convert our reference to generic representation */
|
||||||
int64_t tmp = gv_z_ref>>(GV_Z_REF_FRAC - INT32_POS_FRAC);
|
int64_t tmp = gv_z_ref>>(GV_Z_REF_FRAC - INT32_POS_FRAC);
|
||||||
|
|||||||
@@ -96,14 +96,14 @@ int64_t gv_z_ref;
|
|||||||
int32_t gv_zd_ref;
|
int32_t gv_zd_ref;
|
||||||
int32_t gv_zdd_ref;
|
int32_t gv_zdd_ref;
|
||||||
|
|
||||||
static inline void gv_set_ref(int32_t alt, int32_t speed, int32_t accel) {
|
__attribute__ ((always_inline)) static inline void gv_set_ref(int32_t alt, int32_t speed, int32_t accel) {
|
||||||
int64_t new_z = ((int64_t)alt)<<(GV_Z_REF_FRAC - INT32_POS_FRAC);
|
int64_t new_z = ((int64_t)alt)<<(GV_Z_REF_FRAC - INT32_POS_FRAC);
|
||||||
gv_z_ref = new_z;
|
gv_z_ref = new_z;
|
||||||
gv_zd_ref = speed>>(INT32_SPEED_FRAC - GV_ZD_REF_FRAC);
|
gv_zd_ref = speed>>(INT32_SPEED_FRAC - GV_ZD_REF_FRAC);
|
||||||
gv_zdd_ref = accel>>(INT32_ACCEL_FRAC - GV_ZDD_REF_FRAC);
|
gv_zdd_ref = accel>>(INT32_ACCEL_FRAC - GV_ZDD_REF_FRAC);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void gv_update_ref_from_z_sp(int32_t z_sp) {
|
__attribute__ ((always_inline)) static inline void gv_update_ref_from_z_sp(int32_t z_sp) {
|
||||||
|
|
||||||
gv_z_ref += gv_zd_ref;
|
gv_z_ref += gv_zd_ref;
|
||||||
gv_zd_ref += gv_zdd_ref;
|
gv_zd_ref += gv_zdd_ref;
|
||||||
@@ -135,7 +135,7 @@ static inline void gv_update_ref_from_z_sp(int32_t z_sp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void gv_update_ref_from_zd_sp(int32_t zd_sp) {
|
__attribute__ ((always_inline)) static inline void gv_update_ref_from_zd_sp(int32_t zd_sp) {
|
||||||
|
|
||||||
gv_z_ref += gv_zd_ref;
|
gv_z_ref += gv_zd_ref;
|
||||||
gv_zd_ref += gv_zdd_ref;
|
gv_zd_ref += gv_zdd_ref;
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ void ahrs_update_mag(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* measures phi and theta assuming no dynamic acceleration ?!! */
|
/* measures phi and theta assuming no dynamic acceleration ?!! */
|
||||||
static inline void get_phi_theta_measurement_fom_accel(int32_t* phi_meas, int32_t* theta_meas, struct Int32Vect3 accel) {
|
__attribute__ ((always_inline)) static inline void get_phi_theta_measurement_fom_accel(int32_t* phi_meas, int32_t* theta_meas, struct Int32Vect3 accel) {
|
||||||
|
|
||||||
INT32_ATAN2(*phi_meas, -accel.y, -accel.z);
|
INT32_ATAN2(*phi_meas, -accel.y, -accel.z);
|
||||||
int32_t cphi;
|
int32_t cphi;
|
||||||
@@ -167,7 +167,7 @@ static inline void get_phi_theta_measurement_fom_accel(int32_t* phi_meas, int32_
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* measure psi by projecting magnetic vector in local tangeant plan */
|
/* measure psi by projecting magnetic vector in local tangeant plan */
|
||||||
static inline void get_psi_measurement_from_mag(int32_t* psi_meas, int32_t phi_est, int32_t theta_est, struct Int32Vect3 mag) {
|
__attribute__ ((always_inline)) static inline void get_psi_measurement_from_mag(int32_t* psi_meas, int32_t phi_est, int32_t theta_est, struct Int32Vect3 mag) {
|
||||||
|
|
||||||
int32_t sphi;
|
int32_t sphi;
|
||||||
PPRZ_ITRIG_SIN(sphi, phi_est);
|
PPRZ_ITRIG_SIN(sphi, phi_est);
|
||||||
@@ -196,7 +196,7 @@ static inline void get_psi_measurement_from_mag(int32_t* psi_meas, int32_t phi_e
|
|||||||
|
|
||||||
/* Compute ltp to imu rotation in quaternion and rotation matrice representation
|
/* Compute ltp to imu rotation in quaternion and rotation matrice representation
|
||||||
from the euler angle representation */
|
from the euler angle representation */
|
||||||
static inline void compute_imu_quat_and_rmat_from_euler(void) {
|
__attribute__ ((always_inline)) static inline void compute_imu_quat_and_rmat_from_euler(void) {
|
||||||
|
|
||||||
/* Compute LTP to IMU quaternion */
|
/* Compute LTP to IMU quaternion */
|
||||||
INT32_QUAT_OF_EULERS(ahrs.ltp_to_imu_quat, ahrs.ltp_to_imu_euler);
|
INT32_QUAT_OF_EULERS(ahrs.ltp_to_imu_quat, ahrs.ltp_to_imu_euler);
|
||||||
@@ -205,7 +205,7 @@ static inline void compute_imu_quat_and_rmat_from_euler(void) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void compute_body_orientation(void) {
|
__attribute__ ((always_inline)) static inline void compute_body_orientation(void) {
|
||||||
|
|
||||||
/* Compute LTP to BODY quaternion */
|
/* Compute LTP to BODY quaternion */
|
||||||
INT32_QUAT_COMP_INV(ahrs.ltp_to_body_quat, ahrs.ltp_to_imu_quat, imu.body_to_imu_quat);
|
INT32_QUAT_COMP_INV(ahrs.ltp_to_body_quat, ahrs.ltp_to_imu_quat, imu.body_to_imu_quat);
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ void vff_propagate(float accel) {
|
|||||||
// update covariance
|
// update covariance
|
||||||
Pp = Pm - K*H*Pm;
|
Pp = Pm - K*H*Pm;
|
||||||
*/
|
*/
|
||||||
static inline void update_z_conf(float z_meas, float conf) {
|
__attribute__ ((always_inline)) static inline void update_z_conf(float z_meas, float conf) {
|
||||||
vff_z_meas = z_meas;
|
vff_z_meas = z_meas;
|
||||||
|
|
||||||
const float y = z_meas - vff_z;
|
const float y = z_meas - vff_z;
|
||||||
@@ -179,7 +179,7 @@ void vff_update_z_conf(float z_meas, float conf) {
|
|||||||
// update covariance
|
// update covariance
|
||||||
Pp = Pm - K*H*Pm;
|
Pp = Pm - K*H*Pm;
|
||||||
*/
|
*/
|
||||||
static inline void update_vz_conf(float vz, float conf) {
|
__attribute__ ((always_inline)) static inline void update_vz_conf(float vz, float conf) {
|
||||||
const float yd = vz - vff_zdot;
|
const float yd = vz - vff_zdot;
|
||||||
const float S = vff_P[1][1] + conf;
|
const float S = vff_P[1][1] + conf;
|
||||||
const float K1 = vff_P[0][1] * 1/S;
|
const float K1 = vff_P[0][1] * 1/S;
|
||||||
|
|||||||
Reference in New Issue
Block a user