Single tank (#891)
* add note about dual blocks * fix simulator to match hardware * updated wording
This commit is contained in:
parent
bcb682b602
commit
a302bbfc2b
@ -39,6 +39,13 @@ motors.largeBC.steer(-15, -75)
|
||||
|
||||
## ~
|
||||
|
||||
## ~ hint
|
||||
|
||||
Only one set of synchronized motors will run at the same time. Once you launch tank/steer, it will cancel any existing synchronized speed command.
|
||||
|
||||
## ~
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
### Make a slight right
|
||||
|
@ -35,6 +35,12 @@ motors.largeBC.tank(-75, -75)
|
||||
|
||||
## ~
|
||||
|
||||
## ~ hint
|
||||
|
||||
Only one set of synchronized motors will run at the same time. Once you launch tank/steer, it will cancel any existing synchronized speed command.
|
||||
|
||||
## ~
|
||||
|
||||
## Examples
|
||||
|
||||
### Tank forward and backward
|
||||
|
@ -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)
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user