MotionDriver
Extends:
Driver enables communication with Memristor's motion driver.
Constructor Summary
Public Constructor | ||
public |
constructor(name: *, config: *) |
Method Summary
Public Methods | ||
public |
Finish |
|
public |
getPosition(): Point Get position of the robot |
|
public |
goForward(millimeters: *): * this method was deprecated.
Move robot forward or backward depending on sign |
|
public |
init(): * Check driver by checking checking communication with motion driver board |
|
public |
moveToCurvilinear(position: misc.Point, direction: Number, tolerance: Number): * Move robot to absolute position but robot make curves to speed up motion. |
|
public |
moveToPosition(position: *, direction: *): * Move robot to absolute position |
|
public |
Request state, position and orientation from motion driver |
|
public |
reset() Reset all settings in motion driver |
|
public |
rotateTo(angle: *): * Rotate robot to given angle |
|
public |
setPositionAndOrientation(x: *, y: *, orientation: *) Reset position and orientation |
|
public |
setRefreshInterval(interval: *) Set required refresh interval of robot status. |
|
public |
setSpeed(speed: *) Set default speed of the robot |
|
public |
softStop(): * Stop robot by turning off motors. |
|
public |
stop(): * Stop the robot. |
Private Methods | ||
private |
_onDataReceived(buffer: *, type: *) Callback will be called when new packet is arrived and it will dispatch event to new callback depending on packet type |
|
private |
_onPReceived(buffer: *) Packet type P is received |
Public Constructors
public constructor(name: *, config: *) source
Params:
Name | Type | Attribute | Description |
name | * | {String} - Unique driver name |
|
config | * | {Object} - Configuration presented as an associative array |
Public Methods
public goForward(millimeters: *): * source
Move robot forward or backward depending on sign
Params:
Name | Type | Attribute | Description |
millimeters | * |
Return:
* |
public init(): * source
Check driver by checking checking communication with motion driver board
Return:
* |
public moveToCurvilinear(position: misc.Point, direction: Number, tolerance: Number): * source
Move robot to absolute position but robot make curves to speed up motion. This
command requires finishCommand()
before next motion command.
Return:
* |
public moveToPosition(position: *, direction: *): * source
Move robot to absolute position
Params:
Name | Type | Attribute | Description |
position | * | {misc.Point} - Required position of the robot |
|
direction | * | {Number} - Direction, can be MotionDriver.DIRECTION_FORWARD or MotionDriver.DIRECTION_BACKWARD |
Return:
* |
public rotateTo(angle: *): * source
Rotate robot to given angle
Params:
Name | Type | Attribute | Description |
angle | * | {Number} - Angle |
Return:
* |
public setPositionAndOrientation(x: *, y: *, orientation: *) source
Reset position and orientation
Params:
Name | Type | Attribute | Description |
x | * | {Number} - New X coordinate relative to start position of the robot |
|
y | * | {Number} - New Y coordinate relative to start position of the robot |
|
orientation | * | {Number} - New robot's orientation |
public setRefreshInterval(interval: *) source
Set required refresh interval of robot status. Note that it is required refresh interval and robot can choose to send or not depending on it's state.
Params:
Name | Type | Attribute | Description |
interval | * | {Number} - Period in milliseconds |
public setSpeed(speed: *) source
Set default speed of the robot
Params:
Name | Type | Attribute | Description |
speed | * | {Number} - Speed (0 - 255) |
Private Methods
private _onDataReceived(buffer: *, type: *) source
Callback will be called when new packet is arrived and it will dispatch event to new callback depending on packet type
Params:
Name | Type | Attribute | Description |
buffer | * | {Buffer} - Payload |
|
type | * | {String} - Packet type |
private _onPReceived(buffer: *) source
Packet type P is received
Params:
Name | Type | Attribute | Description |
buffer | * | {Buffer} - Payload |