AI-Planning / strips-js-client

Turns the STRIPS npm module into a client-side library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Strips-JS-Client

A simple tool to allow for the use of the STRIPS library client-side!
Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. License
  5. Contact

About The Project

STRIPS is an awesome library that allows us to interact with PDDL files in many useful ways. However, due to it's dependency on loading the grammar for parsing using the NPM FS library, we're unable to use it client-side within a browser. In an effort to circumvent this, I've written a script that fetches the grammar using node, then uses browserify to compile that into a file that will allow the calling of STRIPS in-browser!

Built using

Getting Started

To get up and running:

Prerequisites

Ensure that both strips and Browserify are installed on your machine.

  • Strips

    npm install strips
  • Browserify

    npm install browserify

Installation

  1. Clone the repo
    git clone https://github.com/AI-Planning/strips-js-client
  2. Give the compile.sh script execution permissions
    chmod +x compile.sh
  3. Execute the compile.sh script to generate the strips.js file
    ./compile.sh
  4. Place the generated strips.js file as a script into your html file
    <script src="strips.js"></script>
  5. You can now include scripts that call and use the strips library client-side!

Usage

In your js files, usage is quite simple:

The updated methods that allow for the loading of PDDL files have slightly different names for distinction.

The main one is:

loadFromString(domain, problem, callback)
  • It is used in the exact same way as the (load) function in the STRIPS library, with a callback that returns the parsed PDDL domain and problem as JSON objects that can be used within the library.
  • Once parsed, the usage is exactly the same
  • Note: There is no need to (require('strips')) at the top of the file

Currently, the function only supports domain and problem input in the form of strings, not file paths. This is due to the fact that we can't read files from the browser.

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Cam Cunningham - camcunningham188@gmail.com

Project Link: https://github.com/AI-Planning/strips-js-client

About

Turns the STRIPS npm module into a client-side library.

License:MIT License


Languages

Language:JavaScript 95.4%Language:Shell 4.6%