本文整理汇总了C++中Drive::InitAutoDrive方法的典型用法代码示例。如果您正苦于以下问题:C++ Drive::InitAutoDrive方法的具体用法?C++ Drive::InitAutoDrive怎么用?C++ Drive::InitAutoDrive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drive
的用法示例。
在下文中一共展示了Drive::InitAutoDrive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AutonomousPeriodic
/**
* Periodic code for autonomous mode should go here.
*
* Use this method for code which will be called periodically at a regular
* rate while the robot is in autonomous mode.
*/
void RobotDemo::AutonomousPeriodic()
{
shooter->handle();
intake->handle();
switch(curAutoState)
{
case AUTO_EXTEND:
if(curAutoState != preAutoState)
{
preAutoState = curAutoState;
intake->move(INTAKE_EXTEND_POWER);
printf("extending, pre %d, cur %d, \n", preAutoState, curAutoState);
}
if(intake->getCurrentPosition() >= EXTENDER_MAX_DISTANCE)
{
intake->move(STOP);
curAutoState = AUTO_DRIVE;
printf("pre %d, cur %d, stopped extender \n", preAutoState, curAutoState);
}
break;
case AUTO_DRIVE:
if(curAutoState != preAutoState)
{
preAutoState = curAutoState;
drive->InitAutoDrive(AUTO_DRIVE_DISTANCE_RIGHT,
AUTO_DRIVE_DISTANCE_LEFT,
AUTO_DRIVE_SPEED);
printf("We're moving! pre %d, cur %d, \n", preAutoState, curAutoState);
}
/* if(HotAutoSensor->Get())
{
HotAutoStarts = true;
}
*/
if(drive->autoDrive() == true)
{
curAutoState = AUTO_STOP_DRIVING;
}
break;
case AUTO_STOP_DRIVING:
if(curAutoState != preAutoState)
{
preAutoState = curAutoState;
printf("now stopping pre %d, cur %d, \n", preAutoState, curAutoState);
drive->TeleopDrive(AUTO_STOPPING_SPEED_LEFT, AUTO_STOPPING_SPEED_RIGHT);
}
if(drive->getSpeed() > 0.01)
{
drive->TeleopDrive(AUTO_STOPPED_SPEED_LEFT, AUTO_STOPPED_SPEED_RIGHT);
// if(HotAutoStarts || HotAutoTimer->Get() > 5.0)
// {
curAutoState = AUTO_SHOOT;
// }
}
break;
case AUTO_SHOOT:
if(curAutoState != preAutoState)
{
preAutoState = curAutoState;
printf("now shooting pre %d, cur %d, \n", preAutoState, curAutoState);
shooter->initShot(SHOT_HIGH_ANGLE, SHOT_HIGH_SPEED);
}
if(!shooter->isShooting())
{
curAutoState = AUTO_STOP;
}
break;
/*
case AUTO_MOBILITY:
if(curAutoState != preAutoState)
{
drive->InitAutoDrive(AUTO_SETUP_SHOT_DISTANCE_RIGHT,
AUTO_SETUP_SHOT_DISTANCE_LEFT,
AUTO_SETUP_SHOT_SPEED);
}
if(drive->autoDrive())
{
curAutoState = AUTO_STOP;
}
break;
*/
case AUTO_STOP:
//.........这里部分代码省略.........