Git Product home page Git Product logo

owylviz's Introduction

Owylviz

Visualize the structure and activity of your Owyl behavior tree.

Installation

$ pip2 install git+https://github.com/hansonrobotics/owylviz

or

$ git clone https://github.com/hansonrobotics/owylviz
$ python2 owylviz/setup.py install

Usage

Create an owylviz.OwylTree instance with your owyl tree (without the root owyl.visit node) as the argument.

t = owyl.succeed()
viztree = owylviz.OwylTree(t)

Pick a unique room name for your tree and connect to a visualization server.

from owylviz import Connection
viztree.connect(Connection('myroom'))

## You can have your room name automatically generated instead.
# viztree.connect()

## Or connect to a locally started web server.
# viztree.connect(Connection('myroom', 'localhost', 3000))

Open http://owylviz.herokuapp.com/myroom to see your tree.

If you want your tree to indicate which nodes are being iterated, don't visit your regular tree, but use viztree.tree_with_hooks instead.

v = owyl.visit(viztree.tree_with_hooks)
v.next()

Full Example

import owyl, time
from owylviz import OwylTree, Connection

t = owyl.repeatAlways(owyl.sequence(owyl.selector(owyl.fail(),
                                                  owyl.succeed(),
                                                  owyl.succeed()),
                                    owyl.sequence(owyl.flip(owyl.failAfter(after=5)),
                                                  owyl.succeed()),
                                    owyl.succeed(),
                                    owyl.fail(),
                                    owyl.sequence(owyl.succeed(),
                                                  owyl.succeed())))

viztree = OwylTree(t)
viztree.connect(Connection('myroom'))
v = owyl.visit(viztree.tree_with_hooks)

while True:
  v.next()
  time.sleep(0.2)

Example

Testing

$ python setup.py test

Server

Owylviz python library communicates with a custom Nodejs web app, the source code of which is stored in the server folder. An instance of that web app runs at http://owylviz.herokuapp.com and can be used by multiple users simultaneously.

But if you wish to run your own instance, you can do that locally.

$ cd owylviz/server
$ npm install
$ node index.js

Or deploy to your own heroku account.

$ cd owylviz
$ heroku create
$ git subtree push --prefix server heroku master
Copyright (c) 2013-2014 Hanson Robotics, Ltd.

owylviz's People

Contributors

gaboose avatar linas avatar

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.