有关通过Web service连接ABB机器人的系列操作

示例:

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

编写软件: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

心之所向 素履以往
原文地址:https://www.cnblogs.com/RobotCode/p/12954982.html