Facility Control

 View Only
  • 1.  Cobalt 9905 Scripting Across Multiple Cards

    Posted 10-28-2022 20:14
    Hi! We have 15 Cobalt 9905-MPx on our truck. Each card has 4 Paths of UDX. I am working on a script to change the output resolution of every path on all cards to a specific resolution when we are changing formats for the truck for a new show. 

    I have been successful in creating a script that will change all 4 paths on 1 card, however I am having trouble getting my script to change multiple cards to work. It seems like the root issue is that the script is going too fast for the cards. 

    In order to change the resolution on these cards, you first need to select the "Path" parameter, and then change the "Requested Output Format" to a resolution. My theory is that there is not enough time between these two setvalues. We have tried to work around this by nesting the set output resolution within a if/else/break loop that verifies that the path has changed. 

    We have been staring at this script and have not come up with anything glaring we can find. Was wondering if anyone here with more experience with OGScript can find what we are doing wrong. 

    Thanks!!

    //  Switch all paths on multiple Cobalt 9905s to 1080P
    //  Written by Evan Aaron and Andrew McManus
    //  10-28-2022
    
    //OIDs:
    // Path Select 0x1300   
    // Path 1 Custom Name 0x1302
    // Path 2 Custom Name 0x1303
    // Path 3 Custom Name 0x1304
    // Path 4 Custom Name 0x1305
    // Requested Output Format 0x1782
    // Output Format 0x1783
    
    var _newRES = "1920x1080p 59.94 A";
    
    var ids = ['00:23:02:07:C3:C7<br>Slot 2<br>9905-MPx', '00:23:02:07:C3:C7<br>Slot 6<br>9905-MPx' ] // Store Node IDs of all cards, to be expanded to all 15 cards afer testing
    
    var paths = ['0x1302', '0x1303', '0x1304', '0x1305'] //Store CustomPath Naming OIDs
    
    var curPath = 'START';
    
    for (i=0;i< ids.length; i++) // Iterate over 9905 Cards
    { 
      for (k=0;k< paths.length; k++) // Iterate over each of the 4 paths on 9905s
      {  
        ogscript.debug("K: " + paths[k] + " " + k);
        params.getParam(ids[i], '0x1300', 0).setValue(params.getParam(ids[i], paths[k], 0).getValueAsString()); //Get CustomPath name for Path k and set Path select to that path
        curPath = params.getParam(ids[i], paths[k],0).getValueAsString();
    
        // Check to see if the Path Select was actually changed
        var cont = false;
        while(cont == false){
          ogscript.debug("SWITCHED PATH: " + params.getParam(ids[i],  '0x1300', 0).getValueAsString()); 
          ogscript.debug("CURPATH: " + curPath);
          if (params.getParam(ids[i],  '0x1300', 0).getValueAsString() != curPath){
             ogscript.debug("OUTPUT FORMAT: " + params.getParam(ids[i],  '0x1783', 0).getValueAsString())
             ogscript.debug(params.getParam(ids[i],  '0x1783', 0).getValueAsString() === _newRES)
             params.getParam(ids[i], '0x1782', 0).setValue(_newRES); // If the Path was changed, change Requested Output format to 1080P
             cont = true;
             break;
          }
          else {
              params.getParam(ids[i], '0x1300', 0).setValue(params.getParam(ids[i], paths[k], 0).getValueAsString()); // If the path was not changed, try and change it again
              ogscript.debug("ELSE");
          }
          }
        }
     }​


    ------------------------------
    Evan Aaron
    Engineer
    Game Creek Video
    ------------------------------


  • 2.  RE: Cobalt 9905 Scripting Across Multiple Cards

    Posted 10-31-2022 09:29
    Hi Evan
    If it is a timing issue, you may find it easiest to verify by putting pauses between your parameter sets (to simulate a more human-speed interaction with the device). To gain access to script pausing, put your code into a function and then execute the function with ogscript.asyncExec:

    function longChainOfActions()
    {
       ogscript.debug('action 1');
       ogscript.pause(1000); //sleep 1 second
       ogscript.debug('action 2');
       ogscript.pause(1000); //sleep 1 second
       ogscript.debug('action 3');
    }
    ogscript.asyncExec(longChainOfActions);​

    Also, you might want to set the id attribute on your context tag for your other cards, this will allow you to use that relatively simple ID when pulling parameters as opposed to needing the longer device identifier string - it also means that you can change the card's frame/slot in the future and be able to just update the context instead of changing your script.

    ------------------------------
    James Peltzer
    Ross Video
    ------------------------------



  • 3.  RE: Cobalt 9905 Scripting Across Multiple Cards

    Posted 10-31-2022 14:15
    Thanks James!

    We were looking for that pause function! Will try that out. 

    For your second point, still new to ogscript-- what do you mean by set the id attribute on your context tag? Basically have reverse engineered what dashboard auto-generated using the visual OGScript GUI with the blocks when creating a task up to this point

    Thanks!

    ------------------------------
    Evan Aaron
    Engineer
    Game Creek Video
    ------------------------------



  • 4.  RE: Cobalt 9905 Scripting Across Multiple Cards

    Posted 11-01-2022 09:39
    For the second point, what I mean is that there are 2 ways to get parameters from a different device in your panel (if your panel talks to multiple devices).  You're using the device's primary identifier but you could use a user-defined/simplified name instead.

    <abs contexttype="opengear" keepalive="true">
       <meta>
          <context contexttype="opengear" id="my-card" objectid="231bf459-000000f9&lt;br&gt;Slot 3&lt;br&gt;ZTC-8399" objecttype="ZTC-8399" subscriptions="false"/>
       </meta>
       <button buttontype="push" height="98" left="40" name="Print Product Name" top="47" width="204">
          <task tasktype="ogscript">//You are using the device's "primary ID"
    ogscript.debug(params.getParam('231bf459-000000f9&lt;br&gt;Slot 3&lt;br&gt;ZTC-8399', '0x105', 0).getValue());
    
    //because I set the "id" attribute on my context tag, I can use this simple name instead
    ogscript.debug(params.getParam("my-card", '0x105', 0).getValue());
    </task>
       </button>
    </abs>
    ​


    ------------------------------
    James Peltzer
    Ross Video
    ------------------------------



  • 5.  RE: Cobalt 9905 Scripting Across Multiple Cards

    Posted 11-01-2022 11:20
    Ah gotcha, that makes sense. 

    However, since we want to have 1 button that changes 1 parameter on all 15 cards with 1 click at once (or as close to at once as we can), how would that example you provided be implemented? Seems like we would have to make a context tag for each card and then create another array of "ids" to pass in to a for loop? Does that offer any computational advantage?

    ------------------------------
    Evan Aaron
    Engineer
    Game Creek Video
    ------------------------------



  • 6.  RE: Cobalt 9905 Scripting Across Multiple Cards

    Posted 11-01-2022 11:30
    That's correct - you would need a context for each card. There are also mechanisms to generate contexts programmatically (by generating XML for the panel) but that's getting into much more advanced scripting.

    There is no computational advantage - just a maintenance/readability advantage. Especially if you decide to program additional commands for your cards.

    ------------------------------
    James Peltzer
    Ross Video
    ------------------------------



  • 7.  RE: Cobalt 9905 Scripting Across Multiple Cards

    Posted 11-01-2022 11:35
    Ok great, that makes sense. 

    Will give it a shot next time we have some free cards to test out on!

    Thanks for the help!

    ------------------------------
    Evan Aaron
    Engineer
    Game Creek Video
    ------------------------------



  • 8.  RE: Cobalt 9905 Scripting Across Multiple Cards

    Posted 11-04-2022 10:08
    Hey James!

    Just trying this out now, seems like something with ogscript.pause isnt working. This is what we edited our script to be, along with the output from the ogscript debugger, which shows the script is not listening to the pauses at all. We even changed it to 5000ms to see if that will help, but no dice

    Any thoughts?

    Thanks!

    //  Switch all paths on multiple Cobalt 9905s to 1080P
    //  Written by Evan Aaron and Andrew McManus
    //  11-03-2022
    
    // OIDs:
    // Path Select 0x1300   
    // Path 1 Custom Name 0x1302
    // Path 2 Custom Name 0x1303
    // Path 3 Custom Name 0x1304
    // Path 4 Custom Name 0x1305
    // Requested Output Format 0x1782
    // Output Format 0x1783
    
    var _newRES = "1920x1080p 59.94 A"; // 1080P Value for Requested Output Format 0x1782
    
    var ids = ['00:23:02:07:C3:C7<br>Slot 2<br>9905-MPx', '00:23:02:07:C3:C7<br>Slot 6<br>9905-MPx' ] // Node IDs for FS 53-55 and FS 56-59 for testing
    
    var paths = ['0x1302', '0x1303', '0x1304', '0x1305']; // OIDs for each Custom Path Name
    
    var curPath = 'START';
    
    function sw1080p(i, k){
        params.getParam(ids[i], '0x1300', 0).setValue(params.getParam(ids[i], paths[k], 0).getValueAsString()); //Get CustomPath name for Path k and set Path Select to that path
        curPath = params.getParam(ids[i], paths[k],0).getValueAsString();
        ogscript.debug('CHANGING ' + curPath + 'TO 1080P...');
        ogscript.pause(5000);// Wait 1 Second
        params.getParam(ids[i], '0x1782', 0).setValue(_newRES); // Change Requested Output format to 1080P
        ogscript.pause(5000);// Wait 1 Second
    }
    
    for (i=0;i< ids.length; i++) // Iterate over 9905 Cards
    { 
      for (k=0;k< paths.length; k++) // Iterate over each of the 4 paths on 9905s
      {  
        ogscript.asyncExec(sw1080p(i, k)); // Call switch function!
        
     }
    }​

    09:02:06:012: CHANGING FS 53TO 1080P...
    
    09:02:06:017: CHANGING FS 54TO 1080P...
    
    09:02:06:019: CHANGING FS 55TO 1080P...
    
    09:02:06:021: CHANGING FS 56TO 1080P...
    
    09:02:06:026: CHANGING FS 57TO 1080P...
    
    09:02:06:028: CHANGING FS 58TO 1080P...
    
    09:02:06:030: CHANGING FS 59TO 1080P...
    
    09:02:06:031: CHANGING FS 60TO 1080P...
    ​


    ------------------------------
    Evan Aaron
    Engineer
    Game Creek Video
    ------------------------------



  • 9.  RE: Cobalt 9905 Scripting Across Multiple Cards

    Posted 11-04-2022 13:03
    Hi Evan
    You aren't passing your function to asyncExec, you're calling the function.  If you need to pass your i and k arguments, you can create a helper function that creates a function to pass to asyncExec:
    function createPausableSwitchFunction(i, k)
    {
       return function()
       {
          swp1080p(i, k);
       }
    }
    
    ogscript.asyncExec(createPausableSwitchFunction(i, k)); // Call switch function!​





    ------------------------------
    James Peltzer
    Ross Video
    ------------------------------



  • 10.  RE: Cobalt 9905 Scripting Across Multiple Cards

    Posted 11-04-2022 13:35
    Ah that worked!! Thanks so much for your help!!

    ------------------------------
    Evan Aaron
    Engineer
    Game Creek Video
    ------------------------------