当前位置: 首页 > wzjs >正文

wordpress 获取分类子分类aso优化推广公司

wordpress 获取分类子分类,aso优化推广公司,域名停靠网站,客户渠道云迹机器人底盘调用还是比较友好的,就是纯socket收发指令就能实现,今天实现一个底盘移动到指定点位功能。底盘的默认IP是192.168.10.10通讯端口是31001,测试机与底盘接入统一网络后直接发指令即可。本文给出两种语言调用源码,选择…

云迹机器人底盘调用还是比较友好的,就是纯socket收发指令就能实现,今天实现一个底盘移动到指定点位功能。底盘的默认IP是192.168.10.10通讯端口是31001,测试机与底盘接入统一网络后直接发指令即可。本文给出两种语言调用源码,选择一种使用即可。

python调用源码:

import socket
import jsonyunji_ip = "192.168.10.10"#设定地盘ip地址,需要根据机器人实际ip地址修改#底盘-移动到指定为止
def YunjiGo(target):print(f"---------------------YunjiGo:{target}---------------------")port = 31001command = "/api/move?marker=" + target + "&distance_tolerance=0&theta_tolerance=0"client = socket.socket()client.connect((yunji_ip, port))print(f"command:{command}")client.send(command.encode())while True:try:data = client.recv(1024)if not data:print("Socket closed by peer.")return Nonestr_data = data.decode('utf-8')split_data = [s for s in str_data.split('\n') if s]for s in split_data:try:json_data = json.loads(s)print(json_data.get("description"))# 检查条件:任务完成且目标匹配if (json_data.get("description") == "The move task is finished."and "data" in json_dataand "target" in json_data["data"]and json_data["data"]["target"] == target):print("Task finished successfully!")client.close()  # 关闭 socketreturn True     # 返回成功except json.JSONDecodeError:print("Invalid JSON data, continue waiting...")continueexcept socket.timeout:print("Timeout reached, no matching data received.")return Noneexcept Exception as e:print(f"Error occurred: {e}")client.close()  # 确保异常时关闭 socketreturn None
YunjiGo("huahua")#移动到点位huahua

JAVA调用源码:(需要下载org.json-20161124.jar)

package examples;
import java.io.*;
import java.net.*;
import org.json.JSONObject;
import org.json.JSONException;/*
依赖安装:
sudo apt update
sudo apt install language-pack-zh-hans  # 简体中文
sudo apt install fonts-noto-cjk        # 中文字体
sudo apt install default-jdk*///make:
/*
cd /home/java
javac -encoding UTF-8 -cp .:\
org.json-20161124.jar \
examples/RobotControl.java
*/
//run : 
/*
cd /home/java
java -Dfile.encoding=UTF-8 -cp .:\
org.json-20161124.jar \
examples.RobotControl
*/public class RobotControl {String yunji_ip  = "192.168.10.10";  // 底盘ip地址int yunji_port = 31001;//底盘通讯端口private static RobotControl mInstance =null;public static synchronized RobotControl getInstance() {if (mInstance == null) {mInstance = new RobotControl();}return mInstance;}//底盘移动public void YunjiGo(String target) throws Exception{String command = "/api/move?marker=" + target + "&distance_tolerance=0.01&theta_tolerance=0.01";try {Socket client = new Socket(yunji_ip, yunji_port);//System.out.println("command:" + command);OutputStream out = client.getOutputStream();out.write(command.getBytes());out.flush();InputStream in = client.getInputStream();BufferedReader reader = new BufferedReader(new InputStreamReader(in));String strData;while ((strData = reader.readLine()) != null) {//System.out.println("strData:" + strData);try {JSONObject jsonData = new JSONObject(strData);System.out.println(jsonData.optString("description"));// 检查条件:任务完成且目标匹配if (jsonData.optString("description").equals("The move task is finished.")&& jsonData.has("data")&& jsonData.getJSONObject("data").has("target")&& jsonData.getJSONObject("data").getString("target").equals(target)) {System.out.println("Task finished successfully!");client.close(); // 关闭 socketreturn;    // 返回成功}} catch (JSONException e) {System.out.println("Invalid JSON data, continue waiting...");continue;}}throw new Exception("Socket closed by peer.");} catch (SocketTimeoutException e) {throw new Exception("Timeout reached, no matching data received.");} catch (Exception e) {throw new Exception("Error occurred: " + e.getMessage());}}public static void main(String[] args) {  RobotControl robotControl = RobotControl.getInstance();try{System.out.println("------------YunjiGo------------");robotControl.YunjiGo("huahua");} catch (Exception e) {System.out.println("YunjiGo Error occurred: " + e.getMessage());}System.out.println();}
}

运行输出:


------------YunjiGo------------The move task is started.
Start to leave charging pile..
Charge status off.
Succeed to leave charging pile.
traffic turn right.
traffic turn right.
The move task is finished.
Task finished successfully!

http://www.dtcms.com/wzjs/486061.html

相关文章:

  • 南通专业网站建设怎么创建网站赚钱
  • 本地做的网站怎么放到网上去漯河网络推广哪家好
  • 如何使用wordpress制作网站基本seo技术在线咨询
  • 个人小说网站怎么做seo搜索引擎优化薪资水平
  • 网牛网站建设南京seo排名公司
  • 网站二级页面设计要求近期时事新闻10条
  • 湖南网站优化搜索引擎营销的手段包括
  • 专注咖啡相关的网站百度推广后台
  • 中铁建设工程项目公示网站附近的电脑培训班在哪里
  • 电商分享推广怎么做seo是指什么职位
  • 响应式网站建设信息智能识别图片
  • 找合伙人做红木家具网站媒体发布平台
  • 云南网站建设的步骤app推广方案怎么写
  • 谷歌推广课程上海优化关键词的公司
  • 网站设计用什么软件图们网络推广
  • 网站开发小公司推荐谷歌seo和百度seo区别
  • 给公众号做头像的网站seo蜘蛛池
  • 有没有可以做兼职的网站国内免费推广产品的网站
  • 网站备案幕布照片百度一下首页网址
  • 图片网站建站系统头条搜索站长平台
  • 从零学习做网站做seo是什么意思
  • 租用服务器建设网站费用网站怎么快速收录
  • 企业网站排名怎么做郑州网络推广效果
  • 怎么看网站是否被百度惩罚德国搜索引擎
  • 株洲市住房和城乡建设厅网站安卓优化大师老版本下载
  • 疫情最新消息数据公布优化方案怎么写
  • b2b网站seo怎么做收录浙江关键词优化
  • 上海网站开发怎么去营销自己的产品
  • 做网站泉州长沙网络公关公司
  • 电视台网站建设方案.doc网络营销的营销方式是什么