Giter VIP home page Giter VIP logo

fluentnao's Introduction

FluentNao

Control Nao using fluent stanza of python code.

Example Code

Example code using Fluent Nao

# zero out joints
nao.zero().go()

# arms up
nao.say("raising my hands") 
nao.arms.up()
nao.go() 

# hands open
nao.say("opening my hands") 
nao.hands.open()
nao.go() 

Duration of Movement

You can specify a number of seconds to take for each command or stanza. We use the setDuration() to set the duration globally for every function that follows

# sets duration to half a second 
nao.set_duration(.5)

We can override the default duration in each motion function

# open hands in half a second
nao.hands.open()

# put arms out in 4 seconds
nao.arms.out(4)
nao.go()

NOTE: passing in a duration of 0 will be ignored

Offsets

You can offset any motion, adding more or less degrees of movement. For example

# zero out joints
nao.zero().go()

# put arms up minus 30 degrees
nao.arms.up(0, -30)

NOTE: the zero is duration telling the api to ignore that argument;

In Choregraphe

To use FluentNao in choregraphe, check out the example behavior ./examples/choregraphe/fluentnao.crg

This behavior includes the FluentNao modules and classes as project references. It contains the python code needed to import and use FluentNao.

In Python Interactive Shell

Try FluentNao in an python interactive shell, directly against a Nao on your local network 'nao.local'

First download the correct python sdk from the nao developers site to your computer

Then clone the FluentNao repository as well.

Include NaoUtil, FluentNao and the Python SDK in your python path; I put the following in my .bashrc

export PYTHONPATH=$PYTHONPATH:$HOME/development/opensource/FluentNao/src/main/python/naoutil
export PYTHONPATH=$PYTHONPATH:$HOME/development/opensource/FluentNao/src/main/python/fluentnao
export PYTHONPATH=$PYTHONPATH:$HOME/development/opensource/pynaoqi-python-2.7-naoqi-1.14-linux64

Then from the FluentNao folder run the following command

python -i bootstrap.py

That loads up the interactive python prompt and you can begin executing FluentNao commands directly against nao

nao.say('wow this is awesome')

Contributing

I'm developing in Sublime Text 2 and Eclipse.

  1. Clone the github repository
  2. Check out ./examples/choregraphe/development/fluentnao_dev.crg

This behavior will run FluentNao modules and classes from your clone of the repository. This behavior can run the FluentNao modules and classes against the local naoqi or the simulator. When you update FluentNao, everything will be reloaded and changes will take effect immediately.

NOTE: you must update pathToFluentNao in the FluentNao Script Box

fluentnao's People

Contributors

dnajd avatar davesnowdon avatar

Watchers

James Cloos avatar Akshay Narayan 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.