Announcement

Collapse
No announcement yet.

MDX and COM big update

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • MDX and COM big update

    Ok, MDX now has the ability to control programs through their COM interface as well as be controlled by other programs through the MDX COM interface.

    New FCC here: <EDIT> Built into MDX now </EDIT>

    <EDIT> See post #13 for more syntax details</EDIT>

    There are still some little things I need to clean up for a full update through the updater, but it should be stable.

    So changes to the com section of the xml file. There are now 2 sections like below:

    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    <FusionControlCentreConfiguration ...>
       ...
      <require>
         ...
      </require>
    
      <speech ...>
         ...
      </speech>
    
      <general>
         ...
        <com status="enabled">
          <commands>
            <command id="RoadRunnerCommand" minimum_delta_vote_time="100">
              <do function="trigger output" functionTargetID="Digital Output 0" vote_opinion="on" vote_priority="medium"></do>
              <do function="trigger output" functionTargetID="Digital Output 1" vote_opinion="on" vote_priority="medium"></do>
            </command>
          </commands>
          <executable_commands>
            <external_COM_id id="RoadRunner.SDK">
              <command internal_id="RoadRunnerCommand_PLAY" external_command="Execute">
                <parameter order="0" external_command_parameter="PLAY" />
              </command>
            </external_COM_id>
          </executable_commands>
        </com>
         ...
      </general>
    
      <graphics>
         ...
      </graphics>
    
      <io>
         ...
      </io>
    
      <logic>
         ...
      </logic>
       ...
    </FusionControlCentreConfiguration>
    Notice the bold section. This is what has been added. Also I am hoping that the xml structure being fully outlined will be easier for people to see what's going on and where this code is in relation to the root.

    Every external_COM_id is a different program. You could have multiple external_COM_id pointing to the same program, but that could cause instance problems, and would take more memory and defeat the purpose.

    In the external_COM_id the id is what the external program needs to be referenced as. In the case of RoadRunner, it is "RoadRunner.SDK". I havent experimented with it enough to know if RR needs it to be case sensitive, but MDX will honour case for everything in this section.

    Child nodes of external_COM_id are the commands that MDX will send. Each command has an internal and external command name.

    Internal is what is used by MDX to find this specific command pointing to this specific program and with these specific parameters.

    The external is what is required by the external program. With RoadRunner, it is "Execute" as far as I know and it works with the build I have.

    The parameters are each child node of command labelled parameter. The order they are based off of is the number in the order attribute, NOT the order in which they appear in the file to allow for greater expandability.

    Now to call this code and have the command send to the program (in this case Execute("PLAY") being sent to RoadRunner), you need to raise a vote with the function of "external command" and the functionTargetID of "RoadRunnerCommand_PLAY". The rest of the vote options need to be filled with filler such as below where a button will call the command to run causing RR to intercept a "PLAY" command.

    Code:
          <button id="BUTTON_COM_TEST" enabled="yes" function="external command" functionTargetID="roadrunnercommand_play" vote="filler" vote_opinion="filler" vote_priority="Medium">
            <images imagePrimary="content\images\button_images\button_down.png" imageSecondary="content\images\button_images\button.png" imageDisabled="content\images\button_images\button.png" imagePushed="content\images\button_images\button_down.png"></images>
            <display size="230,70" location="37,119" page="0" z_order="0.9"></display>
            <vote_options minimum_delta_vote_time_down="20" ></vote_options>
            <text font="verdana" font_size="25"></text>
            <text colourPrimaryARGB="255,255,255,255" textPrimary="COM_Test"></text>
            <text colourSecondaryARGB="255,255,255,255" textSecondary="COM_Test"></text>
          </button>
    That should do it.

    And odd yet not unpleasant side effect of the new code is that if you have RoadRunner being the object getting commands passed to like above, RR will start with MDX if it is not already running. Sort of spiffy and unexpected.

    If you have questions, ask.
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  • #2
    Like usual I'm a little confused by the new code but I'm not very good at writing and understanding this stuff. How would I get this to send my steering wheel controls to RR.

    Using the configurator, everything I send goes under the logic section, will I not be using that anymore? Also, is there a way to use the configurator for this new setup or will I have to write the code myself (with help from you guys obviously)?
    [||||||----] - 60% Complete

    Comment


    • #3
      Originally posted by bigbuffs View Post
      Like usual I'm a little confused by the new code but I'm not very good at writing and understanding this stuff. How would I get this to send my steering wheel controls to RR.

      Using the configurator, everything I send goes under the logic section, will I not be using that anymore? Also, is there a way to use the configurator for this new setup or will I have to write the code myself (with help from you guys obviously)?

      Comment


      • #4
        This is not in the configurator. None of the COM is. I am working on it this weekend, but I have 3 classes this semester where the professor thinks he/she teaches the only class worthwhile and therefore gives more homework than ever possible to do...


        Anyways,

        The first code segment is what "defines" the command. It you wanted to add a second command to RR (such as "STOP"), it would be:

        Code:
                <external_COM_id id="RoadRunner.SDK">
                  <command internal_id="RoadRunnerCommand_PLAY" external_command="Execute">
                    <parameter order="0" external_command_parameter="PLAY" />
                  </command>
                  <command internal_id="RoadRunnerCommand_STOP" external_command="Execute">
                    <parameter order="0" external_command_parameter="STOP" />
                  </command>
                </external_COM_id>
        The second code is how to call it. That displays a button that you click. You click it and it votes exactly like before. The vote however, is to do the "roadrunnercommand_play" that was defined above. So it will send "PLAY" to "RoadRunner.SDK".

        If you want to do it from a logic statement, then in the vote area it would look just like the buttons vote area.
        Fusion Brain Version 6 Released!
        1.9in x 2.9in -- 47mm x 73mm
        30 Digital Outputs -- Directly drive a relay
        15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
        Buy now in the MP3Car.com Store

        Comment


        • #5
          first of all your doing an awesome job with MDX its come a long way in a short period of time.

          I see what you're saying but what if I don't want a button in mdx but I want a button on my SWC to send the "PLAY" command to RR. Can I do this using the new COM integration?

          The code I am trying to use know is something like this
          Code:
          <if fire_on="logic" minimum_delta_vote_time="100">
          - <boolean_operation type="and">
          - <parameter1>
          - <boolean_operation type="less than">
          - <parameter1>
          <analogue id="swc" time="0" />
          </parameter1>
          - <parameter2>
          <number>1.9</number>
          </parameter2>
          </boolean_operation>
          </parameter1>
          - <parameter2>
          - <boolean_operation type="greater than">
          - <parameter1>
          <analogue id="swc" time="0" />
          </parameter1>
          - <parameter2>
          <number>1.2</number>
          </parameter2>
          </boolean_operation>
          </parameter2>
          </boolean_operation>
          - <then>
          <do function="Send Key" functionTargetID="winamp" vote_opinion="NUM6" vote_priority="Medium" />
          </then>
          </if>
          [||||||----] - 60% Complete

          Comment


          • #6
            Like I said, if you want to send it from a logic statement like what you want to do, use the same vote options.

            so in your do code instead of "send key" it should be "external command". Instead of the targetID being "winamp" it should be "roadrunnercommand_play" if using the example uptop.
            Fusion Brain Version 6 Released!
            1.9in x 2.9in -- 47mm x 73mm
            30 Digital Outputs -- Directly drive a relay
            15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
            Buy now in the MP3Car.com Store

            Comment


            • #7
              OK I think I'm starting to understand. I'll probably try to get it up and running in the morning and write some code and I'll post back after that doesn't work. Thanks again for the help.
              [||||||----] - 60% Complete

              Comment


              • #8
                so in theory any command in that RR can accept via a button push in the skin, you can now trigger via the MDX?

                thats great... and exactly what I've been waiting for thanks

                Comment


                • #9
                  Originally posted by Woofnstuff View Post
                  so in theory any command in that RR can accept via a button push in the skin, you can now trigger via the MDX?

                  thats great... and exactly what I've been waiting for thanks
                  Not just theory, but in practice. Any command that RR can interpret, will work
                  Fusion Brain Version 6 Released!
                  1.9in x 2.9in -- 47mm x 73mm
                  30 Digital Outputs -- Directly drive a relay
                  15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
                  Buy now in the MP3Car.com Store

                  Comment


                  • #10
                    Sweet!!!

                    Comment


                    • #11
                      Ok, I see the examples on how to tell RR to do something, but how do you tell MDX from RR what to do? (Turn on digital output 1) as well as check the status so an indicator can be on/off based on the state of digital output 1.

                      Also how would you pull information into RR such as temperature probe hooked to Analog in 1 and have it automatically update?
                      Front End of Choice: Ride Runner (Is there anything else??? ) & Powered by the DFX5.1 Skin Available in the Mobile App Mart

                      My Fiero Build Thread

                      Comment


                      • #12
                        Originally posted by JohnWPB View Post
                        Ok, I see the examples on how to tell RR to do something, but how do you tell MDX from RR what to do? (Turn on digital output 1) as well as check the status so an indicator can be on/off based on the state of digital output 1.

                        Also how would you pull information into RR such as temperature probe hooked to Analog in 1 and have it automatically update?
                        rrfusion might be the way to go here

                        Comment


                        • #13
                          Commands sent from RoadRunner and interpreted by MDX:

                          MDX Code:
                          Code:
                                <commands>
                                  <command id="RoadRunnerCommand" minimum_delta_vote_time="100">
                                    <do function="trigger output" functionTargetID="Digital Output 0" vote_opinion="on" vote_priority="medium"></do>
                                    <do function="trigger output" functionTargetID="Digital Output 1" vote_opinion="on" vote_priority="medium"></do>
                                  </command>
                                </commands>
                          RoadRunner Code:
                          Code:
                          /, B, x, y, w, h, Command;COMMANDCODES, Tooltip
                          B02,348,70,104,75,"fusion_vote_RoadRunnerCommand",""
                          What it does:
                          When the button on RoadRunner is pressed, the command "RoadRunnerCommand" is sent to MDX. MDX will only recognize commands that first are fusion related, and that are of the vote type. I have set this to be seperated by underscored. So "fusion_vote_ZombieAttack" will send the command "ZombieAttack" to MDX. MDX will then look in the COM section of your configuration file under the <commands> tag for each <command> element. If the <command> element id equals that of the command receives it executes its votes (the <do> elements). The syntax is identical to those called from if/then logic blocks.

                          ** Note: I am not a RoadRunner skinner guru, but I am guessing you can send that command from RoadRunner more ways than just a button. But I havent tried very hard to find out if it can be done some other way. I am sure a guru around here can elaborate.

                          ==================================================
                          ==================================================

                          Commands sent from MDX and interpreted by RoadRunner:

                          MDX Code in the COM area:
                          Code:
                                <executable_commands>
                                  <external_COM_id id="RoadRunner.SDK">
                                    <command internal_id="RoadRunnerCommand_PLAY" external_command="Execute">
                                      <parameter order="0" external_command_parameter="PLAY" />
                                    </command>
                                  </external_COM_id>
                                </executable_commands>
                          MDX Code to activate:
                          Code:
                                <button id="NINJABUTTON_COM_TEST" enabled="yes" function="external command" functionTargetID="roadrunnercommand_play" vote="filler" vote_opinion="filler" vote_priority="Medium">
                                  ...
                                  <vote_options minimum_delta_vote_time_down="20" ></vote_options>
                                  ...
                                </button>
                          RoadRunner Code:
                          Internal to RoadRunner. Things like PLAY, STOP, MUTE, MINIMIZE, whatever else I am not sure. Like I said, I am no guru, RR takes care of that.

                          What it does:
                          When a button or logical if/then node, or remote control or even a received COM command from RoadRunner vote with their function tag being equal to "external command" and the functionTargetID equal to the id of a command (in this case "roadrunnercommand_play") then it will execute the command at the given application. So the function of "Execute" is being called in "RoadRunner.SDK", and the parameter "PLAY" is being passed in. So basically it is calling: (RoadRunner.SDK).Execute("PLAY"). If you want to send "KABLOOM" to RoadRunner, then change "PLAY" to "KABLOOM". And if you want to send "PENGUIN" to some application that exposes itself at "WildLifeThing" with the command "Add", then change "PLAY" to "PENGUIN", "Execute" to "Add", and "RoadRunner.SDK" to "WildLifeThing".

                          ==================================================
                          ==================================================

                          Values sent from MDX and displayed by RoadRunner:

                          MDX Code:
                          Nothing specific, it is built off of any configuration file.

                          RoadRunner Code:
                          Code:
                          /, L, x, y, w, h, color R;RGB, G, B, font size;FONT, font name, Code;LABELCODES, Tooltip;LABELALIGNMENT
                          L03,260,10,150,30,255,255,255,18,"Arial Narrow:B","fusion_ai_0", ""
                          L04,410,10,180,30,128,255,128,18,"Arial Narrow:B","fusion_ai_0_3", ""
                          L03,260,10,150,30,255,255,255,18,"Arial Narrow:B","fusion_do_0", ""
                          L03,260,10,150,30,255,255,255,18,"Arial Narrow:B","fusion_di_0", ""
                          L05,260,40,150,30,255,255,255,18,"Arial Narrow:B","fusion_varbool_0", ""
                          L06,410,40,180,30,128,255,128,18,"Arial Narrow:B","fusion_varnum_0", ""
                          What it does:
                          When a RoadRunner label is set to that above, it will poll MDX automatically. Like before, MDX only tries to interpret things that begin with "fusion".
                          The next field is the type, which can be "ai", "do", "di", "varbool", "varnum" which give you back respectively: analogue input, digitial output, digital input, boolean variable, numeric variable.
                          The next number is the index. 0 means the 1st one, 4 means the 5th one. The number is determined by the order in the configuration file, NOT the port number. 0th item is the top of the file, Nth item is at the end of the file.
                          The optional fourh parameter is the decimal precision, only works on analogue inputs.
                          These will automatically update as RoadRunner constantly polls.

                          ==================================================
                          ==================================================
                          Fusion Brain Version 6 Released!
                          1.9in x 2.9in -- 47mm x 73mm
                          30 Digital Outputs -- Directly drive a relay
                          15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
                          Buy now in the MP3Car.com Store

                          Comment


                          • #14
                            OK 2k1, could you tell me how to code it so that I can send a SWC to RR through the COM port. Basically just trying to convert the code below to go through the COM port.
                            Code:
                            - <logic>
                            - <!-- Begin Logging Setup
                            -->
                            <all_logging />
                            - <!-- End Logging Setup
                            -->
                            - <!-- Begin Variable Declarations
                            -->
                            <all_variables />
                            - <!-- End Variable Declarations
                            -->
                            - <!-- Begin Logic Declarations
                            -->
                            - <all_statements>
                            - <if fire_on="logic" minimum_delta_vote_time="100">
                            - <boolean_operation type="and">
                            - <parameter1>
                            - <boolean_operation type="less than">
                            - <parameter1>
                            <analogue id="swc" time="0" />
                            </parameter1>
                            - <parameter2>
                            <number>2.5</number>
                            </parameter2>
                            </boolean_operation>
                            </parameter1>
                            - <parameter2>
                            - <boolean_operation type="greater than">
                            - <parameter1>
                            <analogue id="swc" time="0" />
                            </parameter1>
                            - <parameter2>
                            <number>1.9</number>
                            </parameter2>
                            </boolean_operation>
                            </parameter2>
                            </boolean_operation>
                            - <then>
                            <do function="Send Key" functionTargetID="RoadRunner" vote_opinion="DOWN" vote_priority="High" />
                            </then>
                            </if>
                            </all_statements>
                            - <!-- End Logic Declarations
                            -->
                            </logic>
                            [||||||----] - 60% Complete

                            Comment


                            • #15
                              Originally posted by bigbuffs View Post
                              OK 2k1, could you tell me how to code it so that I can send a SWC to RR through the COM port. Basically just trying to convert the code below to go through the COM port.
                              Code:
                              - 
                              <general>
                                <com>
                                    <executable_commands>
                                      <external_COM_id id="RoadRunner.SDK">
                                        <command internal_id="RoadRunnerCommand_PLAY" external_command="Execute">
                                          <parameter order="0" external_command_parameter="PLAY" />
                                        </command>
                                      </external_COM_id>
                                    </executable_commands>
                                </com>
                              </general>
                              
                              <logic>
                              - <!-- Begin Logging Setup
                              -->
                              <all_logging />
                              - <!-- End Logging Setup
                              -->
                              - <!-- Begin Variable Declarations
                              -->
                              <all_variables />
                              - <!-- End Variable Declarations
                              -->
                              - <!-- Begin Logic Declarations
                              -->
                              - <all_statements>
                              - <if fire_on="logic" minimum_delta_vote_time="100">
                              - <boolean_operation type="and">
                              - <parameter1>
                              - <boolean_operation type="less than">
                              - <parameter1>
                              <analogue id="swc" time="0" />
                              </parameter1>
                              - <parameter2>
                              <number>2.5</number>
                              </parameter2>
                              </boolean_operation>
                              </parameter1>
                              - <parameter2>
                              - <boolean_operation type="greater than">
                              - <parameter1>
                              <analogue id="swc" time="0" />
                              </parameter1>
                              - <parameter2>
                              <number>1.9</number>
                              </parameter2>
                              </boolean_operation>
                              </parameter2>
                              </boolean_operation>
                              - <then>
                              <do function="external command" functionTargetID="roadrunnercommand_play" vote_opinion="fluffy bunny" vote_priority="High" />
                              </then>
                              </if>
                              </all_statements>
                              - <!-- End Logic Declarations
                              -->
                              </logic>

                              Like that.

                              Exactly as I said in the post #13. The voting area's function was changed to external command, the targetID was changed to the command. Then in the general area the com part was added with an identical command id and where and what to do when called.

                              Also make sure all those hyphens on the left side arent in your final code. It's odd that they are there.
                              Fusion Brain Version 6 Released!
                              1.9in x 2.9in -- 47mm x 73mm
                              30 Digital Outputs -- Directly drive a relay
                              15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
                              Buy now in the MP3Car.com Store

                              Comment

                              Working...
                              X