📄 b_shouldwait_r.java
字号:
/* * b_ShouldWait_r.java */package EDU.gatech.cc.is.clay;import java.lang.*;import java.util.Random;import EDU.gatech.cc.is.abstractrobot.*;import EDU.gatech.cc.is.util.Vec2;public class b_ShouldWait_r extends NodeBoolean{ /** * Turn debug printing on or off. */ public static final boolean DEBUG = Node.DEBUG; private MultiForageN150 abstract_robot; public static double innerRange = 3.0; public static double outerRange = 6.0; public static double safeRange = 1.5; public b_ShouldWait_r(MultiForageN150 ar) { if (DEBUG) System.out.println("b_ShouldWait_r: instantiated"); abstract_robot = ar; } public boolean Value(long timestamp) { if (DEBUG) System.out.println("b_ShouldWait_r: Value()"); // if grip no food of visual class 1, return false if (abstract_robot.getFoodID() == -1) return false; // if the gripped food cann't be delivered, wait. if (!abstract_robot.canGetHelp()) { abstract_robot.setWaitTag(true);// set the wait tag. abstract_robot.setInGripper(); // empty the gripper. //reset the position of the robot, Vec2 position = new Vec2(); // prevent the robot from overlap. do { position.sett(Math.random()*Math.PI*2); position.setr(innerRange+Math.random()*(outerRange-innerRange)); abstract_robot.resetPosition(position); } while (abstract_robot.checkOverlap(safeRange)); return true; } return false; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -