Commit 1b4ad800 几米阳光

机器人调试

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