Skip to content
Snippets Groups Projects
Commit 3c33bfec authored by Jon's avatar Jon
Browse files

Add dummy method to make the occupying robot unavailable for subtask (c)

parent 4ad000e1
No related branches found
No related tags found
No related merge requests found
......@@ -321,10 +321,10 @@ class Task2 {
let misplacedRobot = targetTable.getRobotAtTable();
let token = await misplacedRobot.acquire();
let promiseSleep = new Promise((resolve) => {
setTimeout(() => {
misplacedRobot.dummyAction().then( () => {
misplacedRobot.release(token);
resolve(true);
}, 4000 + Math.random() * 5000);
});
});
await safeTeleportTo(randRobot.getRobotID(), targetTable.getTableID());
await promiseSleep;
......
......@@ -159,4 +159,19 @@ class RobotWaiter {
this._acquisitionTokens = [];
}
async dummyAction(){
this.#startProcess(`dummyAction()`);
try{
let actionTime = parseInt(2000 + Math.random() * 5000);
await this.sleep(actionTime);
} catch (error) {
throw(error);
} finally {
this.#endProcess();
}
return true;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment