Added docs
This commit is contained in:
parent
b219dcf60b
commit
0a9f200e97
@ -71,19 +71,6 @@ export class AbsoluteMotor extends TachoMotor {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset the current position as angle 0
|
|
||||||
* @method AbsoluteMotor#resetAngle
|
|
||||||
* @returns {Promise} Resolved upon successful completion of command (ie. once the motor is finished).
|
|
||||||
*/
|
|
||||||
public resetAngle () {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
const data = Buffer.from([0x81, this.portId, 0x11, 0x51, 0x02, 0x00, 0x00, 0x00, 0x00]);
|
|
||||||
this.send(data);
|
|
||||||
return resolve();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,13 @@ export class TachoMotor extends BasicMotor {
|
|||||||
this._brakeStyle = style;
|
this._brakeStyle = style;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the global acceleration time
|
||||||
|
* @method TachoMotor#setAccelerationTime
|
||||||
|
* @param {number} time How long acceleration should last (in milliseconds).
|
||||||
|
* @returns {Promise} Resolved upon successful completion of command (ie. once the motor is finished).
|
||||||
|
*/
|
||||||
public setAccelerationTime (time: number, profile: number = 0x00) {
|
public setAccelerationTime (time: number, profile: number = 0x00) {
|
||||||
const message = Buffer.from([0x81, this.portId, 0x11, 0x05, 0x00, 0x00, profile]);
|
const message = Buffer.from([0x81, this.portId, 0x11, 0x05, 0x00, 0x00, profile]);
|
||||||
message.writeUInt16LE(time, 4);
|
message.writeUInt16LE(time, 4);
|
||||||
@ -55,6 +62,12 @@ export class TachoMotor extends BasicMotor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the global deceleration time
|
||||||
|
* @method TachoMotor#setDecelerationTime
|
||||||
|
* @param {number} time How long deceleration should last (in milliseconds).
|
||||||
|
* @returns {Promise} Resolved upon successful completion of command (ie. once the motor is finished).
|
||||||
|
*/
|
||||||
public setDecelerationTime (time: number, profile: number = 0x00) {
|
public setDecelerationTime (time: number, profile: number = 0x00) {
|
||||||
const message = Buffer.from([0x81, this.portId, 0x11, 0x06, 0x00, 0x00, profile]);
|
const message = Buffer.from([0x81, this.portId, 0x11, 0x06, 0x00, 0x00, profile]);
|
||||||
message.writeUInt16LE(time, 4);
|
message.writeUInt16LE(time, 4);
|
||||||
@ -66,6 +79,7 @@ export class TachoMotor extends BasicMotor {
|
|||||||
* Set the motor speed.
|
* Set the motor speed.
|
||||||
* @method TachoMotor#setSpeed
|
* @method TachoMotor#setSpeed
|
||||||
* @param {number} speed For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.
|
* @param {number} speed For forward, a value between 1 - 100 should be set. For reverse, a value between -1 to -100. Stop is 0.
|
||||||
|
* @param {number} time How long the motor should run for (in milliseconds).
|
||||||
* @returns {Promise} Resolved upon successful issuance of the command.
|
* @returns {Promise} Resolved upon successful issuance of the command.
|
||||||
*/
|
*/
|
||||||
public setSpeed (speed: [number, number] | number, time: number | undefined) {
|
public setSpeed (speed: [number, number] | number, time: number | undefined) {
|
||||||
@ -138,6 +152,20 @@ export class TachoMotor extends BasicMotor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset zero to current position
|
||||||
|
* @method TachoMotor#resetZero
|
||||||
|
* @returns {Promise} Resolved upon successful completion of command (ie. once the motor is finished).
|
||||||
|
*/
|
||||||
|
public resetZero () {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
const data = Buffer.from([0x81, this.portId, 0x11, 0x51, 0x02, 0x00, 0x00, 0x00, 0x00]);
|
||||||
|
this.send(data);
|
||||||
|
return resolve();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected useProfile () {
|
protected useProfile () {
|
||||||
let value = 0x00;
|
let value = 0x00;
|
||||||
if (this.useAccelerationProfile) {
|
if (this.useAccelerationProfile) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user