Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
imu_heater.c File Reference

IMU heater module which can actuate a resistor heater through GPIO or IOMCU. More...

+ Include dependency graph for imu_heater.c:

Go to the source code of this file.

Macros

#define IMU_HEATER_TARGET_TEMP   45
 Default target temperature. More...
 
#define IMU_HEATER_P_GAIN   200.0
 Default heater kP gain. More...
 
#define IMU_HEATER_I_GAIN   0.3
 Default heater kI gain. More...
 
#define IMU_HEATER_GYRO_ID   ABI_BROADCAST
 Default heater gyro abi ID. More...
 

Functions

static float imu_heater_run (struct imu_heater_t *heater, float temp)
 Calculate the IMU command percentage. More...
 
static void send_imu_heater (struct transport_tx *trans, struct link_device *dev)
 Send the IMU heater message. More...
 
static void imu_heater_gyro_raw_cb (uint8_t sender_id, uint32_t stamp, struct Int32Rates *data, uint8_t samples, float rate, float temp)
 
void imu_heater_init (void)
 Initialize the heater Sets the default gains and resets the initial values. More...
 
void imu_heater_periodic (void)
 High speed heater periodic This calculates the temperature average and in case of GPIO heater it will provide a heater output. More...
 
void imu_heater_periodic_10hz (void)
 10Hz IMU heater periodic This will run the control loop for the IMU heater and in case of an IOMCU will transmit the duty cycle to the IMU co-processor. More...
 

Variables

struct imu_heater_t imu_heater
 Local variables and functions. More...
 
static abi_event imu_heater_abi_ev
 

Detailed Description

IMU heater module which can actuate a resistor heater through GPIO or IOMCU.

Definition in file imu_heater.c.

Macro Definition Documentation

◆ IMU_HEATER_GYRO_ID

#define IMU_HEATER_GYRO_ID   ABI_BROADCAST

Default heater gyro abi ID.

Definition at line 54 of file imu_heater.c.

◆ IMU_HEATER_I_GAIN

#define IMU_HEATER_I_GAIN   0.3

Default heater kI gain.

Definition at line 49 of file imu_heater.c.

◆ IMU_HEATER_P_GAIN

#define IMU_HEATER_P_GAIN   200.0

Default heater kP gain.

Definition at line 44 of file imu_heater.c.

◆ IMU_HEATER_TARGET_TEMP

#define IMU_HEATER_TARGET_TEMP   45

Default target temperature.

Definition at line 39 of file imu_heater.c.

Function Documentation

◆ imu_heater_gyro_raw_cb()

static void imu_heater_gyro_raw_cb ( uint8_t  sender_id,
uint32_t  stamp,
struct Int32Rates data,
uint8_t  samples,
float  rate,
float  temp 
)
static

Definition at line 104 of file imu_heater.c.

References imu_heater, imu_heater_t::meas_temp_cnt, and imu_heater_t::meas_temp_sum.

Referenced by imu_heater_init().

+ Here is the caller graph for this function:

◆ imu_heater_init()

◆ imu_heater_periodic()

void imu_heater_periodic ( void  )

High speed heater periodic This calculates the temperature average and in case of GPIO heater it will provide a heater output.

The GPIO out is randomized to reduce the magnetometer influence.

Definition at line 163 of file imu_heater.c.

References gpio_clear(), gpio_set(), imu_heater_t::heat_cmd, imu_heater, and rand_uniform().

+ Here is the call graph for this function:

◆ imu_heater_periodic_10hz()

void imu_heater_periodic_10hz ( void  )

10Hz IMU heater periodic This will run the control loop for the IMU heater and in case of an IOMCU will transmit the duty cycle to the IMU co-processor.

Definition at line 180 of file imu_heater.c.

References imu_heater_t::heat_cmd, imu_heater, imu_heater_run(), iomcu_set_heater_duty_cycle(), imu_heater_t::meas_temp, imu_heater_t::meas_temp_cnt, and imu_heater_t::meas_temp_sum.

+ Here is the call graph for this function:

◆ imu_heater_run()

static float imu_heater_run ( struct imu_heater_t heater,
float  temp 
)
static

Calculate the IMU command percentage.

Parameters
heaterThe heater to calculate the command for
tempThe current measured temperature
Returns
float The target command [0-100%]

Definition at line 204 of file imu_heater.c.

References imu_heater_t::gain_i, imu_heater_t::gain_p, get_sys_time_usec(), imu_heater_t::integrated, imu_heater_t::last_ts, and imu_heater_t::target_temp.

Referenced by imu_heater_periodic_10hz().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send_imu_heater()

static void send_imu_heater ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

Send the IMU heater message.

Parameters
transTransport structure to send
devDevice to send the message over

Definition at line 71 of file imu_heater.c.

References dev, imu_heater_t::heat_cmd, imu_heater, imu_heater_t::meas_temp, and imu_heater_t::target_temp.

Referenced by imu_heater_init().

+ Here is the caller graph for this function:

Variable Documentation

◆ imu_heater

struct imu_heater_t imu_heater

Local variables and functions.

Definition at line 1 of file imu_heater.c.

Referenced by imu_heater_gyro_raw_cb(), imu_heater_init(), imu_heater_periodic(), imu_heater_periodic_10hz(), and send_imu_heater().

◆ imu_heater_abi_ev

abi_event imu_heater_abi_ev
static

Definition at line 59 of file imu_heater.c.

Referenced by imu_heater_init().