越疆机器人TCP通讯之12点标定脚本程序

-- Version: Lua 5.4.4
-- 此线程为主线程,可调用任何指令
--必须先示教P1点位置,运行到P5点后手动暂停将当前位置保存到P2
--P2作为角度旋转标定基准位
--本程序用于越疆Robot和海康Vision master 12点标定
     VelL(20)             -- 设置线性速度
     AccL(20)             -- 设置线性加速度
     SpeedFactor(20)      -- 设置全局速度

     MovL(P1)---初始化位置

     x=50---X赋值
     y=50---Y赋值
     r=15---角度赋值
---------字符串分割----------
     function string.split(str,delimiter)
     if str==nil or str=='' or delimiter==nil then
     return nil
     end
     local result = {}
     for match in (str..delimiter):gmatch("(.-)"..delimiter) do
     table.insert(result,match)
     end
     return result
     end

------------------通讯连接---------------------

     function Connect(isServer,ip,prot)--建立TCP通信
     ::Cab_PC::  --跳转标签
     err, socket = TCPCreate(isServer,ip,prot)-- isServer:表示客户端或服务器(false: 表示创建客户端; true: 表示创建服务)  i
     print("err=",err)
     Wait(100)
     if err ~= 0 then
     print("创建链接失败,重新创建链接...\r\n")
     Wait(100)
     goto Cab_PC  --创建服务器失败跳转到create_serverCab标签继续创建
     end
     err = TCPStart(socket,0)--socket:socket对象  0:如果为0,则一直等待连接。如果不为0,则超过设定 的时间后退出连接。
     if err ~= 0 then
     print("握手失败,重新发起...\r\n")
     TCPDestroy(socket)--关闭TCP功能
     Wait(100)
     goto Cab_PC
     end
     print("握手成功...\r\n")
     end

-----------------数据交互-----------------
     function ReceiveData()          --数据接受                      
     local
     local DataArrayS={}
     err,Recbuf=TCPRead(socket,0,"string")    
     if err==0 and Recbuf~="" then
     DataArrayS=string.split(Recbuf,",")
     else   
     Connect(false,"192.168.1.90",8604) 
     end
     return DataArrayS
end    
----------数据发送-----------
     function SendData(socket,Str)   
     if Str~="" then
     err=TCPWrite(socket, Str)
     print("err=",err)
     if err==0 then
     print("Send Data OK")
     else
     Connect(false,"192.168.1.90",8604)          --接受失败,再次调用重连机制
     print("Send Data NG")
     end
     end
     end

---------------------------main-----------------------------
---P1
     Connect(false,"192.168.1.90",8604)      --建立TCP通信
     print("hello world")
     MovL(P1,{user=0,tool=1})
     Wait(500)
     currentPose_1=GetPose(0,1)
     Wait(300)
     print("currentPose_1=",currentPose_1)
     Test1="A"..","..tonumber(currentPose_1.pose[1])..","..tonumber(currentPose_1.pose[2])..","..tonumber(currentPose_1.pose[6])
     SendData(socket,Test1)
     Wait(1000)

---P2
     RelMovLUser({0,y,0,0,0,0})
     Wait(500)
     currentPose_2=GetPose(0,1)
     Wait(300)
     print("currentPose_2=",currentPose_2)
     Test2="A"..","..tonumber(currentPose_2.pose[1])..","..tonumber(currentPose_2.pose[2])..","..tonumber(currentPose_2.pose[6])
     SendData(socket,Test2)
     Wait(1000) 

     ---P3
     RelMovLUser({0,y,0,0,0,0})
     Wait(500)
     currentPose_3=GetPose(0,1)
     Wait(300)
     print("currentPose_3=",currentPose_3)
     Test3="A"..","..tonumber(currentPose_3.pose[1])..","..tonumber(currentPose_3.pose[2])..","..tonumber(currentPose_3.pose[6])
     SendData(socket,Test3)
     Wait(1000)

-- Version: Lua 5.4.4
-- 此线程为主线程,可调用任何指令
--必须先示教P1点位置,运行到P5点后手动暂停将当前位置保存到P2
--P2作为角度旋转标定基准位
--本程序用于越疆Robot和海康Vision master 12点标定
     VelL(20)             -- 设置线性速度
     AccL(20)             -- 设置线性加速度
     SpeedFactor(20)      -- 设置全局速度

     MovL(P1)---初始化位置

     x=50---X赋值
     y=50---Y赋值
     r=15---角度赋值
---------字符串分割----------
     function string.split(str,delimiter)
     if str==nil or str=='' or delimiter==nil then
     return nil
     end
     local result = {}
     for match in (str..delimiter):gmatch("(.-)"..delimiter) do
     table.insert(result,match)
     end
     return result
     end

------------------通讯连接---------------------

     function Connect(isServer,ip,prot)--建立TCP通信
     ::Cab_PC::  --跳转标签
     err, socket = TCPCreate(isServer,ip,prot)-- isServer:表示客户端或服务器(false: 表示创建客户端; true: 表示创建服务)  i
     print("err=",err)
     Wait(100)
     if err ~= 0 then
     print("创建链接失败,重新创建链接...\r\n")
     Wait(100)
     goto Cab_PC  --创建服务器失败跳转到create_serverCab标签继续创建
     end
     err = TCPStart(socket,0)--socket:socket对象  0:如果为0,则一直等待连接。如果不为0,则超过设定 的时间后退出连接。
     if err ~= 0 then
     print("握手失败,重新发起...\r\n")
     TCPDestroy(socket)--关闭TCP功能
     Wait(100)
     goto Cab_PC
     end
     print("握手成功...\r\n")
     end

-----------------数据交互-----------------
     function ReceiveData()          --数据接受                      
     local
     local DataArrayS={}
     err,Recbuf=TCPRead(socket,0,"string")    
     if err==0 and Recbuf~="" then
     DataArrayS=string.split(Recbuf,",")
     else   
     Connect(false,"192.168.1.90",8604) 
     end
     return DataArrayS
end    
----------数据发送-----------
     function SendData(socket,Str)   
     if Str~="" then
     err=TCPWrite(socket, Str)
     print("err=",err)
     if err==0 then
     print("Send Data OK")
     else
     Connect(false,"192.168.1.90",8604)          --接受失败,再次调用重连机制
     print("Send Data NG")
     end
     end
     end

---------------------------main-----------------------------
---P1
     Connect(false,"192.168.1.90",8604)      --建立TCP通信
     print("hello world")
     MovL(P1,{user=0,tool=1})
     Wait(500)
     currentPose_1=GetPose(0,1)
     Wait(300)
     print("currentPose_1=",currentPose_1)
     Test1="A"..","..tonumber(currentPose_1.pose[1])..","..tonumber(currentPose_1.pose[2])..","..tonumber(currentPose_1.pose[6])
     SendData(socket,Test1)
     Wait(1000)

---P2
     RelMovLUser({0,y,0,0,0,0})
     Wait(500)
     currentPose_2=GetPose(0,1)
     Wait(300)
     print("currentPose_2=",currentPose_2)
     Test2="A"..","..tonumber(currentPose_2.pose[1])..","..tonumber(currentPose_2.pose[2])..","..tonumber(currentPose_2.pose[6])
     SendData(socket,Test2)
     Wait(1000) 

     ---P3
     RelMovLUser({0,y,0,0,0,0})
     Wait(500)
     currentPose_3=GetPose(0,1)
     Wait(300)
     print("currentPose_3=",currentPose_3)
     Test3="A"..","..tonumber(currentPose_3.pose[1])..","..tonumber(currentPose_3.pose[2])..","..tonumber(currentPose_3.pose[6])
     SendData(socket,Test3)
     Wait(1000)
 

Read more

虚拟世界的AI魔法:AIGC引领元宇宙创作革命

虚拟世界的AI魔法:AIGC引领元宇宙创作革命

云边有个稻草人-ZEEKLOG博客——个人主页 热门文章_云边有个稻草人的博客-ZEEKLOG博客——本篇文章所属专栏 ~ 欢迎订阅~ 目录 1. 引言 2. 元宇宙与虚拟世界概述 2.1 什么是元宇宙? 2.2 虚拟世界的构建 3. AIGC在元宇宙中的应用 3.1 AIGC生成虚拟世界环境 3.2 AIGC生成虚拟角色与NPC 3.3 AIGC创造虚拟物品与资产 4. AIGC在虚拟世界与元宇宙的技术实现 4.1 生成式对抗网络(GANs)在元宇宙中的应用 4.2 自然语言处理(NLP)与虚拟角色的对话生成 4.3 计算机视觉与物理引擎 5. 持续创新:AIGC与元宇宙的未来趋势 5.1 个人化与定制化体验 5.

ControlNet实战指南:从零构建AI绘画精准控制系统,轻松控制Stable Diffusion生成效果

ControlNet实战指南:从零构建AI绘画精准控制系统,轻松控制Stable Diffusion生成效果 【免费下载链接】ControlNetLet us control diffusion models! 项目地址: https://gitcode.com/gh_mirrors/co/ControlNet ControlNet是AI绘画领域的革命性技术,它让您能够精准控制Stable Diffusion等扩散模型的生成过程。无论您是想通过边缘检测、深度图、姿态估计还是语义分割来控制AI绘画,ControlNet都能为您提供强大的条件控制能力。这个开源项目让普通用户也能轻松实现专业级的AI绘画控制,无需复杂的编程知识即可上手。 🎨 ControlNet是什么?AI绘画控制的核心技术 ControlNet是一种神经网络结构,专门为扩散模型添加额外的条件控制。它通过复制预训练模型的权重到"锁定"副本和"可训练"副本中,实现了在不破坏原有模型的情况下学习新的控制条件。这种设计让您即使使用小型数据集进行训练,也不会影响生产就绪的扩散模型。 ControlNet架构示意图:

VsCode远程连接服务器后安装Github Copilot无法使用

VsCode远程连接服务器后安装Github Copilot无法使用

VsCode远程连接服务器后安装Github Copilot无法使用 1.在Vscode的settings中搜索Extension Kind,如图所示: 2.点击Edit in settings.json,添加如下代码: "remote.extensionKind":{"GitHub.copilot":["ui"],"GitHub.copilot-chat":["ui"],} remote.extensionKind 的作用 这是 VS Code 的远程开发配置项,用于控制扩展在远程环境(如 SSH、容器、WSL)中的运行位置。可选值: “ui”:扩展在本地客户端运行 “workspace”:扩展在远程服务器运行 这两个扩展始终在 本地客户端运行,

图像编辑新选择!Qwen-Image-Edit-2511对比Stable Diffusion

图像编辑新选择!Qwen-Image-Edit-2511对比Stable Diffusion 1. 技术背景与问题提出 近年来,AI图像生成与编辑技术迅速发展,以Stable Diffusion为代表的扩散模型在创意设计、内容生成等领域广泛应用。然而,在指令理解能力、角色一致性保持、工业级设计生成等方面,传统模型仍面临挑战。特别是在复杂语义编辑任务中,容易出现“图像漂移”或结构失真等问题。 为应对这些挑战,通义实验室推出了 Qwen-Image-Edit-2511 —— 一个基于多模态大模型驱动的图像编辑系统。该模型是 Qwen-Image-Edit-2509 的增强版本,重点优化了以下方面: * 减轻图像漂移现象 * 改进角色一致性表现 * 整合 LoRA 微调支持 * 增强工业设计类图像生成能力 * 提升几何推理与空间布局理解 本文将从技术原理、功能特性、部署实践和性能对比四个维度,深入分析 Qwen-Image-Edit-2511 相较于 Stable Diffusion 在图像编辑场景下的优势与适用边界。 2. 核心机制解析 2.1 模型架构设计