34 #include "rosflight.h" 195 if (target_system ==
sysid_)
206 if (target_system ==
sysid_)
217 if (target_system ==
sysid_)
230 if (target_system ==
sysid_)
244 bool reboot_flag =
false;
245 bool reboot_to_bootloader_flag =
false;
285 reboot_to_bootloader_flag =
true;
295 if (reboot_flag || reboot_to_bootloader_flag)
327 switch (control.
mode)
360 static bool error_data_sent =
false;
361 if (!error_data_sent)
367 error_data_sent =
true;
399 uint8_t control_mode = 0;
620 period_us_(period_us),
622 send_function_(send_function)
642 period_us_ = (rate_hz == 0) ? 0 : 1000000/rate_hz;
virtual void send_diff_pressure(uint8_t system_id, float velocity, float pressure, float temperature)=0
void send_parameter_list()
virtual void send_attitude_quaternion(uint8_t system_id, uint64_t timestamp_us, const turbomath::Quaternion &attitude, const turbomath::Vector &angular_velocity)=0
virtual void send_param_value_int(uint8_t system_id, uint16_t index, const char *const name, int32_t value, uint16_t param_count)=0
void command_callback(CommLink::Command command)
void send_output_raw(void)
void set_streaming_rate(uint8_t stream_id, int16_t param_id)
virtual float rc_read(uint8_t channel)=0
#define GIT_VERSION_STRING
static volatile int16_t gyro[3]
virtual void send_sonar(uint8_t system_id, uint8_t type, float range, float max_range, float min_range)=0
void register_param_request_read_callback(std::function< void(uint8_t, const char *const ,uint16_t)> callback)
void send_diff_pressure(void)
void param_request_list_callback(uint8_t target_system)
struct rosflight_firmware::GNSSData::@109 ecef
virtual void send_baro(uint8_t system_id, float altitude, float pressure, float temperature)=0
void register_param_set_int_callback(std::function< void(uint8_t, const char *const ,int32_t)> callback)
float diff_pressure_velocity
uint32_t last_sent_gnss_tow
void stream(uint64_t now_us)
virtual void send_status(uint8_t system_id, bool armed, bool failsafe, bool rc_override, bool offboard, uint8_t error_code, uint8_t control_mode, int16_t num_errors, int16_t loop_time_us)=0
virtual void send_log_message(uint8_t system_id, LogSeverity severity, const char *text)=0
void update_system_id(uint16_t param_id)
uint16_t lookup_param_id(const char name[PARAMS_NAME_LENGTH])
Gets the id of a parameter from its name.
uint32_t last_sent_gnss_raw_tow
void set_rate(uint32_t rate_hz)
virtual void init(uint32_t baud_rate, uint32_t dev)=0
const control_t & combined_control() const
virtual void send_param_value_float(uint8_t system_id, uint16_t index, const char *const name, float value, uint16_t param_count)=0
const float * get_outputs() const
bool start_imu_calibration(void)
void param_set_int_callback(uint8_t target_system, const char *const param_name, int32_t param_value)
virtual void send_gnss(uint8_t system_id, uint32_t time_of_week, uint8_t fix_type, uint64_t time, uint64_t nanos, int32_t lat, int32_t lon, int32_t height, int32_t vel_n, int32_t vel_e, int32_t vel_d, uint32_t h_acc, uint32_t v_acc, int32_t ecef_x, int32_t ecef_y, int32_t ecef_z, uint32_t p_acc, int32_t ecef_v_x, int32_t ecef_v_y, int32_t ecef_v_z, uint32_t s_acc, uint64_t rosflight_timestamp)=0
void set_defaults(void)
Set all parameters to default values.
bool read(void)
Read parameter values from non-volatile memory.
bool set_param_float(uint16_t id, float value)
Sets the value of a floating point parameter by ID and calls the parameter callback.
virtual void send_error_data(uint8_t system_id, const BackupData &error_data)=0
uint32_t get_loop_time_us()
void register_offboard_control_callback(std::function< void(const OffboardControl &)> callback)
bool offboard_control_active()
void send_named_value_int(const char *const name, int32_t value)
virtual void send_mag(uint8_t system_id, const turbomath::Vector &mag)=0
void heartbeat_callback(void)
void send_param_value(uint16_t param_id)
virtual void send_named_value_float(uint8_t system_id, uint32_t timestamp_ms, const char *const name, float value)=0
virtual void send_gnss_raw(uint8_t system_id, uint32_t time_of_week, uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t min, uint8_t sec, uint8_t valid, uint32_t t_acc, int32_t nano, uint8_t fix_type, uint8_t num_sat, int32_t lon, int32_t lat, int32_t height, int32_t height_msl, uint32_t h_acc, uint32_t v_acc, int32_t vel_n, int32_t vel_e, int32_t vel_d, int32_t g_speed, int32_t head_mot, uint32_t s_acc, uint32_t head_acc, uint16_t p_dop, uint64_t rosflight_timestamp)=0
virtual void send_version(uint8_t system_id, const char *const version)=0
float get_param_float(uint16_t id) const
Get the value of a floating point parameter by id.
const State & state() const
void set_attitude_correction(const turbomath::Quaternion &q)
bool rc_override_active()
virtual void serial_flush()=0
virtual void send_named_value_int(uint8_t system_id, uint32_t timestamp_ms, const char *const name, int32_t value)=0
Stream(uint32_t period_us, std::function< void(void)> send_function)
virtual void send_command_ack(uint8_t system_id, Command command, bool success)=0
ROSLIB_DECL std::string command(const std::string &cmd)
virtual void board_reset(bool bootloader)=0
static const channelConfig_t channels[CC_CHANNELS_PER_TIMER]
void register_timesync_callback(std::function< void(int64_t, int64_t)> callback)
param_type_t get_param_type(uint16_t id) const
Get the type of a parameter.
void add_callback(std::function< void(int)> callback, uint16_t param_id)
bool start_gyro_calibration(void)
void register_param_set_float_callback(std::function< void(uint8_t, const char *const ,float)> callback)
bool start_baro_calibration(void)
virtual uint64_t clock_micros()=0
const State & state() const
void send_heartbeat(void)
void set_new_offboard_command(control_t new_offboard_command)
void param_set_float_callback(uint8_t target_system, const char *const param_name, float param_value)
virtual uint16_t num_sensor_errors()=0
uint64_t rosflight_timestamp
virtual void clock_delay(uint32_t milliseconds)=0
virtual void send_heartbeat(uint8_t system_id, bool fixed_wing)=0
CommManager(ROSflight &rf, CommLink &comm_link)
Stream streams_[STREAM_COUNT]
void register_param_request_list_callback(std::function< void(uint8_t)> callback)
virtual void send_output_raw(uint8_t system_id, uint32_t timestamp_ms, const float raw_outputs[8])=0
turbomath::Quaternion attitude
void log(CommLink::LogSeverity severity, const char *fmt,...)
virtual void send_rc_raw(uint8_t system_id, uint32_t timestamp_ms, const uint16_t channels[8])=0
void get_filtered_IMU(turbomath::Vector &accel, turbomath::Vector &gyro, uint64_t &stamp_us)
virtual void send_timesync(uint8_t system_id, int64_t tc1, int64_t ts1)=0
const char * get_param_name(uint16_t id) const
Get the name of a parameter.
void register_command_callback(std::function< void(Command)> callback)
void send_error_data(void)
virtual uint32_t clock_millis()=0
turbomath::Vector angular_velocity
void timesync_callback(int64_t tc1, int64_t ts1)
int get_param_int(uint16_t id) const
Get the value of an integer parameter by id.
bool start_diff_pressure_calibration(void)
virtual void send_imu(uint8_t system_id, uint64_t timestamp_us, const turbomath::Vector &accel, const turbomath::Vector &gyro, float temperature)=0
uint64_t rosflight_timestamp
void param_request_read_callback(uint8_t target_system, const char *const param_name, int16_t param_index)
StateManager state_manager_
void register_heartbeat_callback(std::function< void()> callback)
void tfp_sprintf(char *s, const char *fmt, va_list va)
std::function< void(void)> send_function_
virtual bool has_backup_data()=0
void calculate_equilbrium_torque_from_rc()
CommandManager command_manager_
void register_attitude_correction_callback(std::function< void(const turbomath::Quaternion)> callback)
uint64_t offboard_control_time_
void send_named_value_float(const char *const name, float value)
void offboard_control_callback(const CommLink::OffboardControl &control)
uint8_t send_params_index_
bool write(void)
Write current parameter values to non-volatile memory.
const Data & data() const
bool set_param_int(uint16_t id, int32_t value)
Sets the value of a parameter by ID and calls the parameter change callback.
void send_low_priority(void)
void attitude_correction_callback(const turbomath::Quaternion &q)
virtual BackupData get_backup_data()=0
void send_next_param(void)