Facility Control

 View Only
  • 1.  rosstalk.sendMessage in a function

    Posted 12-05-2017 17:43
    Hi everybody,

    I try to execute a rosstalk.sendMessage(...) from a function.

    function fExecuteRT(){
    ogscrit.debug("TAKE TO XPRESSION");
    rosstalk.sendMessage(ip,port, 'TAKE 1:0:0');
    }

    But it doesn't works.

    I try to do :

    function fExecuteRT(){
    ogscrit.debug("TAKE TO XPRESSION");

    rosstalk.sendMessage(ip,port, 'TAKE 1:0:0');

    }

    Doesn't works too.

    Some solutions ?

    Many thanks


  • 2.  RE: rosstalk.sendMessage in a function

    Posted 12-05-2017 19:41

    Your first attempt is mostly correct.
    You will need to actually define the IP and the Port somewhere:

    function fExecuteRT(){
    var ip = 'PUT_YOUR_IP_HERE_OR_GET_IT_FROM_A_PARAMETER';
    var port = PUT_YOUR_PORT_HERE_OR_GET_IT_FROM_A_PARAMETER;
    ogscript.debug("TAKE TO XPRESSION"); //You originally had ogscrit.debug which is a typo - this would also cause you problems
    rosstalk.sendMessage(ip,port, 'TAKE 1:0:0');
    }

    #DashBoard


  • 3.  RE: rosstalk.sendMessage in a function

    Posted 12-06-2017 13:11
    Oups...
    Of course, I forget to import the variables ip and port.
    I add this: %const['variables']['vars']% , where are my variables, and now it works.

    Thanks again.
    (I still have lot of questions about Dashboard...^^)

    #DashBoard


  • 4.  RE: rosstalk.sendMessage in a function

    Posted 12-06-2017 13:20
    Just as a small little tip as well to remember, DashBoard works like javascript in that it read from top to bottom. However so line 1-3 might work fine, but if you have an error on line 4, it wont keep going at line 5-9. But rather stop at line 4.

    Other than that, good thing you got it! :D
    #DashBoard


  • 5.  RE: rosstalk.sendMessage in a function

    Posted 12-06-2017 13:28