queuePairOfCups function of packagingWorkshop.js does not put the pair of cups in a package correctly
On the packaging workshop phase, even when the 2 containers moves and reaches to the first slot (opticalSensorContainer1
turns true) and second slot (opticalSensorContainer2
turns true), the robot doesn't put the pair of cups in a package till we have a third cup on the conveyor (this cup vanishes after we got the package on the conveyor or when we add the two cups to the package) that triger the async function again to run the last condition of the block below. I think the issue is on the below async function from packagingWorkshop.js
on the third condition (else).
async function queuePairOfCups() {
let cup1 = await packagingWorkshop.readProperty('opticalSensorContainer1');
let cup2 = await packagingWorkshop.readProperty('opticalSensorContainer2');
if (!cup1) {
packagingWorkshop.writeProperty('opticalSensorContainer1', true);
} else if (!cup2) {
packagingWorkshop.writeProperty('opticalSensorContainer2', true);
} else {
queue = queue
.then(() => placePackage())
.then(() => movePairOfCups());
}
}