C2LC-89: Wait on empty ('none') program steps for a period of time

Description

Rather than skipping over immediately.

Comments

  • Daniel Cho commented 2019-12-09T16:45:47.634-0500

    Now ‘none’ is not just a place holder when program is running, I am wondering if we need ProgramUtils.trimEnd, in case users want to create multiple ‘none’ blocks and then use a command block – later on if that command block is deleted, all the ‘none’ blocks those were created will be deleted as well.

  • Daniel Cho commented 2019-12-10T14:42:01.159-0500

    Possible approach would be add ‘none’ command handler to interpreter from the dashDriver:

    this.interpreter.addCommandHandler('none', 'dash',
                        this.dashDriver.none.bind(this.dashDriver));
    

    And specify none() in DashDriver class as:

    none(): Promise<void> {
            return this.sendCommand(
                [],
                1900
            );
        }
    
  • Simon Bates commented 2019-12-10T15:50:59.347-0500

    Implementing the ‘none’ handler separate from Dash would give us more flexibility when we support multiple robots. I’m thinking something like:

    this.interpreter.addCommandHandler(
        'none',
        'noneHandler',
        () => {
            return new Promise((resolve, reject) => {
                setTimeout(() => {
                    resolve();
                }, 1900);
            });
        }
    );
    
  • Simon Bates commented 2019-12-10T15:52:27.563-0500

    And probably a good idea to extract the timeout (1900) and store that somewhere separate from the handler, like in the App state.

  • Daniel Cho commented 2019-12-10T15:53:34.015-0500

    Ah, that’s really good idea! I didn’t think about using anonymous function to return promise like that.

  • Daniel Cho commented 2019-12-11T10:36:34.109-0500

    Thanks Simon! I used your implementation for this work, and the code is working perfectly.

  • Michelle D'Souza commented 2020-01-22T15:13:07.075-0500

    Given the design changes for 0.3, it doesn’t make sense to do this task for 0.2.