225 lines
4.9 KiB
JSON
225 lines
4.9 KiB
JSON
{
|
|
"start": {
|
|
"state": "Idle"
|
|
},
|
|
"template_transitions": {
|
|
"battery_low": {
|
|
"target": "GoToBattery",
|
|
"conditions": [
|
|
{
|
|
"type": ">=",
|
|
"left": {
|
|
"value": 20
|
|
},
|
|
"right": {
|
|
"accessor": [
|
|
"character",
|
|
"battery_charge"
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"states": {
|
|
"Idle": {
|
|
"transitions": [
|
|
{
|
|
"template": "battery_low"
|
|
},
|
|
{
|
|
"target": "PickupTrash",
|
|
"signal": "waste_detected",
|
|
"conditions": [
|
|
{
|
|
"type": ">=",
|
|
"left": {
|
|
"value": 400
|
|
},
|
|
"right": {
|
|
"function": "distance",
|
|
"args": [
|
|
{
|
|
"accessor": [
|
|
"character",
|
|
"position"
|
|
]
|
|
},
|
|
{
|
|
"accessor": [
|
|
"signals",
|
|
"waste_detected",
|
|
"args",
|
|
"waste",
|
|
"position"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"transfer": {
|
|
"waste": {
|
|
"accessor": [
|
|
"signals",
|
|
"waste_detected",
|
|
"args",
|
|
"waste"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"PickupTrash": {
|
|
"transitions": [
|
|
{
|
|
"template": "battery_low"
|
|
},
|
|
{
|
|
"target": "ThrowTrashAway",
|
|
"signal": "waste_detected",
|
|
"conditions": [
|
|
{
|
|
"type": ">=",
|
|
"left": {
|
|
"value": 75
|
|
},
|
|
"right": {
|
|
"function": "distance",
|
|
"args": [
|
|
{
|
|
"accessor": [
|
|
"character",
|
|
"position"
|
|
]
|
|
},
|
|
{
|
|
"accessor": [
|
|
"signals",
|
|
"waste_detected",
|
|
"args",
|
|
"waste",
|
|
"position"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"transfer": {
|
|
"waste": {
|
|
"accessor": [
|
|
"signals",
|
|
"waste_detected",
|
|
"args",
|
|
"waste"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"ThrowTrashAway": {
|
|
"transitions": [
|
|
{
|
|
"template": "battery_low"
|
|
},
|
|
{
|
|
"target": "Idle",
|
|
"conditions": [
|
|
{
|
|
"type": ">=",
|
|
"left": {
|
|
"value": 90
|
|
},
|
|
"right": {
|
|
"function": "distance",
|
|
"args": [
|
|
{
|
|
"accessor": [
|
|
"character",
|
|
"position"
|
|
]
|
|
},
|
|
{
|
|
"accessor": [
|
|
"root_nodes",
|
|
"StateMachineWorld",
|
|
"child_nodes",
|
|
"TrashBin",
|
|
"position"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"GoToBattery": {
|
|
"transitions": [
|
|
{
|
|
"target": "RechargeBattery",
|
|
"conditions": [
|
|
{
|
|
"type": ">=",
|
|
"left": {
|
|
"value": 90
|
|
},
|
|
"right": {
|
|
"function": "distance",
|
|
"args": [
|
|
{
|
|
"accessor": [
|
|
"character",
|
|
"position"
|
|
]
|
|
},
|
|
{
|
|
"accessor": [
|
|
"root_nodes",
|
|
"StateMachineWorld",
|
|
"child_nodes",
|
|
"Battery",
|
|
"position"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"RechargeBattery": {
|
|
"transitions": [
|
|
{
|
|
"target": {
|
|
"type": "history_first",
|
|
"ignore": [
|
|
"RechargeBattery",
|
|
"GoToBattery"
|
|
]
|
|
},
|
|
"conditions": [
|
|
{
|
|
"type": "<=",
|
|
"left": {
|
|
"value": 100
|
|
},
|
|
"right": {
|
|
"accessor": [
|
|
"character",
|
|
"battery_charge"
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|