本文整理汇总了C++中Movement::turn方法的典型用法代码示例。如果您正苦于以下问题:C++ Movement::turn方法的具体用法?C++ Movement::turn怎么用?C++ Movement::turn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Movement
的用法示例。
在下文中一共展示了Movement::turn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: seek
int Search::seek(int lastPositionXY[2],int currentPositionXY[2])
{
Movement move = Movement(myRobot);
double range = mySonar->currentReadingPolar(-70, 70) - myRobot->getRobotRadius();
ArTime start;
//using timeSet to start the counting the first time we enter Search
if (timeSet == 0)
timeSet = start.getSec();
//if searching for more thatn 1o secs switch to goTo
if(start.getSec() - timeSet > 10)
{ timeSet = 0;
return 3;
}
//if we have found a target
if( currentPositionXY[0] != -1 )
{ timeSet = 0;
std::cout << "Found target " << currentPositionXY[0] << std::endl;
return 1;
}
// if we are safe
if(range > stopDistance)
{ //if the target was last seen on the right
if( lastPositionXY[0] > width/2 )
move.turn(-36);
//if the target was last seen on the left
if( lastPositionXY[0] =< width/2 )
move.turn(36);
return 2;
}
//if we are not safe
else
{ move.stop();