Coder Social home page Coder Social logo

hri-quantifiers's Introduction

HRI-Quantifiers

Installation

  • Recommended OS: Linux
  • Python 3.10
  • Add the mace4/bin directory to PATH:
    • Open the ~/.bashrc file (e.g., by running nano ~/.bashrc), add the following line at the end of it: export PATH="[...]:$PATH", where [..] should be replaced with the absolute path of the bin folder (e.g., export PATH="/home/user/HRI-Quantifier/mace4/bin:$PATH")
    • Save the file and load the new $PATH executing source ~/.bashrc
  • Add the value of OPENAI_API_KEY in .env or use the mocked mode by setting IS_OPENAI_CALL_MOCKED to true
  • requests: pip install requests
  • python-dotenv: pip install python-dotenv
  • OpenAI: pip install --upgrade openai
  • abe_sim: https://github.com/mpomarlan/abe_sim

Execution

  1. In the src folder of abe_sim, run python3 ./runBrain.py -g -l ./abe_sim/logicScene.json
    • You can define more objects in abe_sim/logicScene.json
  2. In the root folder of this repository, run python3 src/main.py

Testing

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 to result.out
  • python3 src/evaluator.py: will evaluate the expressions from the main() function. Update the contents of this function to test different expressions
  • python3 src/converter.py: will convert the sentences from the main() 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

Examples

Queries

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']}

Commands

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.

Article

https://arxiv.org/abs/2308.13192

hri-quantifiers's People

Contributors

stefanmorar avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

apgroza

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.