Differential drive (#164)
* clear sync speed cmd * differential drive model * use cm/s * fixed aggressive clearing of motor sync command * better computation of turn artio * improved robot dimensions * moving block up * hanbdle infinite case * correct handling of inifinte time/step * better stop handling
This commit is contained in:
@ -80,6 +80,7 @@ namespace pxsim {
|
||||
|
||||
stop() {
|
||||
this.started = false;
|
||||
this.clearSpeedCmd();
|
||||
}
|
||||
|
||||
start() {
|
||||
@ -145,14 +146,17 @@ namespace pxsim {
|
||||
const dstep = this.speedCmd == DAL.opOutputTimeSync
|
||||
? pxsim.U.now() - this.speedCmdTime
|
||||
: this.tacho - this.speedCmdTacho;
|
||||
if (dstep < stepsOrTime)
|
||||
// 0 is special case, run infinite
|
||||
if (!stepsOrTime || dstep < stepsOrTime)
|
||||
this.speed = speed;
|
||||
else {
|
||||
if (brake) this.speed = 0;
|
||||
this.clearSpeedCmd();
|
||||
}
|
||||
// send synched motor state
|
||||
otherMotor.speed = Math.floor(this.speed * turnRatio / 100);
|
||||
otherMotor.speed = Math.floor(this.speed * turnRatio / 100);
|
||||
if (!this._synchedMotor)
|
||||
otherMotor.clearSpeedCmd();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user