#ifndef __DATA_MATRIX_H__ #define __DATA_MATRIX_H__ #include "config.h" /** * ダウンリンク経由のデータ送信にSylphideProtocolを使うかどうかを指定 * SylphideProtocolを使用する場合(デフォルト)、 * ユーザデータはSylphideProtocolに包まれてデータが送信され、 * また航法情報等の標準的なデータがテレメトリとして送信される * SylphideProtocolを使用しない場合、 * 全ての送信はユーザに解放され、生データが流れる * * @param use SylphideProtocolを送信使う場合、true */ void downlink_use_builtin_protocol(const bool &use = true); struct BuiltinTelemetry { enum item_t { NAV = 0, GPS, ADS, SERVO, MAG, NUM_OF_ITEMS, }; }; /** * ダウンリンク経由のデータ送信にSylphideProtocolを使った際、 * あらかじめ組み込み済みのテレメトリの頻度を調整する * * @param item 組み込み済みテレメトリの種類 * @param rate 頻度、0指定で出力しない、1で最頻度 * @return 変更後の頻度 */ unsigned int downlink_builtin_rate(const BuiltinTelemetry::item_t &item, const unsigned int &rate); /** * ダウンリンク経由のデータ送信を行う * * @raw_data 送信生データ * @data_size データサイズ */ void downlink_write(const char *raw_data, const unsigned int &data_size); /** * アップリンク経由のデータ受信にSylphideProtocolを使うかどうかを指定 * SylphideProtocolを使用する場合(デフォルト)、 * ユーザデータはSylphideProtocolに包まれていることを想定し、 * データの意味単位における頭だしがされた状態で処理関数に受け渡される * SylphideProtocolを使用しない場合、 * 全ての受信はユーザに解放され、 * データの意味単位における頭だしがされていない状態で処理関数に受け渡される * * @param use SylphideProtocolを使うかどうか */ void uplink_use_builtin_protocol(const bool &use = true); /** * アップリンク経由のデータ受信を行う * * @func 受信した際に呼び出される関数(引数にバッファ、受信サイズを取る) */ void uplink_read(void (*func)(char *buf, const unsigned int &buf_size)); ///< 処理済み情報 extern const struct ProcessedInfo { // GPS情報 struct { float_sylph_t longitude_deg; ///< 経度[deg] float_sylph_t latitude_deg; ///< 緯度[deg] float_sylph_t height_meter; ///< WGS84高度[m] float_sylph_t horizontal_position_accuracy_meter; ///< 水平面上精度[m] float_sylph_t vertical_position_accuracy_meter; ///< 垂直面上精度[m] float_sylph_t v_north_ms; ///< 北方向速度[m/s] float_sylph_t v_east_ms; ///< 東方向速度[m/s] float_sylph_t v_down_ms; ///< 下方向速度[m/s] float_sylph_t velocity_accuracy_ms; ///< 速度精度[m/s] unsigned char using_satellites; ///< 測位使用衛星数 char leap_seconds_gps_minus_utc; ///< 閏秒 enum {NO_FIX = 0, FIX_2D, FIX_3D,} fix_type; ///< 測位状態 } gps; // 加速度、角速度 struct { float_sylph_t accel_ms2[3]; ///< 加速度[m/s^2] X,Y,Z(機体座標) float_sylph_t omega_rads[3]; ///< 角速度[rad/s] X,Y,Z(機体座標) } inertial_sensor; // 空気データ struct { float_sylph_t tas_ms; ///< 真対気速度[m/s] float_sylph_t alpha_rad; ///< 迎角[rad] float_sylph_t beta_rad; ///< 横滑り角[rad] float_sylph_t pressure_alt_meter; ///< 気圧高度[m] } ads; // 地磁気データ struct { float_sylph_t corrected_mag_tesla[3]; ///< 磁束密度[T] X,Y,Z(機体座標) } magnetic_sensor; // 航法情報 struct { float_sylph_t longitude_rad; ///< 経度[rad] float_sylph_t latitude_rad; ///< 緯度[rad] float_sylph_t height_meter; ///< WGS84高度[m] float_sylph_t v_north_ms; ///< 北方向速度[m/s] float_sylph_t v_east_ms; ///< 東方向速度[m/s] float_sylph_t v_down_ms; ///< 下方向速度[m/s] float_sylph_t heading_rad; ///< ヘディング[rad] float_sylph_t roll_rad; ///< ロール[rad] float_sylph_t pitch_rad; ///< ピッチ[rad] float_sylph_t corrected_accel_ms2[3]; ///< 修正加速度[m/s^2] X,Y,Z(機体座標、バイアス等考慮済) float_sylph_t corrected_omega_rads[3]; ///< 修正角速度[rad/s] X,Y,Z(機体座標、バイアス等考慮済) } navigation; } &latest_processed_info; #endif /* __DATA_MATRIX_H__ */