Microsoft MakeCode

Abnormal behaviour with 'run in parallel' with motorD

I am trying out MakeCode EV3 and I found an abnormal behaviour when I tried to run motorD and motorB at the same time. In the example code, I expected both motors to complete one revolution simultaneously before the program exit. The simulator does exactly that but the robot does not turn the motors as expected. The motors did not seem to turn at all.

control.runInParallel(function () {
    motors.mediumD.run(50, 1, MoveUnit.Rotations)
})
motors.largeB.run(50, 1, MoveUnit.Rotations)
brick.exitProgram()

However, if I replace motorD with motorA, the robot behaves as expected and both motors will complete one revolution simultaneously before the program exit.

control.runInParallel(function () {
    motors.mediumA.run(50, 1, MoveUnit.Rotations)
})
motors.largeB.run(50, 1, MoveUnit.Rotations)
brick.exitProgram()

Did I miss something here?

Could you describe briefly the hardware configuration to reproduce this? Medium motor on A/D and large on B?

(Looks like we need a better way to run in parallel and merge threads).

I tried messing with runInParallel a while back and found the scheduler was less then ideal to say the least. The brick is a single core AFAK so at the end of the day you are only really going to do 1 thing at a time. I had some success by doing something like this:

control.runInParallel(function () {
while(motors.mediumA.Angle() < 360)  /// or whatever you want for rotations
{
    motors.mediumA.run(50);
    pause(1);
}
motors.mediumA.stop();
})

without a pause both motors fail to run correctly. It seems like there is an issue with proper time slices for each thread. For what I’ve seen, right now it is better to keep everything in the same thread and maybe start a motor without rotation value and start the other motor then monitor each motors rotations in the same loop.

Medium motor on A and D.
Large motor on B and C.
Color Sensors on 3 and 4.

I was trying to duplicate programs (for FLL City Shaper) that were made with EV3 mindstorm. I find MakeCode to be very good. My robot performs similarly with both Mindstorm and MakeCode except for the problem report above.