Skip to content

Using the Command Bus #45

Open
Open

Description

@rapodaca

Section 8 (v2, rev 1) of the white paper talks about the "Command Bus":

Toast comes with a simple CommandBus implementation. The Command Bus is an interface
that takes in data from the Command Line (or a remote console) and passes it to Toast or the
appropriate module to be processed. This means modules can register their own commands
that invoke and action when used.

http://www.chiefdelphi.com/media/papers/3174?langid=1

I'd like to cause inputs on the simulator to change through external manipulation so that my code can respond to those changes. It sounds like this is what the Command Bus can do, but it's not clear how to access it.

Two questions:

  1. Is my understanding of the purpose of the Command Bus correct?
  2. How can I gain access the Command Bus interface? For example, should I try to ssh into the simulator? (have tried, but don't know port/username/password)

I've successfully installed ToastAPI on Ubuntu 16.04 using Eclipse, can run the simulator, and have written a few simple modules, all following the tutorials. But I'm new to programming the RoboRio, so it's possible I'm missing something obvious.

Activity

  1. JaciBrunning commented on May 27, 2016

    @JaciBrunning
    Member

    You are correct, you can use the command bus in that manner. You can access
    the command bus either through STDIN on the simulator, or running the
    gradlew toastConsole command on your development machine.

    To add your own commands, see the registration functions in the
    CommandBusclass. They must implement AbstractCommand, and examples can
    be found in the jaci.openrio.toast.core.command package.

    On Fri, 27 May 2016 10:48 Richard Apodaca notifications@github.com wrote:

    Section 8 (v2, rev 1) of the white paper talks about the "Command Bus":

    Toast comes with a simple CommandBus implementation. The Command Bus is an
    interface
    that takes in data from the Command Line (or a remote console) and passes
    it to Toast or the
    appropriate module to be processed. This means modules can register their
    own commands
    that invoke and action when used.

    http://www.chiefdelphi.com/media/papers/3174?langid=1

    I'd like to cause inputs on the simulator to change externally so that my
    code can respond to those changes. It sounds like this is what the Command
    Bus can do, but it's not clear how to access it.

    Two questions:

    1. Is my understanding of the purpose of the Command Bus correct?
    2. How can I gain access the Command Bus interface? For example,
      should I try to ssh into the simulator? (have tried, but don't know
      port/username/password)

    I've successfully installed ToastAPI on Ubuntu 16.04 using Eclipse, can
    run the simulator, and have written a few simple modules, all following the
    tutorials. But I'm new to programming the RoboRio, so it's possible I'm
    missing something obvious.

    —
    You are receiving this because you are subscribed to this thread.
    Reply to this email directly, view it on GitHub
    #45, or mute the thread
    https://github.com/notifications/unsubscribe/AJyG6OrBKB5MPcyPlstycgWEzJKIZurMks5qFluWgaJpZM4IoIHK
    .

  2. rapodaca commented on May 27, 2016

    @rapodaca
    Author

    Thanks for the quick response.

    In my project, I tried:

    $ ./gradlew toastConsole
    

    while the simulator was running (launched from Eclipse).

    I got back:

    Trying to override old definition of datatype scp
    Trying to override old definition of datatype sshexec
    :toastConsole
    Attempting via Hostname roboRIO-1000-frc.local...
    Client Disconnected
    > Building 0% > :toastConsole
    

    I get the same message regardless of the phase the simulator is in (Disabled, Autonomous, Teleop, Test).

    Do I need to configure my hosts file or change something else to make the roboRIO-1000-frc.local domain active?

    You can access the command bus either through STDIN ...

    Is that possible through Eclipse? If not, how would I run the project is such a way that I can enter commands through STDIN?

  3. rapodaca commented on May 27, 2016

    @rapodaca
    Author

    Regarding the second point, I think I've found the answer. Just type commands into the bottom "Console" window in Eclipse (looks read-only, but it will take commands).

    Using the help command I can see various commands through list, but none appear to be aimed at directly causing inputs to change value. Would this be something I need to add myself through a subclass of AbstractCommand? If so, are there any examples you can point me to? I found the four AbstractCommand subclasses in the jaci.openrio.toast.core.command package, but they don't seem to be aimed at manipulating inputs.

  4. JaciBrunning commented on May 27, 2016

    @JaciBrunning
    Member

    Yup, toastConsole is for a roborio connection. The eclipse console window
    is STDIN for simulation

    On Fri, 27 May 2016 13:26 Richard Apodaca notifications@github.com wrote:

    Regarding the second point, I think I've found the answer. Just type
    commands into the bottom "Console" window in Eclipse (looks read-only, but
    it will take commands).

    Using the help command I can see various commands through list, but none
    appear to be aimed at directly causing inputs to change value. Would this
    be something I need to add myself through a subclass of AbstractCommand? If
    so, are there any examples you can point me to? I found the four
    AbstractCommand subclasses in the jaci.openrio.toast.core.command
    package, but they don't seem to be aimed at manipulating inputs.

    —
    You are receiving this because you commented.

    Reply to this email directly, view it on GitHub
    #45 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe/AJyG6BOi1I_sxcyrkHUboOMgmUQshUyyks5qFoCGgaJpZM4IoIHK
    .

  5. JaciBrunning commented on May 27, 2016

    @JaciBrunning
    Member

    If you want to change inputs, you will need to write your own command. All
    the variables you need to change will be located in the SimulationData
    class

    On Fri, 27 May 2016 14:00 Jaci Brunning jaci.brunning@gmail.com wrote:

    Yup, toastConsole is for a roborio connection. The eclipse console window
    is STDIN for simulation

    On Fri, 27 May 2016 13:26 Richard Apodaca notifications@github.com
    wrote:

    Regarding the second point, I think I've found the answer. Just type
    commands into the bottom "Console" window in Eclipse (looks read-only, but
    it will take commands).

    Using the help command I can see various commands through list, but none
    appear to be aimed at directly causing inputs to change value. Would this
    be something I need to add myself through a subclass of AbstractCommand? If
    so, are there any examples you can point me to? I found the four
    AbstractCommand subclasses in the jaci.openrio.toast.core.command
    package, but they don't seem to be aimed at manipulating inputs.

    —
    You are receiving this because you commented.

    Reply to this email directly, view it on GitHub
    #45 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe/AJyG6BOi1I_sxcyrkHUboOMgmUQshUyyks5qFoCGgaJpZM4IoIHK
    .

  6. JaciBrunning commented on May 27, 2016

    @JaciBrunning
    Member

    If you like, submit a pull request to Toast if you want to add the command
    into the toast core

    On Fri, 27 May 2016 14:02 Jaci Brunning jaci.brunning@gmail.com wrote:

    If you want to change inputs, you will need to write your own command. All
    the variables you need to change will be located in the SimulationData
    class

    On Fri, 27 May 2016 14:00 Jaci Brunning jaci.brunning@gmail.com wrote:

    Yup, toastConsole is for a roborio connection. The eclipse console window
    is STDIN for simulation

    On Fri, 27 May 2016 13:26 Richard Apodaca notifications@github.com
    wrote:

    Regarding the second point, I think I've found the answer. Just type
    commands into the bottom "Console" window in Eclipse (looks read-only, but
    it will take commands).

    Using the help command I can see various commands through list, but
    none appear to be aimed at directly causing inputs to change value. Would
    this be something I need to add myself through a subclass of
    AbstractCommand? If so, are there any examples you can point me to? I found
    the four AbstractCommand subclasses in the
    jaci.openrio.toast.core.command package, but they don't seem to be
    aimed at manipulating inputs.

    —
    You are receiving this because you commented.

    Reply to this email directly, view it on GitHub
    #45 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe/AJyG6BOi1I_sxcyrkHUboOMgmUQshUyyks5qFoCGgaJpZM4IoIHK
    .

  7. rapodaca commented on May 27, 2016

    @rapodaca
    Author

    This makes a bit more sense now - thanks. I'm able to change values using the static setX methods on SimulationData. I'll look into making a few Commands.

    The ToastAPI document states: "For example, a team may use the CommandBus to define the layout of the Outer Works in the 2016 Stronghold Tournament (hint, hint)."

    That sounds intriguing, but I'm not sure I follow. Can you point me to a simple example that would illustrate using the Command Bus to define a "layout" of a game field? I'm somewhat familiar with Stronghold.

    Aside from what's outlined in the "Contributing to Toast" document, are there any requirements around unit tests or some other QA for pull requests?

  8. JaciBrunning commented on May 27, 2016

    @JaciBrunning
    Member

    We used the CommandBus to set the outerworks layout this year in our code, but the change was later reverted in favour of a WebUI. The arguments passed to the invokeCommand method can be used to gather arguments for the command (i.e. if I type myCommand someText someOtherText, the args parameter will be an array of [someText, someOtherText]. With some clever code, this can be used to configure the layout of the Outer Works before a match, if your autonomous relies on it.

    There are no other requirements around contributing to Toast. I leave it with good faith in the community that if the initial travis build passes, and I give it a quick lookover that the PR is good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions