MotionDriver
Extends:
Driver enables communication with Memristor's motion driver.
Constructor Summary
Public Constructor | ||
public |
constructor(name: String, config: Object) |
Method Summary
Public Methods | ||
public |
Finish |
|
public |
getPosition(): misc.Point Get position of the robot |
|
public |
this method was deprecated.
Move robot forward or backward depending on sign |
|
public |
async init(): * Check driver by checking checking communication with motion driver board |
|
public |
moveToCurvilinear(position: misc.Point, direction: Number, radius: Number, tolerance: Number): * Move robot to absolute position but robot make curves to speed up motion. |
|
public |
moveToPosition(position: misc.Point, direction: Number): * Move robot to absolute position |
|
public |
Request state, position and orientation from motion driver |
|
public |
reset() Reset all settings in motion driver |
|
public |
Rotate for given angle |
|
public |
Rotate robot to given angle |
|
public |
setPositionAndOrientation(x: *, y: *, orientation: *) Reset position and orientation |
|
public |
Set default speed of the robot |
|
public |
softStop(): * Stop robot by turning off motors. |
|
public |
stop(): * Stop the robot. |
Private Methods | ||
private |
_onDataReceived(buffer: Buffer, type: String) Callback will be called when new packet is arrived and it will dispatch event to new callback depending on packet type |
|
private |
_onPReceived(buffer: Buffer) Packet type P is received |
Public Constructors
public constructor(name: String, config: Object) source
Params:
Name | Type | Attribute | Description |
name | String | Unique driver name |
|
config | Object | Configuration presented as an associative array |
|
config.startPosition | strategy.TunedPoint |
|
X coordinate for start position |
config.startOrientation | strategy.TunedAngle |
|
Start orientation |
config.startSpeed | Number |
|
Initial speed |
config.refreshDataPeriod | Number |
|
Get state from motion driver every |
config.connectionTimeout | Number |
|
Connection timeout in ms |
config.ackTimeout | Number |
|
Acknowledgment timeout |
Public Methods
public getPosition(): misc.Point source
Get position of the robot
Return:
misc.Point | Position of the robot |
public goForward(millimeters: Number): * source
Move robot forward or backward depending on sign
Params:
Name | Type | Attribute | Description |
millimeters | Number |
Return:
* |
public async init(): * source
Check driver by checking checking communication with motion driver board
Return:
* |
public moveToCurvilinear(position: misc.Point, direction: Number, radius: 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: misc.Point, direction: Number): * 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 rotateFor(angle: Number): Promise source
Rotate for given angle
Params:
Name | Type | Attribute | Description |
angle | Number |
public rotateTo(angle: Number): Promise source
Rotate robot to given angle
Params:
Name | Type | Attribute | Description |
angle | Number | Angle |
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 setSpeed(speed: Number) source
Set default speed of the robot
Params:
Name | Type | Attribute | Description |
speed | Number | Speed (0 - 255) |
Private Methods
private _onDataReceived(buffer: Buffer, type: String) 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: Buffer) source
Packet type P is received
Params:
Name | Type | Attribute | Description |
buffer | Buffer | Payload |