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
Swing.h
- Committer:
- DeguNaoto
- Date:
- 2015-10-03
- Revision:
- 61:e018207ae860
- Parent:
- 60:4a75f3f3a934
- Child:
- 62:02a44f5bc51e
File content as of revision 61:e018207ae860:
#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);
}
float waitTime = 0.0;
void countSwing() {
Indicator1 = !Indicator1;
if(enableShoot){
enableShoot=0;
if(swingRadVelocity > 2.0){
waitTime = (float)((2 * PI) / swingRadVelocity);
wait(waitTime);
}
sendData(1,6);
}
}
double swingSita=0.0;
inline void mesureSwing() {
PulsesSwing = ( double )SwingSens.getPulses();
swingRadVelocity = ((((PulsesSwing - PrefPulsesSwing) 3450.0) * 2 * PI) / RATE;
PrefPulsesSwing = PulsesSwing;
}
double cont=0.0;
inline void swingFollowing(){
contSwing.setSetPoint(( float )targSwingRadVelocity);
contSwing.setProcessValue(( float )swingRadVelocity);
cont = contSwing.compute();
Motor_swing = cont;
}
#endif /*Swing.h*/

