Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: AmmoPusher AmmoSupplier Shooter
Diff: ShootingSystemDoc.txt
- Revision:
- 0:987c53b6a212
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ShootingSystemDoc.txt Fri Aug 21 04:52:50 2015 +0000
@@ -0,0 +1,92 @@
+MD
+(I2CServo)ShooterAngleManager : 発射角度変更機構 : ポテメ : I2CServo
+(I2CServo)ShooterPositionManager : 発射機構上下機構 : ポテメ : I2CServo
+AmmoPusher : 押出機構 : 2入力スイッチ : DigitalIn * 2, I2CMotor * 1
+AmmoSupplier : 補給機構 : 2モータ, レーザーON/OFF : DigitalIn, InterruptIn, I2CMotor * 2
+
+リレーMD
+Shooter : 発射機構 : 出力3つ : *I2C ( LPC1114側のプログラム : RelayYMotorDriver )
+
+About Shooter{
+ LPC1114{
+ DigitalOut( dp11, dp13, dp14 );
+ }
+}
+
+
+全統一制御ShootingSystem
+interface:
+ void update( Command command ){
+ if ( command.getIsShootable() && ( !mIsShooting ) ){
+ mIsShooting = true;
+ mShooterAngleManager->setTargetPosition( command.getAngleOfShooting() );
+ mShooterPositionManager->setTargetPosition( command.getPositionOfShooting() );
+ mAmmoPusher->draw(); // 補給された時に受け取れるように引いておく
+ }
+
+ // 弾押し出し機構が補給された弾を受け取る位置に来たら補給開始
+ if ( mAmmoPusher->hasPusherFinishedDrawing() ){
+ mAmmoSupplier->supply();
+ }
+
+ // 射撃作業で
+ // ・角度調整
+ // ・位置調整
+ // ・弾補給
+ // ・押出機構の準備
+ // が完了したら発射
+ bool canShooterFire = mIsShooting;
+ canShooterFire &= mShooterAngleManager->isStop();
+ canShooterFire &= mShooterPositionManager->isSop();
+ canShooterFire &= mAmmoPusher->hasPusherFinishedDrawing();
+ canShooterFire &= mAmmoSupplier->hasSupplied();
+ if ( canShooterFire ){
+ mShooter->launch();
+ mAmmoPusher->push();
+
+ if ( mAmmoPresser->hasPresserFinishedPushing() ){
+ mAmmoPresser->draw();
+ }
+ }
+ /*
+ hasWorkFinished系は仕事の受注でフラグリセット、仕事の完了でフラグセット.
+ つまり受注前に使用すると前回の仕事のフラグを返されるため正しく動作しない可能性がある.
+ */
+ }
+ void update( Command command ){
+ if ( command.getIsShootable() && ( !mIsShooting ) ){
+ mIsShooting = true;
+ mShooterAngleManager->setAngle( command.getAngleOfShooting() );
+ mShooterPositionManager->setPosition( command.getPositionOfShooting() );
+ mAmmoPusher->draw();
+ }
+
+ // 弾押し出し機構が補給された弾を受け取る位置に来たら補給開始
+ if ( mAmmoPusher->hasPusherFinishedDrawing() ){
+ mAmmoSupplier->supply();
+ }
+
+ // 射撃作業で
+ // ・角度調整
+ // ・位置調整
+ // ・弾補給
+ // ・押出機構の準備
+ // が完了したら発射
+ bool canShooterFire = mIsShooting;
+ canShooterFire &= mShooterAngleManager->hasWorkFinished();
+ canShooterFire &= mShooterPositionManager->hasWorkFinished();
+ canShooterFire &= mAmmoPusher->hasPusherFinishedDrawing();
+ canShooterFire &= mAmmoSupplier->hasSupplied();
+ if ( canShooterFire ){
+ mShooter->launch();
+ mAmmoPusher->push();
+
+ if ( mAmmoPresser->hasPresserFinishedPushing() ){
+ mAmmoPresser->draw();
+ }
+ }
+ /*
+ hasWorkFinished系は仕事の受注でフラグリセット、仕事の完了でフラグセット.
+ つまり受注前に使用すると前回の仕事のフラグを返されるため正しく動作しない可能性がある.
+ */
+ }