Rapiro
Allows user to interact with the Rapiro robot using Cylon.js.
For more information click here.
How To Connect
Connecting to the Rapiro uses a simple serial port protocol. You will need to know which serial port the Rapiro's board is connected to.
var Cylon = require('cylon'); Cylon.robot({ connections: { rapiro: { adaptor: 'rapiro', port: '/dev/ttyACM0' } }, devices: { rapiro: { driver: 'rapiro' } }, });
How To Use
Example of a simple program that makes the Rapiro's LED blink.
var Cylon = require('cylon'); Cylon.robot({ connections: { rapiro: { adaptor: 'rapiro', port: '/dev/ttyUSB0' } }, devices: { rapiro: { driver: 'rapiro' } }, work: function(my) { var on = false; every((1).second(), function() { if (on == true) { my.rapiro.led(0, 0, 0); on = false; } else { my.rapiro.led(255, 0, 0); on = true; } }); }
Commands
move
Makes the Rapiro move, the specific movement is dependent on the provided motion number.
Params
-
motionNumber (
Number
) which movement to make
Returns
- (
undefined
)
stop
Makes the Rapiro stop moving
Returns
- (
undefined
)
forward
Makes the Rapiro move forward
Returns
- (
undefined
)
backward
Makes the Rapiro move backward
Returns
- (
undefined
)
right
Makes the Rapiro move to the right
Returns
- (
undefined
)
left
Makes the Rapiro move to the left
Returns
- (
undefined
)
happy
Makes the Rapiro make a 'happy' expression
Returns
- (
undefined
)
unhappy
Makes the Rapiro make a 'unhappy' expression
Returns
- (
undefined
)
concerned
Makes the Rapiro make a 'concerned' expression
Returns
- (
undefined
)
mad
Makes the Rapiro make a 'mad' expression
Returns
- (
undefined
)
push
Makes the Rapiro make a 'push' motion
Returns
- (
undefined
)
led
Sets the Rapiro's LED color
Params
-
r (
Number
) red value -
g (
Number
) green value -
b (
Number
) blue value
Returns
- (
undefined
)
setServo
Sets the angle of a specific Rapiro servo
The servos are:
- 0: Head
- 1: waist
- 2: right shoulder roll
- 3: right shoulder pitch
- 4: right hand
- 5: left shoulder roll
- 6: left shoulder pitch
- 7: left hand
- 8: right foot yaw
- 9: right foot pitch
- 10: left foot yaw
- 11: left foot pitch
Params
-
servo (
Number
) which servo to write to -
angle (
Number
) angle to set
Returns
- (
undefined
)
head
Sets the angle of Rapiro's head servo
Params
-
angle (
Number
) angle to set
Returns
- (
undefined
)
waist
Sets the angle of Rapiro's waist servo
Params
-
angle (
Number
) angle to set
Returns
- (
undefined
)
rightShoulderRoll
Sets the angle of Rapiro's right shoulder roll servo
Params
-
angle (
Number
) angle to set
Returns
- (
undefined
)
rightShoulderPitch
Sets the angle of Rapiro's right shoulder pitch servo
Params
-
angle (
Number
) angle to set
Returns
- (
undefined
)
rightHand
Sets the angle of Rapiro's right hand servo
Params
-
angle (
Number
) angle to set
Returns
- (
undefined
)
leftShoulderRoll
Sets the angle of Rapiro's left shoulder roll servo
Params
-
angle (
Number
) angle to set
Returns
- (
undefined
)
leftShoulderPitch
Sets the angle of Rapiro's left shoulder pitch servo
Params
-
angle (
Number
) angle to set
Returns
- (
undefined
)
leftHand
Sets the angle of Rapiro's left hand servo
Params
-
angle (
Number
) angle to set
Returns
- (
undefined
)
rightFootYaw
Sets the angle of Rapiro's right foot yaw servo
Params
-
angle (
Number
) angle to set
Returns
- (
undefined
)
rightFootPitch
Sets the angle of Rapiro's right foot pitch servo
Params
-
angle (
Number
) angle to set
Returns
- (
undefined
)
leftFootYaw
Sets the angle of Rapiro's left foot yaw servo
Params
-
angle (
Number
) angle to set
Returns
- (
undefined
)
leftFootPitch
Sets the angle of Rapiro's left foot pitch servo
Params
-
angle (
Number
) angle to set
Returns
- (
undefined
)