Commit 1b4ad800 几米阳光

机器人调试

1 个父辈 7a9f2418
......@@ -118,9 +118,6 @@
</None>
</ItemGroup>
<ItemGroup>
<Content Include="RobotConfig\config\boardData.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="RobotConfig\config\defaultBoard.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
......
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using URSoldering.Common;
namespace URSoldering.DeviceLibrary
......@@ -70,6 +71,7 @@ namespace URSoldering.DeviceLibrary
{
listenClient.sendLine(LastMoveCMD);
LastMoveCMD = "";
//Thread.Sleep(50);
}
StopListen();
try
......@@ -129,10 +131,11 @@ namespace URSoldering.DeviceLibrary
else
{
string reviceMsg = ByteToStr(reviceData);
LogUtil.URLError(LogName + "Read data:【" + reviceMsg + "】 ");
LogUtil.URLError(LogName + "无法获取坐标,数据长度不正确");
//LogUtil.URLError(LogName + "Read data:【" + reviceMsg + "】 ");
LogUtil.URLError(LogName + "length[" + messageSize + "],data长[" + reviceData.Length + "]无法获取坐标,数据长度不正确");
}
}catch(Exception ex)
}
catch(Exception ex)
{
LogUtil.URLError(LogName+ "HandleMessage出错:" + ex.ToString());
StopListen();
......
......@@ -67,10 +67,48 @@ namespace URSoldering.DeviceLibrary
{
get { return "【" + RobotIp + " ," + ControlPort + "】"; }
}
public static void Test()
public static string GetStatus()
{
if (WarnMsg.Equals(""))
{
if (IsRun)
{
return "正常连接中";
}
else
{
if (IsStartConnect)
{
TimeSpan span = DateTime.Now - PreStartTime;
if (span.TotalMilliseconds > StartTimeOutSeconds)
{
return "启动超时";
}
else
{
return "启动中";
}
}
else
{
return "未连接";
}
}
}
else
{
return WarnMsg;
}
}
public static void Reset()
{
URWithOutTP a = new URWithOutTP(); //创建对象
a.restartURControl(RobotIp); //重置UR控制器,然后可以利用dashboard,poweron,brake release
LogUtil.info(LogName+"重置完成");
Thread.Sleep(100);
}
/// <summary>
/// 开始启动连接机器人
......@@ -121,6 +159,7 @@ namespace URSoldering.DeviceLibrary
PreStartTime = DateTime.Now;
startCount++;
//Reset();
controlTcp = new TcpClient();
bool result = controlTcp.connect(RobotIp, ControlPort, new TcpClient.HandleMessage(OnControlRevice));
......@@ -241,11 +280,11 @@ namespace URSoldering.DeviceLibrary
}
else if (message.ToLower().IndexOf(REV_RobotMode) >= 0)
{
SafetymodeProcess(message);
StatusProcess(message);
}
else if (message.ToLower().IndexOf(REV_SafetyMode) >= 0)
{
StatusProcess(message);
SafetymodeProcess(message);
}
else
{
......@@ -257,7 +296,7 @@ namespace URSoldering.DeviceLibrary
LogUtil.URSError(LogName + " OnControlRevice出错啦" + ex.ToString());
}
}
private static void SafetymodeProcess(string message)
private static void StatusProcess(string message)
{
string msg = message.ToLower().Replace(REV_RobotMode + ": ", "").ToUpper().Trim();
......@@ -282,7 +321,7 @@ namespace URSoldering.DeviceLibrary
}
}
}
private static void StatusProcess(string message)
private static void SafetymodeProcess(string message)
{
string msg = message.ToLower().Replace(REV_SafetyMode + ": ", "").ToUpper().Trim();
if (msg.Equals(URStatus.SFETY_POWER_OFF) || msg.Equals(URStatus.ROBOT_EMERGENCY_STOP))
......@@ -300,7 +339,7 @@ namespace URSoldering.DeviceLibrary
}
else
{
SendCMD(CMD_Safetymode, 500);
SendCMD(CMD_robotMode, 500);
}
}
private static bool IsTimeOut(string status)
......@@ -366,8 +405,14 @@ namespace URSoldering.DeviceLibrary
/// <param name="point"></param>
public static bool MoveTo(URPointValue point)
{
//movep(p[0.062, -0.030, 0.325, 0.0299, 2.2263, 2.2171], a = 1.2, v = 0.25, r = 0)
LogUtil.info(LogName + "试图移动到:"+point.ToShowStr());
//movej([0, 1.57, -1.57, 3.14, -1.57, 1.57],a = 1.4, v = 1.05, t = 0, r = 0)
string moveCmd = "movej([" + point.X + spiltStr + point.X + spiltStr + point.X + spiltStr + point.X + spiltStr + point.X + spiltStr + point.X + "],a=1.4, v=1.05, t=0, r=0)";
string x = Math.Round(point.X / 1000F, 5).ToString();
string y= Math.Round(point.Y / 1000F, 5).ToString();
string z = Math.Round(point.Z / 1000F, 5).ToString();
string moveCmd = "movep(p[" +x+ spiltStr +y+ spiltStr + z+ spiltStr + point.RX + spiltStr + point.RY + spiltStr + point.RZ + "],a=0.1, v=0.1, r=0)";
URRobotClient.LastMoveCMD = moveCmd;
return true;
}
......
......@@ -150,7 +150,6 @@ namespace URSoldering.Client
this.btnWireWork.TabIndex = 269;
this.btnWireWork.Text = "送丝工作端";
this.btnWireWork.UseVisualStyleBackColor = true;
this.btnWireWork.Visible = false;
this.btnWireWork.Click += new System.EventHandler(this.btnWireWork_Click);
//
// btnWUp
......@@ -173,7 +172,6 @@ namespace URSoldering.Client
this.btnWireClear.TabIndex = 268;
this.btnWireClear.Text = "送丝清洗端";
this.btnWireClear.UseVisualStyleBackColor = true;
this.btnWireClear.Visible = false;
this.btnWireClear.Click += new System.EventHandler(this.btnWireClear_Click);
//
// btnWStop
......
......@@ -305,7 +305,7 @@ namespace URSoldering.Client
private void btnWireClear_Click(object sender, EventArgs e)
{
SendWireCylinderMove(IO_VALUE.HIGH, IO_VALUE.LOW);
SendWireCylinderMove(IO_VALUE.LOW, IO_VALUE.HIGH);
}
}
}
......@@ -74,7 +74,8 @@ namespace URSoldering.Client
URPointValue lastP = URRobotControl.GetLastPosition();
urRobotSControl1.ShowPoint(lastP);
}
lblMsg.Text = URRobotControl.WarnMsg;
lblMsg.Text = URRobotControl.GetStatus();
}
private void FrmBoardInfo_FormClosing(object sender, FormClosingEventArgs e)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!