- Recommended OS: Linux
- Python 3.10
- Add the mace4/bin directory to PATH:
- Open the
~/.bashrc
file (e.g., by runningnano ~/.bashrc
), add the following line at the end of it:export PATH="[...]:$PATH"
, where[..]
should be replaced with the absolute path of thebin
folder (e.g.,export PATH="/home/user/HRI-Quantifier/mace4/bin:$PATH"
) - Save the file and load the new
$PATH
executingsource ~/.bashrc
- Open the
- Add the value of
OPENAI_API_KEY
in .env or use the mocked mode by settingIS_OPENAI_CALL_MOCKED
totrue
- requests:
pip install requests
- python-dotenv:
pip install python-dotenv
- OpenAI:
pip install --upgrade openai
- abe_sim: https://github.com/mpomarlan/abe_sim
- In the
src
folder ofabe_sim
, runpython3 ./runBrain.py -g -l ./abe_sim/logicScene.json
- You can define more objects in
abe_sim/logicScene.json
- You can define more objects in
- In the root folder of this repository, run
python3 src/main.py
Alternatively, each component can be executed independently:
python3 mace4/run_mace4.py
: will evaluate the expression from expression.in against background_knowledge.in and sensors.in and write the models toresult.out
python3 src/evaluator.py
: will evaluate the expressions from themain()
function. Update the contents of this function to test different expressionspython3 src/converter.py
: will convert the sentences from themain()
function to expressions that can be used to query the state or send commands to the robot using the abe_sim agent simulation in PyBullet
Sentence | Conversion |
---|---|
There are twice as many onions than carrots | {'type':'query','expressions':['|exists x0 (onion(x0)).| == 2 * |exists x0 (carrot(x0)).|']} |
There are twice as many onions than carrots | {'type':'query','expressions':['|exists x0 (vegetable(x0) & redOnion(x0)).| > |exists x0 (vegetable(x0) & -redOnion(x0)).|']} |
There are exactly 2 ovens | {'type':'query','expressions':['|exists x0 (oven(x0)).| == 2']} |
Sentence | Conversion |
---|---|
Fetch a couple of red chilli peppers | {'type':'command','expressions':[['|exists x1 (redChilliPepper(x1)).| >= 2']],'commands':['robot(x0) & redChilliPepper(x1) -> fetch(x0, x1).']} |
Cut several broccoli | {'type':'command','expressions':[['|exists x1 (broccoli(x1)).| >= 3']],'commands':['robot(x0) & broccoli(x1) & cuttingTool(x2) -> cut(x0, x1, x2).']} |
Line a baking tray with paper | {'type':'command','expressions':[['|exists x1 (bakingSheet(x1)).| >= 1','|exists x2 (bakingTray(x2)).| >= 1']],'commands':['robot(x0) & bakingSheet(x1) & bakingTray(x2) -> line(x0, x1, x2).']} |
For more examples, check train_data.csv.