Skip to content

dalner/HROS-node-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Socket Connection Client API Socket Connection Client API gives you an easy to use javascript function API calls to manage the underlying socket.io connections. It helps manage dropped socket connections, state changes and other diagnostic information. It will be extended to support other items as the node server development and its API progresses.

#Maintainer Daniel Alner
dalner.dev@gmail.com

#Getting started First install all dependencies using npm:

$ npm install

This will install all necessesary dependencies such as

  • grunt
  • grunt-contrib-jshint
  • grunt-contrib-nodeunit
  • grunt-contrib-uglify

Following successful install, run grunt:

$ grunt

This will build the minified API into the build folder and into the hello world folder.

#Functions First create a new object:

var varName = new HROS_JS();

##"Public" Variables

  • ConnectionStatus Returns an integer value "enum" of type ConnectedStates which is also a "public" variable. Its states are as follows:
    • CONNECTED (0)
    • DISCONNECTED (1)
    • CONNECTING (2)
    • FAILED (3)
// get connection status
var status = varName.ConnectionStatus();

// compare connection status to "enum"
if(status === varName.ConnectedStates.DISCONNECTED)
  • CurrentAction Partial Implementation
    • This will return what it is currently doing. As a partial implementation, it will only return a NOTHING state or WALKING state. The ACTION state needs to be implemented but there needs to be a communcation back as to when the action starts and stops.

This also returns a "enum" of type ActionStates which have the following variables:

  • ACTION (0)
  • WALKING (1)
  • NOTHING (2)
// get Current Action State
var CurrentActionState = varName.CurrentActionStatus()

// comparing action states
if(CurrentActionState === varName.ActionStates.WALKING)

##General/Options

  • Connect takes an ip address, and attempts to connect to it 10 times before it sets ConnectionStatus to a failed state.
varName.Connect('192.168.1.2');
  • Initialize servos
varName.Initialize();

##Actions

  • Play action by name stored in nodeJS server (which links page # to name)
varName.PlayAction('sit');

##Walk

  • Toggle walk, if walking, stop, otherwise start - Cannot start walking if in middle of action - Cannot do actions while walking
varName.ToggleWalk();
  • Walk Position send x & y coordinates make robot walk forward, backward, left & right - Safely you can go from +50 to -50 but the variables can range from +255 to -255 however, the greater the value coordinates the faster the robot walks
varName.WalkPosition(x,y);

##Diagnostics Diagnostics is still a continued effort. While there are function placeholders here, they are currently unimplemented. However, once implemented, they will look something like this.

##Servo Diagnostics UNIMPLEMENTED This will likely return various states of the servos, such as ERROR, DISCONNECTED, STABLE, HOT etc.

var servoValues = varName.CheckServos()

##Battery Levels Returns an integer value, testing required to understand meaning.

var servoValues = varName.BatteryLevel()

About

Client side node server on HROS Framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published