PX4 Firmware
PX4 Autopilot Software http://px4.io
Heater Class Reference

#include <heater.h>

Inheritance diagram for Heater:
Collaboration diagram for Heater:

Public Member Functions

 Heater ()
 
virtual ~Heater ()
 
int controller_period (char *argv[])
 Sets and/or reports the heater controller time period value in microseconds. More...
 
float integrator (char *argv[])
 Sets and/or reports the heater controller integrator gain value. More...
 
float proportional (char *argv[])
 Sets and/or reports the heater controller proportional gain value. More...
 
uint32_t sensor_id ()
 Reports the heater target sensor. More...
 
int start ()
 Initiates the heater driver work queue, starts a new background task, and fails if it is already running. More...
 
int print_status ()
 Reports curent status and diagnostic information about the heater driver. More...
 
float temperature_setpoint (char *argv[])
 Sets and/or reports the heater target temperature. More...
 

Static Public Member Functions

static int custom_command (int argc, char *argv[])
 main Main entry point to the module that should be called directly from the module's main method. More...
 
static int print_usage (const char *reason=nullptr)
 Prints the module usage to the nuttshell console. More...
 
static int task_spawn (int argc, char *argv[])
 Initializes the class in the same context as the work queue and starts the background listener. More...
 

Protected Member Functions

void initialize_topics ()
 Called once to initialize uORB topics. More...
 

Private Member Functions

void Run () override
 Calculates the heater element on/off time, carries out closed loop feedback and feedforward temperature control, and schedules the next cycle. More...
 
void update_params (const bool force=false)
 Updates and checks for updated uORB parameters. More...
 

Private Attributes

int _controller_period_usec = CONTROLLER_PERIOD_DEFAULT
 
int _controller_time_on_usec = 0
 
bool _heater_on = false
 
float _integrator_value = 0.0f
 
uORB::Subscription _parameter_update_sub {ORB_ID(parameter_update)}
 
float _proportional_value = 0.0f
 
uORB::Subscription _sensor_accel_sub {ORB_ID(sensor_accel)}
 
sensor_accel_s _sensor_accel {}
 
float _sensor_temperature = 0.0f
 

Static Private Attributes

static struct work_s _work
 Work queue struct for the RTOS scheduler. More...
 

Detailed Description

Definition at line 64 of file heater.h.

Constructor & Destructor Documentation

◆ Heater()

Heater::Heater ( )

Definition at line 53 of file heater.cpp.

Referenced by task_spawn().

Here is the caller graph for this function:

◆ ~Heater()

Heater::~Heater ( )
virtual

Definition at line 61 of file heater.cpp.

Member Function Documentation

◆ controller_period()

int Heater::controller_period ( char *  argv[])

Sets and/or reports the heater controller time period value in microseconds.

Parameters
argvPointer to the input argument array.
Returns
Returns 0 iff successful, -1 otherwise.

◆ custom_command()

int Heater::custom_command ( int  argc,
char *  argv[] 
)
static

main Main entry point to the module that should be called directly from the module's main method.

See also
ModuleBase::custom_command().
Parameters
argcThe input argument count.
argvPointer to the input argument array.
Returns
Returns 0 iff successful, -1 otherwise.

Definition at line 67 of file heater.cpp.

References is_running(), and print_usage().

Here is the call graph for this function:

◆ initialize_topics()

void Heater::initialize_topics ( )
protected

Called once to initialize uORB topics.

Definition at line 130 of file heater.cpp.

References _sensor_accel, _sensor_accel_sub, uORB::Subscription::advertised(), uORB::Subscription::copy(), sensor_accel_s::device_id, orb_group_count(), and ORB_ID.

Referenced by start().

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

◆ integrator()

float Heater::integrator ( char *  argv[])

Sets and/or reports the heater controller integrator gain value.

Parameters
argvPointer to the input argument array.
Returns
Returns the heater integrator gain value iff successful, 0.0f otherwise.

◆ print_status()

int Heater::print_status ( )

Reports curent status and diagnostic information about the heater driver.

Returns
Returns 0 iff successful, -1 otherwise.

Definition at line 158 of file heater.cpp.

References _heater_on, _sensor_accel, _sensor_temperature, and sensor_accel_s::device_id.

◆ print_usage()

int Heater::print_usage ( const char *  reason = nullptr)
static

Prints the module usage to the nuttshell console.

See also
ModuleBase::print_usage().
Parameters
reasonThe requested reason for printing to console.

Definition at line 209 of file heater.cpp.

Referenced by custom_command().

Here is the caller graph for this function:

◆ proportional()

float Heater::proportional ( char *  argv[])

Sets and/or reports the heater controller proportional gain value.

Parameters
argvPointer to the input argument array.
Returns
Returns the heater proportional gain value iff successful, 0.0f otherwise.

◆ Run()

void Heater::Run ( )
overrideprivate

Calculates the heater element on/off time, carries out closed loop feedback and feedforward temperature control, and schedules the next cycle.

Definition at line 78 of file heater.cpp.

References _controller_period_usec, _controller_time_on_usec, _heater_on, _integrator_value, _proportional_value, _sensor_accel, _sensor_accel_sub, _sensor_temperature, math::constrain(), f(), sensor_accel_s::temperature, uORB::Subscription::update(), and update_params().

Here is the call graph for this function:

◆ sensor_id()

uint32_t Heater::sensor_id ( )

Reports the heater target sensor.

Returns
Returns the id of the target sensor

◆ start()

int Heater::start ( )

Initiates the heater driver work queue, starts a new background task, and fails if it is already running.

Returns
Returns 1 iff start was successful.

Definition at line 169 of file heater.cpp.

References initialize_topics(), and update_params().

Referenced by task_spawn().

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

◆ task_spawn()

int Heater::task_spawn ( int  argc,
char *  argv[] 
)
static

Initializes the class in the same context as the work queue and starts the background listener.

See also
ModuleBase::task_spawn().
Parameters
argvPointer to the input argument array.
Returns
Returns 0 iff successful, -1 otherwise.

Definition at line 179 of file heater.cpp.

References Heater(), and start().

Here is the call graph for this function:

◆ temperature_setpoint()

float Heater::temperature_setpoint ( char *  argv[])

Sets and/or reports the heater target temperature.

Parameters
argvPointer to the input argument array.
Returns
Returns the heater target temperature value iff successful, -1.0f otherwise.

◆ update_params()

void Heater::update_params ( const bool  force = false)
private

Updates and checks for updated uORB parameters.

Parameters
forceBoolean to determine if an update check should be forced.

Definition at line 196 of file heater.cpp.

References _parameter_update_sub, uORB::Subscription::copy(), and uORB::Subscription::updated().

Referenced by Run(), and start().

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

Member Data Documentation

◆ _controller_period_usec

int Heater::_controller_period_usec = CONTROLLER_PERIOD_DEFAULT
private

Definition at line 169 of file heater.h.

Referenced by Run().

◆ _controller_time_on_usec

int Heater::_controller_time_on_usec = 0
private

Definition at line 171 of file heater.h.

Referenced by Run().

◆ _heater_on

bool Heater::_heater_on = false
private

Definition at line 173 of file heater.h.

Referenced by print_status(), and Run().

◆ _integrator_value

float Heater::_integrator_value = 0.0f
private

Definition at line 175 of file heater.h.

Referenced by Run().

◆ _parameter_update_sub

uORB::Subscription Heater::_parameter_update_sub {ORB_ID(parameter_update)}
private

Definition at line 177 of file heater.h.

Referenced by update_params().

◆ _proportional_value

float Heater::_proportional_value = 0.0f
private

Definition at line 179 of file heater.h.

Referenced by Run().

◆ _sensor_accel

sensor_accel_s Heater::_sensor_accel {}
private

Definition at line 182 of file heater.h.

Referenced by initialize_topics(), print_status(), and Run().

◆ _sensor_accel_sub

uORB::Subscription Heater::_sensor_accel_sub {ORB_ID(sensor_accel)}
private

Definition at line 181 of file heater.h.

Referenced by initialize_topics(), and Run().

◆ _sensor_temperature

float Heater::_sensor_temperature = 0.0f
private

Definition at line 184 of file heater.h.

Referenced by print_status(), and Run().

◆ _work

struct work_s Heater::_work
staticprivate

Work queue struct for the RTOS scheduler.

Definition at line 167 of file heater.h.


The documentation for this class was generated from the following files: