本文整理汇总了C++中SearchController::continueInterruptedSearch方法的典型用法代码示例。如果您正苦于以下问题:C++ SearchController::continueInterruptedSearch方法的具体用法?C++ SearchController::continueInterruptedSearch怎么用?C++ SearchController::continueInterruptedSearch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchController
的用法示例。
在下文中一共展示了SearchController::continueInterruptedSearch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: obstacleHandler
void obstacleHandler(const std_msgs::UInt8::ConstPtr& message) {
if ((!targetDetected || targetCollected) && (message->data > 0)) {
// obstacle on right side
if (message->data == 1) {
// select new heading 0.2 radians to the left
goalLocation.theta = currentLocation.theta + 0.6;
}
// obstacle in front or on left side
else if (message->data == 2) {
// select new heading 0.2 radians to the right
goalLocation.theta = currentLocation.theta + 0.6;
}
// continues an interrupted search
goalLocation = searchController.continueInterruptedSearch(currentLocation, goalLocation);
// switch to transform state to trigger collision avoidance
stateMachineState = STATE_MACHINE_ROTATE;
avoidingObstacle = true;
}
// the front ultrasond is blocked very closely. 0.14m currently
if (message->data == 4) {
blockBlock = true;
} else {
blockBlock = false;
}
}
示例2: targetHandler
void targetHandler(const apriltags_ros::AprilTagDetectionArray::ConstPtr& message) {
// If in manual mode do not try to automatically pick up the target
if (currentMode == 1 || currentMode == 0) return;
// if a target is detected and we are looking for center tags
if (message->detections.size() > 0 && !reachedCollectionPoint) {
float cameraOffsetCorrection = 0.020; //meters;
centerSeen = false;
double count = 0;
double countRight = 0;
double countLeft = 0;
// this loop is to get the number of center tags
for (int i = 0; i < message->detections.size(); i++) {
if (message->detections[i].id == 256) {
geometry_msgs::PoseStamped cenPose = message->detections[i].pose;
// checks if tag is on the right or left side of the image
if (cenPose.pose.position.x + cameraOffsetCorrection > 0) {
countRight++;
} else {
countLeft++;
}
centerSeen = true;
count++;
}
}
if (centerSeen && targetCollected) {
stateMachineState = STATE_MACHINE_TRANSFORM;
goalLocation = currentLocation;
}
dropOffController.setDataTargets(count,countLeft,countRight);
// if we see the center and we dont have a target collected
if (centerSeen && !targetCollected) {
float centeringTurn = 0.15; //radians
stateMachineState = STATE_MACHINE_TRANSFORM;
// this code keeps the robot from driving over
// the center when searching for blocks
if (right) {
// turn away from the center to the left if just driving
// around/searching.
goalLocation.theta += centeringTurn;
} else {
// turn away from the center to the right if just driving
// around/searching.
goalLocation.theta -= centeringTurn;
}
// continues an interrupted search
goalLocation = searchController.continueInterruptedSearch(currentLocation, goalLocation);
targetDetected = false;
pickUpController.reset();
return;
}
}
// end found target and looking for center tags
// found a target april tag and looking for april cubes;
// with safety timer at greater than 5 seconds.
PickUpResult result;
if (message->detections.size() > 0 && !targetCollected && timerTimeElapsed > 5) {
targetDetected = true;
// pickup state so target handler can take over driving.
stateMachineState = STATE_MACHINE_PICKUP;
result = pickUpController.selectTarget(message);
std_msgs::Float32 angle;
if (result.fingerAngle != -1) {
angle.data = result.fingerAngle;
fingerAnglePublish.publish(angle);
}
if (result.wristAngle != -1) {
angle.data = result.wristAngle;
wristAnglePublish.publish(angle);
}
}
}