RobotCode

示例:

 

对示教器中的数据进行读取写入,其中自动状态下可以自由写入读取,手动状态下只可以进行读取;

 

编写软件:vs code、pycharm、note++等都可以,我使用的是vs code;

编写的语言:简单掌握HTML及javeScrip即可;

HTML Code:

1 <div style="float: left" >
2             <h2>查询对应数值</h2>
3             请输入对应数值名称:<input type="text" name="rob_name" id="rob_name" value="textNum"><br>
4             对应值:<span id="num_value" ></span><br>
5             <button type="button" onclick="getnum(document.getElementById(\'rob_name\').value)">获取数值</button>
6         </div>
<script>
            function getnum(rob_name) {
                var rwServiceResource = new XMLHttpRequest();
                rwServiceResource.onreadystatechange = function () {
                    if (rwServiceResource.readyState == 4 && rwServiceResource.status == 200) {
                        var obj = JSON.parse(rwServiceResource.responseText);
                        var service = obj._embedded._state[0]
                        document.getElementById("num_value").innerHTML = service.value;
                    }
                }
                var rob_path = "/rw/rapid/symbol/data/RAPID/T_ROB1/MainModule/" + rob_name + "?json=1"
                rwServiceResource.open("GET", rob_path, true, "Default User", "robotics");
                rwServiceResource.send();
            }
        </script>

上图为读取示教器对应名称的值

 

参考文档地址:https://developercenter.robotstudio.com/api/RWS

 

分类:

技术点:

相关文章:

  • 2021-06-13
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
  • 2021-05-22
  • 2021-04-27
  • 2021-12-13
  • 2021-10-26
猜你喜欢
  • 2021-12-10
  • 2022-01-20
  • 2021-09-06
  • 2021-11-21
相关资源
相似解决方案