-
Notifications
You must be signed in to change notification settings - Fork 15
node_server
Node.js API Server for HR-OSX Humanoid Robots
This project allows the use of a Node.js API Server. This node_server project connects to the HR-OSX-Framework libraries via Linux/build/api_wrapper/api_wrapper.so The api_wrapper.so has basic high-level functions of the robot exposed to the node_server API, allowing users to send high-level commands such as "walk on/off, walk forward/back X speed, Turn left/right Y degree/sec, play action page X, etc"
It uses a socket server connection over IP to communicate with a Hello World app on a remote device (Android Tablet, etc).
Ensure these are installed via root user or sudo.
Dependencies: (installed via package.json file)
- node.js http://nodejs.org
- python v 2.7
- make
- GCC
Change Directory to your node_server project folder:
$ cd path/to/HROSXFramework/Linux/project/node_server
Install dependencies via npm install, using package.json file within node_server:
$ npm install
This installs socket.io, ffi, node-gyp, and grunt.
To launch the node_server app.js program:
$ node app.js
You can use the socket.io npm module to send requests to the node server.
See client side javascript API
See client side javascript API hello world
Basic syntax:
socket.emit('command', parameter)
socket.emit('initialize')
Sets core actions, initializes the servos and sits the robot
socket.emit('servoshutdown')
Sits robot and turns off servos
socket.emit('disconnect')
Safely disconnect from server (sits robot)
socket.emit('action', integer/string)
Calls page number from rme, or string name from list of core actions
socket.emit('walktoggle', bool)
Turns on or off walking engine (first plays the walking stance action)
socket.emit('walking', {x:x, y:y})
Takes json element in x an y integer coords and sends them to the walking engine (-255,255)
socket.on('batterylevel', batteryLevel)
Gives client current battery level (currently implemented but unsure of results meaning)
If you would like to build a minimal version of the node server, dev dependencies are required:
$ npm install --dev
Lint node.js install:
$ grunt
To launch the minimized node_server app.js program:
$ node node-app.min.js
-
HR-OS5 Humanoid Research Robot
- Use upstart to start node server
-
HR-OS1 Humanoid Robot
- Use init.d to start node server
Guides & General Info
HR-OS5 Framework
HR-OS5 Projects
Ubuntu Dependencies & Notes