Single tank (#891)

* add note about dual blocks

* fix simulator to match hardware

* updated wording
This commit is contained in:
Peli de Halleux
2019-08-29 13:11:01 -07:00
committed by GitHub
parent bcb682b602
commit a302bbfc2b
4 changed files with 24 additions and 0 deletions

View File

@ -65,6 +65,11 @@ namespace pxsim {
delete this._synchedMotor;
}
clearSyncCmd() {
if (this._synchedMotor)
this.clearSpeedCmd();
}
setLarge(large: boolean) {
this.id = large ? NodeType.LargeMotor : NodeType.MediumMotor;
// large 170 rpm (https://education.lego.com/en-us/products/ev3-large-servo-motor/45502)

View File

@ -80,6 +80,12 @@ namespace pxsim {
const brake = pxsim.BufferMethods.getNumber(buf, BufferMethods.NumberFormat.Int8LE, 12);
const motors = ev3board().getMotor(port);
// cancel any other sync command
for(const motor of ev3board().getMotors().filter(motor => motors.indexOf(motor) < 0)) {
motor.clearSyncCmd()
}
// apply commands to all motors
for (const motor of motors) {
const otherMotor = motors.filter(m => m.port != motor.port)[0];
motor.setSyncCmd(