appliying manual speed
This commit is contained in:
parent
e93e659e8a
commit
0dd5ab9bde
@ -17,6 +17,8 @@ namespace pxsim {
|
||||
private speedCmdTime: number;
|
||||
private _synchedMotor: MotorNode; // non-null if synchronized
|
||||
|
||||
private manualSpeed: number = 0;
|
||||
|
||||
constructor(port: number, large: boolean) {
|
||||
super(port);
|
||||
this.setLarge(large);
|
||||
@ -97,15 +99,14 @@ namespace pxsim {
|
||||
}
|
||||
|
||||
manualMotorDown() {
|
||||
|
||||
}
|
||||
|
||||
manualMotorMove(angle: number) {
|
||||
|
||||
manualMotorMove(speed: number) {
|
||||
this.manualSpeed = speed;
|
||||
}
|
||||
|
||||
manualMotorUp() {
|
||||
|
||||
this.manualSpeed = undefined;
|
||||
}
|
||||
|
||||
updateState(elapsed: number) {
|
||||
@ -121,6 +122,7 @@ namespace pxsim {
|
||||
}
|
||||
|
||||
private updateStateStep(elapsed: number) {
|
||||
if (!this.manualSpeed) {
|
||||
// compute new speed
|
||||
switch (this.speedCmd) {
|
||||
case DAL.opOutputSpeed:
|
||||
@ -194,6 +196,10 @@ namespace pxsim {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.speed = this.manualSpeed;
|
||||
}
|
||||
this.speed = Math.round(this.speed); // integer only
|
||||
|
||||
// compute delta angle
|
||||
|
Loading…
Reference in New Issue
Block a user