本文整理汇总了C++中Motion::pop_back方法的典型用法代码示例。如果您正苦于以下问题:C++ Motion::pop_back方法的具体用法?C++ Motion::pop_back怎么用?C++ Motion::pop_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Motion
的用法示例。
在下文中一共展示了Motion::pop_back方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: move
// Generate next movement
bool BufferingPlayer::move(double deadline, Motion& motion_output) {
initialize();
CGAL::Timer timer;
timer.start();
// Make sure the motion buffer is not empty before we proceed
while ((timer.time() < deadline) && !has_buffered_motion()) {
TIMED_TRACE_ACTION("move", "no pending movement");
plan(deadline);
}
if (timer.time() < deadline) {
TIMED_TRACE_ACTION("move", "additional motion found");
} else {
TIMED_TRACE_ACTION("move", "could not find additional movement");
return true;
}
// Attempt to perform the first motion in the buffer
Motion& motion = motion_buffer.front();
MS_base* step = NULL;
bool blocked = false;
while (!motion.empty() && !blocked && (deadline - timer.time() > 0)) {
// Get the next step
motion.cut_step(deadline - timer.time(), motion_output);
step = motion_output.back();
deadline -= Motion::step_time(step);
// Validate it
Extended_polygon robot_a = env->get_robot_a();
robot_a.move_absolute(step->source());
Extended_polygon robot_b = env->get_robot_b();
robot_b.move_absolute(dynamic_obstacle);
VALIDATION vResult = planner.validate_step(*step, robot_a, robot_b);
switch (vResult) {
case OK:
// Step is valid
continue;
case PATH_BLOCKED:
// Path is blocked but destination is free
case DST_BLOCKED:
// Destination is blocked
// Return it to the buffer
motion.add_motion_step_front(step);
// Don't output this invalid step
motion_output.pop_back();
// TODO find the entire gap and find a path around it
// Right now we can't do anything useful with our remaining time
blocked = true;
break;
}
}
if (step == NULL) {
return false;
}
if (motion.empty()) {
// Executed the entire motion
buffered_targets.pop_front();
motion_buffer.pop_front();
}
return !blocked;
}