A simple tool to allow for the use of the STRIPS library client-side!
Report Bug
·
Request Feature
Table of Contents
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!
To get up and running:
Ensure that both strips and Browserify are installed on your machine.
-
Strips
npm install strips
-
Browserify
npm install browserify
- Clone the repo
git clone https://github.com/AI-Planning/strips-js-client
- Give the compile.sh script execution permissions
chmod +x compile.sh
- Execute the compile.sh script to generate the strips.js file
./compile.sh
- Place the generated strips.js file as a script into your html file
<script src="strips.js"></script>
- You can now include scripts that call and use the strips library client-side!
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.
Distributed under the MIT License. See LICENSE
for more information.
Cam Cunningham - camcunningham188@gmail.com
Project Link: https://github.com/AI-Planning/strips-js-client