Diese Seite wurde maschinell übersetzt und wurde noch nicht von einer Person überprüft. Englisch ist die Referenz; Korrekturen auf GitHub sind willkommen. GitHub
Cookwala / SDK und Szenarien / 012
Six example recipes dry-run on the kitchen robot with thermometers
A kitchen robot with a hob, a pan thermometer, a liquid thermometer and a core probe plans six of the nine example dishes without a person doing any step, as long as a person is present for the knife work.
Zuerst lesen: /docs/CORE/ /docs/QUICKSTART/
Schritte
Shakshuka: thirteen steps, all by the device.
dryRunLentil soup: hot holding at the end is verified by the core probe.
dryRunMolokhia with chicken: twelve steps.
dryRunFul medames: the simmer is verified by the liquid thermometer.
dryRunRice with vermicelli: toasting the vermicelli is verified by the pan thermometer.
dryRunBasbousa: melting the butter has no product thermometer on this robot, so it is a logged estimate.
dryRun
Ergebnis
You have a plan for each dish and can read, step by step, what verifies it. Next: scenario 013 puts the remaining three recipes on the devices that fit them.
Kommandozeile
cookwala dryrun examples/shakshuka.cookwala.json --device examples/capabilities/demo-hob-robot.json --human-present
cookwala dryrun examples/lentil-soup.cookwala.json --device examples/capabilities/demo-hob-robot.json --human-present
cookwala dryrun examples/molokhia.cookwala.json --device examples/capabilities/demo-hob-robot.json --human-present
cookwala dryrun examples/ful-medames.cookwala.json --device examples/capabilities/demo-hob-robot.json --human-present
cookwala dryrun examples/rice-vermicelli.cookwala.json --device examples/capabilities/demo-hob-robot.json --human-present
cookwala dryrun examples/basbousa.cookwala.json --device examples/capabilities/demo-hob-robot.json --human-presentAufgezeichnete Ausgabe
Status: ok
[1] dryRun: {"state": "accepted", "plan": [{"node": "n1", "op": "cw.op.cut", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.vision"}, {"node": "n2", "op": "cw.op.cut", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.vision"}, {"node": "n3", "op": "cw.op.cut", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.vision"}, {"node": "n4", "op": "cw.op.heat", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.pan_surface_temp"}, {"node": "n5", "op": "cw.op.saute", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.pan_surface_temp"}, {"node": "n6", "op": "cw.op.saute", …
[2] dryRun: {"state": "accepted", "plan": [{"node": "n1", "op": "cw.op.cut", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.vision"}, {"node": "n2", "op": "cw.op.cut", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.vision"}, {"node": "n3", "op": "cw.op.crush", "by": "device", "verifiedBy": "time", "rung": "time"}, {"node": "n4", "op": "cw.op.heat", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.pan_surface_temp"}, {"node": "n5", "op": "cw.op.saute", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.pan_surface_temp"}, {"node": "n6", "op": "cw.op.boil", "by": "devic…
[3] dryRun: {"state": "accepted", "plan": [{"node": "n1", "op": "cw.op.boil", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.liquid_temp"}, {"node": "n2", "op": "cw.op.simmer", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.liquid_temp"}, {"node": "n3", "op": "cw.op.drain", "by": "device", "verifiedBy": "time", "rung": "time"}, {"node": "n4", "op": "cw.op.simmer", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.liquid_temp"}, {"node": "n5", "op": "cw.op.crush", "by": "device", "verifiedBy": "time", "rung": "time"}, {"node": "n6", "op": "cw.op.heat", "by": "device", "verifie…
[4] dryRun: {"state": "accepted", "plan": [{"node": "n1", "op": "cw.op.crush", "by": "device", "verifiedBy": "time", "rung": "time"}, {"node": "n2", "op": "cw.op.simmer", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.liquid_temp"}, {"node": "n3", "op": "cw.op.crush", "by": "device", "verifiedBy": "time", "rung": "time"}, {"node": "n4", "op": "cw.op.season", "by": "device", "verifiedBy": "time", "rung": "time"}, {"node": "n5", "op": "cw.op.cut", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.vision"}, {"node": "n6", "op": "cw.op.garnish", "by": "device", "verifiedBy": "time", "rung":…
[5] dryRun: {"state": "accepted", "plan": [{"node": "n1", "op": "cw.op.wash", "by": "device", "verifiedBy": "time", "rung": "time"}, {"node": "n2", "op": "cw.op.drain", "by": "device", "verifiedBy": "time", "rung": "time"}, {"node": "n3", "op": "cw.op.heat", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.pan_surface_temp"}, {"node": "n4", "op": "cw.op.toast", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.pan_surface_temp"}, {"node": "n5", "op": "cw.op.saute", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.pan_surface_temp"}, {"node": "n6", "op": "cw.op.boil", "by": "devic…
[6] dryRun: {"state": "accepted", "plan": [{"node": "n1", "op": "cw.op.melt", "by": "device", "verifiedBy": "model", "rung": "model"}, {"node": "n2", "op": "cw.op.mix", "by": "device", "verifiedBy": "time", "rung": "time"}, {"node": "n3", "op": "cw.op.mix", "by": "device", "verifiedBy": "time", "rung": "time"}, {"node": "n4", "op": "cw.op.transfer", "by": "device", "verifiedBy": "time", "rung": "time"}, {"node": "n5", "op": "cw.op.rest", "by": "device", "verifiedBy": "time", "rung": "time"}, {"node": "n6", "op": "cw.op.heat", "by": "device", "verifiedBy": "sensor", "rung": "cw.sense.pan_surface_temp"}, {"…Code
Ausführen: python scenarios/out/012-example-recipes-on-the-hob-robot/python.py
# Scenario 012: Six example recipes dry-run on the kitchen robot with thermometers
# A kitchen robot with a hob, a pan thermometer, a liquid thermometer and a core probe plans six of the nine example dishes without a person doing any step, as long as a person is present for the knife work.
# Run a hub first: python hub/cookwala_hub.py --recipes examples
import json, os
from cookwala.client import CookwalaClient, CookwalaProblem
def load(path):
with open(path, encoding="utf-8") as f:
return json.load(f)
def pick(obj, path):
for part in path.replace("]", "").replace("[", ".").split("."):
obj = obj[int(part)] if part.isdigit() else (len(obj) if part == "length" else obj.get(part))
return obj
c = CookwalaClient(os.environ.get("COOKWALA_HUB", "http://localhost:7878"))
# Step 1: Shakshuka: thirteen steps, all by the device.
shakshuka = c.dry_run(recipe_id="shakshuka", device_id="demo-hob-robot", human_present=True)
assert pick(shakshuka, "state") == "accepted", pick(shakshuka, "state")
print("ok", "state", "=", "accepted")
assert pick(shakshuka, "plan.length") == 13, pick(shakshuka, "plan.length")
print("ok", "plan.length", "=", 13)
# Step 2: Lentil soup: hot holding at the end is verified by the core probe.
lentil = c.dry_run(recipe_id="lentil-soup", device_id="demo-hob-robot", human_present=True)
assert pick(lentil, "state") == "accepted", pick(lentil, "state")
print("ok", "state", "=", "accepted")
assert pick(lentil, "plan.length") == 11, pick(lentil, "plan.length")
print("ok", "plan.length", "=", 11)
assert pick(lentil, "plan[9].op") == "cw.op.hold", pick(lentil, "plan[9].op")
print("ok", "plan[9].op", "=", "cw.op.hold")
assert pick(lentil, "plan[9].rung") == "cw.sense.core_temp", pick(lentil, "plan[9].rung")
print("ok", "plan[9].rung", "=", "cw.sense.core_temp")
# Step 3: Molokhia with chicken: twelve steps.
molokhia = c.dry_run(recipe_id="molokhia", device_id="demo-hob-robot", human_present=True)
assert pick(molokhia, "state") == "accepted", pick(molokhia, "state")
print("ok", "state", "=", "accepted")
assert pick(molokhia, "plan.length") == 12, pick(molokhia, "plan.length")
print("ok", "plan.length", "=", 12)
# Step 4: Ful medames: the simmer is verified by the liquid thermometer.
ful = c.dry_run(recipe_id="ful-medames", device_id="demo-hob-robot", human_present=True)
assert pick(ful, "state") == "accepted", pick(ful, "state")
print("ok", "state", "=", "accepted")
assert pick(ful, "plan.length") == 7, pick(ful, "plan.length")
print("ok", "plan.length", "=", 7)
assert pick(ful, "plan[1].rung") == "cw.sense.liquid_temp", pick(ful, "plan[1].rung")
print("ok", "plan[1].rung", "=", "cw.sense.liquid_temp")
# Step 5: Rice with vermicelli: toasting the vermicelli is verified by the pan thermometer.
rice = c.dry_run(recipe_id="rice-vermicelli", device_id="demo-hob-robot", human_present=True)
assert pick(rice, "state") == "accepted", pick(rice, "state")
print("ok", "state", "=", "accepted")
assert pick(rice, "plan.length") == 9, pick(rice, "plan.length")
print("ok", "plan.length", "=", 9)
assert pick(rice, "plan[3].op") == "cw.op.toast", pick(rice, "plan[3].op")
print("ok", "plan[3].op", "=", "cw.op.toast")
assert pick(rice, "plan[3].rung") == "cw.sense.pan_surface_temp", pick(rice, "plan[3].rung")
print("ok", "plan[3].rung", "=", "cw.sense.pan_surface_temp")
# Step 6: Basbousa: melting the butter has no product thermometer on this robot, so it is a logged estimate.
basbousa = c.dry_run(recipe_id="basbousa", device_id="demo-hob-robot", human_present=True)
assert pick(basbousa, "state") == "accepted", pick(basbousa, "state")
print("ok", "state", "=", "accepted")
assert pick(basbousa, "plan.length") == 13, pick(basbousa, "plan.length")
print("ok", "plan.length", "=", 13)
assert pick(basbousa, "plan[0].op") == "cw.op.melt", pick(basbousa, "plan[0].op")
print("ok", "plan[0].op", "=", "cw.op.melt")
assert pick(basbousa, "plan[0].rung") == "model", pick(basbousa, "plan[0].rung")
print("ok", "plan[0].rung", "=", "model")
print("scenario complete")