本文整理汇总了C++中SearchController::search方法的典型用法代码示例。如果您正苦于以下问题:C++ SearchController::search方法的具体用法?C++ SearchController::search怎么用?C++ SearchController::search使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchController
的用法示例。
在下文中一共展示了SearchController::search方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mobilityStateMachine
//.........这里部分代码省略.........
// move back to transform step
stateMachineState = STATE_MACHINE_TRANSFORM;
reachedCollectionPoint = false;;
centerLocationOdom = currentLocation;
dropOffController.reset();
} else if (result.goalDriving && timerTimeElapsed >= 5 ) {
goalLocation = result.centerGoal;
stateMachineState = STATE_MACHINE_ROTATE;
timerStartTime = time(0);
}
// we are in precision/timed driving
else {
goalLocation = currentLocation;
sendDriveCommand(result.cmdVel,result.angleError);
stateMachineState = STATE_MACHINE_TRANSFORM;
break;
}
}
//If angle between current and goal is significant
//if error in heading is greater than 0.4 radians
else if (fabs(angles::shortest_angular_distance(currentLocation.theta, goalLocation.theta)) > rotateOnlyAngleTolerance) {
stateMachineState = STATE_MACHINE_ROTATE;
}
//If goal has not yet been reached drive and maintane heading
else if (fabs(angles::shortest_angular_distance(currentLocation.theta, atan2(goalLocation.y - currentLocation.y, goalLocation.x - currentLocation.x))) < M_PI_2) {
stateMachineState = STATE_MACHINE_SKID_STEER;
}
//Otherwise, drop off target and select new random uniform heading
//If no targets have been detected, assign a new goal
else if (!targetDetected && timerTimeElapsed > returnToSearchDelay) {
goalLocation = searchController.search(currentLocation);
}
//Purposefully fall through to next case without breaking
}
// Calculate angle between currentLocation.theta and goalLocation.theta
// Rotate left or right depending on sign of angle
// Stay in this state until angle is minimized
case STATE_MACHINE_ROTATE: {
stateMachineMsg.data = "ROTATING";
// Calculate the diffrence between current and desired
// heading in radians.
float errorYaw = angles::shortest_angular_distance(currentLocation.theta, goalLocation.theta);
// If angle > 0.4 radians rotate but dont drive forward.
if (fabs(angles::shortest_angular_distance(currentLocation.theta, goalLocation.theta)) > rotateOnlyAngleTolerance) {
// rotate but dont drive 0.05 is to prevent turning in reverse
sendDriveCommand(0.05, errorYaw);
break;
} else {
// move to differential drive step
stateMachineState = STATE_MACHINE_SKID_STEER;
//fall through on purpose.
}
}
// Calculate angle between currentLocation.x/y and goalLocation.x/y
// Drive forward
// Stay in this state until angle is at least PI/2
case STATE_MACHINE_SKID_STEER: {
stateMachineMsg.data = "SKID_STEER";