本文整理汇总了C++中Gyro::correct方法的典型用法代码示例。如果您正苦于以下问题:C++ Gyro::correct方法的具体用法?C++ Gyro::correct怎么用?C++ Gyro::correct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gyro
的用法示例。
在下文中一共展示了Gyro::correct方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
spimotor.setOutput((float) SPI_out / 500.0);
MillisecondTimer::delay(50);
continue;
}else if(Start == true && ps3con->getButtonPress(START)){//Emergency stop
mainBoard.buzzer.set(-1, 4);
debug << "[WARN]Emergency stop!!\r\n";
Start = false;
build.Reset();
//PWM output
mainBoard.motorA.setOutput(0 / 500.0);
mainBoard.motorB.setOutput(0 / 500.0);
mainBoard.motorC.setOutput(0 / 500.0);
mainBoard.motorD.setOutput(0 / 500.0);
spimotor.setOutput(0/500.0);
MillisecondTimer::delay(200);
continue;
}
mainBoard.led.On();
enc_now[X] = mainBoard.encoders.getCounter1();
enc_now[Y] = mainBoard.encoders.getCounter2();
machine.extendEncValue(enc_now[X],enc_old[X],X);
machine.extendEncValue(enc_now[Y],enc_old[Y],Y);
sensor_timer.ahrs.getYaw(yaw_now);
yaw_now *= RAD_TO_DEG;
gyro.set(yaw_now,yaw_old);
rotation_gyro = gyro.correct();
setLimit(rotation_gyro,R_Gyro_LIMIT);
//Rotate (angle of 90)
if (ps3con->getButtonPress(R1) && push_time[0] == 0){
mainBoard.buzzer.set(-1, 5);
gyro.setAngle90(90);
push_time[0] = 1;
}
else if (ps3con->getButtonPress(L1) && push_time[0] == 0){
mainBoard.buzzer.set(-1, 5);
gyro.setAngle90(-90);
push_time[0] = 1;
}
//Rotate (Normal)
if(ps3con->getButtonPress(L2)||ps3con->getButtonPress(R2)){
gyro.reset(rotation_gyro);
rotation = (ps3con->getAnalog(ANALOG_R2) - ps3con->getAnalog(ANALOG_L2)) / 2;
}
machine.antiSlip(rotation,ROTATE,NO_CAHNGE);
setLimit(rotation,R_LIMIT);
//change manual build mode
if(ps3con->getButtonPress(SELECT) && push_time[1] == 0){
mainBoard.buzzer.set(-1, 5);
push_time[1] = 1;
if(_build_mode == AUTO){
_build_mode = MANUAL;
build.changeMode(-2);
}
else{