Skip to content

Commit

Permalink
WEAK instead of ABI
Browse files Browse the repository at this point in the history
  • Loading branch information
dewagter committed Sep 29, 2023
1 parent dd0f831 commit cc096e3
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 45 deletions.
4 changes: 0 additions & 4 deletions conf/abi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,6 @@
<field name="vel_sp" type="struct FloatVect3 *" unit="m/s"/>
</message>

<message name="LIFT_D" id="37">
<field name="liftd" type="float"/>
</message>

</msg_class>

</protocol>
34 changes: 1 addition & 33 deletions sw/airborne/firmwares/rotorcraft/guidance/guidance_indi_hybrid.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,8 @@ static void vel_sp_cb(uint8_t sender_id, struct FloatVect3 *vel_sp);
struct FloatVect3 indi_vel_sp = {0.0, 0.0, 0.0};
float time_of_vel_sp = 0.0;

#ifndef GUIDANCE_INDI_LIFT_D_ID
#define GUIDANCE_INDI_LIFT_D_ID ABI_BROADCAST
#endif
abi_event lift_d_ev;
static void lift_d_cb(uint8_t sender_id, float lift_d);
float indi_lift_d_abi = 0;
float time_of_lift_d = 0.0;

void guidance_indi_propagate_filters(void);
static void guidance_indi_calcg_wing(struct FloatMat33 *Gmat);
static float guidance_indi_get_liftd(float pitch, float theta);

#if PERIODIC_TELEMETRY
#include "modules/datalink/telemetry.h"
Expand Down Expand Up @@ -217,7 +208,6 @@ void guidance_indi_init(void)
{
/*AbiBindMsgACCEL_SP(GUIDANCE_INDI_ACCEL_SP_ID, &accel_sp_ev, accel_sp_cb);*/
AbiBindMsgVEL_SP(GUIDANCE_INDI_VEL_SP_ID, &vel_sp_ev, vel_sp_cb);
AbiBindMsgLIFT_D(GUIDANCE_INDI_LIFT_D_ID, &lift_d_ev, lift_d_cb);

float tau = 1.0/(2.0*M_PI*filter_cutoff);
float sample_time = 1.0/PERIODIC_FREQUENCY;
Expand Down Expand Up @@ -715,7 +705,7 @@ void guidance_indi_calcg_wing(struct FloatMat33 *Gmat) {
*
* @return The derivative of lift w.r.t. pitch
*/
float guidance_indi_get_liftd(float airspeed, float theta) {
float WEAK guidance_indi_get_liftd(float airspeed, float theta) {
float liftd = 0.0;

if(airspeed < 12) {
Expand Down Expand Up @@ -744,20 +734,6 @@ float guidance_indi_get_liftd(float airspeed, float theta) {
return liftd;
}

/**
* @brief Get the derivative of lift w.r.t. pitch from a ABI message
*
* @return The derivative of lift w.r.t. pitch
*/
float guidance_indi_get_liftd_abi(void) {
float liftd = 0.0;
float dt = get_sys_time_float() - time_of_lift_d;
if (dt < 0.5) {
liftd = indi_lift_d_abi;
}
return liftd;
}

/**
* ABI callback that obtains the velocity setpoint from a module
*/
Expand All @@ -769,14 +745,6 @@ static void vel_sp_cb(uint8_t sender_id __attribute__((unused)), struct FloatVec
time_of_vel_sp = get_sys_time_float();
}

/**
* ABI callback that obtains the liftd from a module
*/
static void lift_d_cb(uint8_t sender_id __attribute__((unused)), float lift_d)
{
indi_lift_d_abi = lift_d;
time_of_lift_d = get_sys_time_float();
}

#if GUIDANCE_INDI_HYBRID_USE_AS_DEFAULT
// guidance indi control function is implementing the default functions of guidance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

extern void guidance_indi_init(void);
extern void guidance_indi_enter(void);
extern float guidance_indi_get_liftd(float pitch, float theta);

enum GuidanceIndiHybrid_HMode {
GUIDANCE_INDI_HYBRID_H_POS,
Expand Down
8 changes: 0 additions & 8 deletions sw/airborne/modules/core/abi_sender_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -624,12 +624,4 @@
#define VEL_SP_FCR_ID 1 // Approach Moving Target
#endif

/*
* IDs of LIFT_D senders
*/

#ifndef LIFT_D_SCHED_ID
#define LIFT_D_SCHED_ID 1
#endif

#endif /* ABI_SENDER_IDS_H */

0 comments on commit cc096e3

Please sign in to comment.