-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ void setup() | |
|
||
// CAN | ||
CCP.begin(); | ||
|
||
opener.init(); | ||
} | ||
|
||
void loop() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include <Arduino.h> | ||
#include "myOpener.h" | ||
|
||
#include <Servo.h> | ||
#define SERVO_1 3 | ||
#define SERVO_2 4 | ||
Servo servo1; | ||
Servo servo2; | ||
|
||
void MY_OPENER::init() | ||
{ | ||
servo1.attach(SERVO_1); | ||
servo2.attach(SERVO_2); | ||
close(); | ||
} | ||
|
||
void MY_OPENER::open() | ||
{ | ||
servo1.write(120); | ||
servo2.write(120); | ||
} | ||
|
||
void MY_OPENER::close() | ||
{ | ||
servo1.write(30); | ||
servo2.write(30); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#ifndef MY_OPENER_H | ||
#define MY_OPENER_H | ||
|
||
#include <Arduino.h> | ||
#include <Opener.h> | ||
|
||
class MY_OPENER : public OPENER | ||
{ | ||
protected: | ||
//! 頂点判定に使われる,0.1秒間の高度変化の閾値 | ||
const float open_threshold_altitude_m = 0.5; | ||
//! 燃焼終了に使われる,加速度の閾値 | ||
const float open_threshold_ac_mss = 5; | ||
//! opener_10Hz()が適切なタイミングで呼ばれているかの判定に使われる,10Hzの周期 | ||
const uint32_t period_10Hz_ms = 150; // 10Hz+50ms | ||
//! opener_100Hz()が適切なタイミングで呼ばれているかの判定に使われる,100Hzの周期 | ||
const uint32_t period_100Hz_ms = 20; // 100Hz+10ms | ||
//! 閾値以上の加速度が何回連続したときに離床判定・燃焼終了判定を行うかという回数 | ||
const int ACC_threshold_count = 5; | ||
//! 離床判定にかかる時間 | ||
const int flight_judgement_duration_ms = ACC_threshold_count * 100; | ||
|
||
float fm_lift_off_threshold_altitude_m = 1.0; | ||
float fm_lift_off_threshold_ac_mss = 25.0; | ||
int fm_ALT_oversampling_count = 1; | ||
int fm_ALT_threshold_count = ACC_threshold_count; | ||
|
||
float shinsasyo_lift_off_threshold_altitude_m = 0.5; | ||
float shinsasyo_lift_off_threshold_ac_mss = 9.0; | ||
int shinsasyo_ALT_oversampling_count = 5.0; | ||
int shinsasyo_ALT_threshold_count = 2; | ||
|
||
//! 離床判定後,燃焼中と判断し開放判定を行わない時間[ms] | ||
const uint32_t meco_threshold_time_ms = 10000; | ||
//! 開放機構の動作にかかる時間を引いた,離床から開放までの時間のシム値[ms]の初期値 | ||
uint32_t open_threshold_time_ms = 19000; | ||
|
||
//! 開放機構を開く | ||
void open(); | ||
//! 開放機構を閉じる | ||
void close(); | ||
|
||
public: | ||
MY_OPENER(OPENER::SETTING _setting) : OPENER(_setting) | ||
{ | ||
} | ||
|
||
void init(); | ||
}; | ||
|
||
#endif // MY_OPENER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include "myOpener.h" | ||
|
||
MY_OPENER opener(OPENER::FM); | ||
|
||
void setup() | ||
{ | ||
// 開放機構のハードウェアの初期設定(Option) | ||
opener.init(); | ||
} | ||
|
||
void loop() | ||
{ | ||
// テレメトリ送信に関するブロック | ||
{ | ||
// 以下の構造体から状態を読み出し可能 | ||
// opener.mode | ||
// opener.lift_off_judge | ||
// opener.open_judge | ||
} | ||
|
||
// コマンド受信に関するブロック | ||
{ | ||
// 開放禁止コマンドを受信したとき, | ||
opener.prohibitOpen(); | ||
// 開放禁止解除コマンドを受信したとき, | ||
opener.clear_prohibitOpen(); | ||
|
||
// 手動開放コマンドを受信したとき, | ||
opener.manualOpen(); | ||
// 手動閉鎖コマンドを受信したとき, | ||
opener.manualClose(); | ||
|
||
// フェーズ移行コマンドを受信したとき, | ||
opener.goCHECK(); | ||
opener.goREADY(); | ||
|
||
// 開放閾値時間を受信したとき, | ||
uint32_t open_threshold_time_ms = 0; | ||
opener.set_open_threshold_time_ms(open_threshold_time_ms); | ||
// opener.get_open_threshold_time_ms() で設定値を取得可 | ||
} | ||
|
||
// 100Hzで実行するブロック | ||
{ | ||
// 加速度センサーにより測定した機軸方向の加速度[m/s^2] | ||
// 地上でロケットを立ち上げて重力加速度がかかったとき,正の値となる向き | ||
float acceleration_mss = 0; | ||
|
||
// 気圧センサーにより測定される高度[m] | ||
// 高度差を利用するため,射点で0mである必要はない. | ||
float altitude_m = 0; | ||
|
||
opener.opener_100Hz(acceleration_mss, altitude_m); | ||
} | ||
} |