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.
Fork of 2015robot_main by
Diff: Swing.h
- Revision:
- 49:9276fda93084
- Child:
- 50:8ea4714316ce
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Swing.h Sat Sep 26 01:37:01 2015 +0000
@@ -0,0 +1,37 @@
+#ifndef SWING_H
+#define SWING_H
+
+/***Swing.***/
+PID contSwing(5.917 ,0.2145 ,0.0 ,RATE);
+inline void initializeSwing() {
+ interrupter.rise(&countSwing);
+ Motor_swing.period_us(SWING_PERIOD);
+ //controller set
+ contSwing.setInputLimits(0.0, 1.0);
+ contSwing.setOutputLimits(0.0, 1.0);
+ contSwing.setBias(0.0);
+ contSwing.setMode(AUTO_MODE);
+}
+
+void countSwing() {
+ Indicator1 = !Indicator1;
+ if(enableShoot){
+ enableShoot=0;
+ if(targSwingRadVelocity != 0.0) wait((2 * PI) / swingRadVelocity);
+ sendData(1,6);
+ }
+}
+
+inline void mesureSwing() {
+ PulsesSwing = ( double )SwingSens.getPulses();
+ swingRadVelocity = (((PulsesSwing - PrefPulsesSwing) / 4.0) / pprS ) * 2 * PI;
+ PrefPulsesSwing = PulsesSwing;
+}
+
+inline void swingFollowing(){
+ contSwing.setSetPoint(( float )targSwingRadVelocity);
+ contSwing.setProcessValue(( float )swingRadVelocity);
+ Motor_swing = contSwing.compute();
+}
+
+#endif /*Swing.h*/
\ No newline at end of file

