Commit 0fbc88eb LN

机器人测试程序

1 个父辈 501ba9eb
...@@ -2,68 +2,82 @@ ...@@ -2,68 +2,82 @@
using ABB.Robotics.Controllers.Discovery; using ABB.Robotics.Controllers.Discovery;
using ABB.Robotics.Controllers.IOSystemDomain; using ABB.Robotics.Controllers.IOSystemDomain;
using ABB.Robotics.Controllers.RapidDomain; using ABB.Robotics.Controllers.RapidDomain;
using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading;
namespace ABBRobotTest namespace ABBRobotTest
{ {
public class ABBRobotManager internal class ABBRobotManager
{ {
private NetworkScanner scanner = null; private static NetworkScanner scanner = null;
// private Controller controller = null; // private Controller controller = null;
private Task[] tasks = null; private static Task[] tasks = null;
private NetworkWatcher networkwatcher = null; private static NetworkWatcher networkwatcher = null;
private Dictionary<string, Controller> controllerMap = new Dictionary<string, Controller>(); internal static Dictionary<string, Controller> controllerMap = new Dictionary<string, Controller>();
internal static Dictionary<string, ControllerInfo> controllerInfoMap = new Dictionary<string, ControllerInfo>();
public void LoadController()
internal delegate void ControllerAddDelegate(ControllerInfo controller);
internal static event ControllerAddDelegate ControllerAddEvent;
internal static void LoadController()
{ {
this.scanner = new NetworkScanner(); controllerMap = new Dictionary<string, Controller>();
this.scanner.Scan(); controllerInfoMap = new Dictionary<string, ControllerInfo>();
scanner = new NetworkScanner();
scanner.Scan();
ControllerInfoCollection controllers = scanner.Controllers; ControllerInfoCollection controllers = scanner.Controllers;
int i = 0; int i = 0;
foreach (ControllerInfo controllerInfo in controllers) foreach (ControllerInfo controllerInfo in controllers)
{ {
Controller con = ControllerFactory.CreateFrom(controllerInfo); AddControllerInfo(controllerInfo);
con.Logon(UserInfo.DefaultUser);
ControllerState state = con.State;
controllerMap.Add(con.IPAddress.ToString(), con);
// controller = con;
i++; i++;
} }
this.networkwatcher = new NetworkWatcher(scanner.Controllers); networkwatcher = new NetworkWatcher(scanner.Controllers);
this.networkwatcher.Found += new EventHandler<NetworkWatcherEventArgs>(HandleFoundEvent); networkwatcher.Found += new EventHandler<NetworkWatcherEventArgs>(HandleFoundEvent);
this.networkwatcher.Lost += new EventHandler<NetworkWatcherEventArgs>(HandleLostEvent); networkwatcher.Lost += new EventHandler<NetworkWatcherEventArgs>(HandleLostEvent);
this.networkwatcher.EnableRaisingEvents = true; networkwatcher.EnableRaisingEvents = true;
} }
private static void AddControllerInfo(ControllerInfo controllerInfo)
private void HandleLostEvent(object sender, NetworkWatcherEventArgs e) {
Controller con = ControllerFactory.CreateFrom(controllerInfo);
con.Logon(UserInfo.DefaultUser);
ControllerState state = con.State;
controllerMap.Add(con.IPAddress.ToString(), con);
// controller = con;
controllerInfoMap.Add(controllerInfo.IPAddress.ToString(), controllerInfo);
}
private static void HandleLostEvent(object sender, NetworkWatcherEventArgs e)
{ {
} }
private void HandleFoundEvent(object sender, NetworkWatcherEventArgs e) private static void HandleFoundEvent(object sender, NetworkWatcherEventArgs e)
{ {
this.Invoke(new Invoke(new
EventHandler<NetworkWatcherEventArgs>(AddControllerToListView), EventHandler<NetworkWatcherEventArgs>(AddControllerToListView),
new Object[] { this, e }); new Object[] { null, e });
} }
private void Invoke(EventHandler<NetworkWatcherEventArgs> eventHandler, object[] v) private static void Invoke(EventHandler<NetworkWatcherEventArgs> eventHandler, object[] v)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
private void AddControllerToListView(object sender, NetworkWatcherEventArgs e) private static void AddControllerToListView(object sender, NetworkWatcherEventArgs e)
{ {
//ControllerInfo controllerInfo = e.Controller; ListViewItem item ControllerInfo controllerInfo = e.Controller;
// = new ListViewItem(controllerInfo.IPAddress.ToString()); if (controllerInfo != null)
//item.SubItems.Add(controllerInfo.Id); item.SubItems.Add(controllerInfo.Availability.ToString()); item.SubItems.Add(controllerInfo.IsVirtual.ToString()); item.SubItems.Add(controllerInfo.SystemName); item.SubItems.Add(controllerInfo.Version.ToString()); item.SubItems.Add(controllerInfo.ControllerName); this.listView1.Items.Add(item); item.Tag {
// = controllerInfo; AddControllerInfo(controllerInfo);
ControllerAddEvent?.Invoke(controllerInfo);
}
} }
private void StartRobot(string ip) private void StartRobotByTask(string ip)
{ {
try try
{ {
...@@ -96,7 +110,7 @@ namespace ABBRobotTest ...@@ -96,7 +110,7 @@ namespace ABBRobotTest
Console.WriteLine("Unexpected error occurred: " + ex.Message); Console.WriteLine("Unexpected error occurred: " + ex.Message);
} }
} }
private void StopRobot(string ip) private void StopRobotByTask(string ip)
{ {
try try
{ {
...@@ -129,56 +143,110 @@ namespace ABBRobotTest ...@@ -129,56 +143,110 @@ namespace ABBRobotTest
{ {
Console.WriteLine("Unexpected error occurred: " + ex.Message); Console.WriteLine("Unexpected error occurred: " + ex.Message);
} }
} }
private void SetRobotSignal(string ip, string name) internal static void StartRobotBySingle(string ip,string signalName = "di_start",bool isReset=true )
{ {
Controller controller = GetControllerByIP(ip); if (isReset)
if (controller != null)
{ {
// string name = comboBox1.Text; StopRobotBySingle(ip);
Signal singalValue = controller.IOSystem.GetSignal(name);
DigitalSignal digitalSig = (DigitalSignal)singalValue;
digitalSig.Set();
} }
SetRobotSignal(ip, signalName);
Thread.Sleep(100);
ResetRobotSignal(ip, signalName);
} }
private void ResetRobotSignal(string ip, string name) internal static void StopRobotBySingle(string ip,string signalName = "di_stop")
{ {
Controller controller = GetControllerByIP(ip); SetRobotSignal(ip, signalName);
if (controller != null) Thread.Sleep(100);
ResetRobotSignal(ip, signalName);
}
internal static void SetRobotSignal(string ip, string name)
{
try
{
Controller controller = GetControllerByIP(ip);
if (controller != null)
{
// string name = comboBox1.Text;
Signal singalValue = controller.IOSystem.GetSignal(name);
if (singalValue == null)
{
LogUtil.error("ABBRobot[" + ip + "] GetSignal [" + name + "] =null");
}
else
{
DigitalSignal digitalSig = (DigitalSignal)singalValue;
digitalSig.Set();
}
}
}
catch (Exception ex)
{ {
//string name = comboBox1.Text; LogUtil.error("ABBRobot[" + ip + "] SetRobotSignal [" + name + "] Error:" + ex.ToString());
Signal singalValue = controller.IOSystem.GetSignal(name);
DigitalSignal digitalSig = (DigitalSignal)singalValue;
digitalSig.Reset();
} }
} }
public string GetRobotState(string ip) internal static void ResetRobotSignal(string ip, string name)
{
try
{
Controller controller = GetControllerByIP(ip);
if (controller != null)
{
//string name = comboBox1.Text;
Signal singalValue = controller.IOSystem.GetSignal(name);
if (singalValue == null)
{
LogUtil.error("ABBRobot[" + ip + "] GetSignal [" + name + "]= null");
}
else
{
DigitalSignal digitalSig = (DigitalSignal)singalValue;
digitalSig.Reset();
}
}
}
catch (Exception ex)
{
LogUtil.error("ABBRobot[" + ip + "] ResetRobotSignal [" + name + "] Error:" + ex.ToString());
}
}
internal static string GetRobotState(string ip)
{ {
Controller controller = GetControllerByIP(ip); try
if (controller != null) {
{ Controller controller = GetControllerByIP(ip);
ControllerState state = controller.State; if (controller != null)
return state.ToString(); {
ControllerState state = controller.State;
return state.ToString();
}
}catch(Exception ex)
{
LogUtil.error("ABBRobot[" + ip + "] GetRobotState" +"error:"+ex.ToString());
} }
return ""; return "";
} }
private Controller GetControllerByIP(string ip) internal static Controller GetControllerByIP(string ip)
{ {
if (controllerMap.ContainsKey(ip)) if (controllerMap.ContainsKey(ip))
{ {
return controllerMap[ip]; return controllerMap[ip];
} }
LogUtil.error("ABBRobot [" + ip + "] GetControllerByIP= null");
return null; return null;
} }
private void DisposeControllers() internal static void DisposeControllers()
{ {
foreach (Controller con in controllerMap.Values) foreach (Controller con in controllerMap.Values)
{ {
......
...@@ -15,15 +15,13 @@ namespace ABBRobotTest ...@@ -15,15 +15,13 @@ namespace ABBRobotTest
private static TcpServer tcpserver = null; private static TcpServer tcpserver = null;
public static bool IsStart = false; public static bool IsStart = false;
private static int ClientKeepSecond = 10; private static int ClientKeepSecond = 10;
private static int ServerPort = 21;
public static string ErrorInfo = "";
private static string MoveOK = "point ok";
private static string FreeOK = "free ok";
private static string LockOK = "lock ok";
private static string MoveCMD_1 = "move"; private static int ABBServerPort = ConfigAppSettings.GetIntValue(Setting_Init.ABBServerPort );
private static string MoveCMD_2 = "move2"; public static string ErrorInfo = "";
internal static string Cmd_movep = "movep";
internal static string Cmd_moveget = "moveget";
internal static string Cmd_moveput = "moveput";
public static Dictionary<string, Client> ClientMap = new Dictionary<string, Client>(); public static Dictionary<string, Client> ClientMap = new Dictionary<string, Client>();
...@@ -35,23 +33,51 @@ namespace ABBRobotTest ...@@ -35,23 +33,51 @@ namespace ABBRobotTest
private static object LockObj = new object(); private static object LockObj = new object();
public static void StartServer(int port) public static void StartServer( )
{ {
if (!IsStart) try
{ {
ClientMap = new Dictionary<string, Client>(); if (ABBServerPort <= 0)
if (tcpserver == null)
{ {
tcpserver = new TcpServer(); ABBServerPort = 21;
} }
IsStart = true; if (!IsStart)
tcpserver.Start(port); {
LogUtil.info( "ABBRobotServer在端口[" + port + "]监听!"); ClientMap = new Dictionary<string, Client>();
tcpserver.ReviceMsgEvent += tcp_ReviceMsgEvent; if (tcpserver == null)
{
tcpserver = new TcpServer();
}
IsStart = true;
tcpserver.Start(ABBServerPort);
tcpserver.AcceptClientEvent += Tcpserver_AcceptClientEvent;
LogUtil.info("ABBRobotServer在端口[" + ABBServerPort + "]监听!");
tcpserver.ReviceMsgEvent += tcp_ReviceMsgEvent;
}
}catch(Exception ex)
{
LogUtil.error("ABBRobotServer启动[" + ABBServerPort + "]监听错误:" + ex.ToString());
} }
} }
private static void Tcpserver_AcceptClientEvent(Client client)
{
SaveRobotClient(client);
}
private static object MapLock = "";
private static void SaveRobotClient( Client client)
{
lock (MapLock)
{
IPEndPoint clientipe = (IPEndPoint)client.ClientSocket.RemoteEndPoint;
string ip = clientipe.Address.ToString();
if (ClientMap.ContainsKey(ip))
{
ClientMap.Remove(ip);
}
ClientMap.Add(ip, client);
}
}
public static void StopServer() public static void StopServer()
{ {
try try
...@@ -80,7 +106,7 @@ namespace ABBRobotTest ...@@ -80,7 +106,7 @@ namespace ABBRobotTest
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("处理料仓消息【" + msg + "】出错:" + ex.ToString()); LogUtil.error("处理ABB消息【" + msg + "】出错:" + ex.ToString());
} }
} }
...@@ -89,34 +115,52 @@ namespace ABBRobotTest ...@@ -89,34 +115,52 @@ namespace ABBRobotTest
IPEndPoint clientipe = (IPEndPoint)client.ClientSocket.RemoteEndPoint; IPEndPoint clientipe = (IPEndPoint)client.ClientSocket.RemoteEndPoint;
string add = clientipe.Address.ToString(); string add = clientipe.Address.ToString();
// string[] msgArray = msg.Split(cmd_spilt); // string[] msgArray = msg.Split(cmd_spilt);
msg = msg.Replace("\r", ""); msg = msg.Replace("\r", "").ToLower();
LogUtil.debug("收到【" + add + "】的消息【" + msg + "】"); LogUtil.info("Revice[" + add + "]:[" + msg + "]");
if (msg.ToUpper().Contains("ERROR"))
{
}else if(msg.ToUpper().Contains("MOVE")&& msg.ToUpper().Contains("OK")) if (msg.ToLower().Contains("error"))
{
ErrorInfo = msg;
}
else if(msg.Contains(Cmd_movep)&& msg.Contains("OK"))
{ {
OnMoveEnd?.Invoke(msg); OnMoveEnd?.Invoke(msg);
} }
else if (msg.ToUpper().Contains("MOVE2") && msg.ToUpper().Contains("OK")) else if (msg.Contains(Cmd_moveput) && msg.Contains("OK"))
{ {
OnMoveEnd?.Invoke(msg); OnMoveEnd?.Invoke(msg);
} } else if (msg.Contains(Cmd_moveget) && msg.Contains("ok"))
{
OnMoveEnd?.Invoke(msg);
}
return false; return false;
} }
public static void MoveTo(string robotIp, string PointName, string moveType="L" , double targetSpeed = 100, OpEnd AfterMove = null) public static void MoveToP(string robotIp, string PointName, string moveType="L" , double targetSpeed = 100, OpEnd AfterMove = null)
{ {
ABBRobotServer.OnMoveEnd = AfterMove; ABBRobotServer.OnMoveEnd = AfterMove;
SendMovePoint(robotIp, MoveCMD_1,PointName,moveType,targetSpeed.ToString()); SendMovePoint(robotIp, Cmd_movep, PointName,moveType,targetSpeed.ToString());
} }
public static void Move2To(string robotIp, string PointName, string moveType = "L", double targetSpeed = 100, OpEnd AfterMove = null) public static void MoveToPut(string robotIp, string PointName, string moveType = "L", double targetSpeed = 100, OpEnd AfterMove = null)
{ {
ABBRobotServer.OnMoveEnd = AfterMove; ABBRobotServer.OnMoveEnd = AfterMove;
SendMovePoint(robotIp, MoveCMD_2, PointName, moveType, targetSpeed.ToString()); SendMovePoint(robotIp, Cmd_moveput, PointName, moveType, targetSpeed.ToString());
}
public static void MoveToGet(string robotIp, string PointName, string moveType = "L", double targetSpeed = 100, OpEnd AfterMove = null)
{
ABBRobotServer.OnMoveEnd = AfterMove;
SendMovePoint(robotIp, Cmd_moveget, PointName, moveType, targetSpeed.ToString());
}
public static void Move(string robotIp, string moveCmd,string PointName, string moveType = "L", double targetSpeed = 100, OpEnd AfterMove = null)
{
ABBRobotServer.OnMoveEnd = AfterMove;
if (moveCmd.Equals(Cmd_moveget) || moveCmd.Equals(Cmd_movep) || moveCmd.Equals(Cmd_moveput))
{
SendMovePoint(robotIp, moveCmd, PointName, moveType, targetSpeed.ToString());
}
} }
private static void SendMovePoint(string robotIp, string param1,string param2,string param3,string param4) private static void SendMovePoint(string robotIp, string param1,string param2,string param3,string param4)
{ {
lock (LockObj) lock (LockObj)
...@@ -124,9 +168,9 @@ namespace ABBRobotTest ...@@ -124,9 +168,9 @@ namespace ABBRobotTest
if (ClientMap.ContainsKey(robotIp)) if (ClientMap.ContainsKey(robotIp))
{ {
Client client = ClientMap[robotIp]; Client client = ClientMap[robotIp];
string str = param1 + "," + param2 + "," + param3 + "," + param4+"\r\n"; string str = param1 + "," + param2 + "," + param3 + "," + param4+"";
LastSendPoint = param2; LastSendPoint = param2;
LogUtil.info("Send [" + robotIp + "] : [" + str + "]");
SendStrToClient(client, str); SendStrToClient(client, str);
} }
} }
...@@ -143,7 +187,13 @@ namespace ABBRobotTest ...@@ -143,7 +187,13 @@ namespace ABBRobotTest
return false; return false;
} }
internal static bool RobotIsConnect(string ip)
{
if (ClientMap.ContainsKey(ip))
{
return true;
}
return false;
}
} }
} }
...@@ -36,6 +36,10 @@ ...@@ -36,6 +36,10 @@
<Reference Include="ABB.Robotics.Controllers.PC"> <Reference Include="ABB.Robotics.Controllers.PC">
<HintPath>..\dll\ABB\ABB.Robotics.Controllers.PC.dll</HintPath> <HintPath>..\dll\ABB\ABB.Robotics.Controllers.PC.dll</HintPath>
</Reference> </Reference>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\dll\log4net.dll</HintPath>
</Reference>
<Reference Include="RobotStudio.Services.RobApi"> <Reference Include="RobotStudio.Services.RobApi">
<HintPath>..\dll\ABB\RobotStudio.Services.RobApi.dll</HintPath> <HintPath>..\dll\ABB\RobotStudio.Services.RobApi.dll</HintPath>
</Reference> </Reference>
...@@ -57,6 +61,12 @@ ...@@ -57,6 +61,12 @@
<ItemGroup> <ItemGroup>
<Compile Include="ABBRobotServer.cs" /> <Compile Include="ABBRobotServer.cs" />
<Compile Include="ABBRobotManager.cs" /> <Compile Include="ABBRobotManager.cs" />
<Compile Include="FrmRobotMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmRobotMain.Designer.cs">
<DependentUpon>FrmRobotMain.cs</DependentUpon>
</Compile>
<Compile Include="FrmRobotTest.cs"> <Compile Include="FrmRobotTest.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
...@@ -65,6 +75,9 @@ ...@@ -65,6 +75,9 @@
</Compile> </Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FrmRobotMain.resx">
<DependentUpon>FrmRobotMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmRobotTest.resx"> <EmbeddedResource Include="FrmRobotTest.resx">
<DependentUpon>FrmRobotTest.cs</DependentUpon> <DependentUpon>FrmRobotTest.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<configuration> <configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<appSettings>
<!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1" />
<add key="App_Title" value="流水线客户端" />
<!--Server address-->
<add key="http.server" value="http://localhost/myproject/service/store/emptyPosForPutin"/>
<!--storeType-->
<add key="Line_moveEquip_count" value="18" />
<add key="Line_feedingEquip_count" value="4" />
<add key="Line_providingEquip_count" value="4" />
<add key ="Line_dischargeLine_count" value ="2"/>
<!--start one store config-->
<add key="ConfigPath_Line" value="\LineConfig\Config_Line.csv" />
<add key="ConfigPath_MoveEquip" value="\LineConfig\MoveEquip\Config_MoveEquip.csv" />
<add key="ConfigPath_FeedingEquip" value="\LineConfig\Config_FeedingEquip.csv" />
<add key="ConfigPath_ProvidingEquip" value="\LineConfig\Config_ProvidingEquip.csv" />
<add key ="ConfigPath_DischargeLine" value ="\LineConfig\Config_DischargeLine.csv"/>
<add key="Line_Type" value="RC_LINE" />
<add key="Line_CID" value="rc1250" />
<!--end one store config-->
<!--摄像机名称列表配置,用#分割-->
<add key="CameraName" value="GigE:MV-CE100-30GC (00C69898519)#GigE:MV-CE100-30GC (00C95305929)" />
<!--二维码类型列表配置,用#分割,一维码=Barcode 二维码: QR Code#Data Matrix ECC 200#Micro QR Code-->
<add key="CodeType" value="QR Code" />
<!--<add key="CodeType" value="Data Matrix ECC 200"/>-->
<add key="ACBaudRate" value="115200" />
<!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<add key="CodeParamPath" value="\CodeParam\" />
<add key="Config_Pwd" value="123456" />
<!--出库等待料盘拿走的时间,秒-->
<add key="OutStoreWaitSeconds" value="10" />
<add key="UseAIOBOX" value="1" />
<!--流水线监听端口-->
<add key="TCPServerPort" value="5246" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
<add key ="DIMS" value ="120"/>
<add key ="DOMS" value ="300"/>
<add key ="LineRunTest" value ="1"/>
<!--ABB机器人服务器-->
<add key ="ABBServerPort" value ="21"/>
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/Line-RC1250.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" />
</layout>
</appender>
<root>
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
</root>
</log4net>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup> </startup>
......
namespace ABBRobotTest
{
partial class FrmRobotMain
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.listView1 = new System.Windows.Forms.ListView();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.btnStop = new System.Windows.Forms.Button();
this.btnStart = new System.Windows.Forms.Button();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.groupMove = new System.Windows.Forms.GroupBox();
this.btnExit = new System.Windows.Forms.Button();
this.comMoveCmd = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.comMoveP = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.numSpeed = new System.Windows.Forms.NumericUpDown();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.btnMove = new System.Windows.Forms.Button();
this.groupMove.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numSpeed)).BeginInit();
this.SuspendLayout();
//
// listView1
//
this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listView1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.listView1.FullRowSelect = true;
this.listView1.GridLines = true;
this.listView1.HideSelection = false;
this.listView1.Location = new System.Drawing.Point(12, 12);
this.listView1.MultiSelect = false;
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(1308, 143);
this.listView1.TabIndex = 193;
this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.View = System.Windows.Forms.View.Details;
this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
//
// timer1
//
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// btnStop
//
this.btnStop.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnStop.Location = new System.Drawing.Point(171, 176);
this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(108, 46);
this.btnStop.TabIndex = 195;
this.btnStop.Text = "停止";
this.btnStop.UseVisualStyleBackColor = true;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
//
// btnStart
//
this.btnStart.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnStart.Location = new System.Drawing.Point(34, 176);
this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(108, 46);
this.btnStart.TabIndex = 194;
this.btnStart.Text = "启动";
this.btnStart.UseVisualStyleBackColor = true;
this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
//
// richTextBox1
//
this.richTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.richTextBox1.Location = new System.Drawing.Point(444, 161);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(876, 553);
this.richTextBox1.TabIndex = 196;
this.richTextBox1.Text = "";
//
// groupMove
//
this.groupMove.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupMove.Controls.Add(this.btnMove);
this.groupMove.Controls.Add(this.radioButton2);
this.groupMove.Controls.Add(this.radioButton1);
this.groupMove.Controls.Add(this.numSpeed);
this.groupMove.Controls.Add(this.label3);
this.groupMove.Controls.Add(this.label2);
this.groupMove.Controls.Add(this.comMoveP);
this.groupMove.Controls.Add(this.label1);
this.groupMove.Controls.Add(this.comMoveCmd);
this.groupMove.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupMove.Location = new System.Drawing.Point(12, 243);
this.groupMove.Name = "groupMove";
this.groupMove.Size = new System.Drawing.Size(426, 471);
this.groupMove.TabIndex = 197;
this.groupMove.TabStop = false;
this.groupMove.Text = "运动测试";
//
// btnExit
//
this.btnExit.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExit.Location = new System.Drawing.Point(309, 176);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(108, 46);
this.btnExit.TabIndex = 198;
this.btnExit.Text = "退出";
this.btnExit.UseVisualStyleBackColor = true;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// comMoveCmd
//
this.comMoveCmd.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.comMoveCmd.FormattingEnabled = true;
this.comMoveCmd.Location = new System.Drawing.Point(136, 41);
this.comMoveCmd.Name = "comMoveCmd";
this.comMoveCmd.Size = new System.Drawing.Size(171, 29);
this.comMoveCmd.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(37, 45);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(79, 20);
this.label1.TabIndex = 2;
this.label1.Text = "运动方式:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(37, 100);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(93, 20);
this.label2.TabIndex = 4;
this.label2.Text = "坐标点名称:";
//
// comMoveP
//
this.comMoveP.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.comMoveP.FormattingEnabled = true;
this.comMoveP.Location = new System.Drawing.Point(136, 96);
this.comMoveP.Name = "comMoveP";
this.comMoveP.Size = new System.Drawing.Size(171, 29);
this.comMoveP.TabIndex = 3;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(37, 155);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(51, 20);
this.label3.TabIndex = 6;
this.label3.Text = "速度:";
//
// numSpeed
//
this.numSpeed.Increment = new decimal(new int[] {
10,
0,
0,
0});
this.numSpeed.Location = new System.Drawing.Point(137, 153);
this.numSpeed.Maximum = new decimal(new int[] {
500,
0,
0,
0});
this.numSpeed.Minimum = new decimal(new int[] {
10,
0,
0,
0});
this.numSpeed.Name = "numSpeed";
this.numSpeed.Size = new System.Drawing.Size(170, 26);
this.numSpeed.TabIndex = 7;
this.numSpeed.Value = new decimal(new int[] {
50,
0,
0,
0});
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Location = new System.Drawing.Point(63, 216);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(83, 24);
this.radioButton1.TabIndex = 8;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "直线运动";
this.radioButton1.UseVisualStyleBackColor = true;
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(200, 216);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(83, 24);
this.radioButton2.TabIndex = 9;
this.radioButton2.TabStop = true;
this.radioButton2.Text = "圆弧运动";
this.radioButton2.UseVisualStyleBackColor = true;
//
// btnMove
//
this.btnMove.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnMove.Location = new System.Drawing.Point(159, 283);
this.btnMove.Name = "btnMove";
this.btnMove.Size = new System.Drawing.Size(108, 46);
this.btnMove.TabIndex = 195;
this.btnMove.Text = "运动测试";
this.btnMove.UseVisualStyleBackColor = true;
this.btnMove.Click += new System.EventHandler(this.btnMove_Click);
//
// FrmRobotMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1335, 726);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.groupMove);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.btnStop);
this.Controls.Add(this.btnStart);
this.Controls.Add(this.listView1);
this.Name = "FrmRobotMain";
this.Text = "FrmRobotMain";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmRobotMain_FormClosing);
this.Load += new System.EventHandler(this.FrmRobotMain_Load);
this.groupMove.ResumeLayout(false);
this.groupMove.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numSpeed)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.Button btnStart;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.GroupBox groupMove;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox comMoveP;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox comMoveCmd;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.NumericUpDown numSpeed;
private System.Windows.Forms.Button btnMove;
}
}
\ No newline at end of file \ No newline at end of file
using ABB.Robotics.Controllers;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ABBRobotTest
{
public partial class FrmRobotMain : Form
{
public FrmRobotMain()
{
InitializeComponent();
}
private string SelConIp = "";
private void FrmRobotMain_Load(object sender, EventArgs e)
{
CheckForIllegalCrossThreadCalls = false;
LoadCom();
LoadListView();
LoadController();
timer1.Start();
ABBRobotServer.StartServer();
LogUtil.logBox = this.richTextBox1;
}
private void LoadCom()
{
comMoveCmd.Items.Clear();
comMoveCmd.Items.Add(ABBRobotServer.Cmd_movep);
comMoveCmd.Items.Add(ABBRobotServer.Cmd_moveget);
comMoveCmd.Items.Add(ABBRobotServer.Cmd_moveput);
comMoveP.Items.Clear();
for(int i = 0; i < 30; i++)
{
comMoveP.Items.Add("p" + i);
}
comMoveP.SelectedIndex = 0;
comMoveCmd.SelectedIndex = 1;
radioButton1.Checked = true;
}
private void LoadController()
{
ABBRobotManager.LoadController();
int i = 0;
foreach (ControllerInfo con in ABBRobotManager.controllerInfoMap.Values)
{
ListViewItem item = new ListViewItem(con.IPAddress.ToString());
item.SubItems.Add(con.Id.ToString());
item.SubItems.Add(con.Availability.ToString());
item.SubItems.Add(con.IsVirtual.ToString());
item.SubItems.Add(con.SystemName);
item.SubItems.Add(con.Version.ToString());
item.SubItems.Add(con.ControllerName);
item.Tag = con.IPAddress;
string state = ABBRobotManager.GetRobotState(con.IPAddress.ToString());
item.SubItems.Add(state);
this.listView1.Items.Add(item);
this.listView1.Items[i].Selected = true;
SelConIp = con.IPAddress.ToString();
i++;
}
}
private void LoadListView()
{
this.listView1.Columns.Clear();
AddHealder("IPAddress", 100);
AddHealder("ID", 80);
// AddHealder("设备状态", 100);
AddHealder("Availability", 100);
AddHealder("IsVirtual", 100);
AddHealder("SystemName", 100);
AddHealder("Version", 100);
AddHealder("ControllerName", 180);
AddHealder("Statue", 100);
}
private void AddHealder(string name, int widht)
{
ColumnHeader preSendwire = new ColumnHeader();
preSendwire.Text = name; //设置列标题
preSendwire.Width = widht; //设置列宽度
preSendwire.TextAlign = HorizontalAlignment.Left; //设置列的对齐方式
this.listView1.Columns.Add(preSendwire); //将列头添加到ListView控件。
}
private void timer1_Tick(object sender, EventArgs e)
{
int i = 0;
List<string> conList = new List<string>(ABBRobotManager.controllerMap.Keys);
foreach (string con in conList)
{
string result = ABBRobotManager.GetRobotState(con);
listView1.Items[i].SubItems[7].Text = result;
i++;
}
if (ABBRobotServer.RobotIsConnect(SelConIp))
{
groupMove.Enabled = true;
}
else
{
groupMove.Enabled = false;
}
}
private void btnStart_Click(object sender, EventArgs e)
{
if (String.IsNullOrEmpty(SelConIp))
{
return;
}
ABBRobotManager.StartRobotBySingle(SelConIp);
}
private void btnStop_Click(object sender, EventArgs e)
{
if (String.IsNullOrEmpty(SelConIp))
{
return;
}
ABBRobotManager.StopRobotBySingle(SelConIp);
}
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
if (listView1.SelectedItems != null && listView1.SelectedItems.Count > 0)
{
int index = listView1.SelectedItems[0].Index;
string ip = listView1.Items[index].SubItems[0].ToString();
if (!String.IsNullOrEmpty(ip))
{
SelConIp = ip;
if (ABBRobotServer.RobotIsConnect(SelConIp))
{
groupMove.Enabled = true;
}
else
{
groupMove.Enabled = false;
}
}
}
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
private void FrmRobotMain_FormClosing(object sender, FormClosingEventArgs e)
{
ABBRobotManager.DisposeControllers();
ABBRobotServer.StopServer();
LogUtil.logBox = null;
}
private void btnMove_Click(object sender, EventArgs e)
{
string moveCmd = comMoveCmd.Text;
string PPoint = comMoveP.Text;
string MType = "L";
if (radioButton2.Checked)
{
MType = "J";
}
int speed =(int) numSpeed.Value;
if (speed > 500)
{
speed = 100;
}
ABBRobotServer.Move(SelConIp, moveCmd, PPoint, MType, speed, MoveEnd);
}
private void MoveEnd(string msg)
{
LogUtil.info("机器人运动完成:" + msg);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file \ No newline at end of file
...@@ -29,30 +29,31 @@ ...@@ -29,30 +29,31 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.button1 = new System.Windows.Forms.Button(); this.btnStart = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.button4 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox(); this.comboBox1 = new System.Windows.Forms.ComboBox();
this.button5 = new System.Windows.Forms.Button(); this.btnStop = new System.Windows.Forms.Button();
this.listView1 = new System.Windows.Forms.ListView(); this.listView1 = new System.Windows.Forms.ListView();
this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.SuspendLayout(); this.SuspendLayout();
// //
// button1 // btnStart
// //
this.button1.Location = new System.Drawing.Point(11, 195); this.btnStart.Location = new System.Drawing.Point(27, 486);
this.button1.Name = "button1"; this.btnStart.Name = "btnStart";
this.button1.Size = new System.Drawing.Size(108, 46); this.btnStart.Size = new System.Drawing.Size(108, 46);
this.button1.TabIndex = 0; this.btnStart.TabIndex = 0;
this.button1.Text = "启动"; this.btnStart.Text = "启动";
this.button1.UseVisualStyleBackColor = true; this.btnStart.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click); this.btnStart.Visible = false;
this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
// //
// button2 // button2
// //
this.button2.Location = new System.Drawing.Point(23, 383); this.button2.Location = new System.Drawing.Point(160, 155);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(108, 46); this.button2.Size = new System.Drawing.Size(108, 46);
this.button2.TabIndex = 2; this.button2.TabIndex = 2;
...@@ -62,7 +63,7 @@ ...@@ -62,7 +63,7 @@
// //
// button3 // button3
// //
this.button3.Location = new System.Drawing.Point(148, 383); this.button3.Location = new System.Drawing.Point(272, 155);
this.button3.Name = "button3"; this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(108, 46); this.button3.Size = new System.Drawing.Size(108, 46);
this.button3.TabIndex = 3; this.button3.TabIndex = 3;
...@@ -77,7 +78,7 @@ ...@@ -77,7 +78,7 @@
// //
// button4 // button4
// //
this.button4.Location = new System.Drawing.Point(469, 195); this.button4.Location = new System.Drawing.Point(591, 155);
this.button4.Name = "button4"; this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(108, 46); this.button4.Size = new System.Drawing.Size(108, 46);
this.button4.TabIndex = 5; this.button4.TabIndex = 5;
...@@ -95,20 +96,21 @@ ...@@ -95,20 +96,21 @@
"di_startatmain", "di_startatmain",
"di_stop", "di_stop",
"aaa"}); "aaa"});
this.comboBox1.Location = new System.Drawing.Point(23, 330); this.comboBox1.Location = new System.Drawing.Point(16, 163);
this.comboBox1.Name = "comboBox1"; this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 28); this.comboBox1.Size = new System.Drawing.Size(121, 28);
this.comboBox1.TabIndex = 6; this.comboBox1.TabIndex = 6;
// //
// button5 // btnStop
// //
this.button5.Location = new System.Drawing.Point(148, 195); this.btnStop.Location = new System.Drawing.Point(164, 486);
this.button5.Name = "button5"; this.btnStop.Name = "btnStop";
this.button5.Size = new System.Drawing.Size(108, 46); this.btnStop.Size = new System.Drawing.Size(108, 46);
this.button5.TabIndex = 7; this.btnStop.TabIndex = 7;
this.button5.Text = "停止"; this.btnStop.Text = "停止";
this.button5.UseVisualStyleBackColor = true; this.btnStop.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click); this.btnStop.Visible = false;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
// //
// listView1 // listView1
// //
...@@ -121,7 +123,7 @@ ...@@ -121,7 +123,7 @@
this.listView1.Location = new System.Drawing.Point(11, 12); this.listView1.Location = new System.Drawing.Point(11, 12);
this.listView1.MultiSelect = false; this.listView1.MultiSelect = false;
this.listView1.Name = "listView1"; this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(864, 177); this.listView1.Size = new System.Drawing.Size(872, 117);
this.listView1.TabIndex = 192; this.listView1.TabIndex = 192;
this.listView1.UseCompatibleStateImageBehavior = false; this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.View = System.Windows.Forms.View.Details; this.listView1.View = System.Windows.Forms.View.Details;
...@@ -129,9 +131,9 @@ ...@@ -129,9 +131,9 @@
// //
// richTextBox1 // richTextBox1
// //
this.richTextBox1.Location = new System.Drawing.Point(469, 271); this.richTextBox1.Location = new System.Drawing.Point(716, 135);
this.richTextBox1.Name = "richTextBox1"; this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(322, 261); this.richTextBox1.Size = new System.Drawing.Size(159, 159);
this.richTextBox1.TabIndex = 193; this.richTextBox1.TabIndex = 193;
this.richTextBox1.Text = ""; this.richTextBox1.Text = "";
// //
...@@ -142,12 +144,12 @@ ...@@ -142,12 +144,12 @@
this.ClientSize = new System.Drawing.Size(887, 595); this.ClientSize = new System.Drawing.Size(887, 595);
this.Controls.Add(this.richTextBox1); this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.listView1); this.Controls.Add(this.listView1);
this.Controls.Add(this.button5); this.Controls.Add(this.btnStop);
this.Controls.Add(this.comboBox1); this.Controls.Add(this.comboBox1);
this.Controls.Add(this.button4); this.Controls.Add(this.button4);
this.Controls.Add(this.button3); this.Controls.Add(this.button3);
this.Controls.Add(this.button2); this.Controls.Add(this.button2);
this.Controls.Add(this.button1); this.Controls.Add(this.btnStart);
this.Name = "FrmRobotTest"; this.Name = "FrmRobotTest";
this.Text = "network scanning"; this.Text = "network scanning";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmRobotTest_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmRobotTest_FormClosing);
...@@ -158,13 +160,13 @@ ...@@ -158,13 +160,13 @@
#endregion #endregion
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button btnStart;
private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button3;
private System.Windows.Forms.Timer timer1; private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button4;
private System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Button button5; private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.ListView listView1; private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.RichTextBox richTextBox1; private System.Windows.Forms.RichTextBox richTextBox1;
} }
......
...@@ -109,7 +109,7 @@ namespace ABBRobotTest ...@@ -109,7 +109,7 @@ namespace ABBRobotTest
item.SubItems.Add(controllerInfo.Id); item.SubItems.Add(controllerInfo.Availability.ToString()); item.SubItems.Add(controllerInfo.IsVirtual.ToString()); item.SubItems.Add(controllerInfo.SystemName); item.SubItems.Add(controllerInfo.Version.ToString()); item.SubItems.Add(controllerInfo.ControllerName); this.listView1.Items.Add(item); item.Tag item.SubItems.Add(controllerInfo.Id); item.SubItems.Add(controllerInfo.Availability.ToString()); item.SubItems.Add(controllerInfo.IsVirtual.ToString()); item.SubItems.Add(controllerInfo.SystemName); item.SubItems.Add(controllerInfo.Version.ToString()); item.SubItems.Add(controllerInfo.ControllerName); this.listView1.Items.Add(item); item.Tag
= controllerInfo; = controllerInfo;
} }
private void button1_Click(object sender, EventArgs e) private void btnStart_Click(object sender, EventArgs e)
{ {
try try
{ {
...@@ -224,7 +224,7 @@ namespace ABBRobotTest ...@@ -224,7 +224,7 @@ namespace ABBRobotTest
} }
} }
private void button5_Click(object sender, EventArgs e) private void btnStop_Click(object sender, EventArgs e)
{ {
try try
{ {
......
using System; using log4net.Config;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -14,9 +15,10 @@ namespace ABBRobotTest ...@@ -14,9 +15,10 @@ namespace ABBRobotTest
[STAThread] [STAThread]
static void Main() static void Main()
{ {
XmlConfigurator.Configure();
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FrmRobotTest()); Application.Run(new FrmRobotMain());
} }
} }
} }
MODULE aaa MODULE aaa
PERS tooldata MyTool:=[TRUE,[[31.792631019,0,229.638935148],[0.945518576,0,0.325568154,0]],[1,[0,0,1],[1,0,0,0],0,0,0]]; PERS tooldata MyTool:=[TRUE,[[31.792631019,0,229.638935148],[0.945518576,0,0.325568154,0]],[1,[0,0,1],[1,0,0,0],0,0,0]];
CONST robtarget p1:=[[811.5983,-418.1001,718.5829],[0.05370732,1.526351E-08,-0.9985567,2.109476E-08],[-1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; CONST robtarget p1:=[[-58.97,-251.82,388.62],[0.718543,-0.63799,0.152339,0.23121],[0,0,-1,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p2:=[[825.4576,0.000000156,533.4979],[0.03072789,-0.000000002,-0.9995278,-0.000000001],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; CONST robtarget p2:=[[133.92,-253.65,388.62],[0.718545,-0.637985,0.152332,0.231221],[-1,-1,-1,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p3:=[[825.4576,0.000001046,609.3],[0.03072784,-0.000000013,-0.9995278,-0.00000001],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; CONST robtarget p3:=[[825.4576,0.000001046,609.3],[0.03072784,-0.000000013,-0.9995278,-0.00000001],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p4:=[[825.4576,-0.000000111,675.4476],[0.03072794,0.000000001,-0.9995278,0.000000001],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; CONST robtarget p4:=[[825.4576,-0.000000111,675.4476],[0.03072794,0.000000001,-0.9995278,0.000000001],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p5:=[[825.4576,0.000000831,745.9818],[0.03072797,-0.000000011,-0.9995278,-0.000000008],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; CONST robtarget p5:=[[825.4576,0.000000831,745.9818],[0.03072797,-0.000000011,-0.9995278,-0.000000008],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
...@@ -34,11 +34,12 @@ MODULE aaa ...@@ -34,11 +34,12 @@ MODULE aaa
CONST robtarget p30:=[[969.94,296.56,505.18],[0.17191,0.382088,-0.905649,0.0652315],[0,0,-1,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]]; CONST robtarget p30:=[[969.94,296.56,505.18],[0.17191,0.382088,-0.905649,0.0652315],[0,0,-1,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
PERS speeddata speed1:=[345,50,400,100]; PERS speeddata speed1:=[50,50,400,100];
VAR socketdev socket_server; VAR socketdev socket_server;
VAR socketdev socket_client; VAR socketdev socket_client;
PERS string str_address:="127.0.0.1"; PERS string str_address:="127.0.0.1";
!PERS string str_address:="192.168.201.88";
PERS num n_port:=21; PERS num n_port:=21;
VAR string strReceive:="p1,L,100"; VAR string strReceive:="p1,L,100";
...@@ -57,59 +58,65 @@ MODULE aaa ...@@ -57,59 +58,65 @@ MODULE aaa
VAR num LengBit4:=0; VAR num LengBit4:=0;
VAR num starBit4:=0; VAR num starBit4:=0;
PERS string s1_1:="movep"; PERS string s1_1:="movep";
PERS string s1_2:="p27"; PERS string s1_2:="p2";
PERS string s1_3:="l"; PERS string s1_3:="L";
PERS string s1_4:="345"; PERS string s1_4:="50";
VAR bool flag1:=false; VAR bool flag1:=false;
PERS num value_1:=700; PERS num value_1:=700;
PERS num value_2:=50; PERS num value_2:=50;
PERS num value_3:=345; PERS num value_3:=50;
VAR robtarget pTarget:=[[700,50,700],[0.0258621,-0.000364211,-0.999665,0.000003063],[0,-1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]; VAR robtarget pTarget:=[[700,50,700],[0.0258621,-0.000364211,-0.999665,0.000003063],[0,-1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
VAR robtarget pTemp:=[[700,50,700],[0.0258621,-0.000364211,-0.999665,3.06266E-6],[0,-1,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]]; VAR robtarget pTemp:=[[700,50,700],[0.0258621,-0.000364211,-0.999665,3.06266E-6],[0,-1,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
PERS bool bLinear:=TRUE; PERS bool bLinear:=TRUE;
PERS bool dataOk:=TRUE; PERS bool dataOk:=TRUE;
VAR num len:=0; VAR num len:=0;
TASK PERS tooldata tool1:=[TRUE,[[-19.2067,-21.2174,16.2824],[1,0,0,0]],[1,[0,0,1],[1,0,0,0],0,0,0]];
TASK PERS wobjdata wobj1:=[FALSE,TRUE,"",[[767.868,61.732,519.513],[0.710458,6.744E-06,-2.16356E-05,-0.703739]],[[0,0,0],[1,0,0,0]]];
PERS zonedata zone1:=[FALSE,5,8,8,0.8,8,0.8];
PERS loaddata load1:=[4,[0,0,0],[1,0,0,0],0,0,0];
PROC modifyPoint() PROC modifyPoint()
MoveL p1,speed1,z50,MyTool\WObj:=wobj0;
MoveL p2,speed1,z50,MyTool\WObj:=wobj0; MoveL p1,speed1,z50,tool1\WObj:=wobj1;
MoveL p3,speed1,z50,MyTool\WObj:=wobj0; MoveL p2,speed1,z50,tool1\WObj:=wobj1;
MoveL p4,speed1,z50,MyTool\WObj:=wobj0; MoveL p3,speed1,z50,tool1\WObj:=wobj1;
MoveL p5,speed1,z50,MyTool\WObj:=wobj0; MoveL p4,speed1,z50,tool1\WObj:=wobj1;
MoveL p6,speed1,z50,MyTool\WObj:=wobj0; MoveL p5,speed1,z50,tool1\WObj:=wobj1;
MoveL p7,speed1,z50,MyTool\WObj:=wobj0; MoveL p6,speed1,z50,tool1\WObj:=wobj1;
MoveL p8,speed1,z50,MyTool\WObj:=wobj0; MoveL p7,speed1,z50,tool1\WObj:=wobj1;
MoveL p9,speed1,z50,MyTool\WObj:=wobj0; MoveL p8,speed1,z50,tool1\WObj:=wobj1;
MoveL p10,speed1,z50,MyTool\WObj:=wobj0; MoveL p9,speed1,z50,tool1\WObj:=wobj1;
MoveL p10,speed1,z50,tool1\WObj:=wobj1;
MoveL p11,speed1,z50,MyTool\WObj:=wobj0;
MoveL p12,speed1,z50,MyTool\WObj:=wobj0; MoveL p11,speed1,z50,tool1\WObj:=wobj1;
MoveL p13,speed1,z50,MyTool\WObj:=wobj0; MoveL p12,speed1,z50,tool1\WObj:=wobj1;
MoveL p14,speed1,z50,MyTool\WObj:=wobj0; MoveL p13,speed1,z50,tool1\WObj:=wobj1;
MoveL p15,speed1,z50,MyTool\WObj:=wobj0; MoveL p14,speed1,z50,tool1\WObj:=wobj1;
MoveL p16,speed1,z50,MyTool\WObj:=wobj0; MoveL p15,speed1,z50,tool1\WObj:=wobj1;
MoveL p17,speed1,z50,MyTool\WObj:=wobj0; MoveL p16,speed1,z50,tool1\WObj:=wobj1;
MoveL p18,speed1,z50,MyTool\WObj:=wobj0; MoveL p17,speed1,z50,tool1\WObj:=wobj1;
MoveL p19,speed1,z50,MyTool\WObj:=wobj0; MoveL p18,speed1,z50,tool1\WObj:=wobj1;
MoveL p20,speed1,z50,MyTool\WObj:=wobj0; MoveL p19,speed1,z50,tool1\WObj:=wobj1;
MoveL p20,speed1,z50,tool1\WObj:=wobj1;
MoveL p21, speed1, z50, MyTool\WObj:=wobj0;
MoveL p22,speed1,z50,MyTool\WObj:=wobj0; MoveL p21,speed1,z50,tool1\WObj:=wobj1;
MoveL p23,speed1,z50,MyTool\WObj:=wobj0; MoveL p22,speed1,z50,tool1\WObj:=wobj1;
MoveL p24,speed1,z50,MyTool\WObj:=wobj0; MoveL p23,speed1,z50,tool1\WObj:=wobj1;
MoveL p25,speed1,z50,MyTool\WObj:=wobj0; MoveL p24,speed1,z50,tool1\WObj:=wobj1;
MoveL p26,speed1,z50,MyTool\WObj:=wobj0; MoveL p25,speed1,z50,tool1\WObj:=wobj1;
MoveL p27,speed1,z50,MyTool\WObj:=wobj0; MoveL p26,speed1,z50,tool1\WObj:=wobj1;
MoveL p28,speed1,z50,MyTool\WObj:=wobj0; MoveL p27,speed1,z50,tool1\WObj:=wobj1;
MoveL p29,speed1,z50,MyTool\WObj:=wobj0; MoveL p28,speed1,z50,tool1\WObj:=wobj1;
MoveL p30,speed1,z50,MyTool\WObj:=wobj0; MoveL p29,speed1,z50,tool1\WObj:=wobj1;
MoveL p30,speed1,z50,tool1\WObj:=wobj1;
ENDPROC ENDPROC
PROC main() PROC main()
zone1:=z5;
SocketPro; SocketPro;
error error
...@@ -131,27 +138,23 @@ MODULE aaa ...@@ -131,27 +138,23 @@ MODULE aaa
ENDIF ENDIF
ENDPROC ENDPROC
! PROC Reconnect()
! TPErase; PROC loadexample()
! SocketCreate socket_client; VAR robtarget ptemp:=[[0,0,0],[1,0,0,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
! SocketConnect socket_client,str_address,n_port\Time:=2; VAR robtarget pPlace:=[[0,0,0],[1,0,0,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
! WHILE TRUE DO MoveL Offs(pTemp,0,0,10),speed1,z50,tool1\WObj:=wobj1;
! WaitTime 1; MoveL pTemp,speed1,fine,tool1\WObj:=wobj1;
! SocketReceive socket_client\Str:=strReceive; GripLoad load1;
! SocketSend socket_client\Str:=strSend; MoveL Offs(pTemp,0,0,10),speed1,z50,tool1\WObj:=wobj1;
! strSend:=strSend+"a";
! ENDWHILE
! ERROR MoveL Offs(pPlace,0,0,10),speed1,z50,tool1\WObj:=wobj1;
! IF ERRNO=ERR_SOCK_TIMEOUT THEN MoveL pPlace,speed1,fine,tool1\WObj:=wobj1;
! ResetRetryCount; GripLoad load0;
! RETRY; MoveL Offs(pPlace,0,0,10),speed1,z50,tool1\WObj:=wobj1;
! ELSEIF ERRNO=ERR_SOCK_CLOSED THEN
! socketRecover; ENDPROC
! ResetRetryCount;
! RETRY;
! ENDIF
! ENDPROC
PROC socketRecover() PROC socketRecover()
SocketClose socket_client; SocketClose socket_client;
...@@ -172,7 +175,7 @@ MODULE aaa ...@@ -172,7 +175,7 @@ MODULE aaa
!connect server !connect server
SocketConnect socket_client,str_address,n_port\Time:=WAIT_MAX; SocketConnect socket_client,str_address,n_port\Time:=WAIT_MAX;
WHILE TRUE DO WHILE TRUE DO
pTarget:=CRobT(\Tool:=MyTool); pTarget:=CRobT(\Tool:=tool1);
ptemp:=pTarget; ptemp:=pTarget;
!receive instruction !receive instruction
label1: label1:
...@@ -183,20 +186,32 @@ MODULE aaa ...@@ -183,20 +186,32 @@ MODULE aaa
! GOTO label1; ! GOTO label1;
IF s1_1="movep" THEN IF s1_1="movep" THEN
IF bLinear THEN IF bLinear THEN
MoveL pTarget,speed1,fine,MyTool\WObj:=wobj0; MoveL pTarget,speed1,fine,tool1\WObj:=wobj1;
ELSE ELSE
MoveJ pTarget,speed1,fine,MyTool\WObj:=wobj0; MoveJ pTarget,speed1,fine,tool1\WObj:=wobj1;
ENDIF ENDIF
SocketSend socket_client\Str:=strReceive+strSend; SocketSend socket_client\Str:=strReceive+strSend;
SocketSend socket_client\Str:=s1_1+","+s1_2+","+strSend; SocketSend socket_client\Str:=s1_1+","+s1_2+","+strSend;
ELSEIF s1_1="move2" THEN ELSEIF s1_1="moveget" THEN
IF bLinear THEN IF bLinear THEN
MoveL Offs(pTarget,0,0,10),speed1,fine,MyTool\WObj:=wobj0; ! MoveL Offs(pTarget,0,0,10), speed1, zone1, tool1\WObj:=wobj1;
MoveL pTarget,speed1,fine,MyTool\WObj:=wobj0; MoveL pTarget,speed1,fine,tool1\WObj:=wobj1;
MoveL Offs(pTarget,-50,0,0),speed1,fine,MyTool\WObj:=wobj0; GripLoad load0;
MoveL Offs(pTarget,0,60,0),speed1,fine,MyTool\WObj:=wobj0; MoveL Offs(pTarget,0,0,-50),speed1,zone1,tool1\WObj:=wobj1;
MoveL Offs(pTarget,0,-60,0),speed1,zone1,tool1\WObj:=wobj1;
ELSE ELSE
MoveJ pTarget,speed1,fine,MyTool\WObj:=wobj0; MoveJ pTarget,speed1,fine,tool1\WObj:=wobj1;
ENDIF
SocketSend socket_client\Str:=strReceive+strSend;
SocketSend socket_client\Str:=s1_1+","+s1_2+","+strSend;
ELSEIF s1_1="moveput" THEN
IF bLinear THEN
MoveL pTarget,speed1,fine,tool1\WObj:=wobj1;
GripLoad load1;
MoveL Offs(pTarget,0,0,50),speed1,zone1,tool1\WObj:=wobj1;
MoveL Offs(pTarget,0,-60,0),speed1,zone1,tool1\WObj:=wobj1;
ELSE
MoveJ pTarget,speed1,fine,tool1\WObj:=wobj1;
ENDIF ENDIF
SocketSend socket_client\Str:=strReceive+strSend; SocketSend socket_client\Str:=strReceive+strSend;
SocketSend socket_client\Str:=s1_1+","+s1_2+","+strSend; SocketSend socket_client\Str:=s1_1+","+s1_2+","+strSend;
...@@ -204,9 +219,7 @@ MODULE aaa ...@@ -204,9 +219,7 @@ MODULE aaa
ELSE ELSE
SocketSend socket_client\Str:=strReceive+" DATA ERROR "; SocketSend socket_client\Str:=strReceive+" DATA ERROR ";
ENDIF ENDIF
ENDWHILE ENDWHILE
ERROR ERROR
...@@ -223,16 +236,12 @@ MODULE aaa ...@@ -223,16 +236,12 @@ MODULE aaa
PROC strParse(string string1) PROC strParse(string string1)
lable2: lable2:
len:=StrLen(string1); len:=StrLen(string1);
starBit1:=1; starBit1:=1;
endBit1:=StrFind(string1,starBit1,","); endBit1:=StrFind(string1,starBit1,",");
LengBit1:=endBit1-starBit1; LengBit1:=endBit1-starBit1;
starBit2:=endBit1+1; starBit2:=endBit1+1;
IF starBit2>len THEN IF starBit2>len THEN
...@@ -276,6 +285,10 @@ MODULE aaa ...@@ -276,6 +285,10 @@ MODULE aaa
! get speed ! get speed
flag1:=StrToVal(s1_4,value_3); flag1:=StrToVal(s1_4,value_3);
IF value_3>100 THEN
value_3:=100;
ENDIF
speed1.v_tcp:=value_3; speed1.v_tcp:=value_3;
dataOk:=TRUE; dataOk:=TRUE;
ERROR ERROR
...@@ -286,8 +299,15 @@ MODULE aaa ...@@ -286,8 +299,15 @@ MODULE aaa
ENDIF ENDIF
ENDPROC ENDPROC
PROC Path_10() !PROC Path_10()
! MoveL Target_10,v1000,z100,MyTool\WObj:=wobj0; ! MoveL Target_10,v1000,z100,tool1\WObj:=wobj1;
! MoveL Target_20,v1000,z100,MyTool\WObj:=wobj0; ! MoveL Target_20,v1000,z100,tool1\WObj:=wobj1;
!ENDPROC
PROC Routine1()
MoveL [[-59.00,-191.91,358.37],[0.718539,-0.637964,0.152099,0.231451],[0,0,-1,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v100,z50,tool1\WObj:=wobj1;
MoveL [[117.05,-193.58,358.36],[0.718537,-0.63796,0.1521,0.231467],[-1,-1,-1,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v100,z10,tool1\WObj:=wobj1;
MoveL [[117.05,-193.58,473.42],[0.718538,-0.637961,0.152095,0.231465],[-1,-1,-1,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v100,z10,tool1\WObj:=wobj1;
MoveL [[-16.00,-192.31,473.42],[0.718545,-0.637953,0.152097,0.231464],[0,0,-1,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]],v100,z10,tool1\WObj:=wobj1;
ENDPROC ENDPROC
ENDMODULE ENDMODULE
\ No newline at end of file \ No newline at end of file
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
<add key ="DIMS" value ="120"/> <add key ="DIMS" value ="120"/>
<add key ="DOMS" value ="300"/> <add key ="DOMS" value ="300"/>
<add key ="LineRunTest" value ="1"/> <add key ="LineRunTest" value ="1"/>
<!--ABB机器人服务器-->
<add key ="ABBServerPort" value ="21"/>
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
...@@ -72,5 +72,7 @@ namespace OnlineStore.Common ...@@ -72,5 +72,7 @@ namespace OnlineStore.Common
public static string LineRunTest = "LineRunTest"; public static string LineRunTest = "LineRunTest";
public static string Line_dischargeLine_count= "Line_dischargeLine_count"; public static string Line_dischargeLine_count= "Line_dischargeLine_count";
public static string ConfigPath_DischargeLine= "ConfigPath_DischargeLine"; public static string ConfigPath_DischargeLine= "ConfigPath_DischargeLine";
public static string ABBServerPort = "ABBServerPort";
} }
} }
...@@ -13,6 +13,9 @@ PRO,0,批量上料轴减速度,BatchAxis_DelSpeed,400,,,,, ...@@ -13,6 +13,9 @@ PRO,0,批量上料轴减速度,BatchAxis_DelSpeed,400,,,,,
PRO,0,批量上料轴原点低速度,BatchAxis_HomeLowSpeed,100,,,,, PRO,0,批量上料轴原点低速度,BatchAxis_HomeLowSpeed,100,,,,,
PRO,0,批量上料轴原点高速,BatchAxis_HomeHighSpeed,200,,,,, PRO,0,批量上料轴原点高速,BatchAxis_HomeHighSpeed,200,,,,,
PRO,0,批量上料轴原点加速度,BatchAxis_HomeAddSpeed,200,,,,, PRO,0,批量上料轴原点加速度,BatchAxis_HomeAddSpeed,200,,,,,
PRO,0,移栽上下轴慢速上升速度,BatchAxis_SlowSpeed,200,,,,,
PRO,0,批量上料轴P1速度,BatchAxis_P1Speed,400,,,,,
,,,,,,,,,
,,,,,,,,, ,,,,,,,,,
PRO,0,移栽上下轴在移栽上下降的位置,UpDownPositions,0=180000;,,,,, PRO,0,移栽上下轴在移栽上下降的位置,UpDownPositions,0=180000;,,,,,
PRO,0,移栽上下轴在料仓门口下降的位置,UpDownBoxPositions,0=116000;,,,,, PRO,0,移栽上下轴在料仓门口下降的位置,UpDownBoxPositions,0=116000;,,,,,
...@@ -25,7 +28,7 @@ PRO,0,移栽上下轴原点低速度,UpdownAxis_HomeLowSpeed,100,,,,, ...@@ -25,7 +28,7 @@ PRO,0,移栽上下轴原点低速度,UpdownAxis_HomeLowSpeed,100,,,,,
PRO,0,移栽上下轴原点高速,UpdownAxis_HomeHighSpeed,200,,,,, PRO,0,移栽上下轴原点高速,UpdownAxis_HomeHighSpeed,200,,,,,
PRO,0,移栽上下轴原点加速度,UpdownAxis_HomeAddSpeed,200,,,,, PRO,0,移栽上下轴原点加速度,UpdownAxis_HomeAddSpeed,200,,,,,
PRO,0,移栽上下轴下降速度,UpdownAxis_DownSpeed,500,,,,, PRO,0,移栽上下轴下降速度,UpdownAxis_DownSpeed,500,,,,,
PRO,0,移栽上下轴走到待机点速度,UpdownAxis_P1Speed,400,,,,, PRO,0,移栽上下轴P1速度,UpdownAxis_P1Speed,400,,,,,
,,,,,,,,, ,,,,,,,,,
,,,,,,,,, ,,,,,,,,,
,,,,,,,,, ,,,,,,,,,
...@@ -54,8 +57,8 @@ DI,0,SL1上料横移气缸取料端,SL_FeedSideWayCylinder_Take,5,PRO_AOI_IP_12,0,SL1上料 ...@@ -54,8 +57,8 @@ DI,0,SL1上料横移气缸取料端,SL_FeedSideWayCylinder_Take,5,PRO_AOI_IP_12,0,SL1上料
DI,0,SL1上料横移气缸放料端,SL_FeedSideWayCylinder_Emptying,6,PRO_AOI_IP_12,0,SL1上料横移气缸放料端,X127,X127 DI,0,SL1上料横移气缸放料端,SL_FeedSideWayCylinder_Emptying,6,PRO_AOI_IP_12,0,SL1上料横移气缸放料端,X127,X127
DI,0,SL1上料气缸放松端,SL_FeedCylinder_Slack,7,PRO_AOI_IP_12,0,SL1上料气缸放松端,X128,X128 DI,0,SL1上料气缸放松端,SL_FeedCylinder_Slack,7,PRO_AOI_IP_12,0,SL1上料气缸放松端,X128,X128
DI,0,SL1上料气缸夹紧端,SL_FeedCylinder_Tighten,8,PRO_AOI_IP_12,0,SL1上料气缸夹紧端,X129,X129 DI,0,SL1上料气缸夹紧端,SL_FeedCylinder_Tighten,8,PRO_AOI_IP_12,0,SL1上料气缸夹紧端,X129,X129
DI,1000,环形线横移1托盘检测,SW1_SideWay_TrayCheck,9,PRO_AOI_IP_12,0,环形线横移1托盘检测,X130,X130 DI,1000,环形线横移1托盘检测,SW1_TrayCheck,9,PRO_AOI_IP_12,0,环形线横移1托盘检测,X130,X130
DI,1000,环形线横移1料盘检测1,SW1_SideWay_ReelCheck,10,PRO_AOI_IP_12,0,环形线横移1料盘检测1,X131,X131 DI,1000,环形线横移1料盘检测1,SW1_ReelCheck,10,PRO_AOI_IP_12,0,环形线横移1料盘检测1,X131,X131
DI,1000,环形线横移1顶升上升端,SW1_TopCylinder_Up,11,PRO_AOI_IP_12,0,环形线横移1顶升上升端,X132,X132 DI,1000,环形线横移1顶升上升端,SW1_TopCylinder_Up,11,PRO_AOI_IP_12,0,环形线横移1顶升上升端,X132,X132
DI,1000,环形线横移1顶升下降端,SW1_TopCylinder_Down,12,PRO_AOI_IP_12,0,环形线横移1顶升下降端,X133,X133 DI,1000,环形线横移1顶升下降端,SW1_TopCylinder_Down,12,PRO_AOI_IP_12,0,环形线横移1顶升下降端,X133,X133
DI,1000,环形线横移1定位上升端,SW1_LocationCylinder_Up,13,PRO_AOI_IP_12,0,环形线横移1定位上升端,X134,X134 DI,1000,环形线横移1定位上升端,SW1_LocationCylinder_Up,13,PRO_AOI_IP_12,0,环形线横移1定位上升端,X134,X134
......
...@@ -78,14 +78,41 @@ namespace OnlineStore.DeviceLibrary ...@@ -78,14 +78,41 @@ namespace OnlineStore.DeviceLibrary
public override void TimerProcess() public override void TimerProcess()
{ {
if (IOValue(IO_Type.SL_SuddenStop_BTN).Equals(IO_VALUE.LOW))
{
WarnMsg = Name + "收到急停信号";
LogUtil.error(WarnMsg);
Alarm(LineAlarmType.SuddenStop);
return;
}
if (IOValue(IO_Type.SL_Reset_BTN).Equals(IO_VALUE.HIGH))
{
if (alarmType.Equals(LineAlarmType.None))
{
if (MoveInfo.MoveType.Equals(LineMoveType.None))
{
LogUtil.error(Name + "收到复位信号,当前无报警,不需要复位");
}
else
{
LogUtil.error(Name + "收到复位信号,当前无报警,正在" + MoveInfo.MoveType + "处理中,不需要复位");
}
}
else
{
LogUtil.info(Name + "收到复位信号,开始复位");
Reset();
}
return;
}
BusyMoveProcess(); BusyMoveProcess();
//判断流水线打开了才可以运行 //判断流水线打开了才可以运行
if (MoveInfo.MoveType.Equals(LineMoveType.None)) if (MoveInfo.MoveType.Equals(LineMoveType.None))
{ {
if (LineManager.Line.CanProcessLine()) if (LineManager.Line.CanProcessLine())
{ {
// LogUtil.info("StartCheckFixture"); StartCheckFixture();
// StartCheckFixture();
} }
} }
IOTimeOutProcess(); IOTimeOutProcess();
...@@ -99,6 +126,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -99,6 +126,8 @@ namespace OnlineStore.DeviceLibrary
public bool ReturnHome() public bool ReturnHome()
{ {
mainTimer.Stop(); mainTimer.Stop();
MoveInfo.EndMove();
SecondMoveInfo.EndMove();
if (!RunAxis(true,Config.Batch_Axis)) if (!RunAxis(true,Config.Batch_Axis))
{ {
return false; return false;
...@@ -110,21 +139,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -110,21 +139,9 @@ namespace OnlineStore.DeviceLibrary
alarmType = LineAlarmType.None; alarmType = LineAlarmType.None;
runStatus = LineRunStatus.HomeMoving; runStatus = LineRunStatus.HomeMoving;
LogInfo( "开始原点返回: (上下气缸回原点,阻挡气缸输入=0 )开始"); LogInfo( "开始原点返回: (上下伺服原点返回,上料伺服原点返回 )开始");
MoveInfo.NewMove(LineMoveType.ReturnHome); MoveInfo.NewMove(LineMoveType.ReturnHome);
//移载装置原点状态:顶升气缸下降端,前后气缸后退端,上下气缸上升端,夹料气缸放松端,阻挡气缸输入=0
UpdownHomeMove();
// CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up);
if (IsDebug)
{
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
}
else
{
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
}
return true; return true;
} }
/// <summary> /// <summary>
...@@ -142,41 +159,38 @@ namespace OnlineStore.DeviceLibrary ...@@ -142,41 +159,38 @@ namespace OnlineStore.DeviceLibrary
{ {
return false; return false;
} }
alarmType = LineAlarmType.None; alarmType = LineAlarmType.None;
//重置时清理盘号,从头开始判断 LogInfo("开始重置: (上下伺服原点返回,上料伺服原点返回)开始;");
// preTrayNum = 0;
// currMoveTrayNum = 0;
LogInfo("开始重置:清零上一个托盘号,(上下气缸回原点,阻挡气缸输入=0 )开始;");
runStatus = LineRunStatus.Reset; runStatus = LineRunStatus.Reset;
MoveInfo.NewMove(LineMoveType.Reset); MoveInfo.NewMove(LineMoveType.Reset);
StartReset();
UpdownHomeMove();
// CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up);
if (IsDebug)
{
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.HIGH);
}
else
{
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.HIGH);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
}
isInPro = false;
return true; return true;
} }
private void StartReset()
{
IOMove(IO_Type.SL_HddLed, IO_VALUE.HIGH);
MoveInfo.NextMoveStep(LineMoveStep.FR_01_StopCylinderMove);
ACAxisHomeMove(Config.UpDown_Axis);
ACAxisHomeMove(Config.Batch_Axis);
isInPro = false;
}
/// <summary> /// <summary>
/// 重置处理 /// 重置处理
/// </summary> /// </summary>
protected override void ResetProcess() protected override void ResetProcess()
{ {
ReturnHomeProcess();
}
/// <summary>
/// 原点返回处理
/// </summary>
protected override void ReturnHomeProcess()
{
if (MoveInfo.IsInWait) if (MoveInfo.IsInWait)
{ {
CheckWait(MoveInfo); CheckWait(MoveInfo);
} }
if (!MoveInfo.IsInWait)
if (!MoveInfo.IsInWait )
{ {
//流水线各装置复原位,夹料气缸状态不变 //流水线各装置复原位,夹料气缸状态不变
//阻挡气缸全部=0 //阻挡气缸全部=0
...@@ -185,24 +199,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -185,24 +199,19 @@ namespace OnlineStore.DeviceLibrary
//复位时夹紧气缸需要发送,不然后面出入库会有问题 //复位时夹紧气缸需要发送,不然后面出入库会有问题
switch (MoveInfo.MoveStep) switch (MoveInfo.MoveStep)
{ {
case LineMoveStep.MH_UpDownHomeMove: case LineMoveStep.FR_01_StopCylinderMove:
MoveInfo.NextMoveStep(LineMoveStep.MH_UpDownCylinder_Up);
LogInfo("重置: (上下轴原点返回完成,上下轴走到待机点 )开始");
UpdownUpMove();
break;
case LineMoveStep.MH_UpDownCylinder_Up:
MoveInfo.NextMoveStep(LineMoveStep.MH_OtherCylinder_Back); LogInfo(MoveInfo.MoveType + ":开始气缸下降");
LogInfo( "重置: (上升到位,顶升气缸下降,前后气缸回退 )开始"); break;
CylinderMove(MoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down); case LineMoveStep.FR_02_LocationCylinderDown:
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After);
CylinderMove(MoveInfo, IO_Type.ClampCylinder_Slack, IO_Type.ClampCylinder_Tighten);
break; break;
case LineMoveStep.FR_03_AxisHomeMove:
break;
case LineMoveStep.FR_04_AxisToP1:
case LineMoveStep.MH_OtherCylinder_Back: LogInfo("重置完成!");
LogInfo( "重置完成!");
runStatus = LineRunStatus.Runing; runStatus = LineRunStatus.Runing;
MoveInfo.EndMove(); MoveInfo.EndMove();
break; break;
//TODO 需要继续之前的的出入库处理 //TODO 需要继续之前的的出入库处理
//ContinueInOutStore(); //ContinueInOutStore();
...@@ -211,174 +220,34 @@ namespace OnlineStore.DeviceLibrary ...@@ -211,174 +220,34 @@ namespace OnlineStore.DeviceLibrary
} }
} }
} }
/// <summary>
/// 原点返回处理 protected override void StopMoveProcess()
/// </summary>
protected override void ReturnHomeProcess()
{ {
if (MoveInfo.IsInWait) if (MoveInfo.IsInWait)
{ {
CheckWait(MoveInfo); CheckWait(MoveInfo);
} }
if (!MoveInfo.IsInWait )
if (!MoveInfo.IsInWait)
{ {
switch (MoveInfo.MoveStep) switch (MoveInfo.MoveStep)
{ {
case LineMoveStep.MH_UpDownHomeMove:
MoveInfo.NextMoveStep(LineMoveStep.MH_UpDownCylinder_Up);
LogInfo("原点返回: (上下轴原点返回完成,上下轴走到待机点 )开始");
UpdownUpMove();
break;
case LineMoveStep.MH_UpDownCylinder_Up: case LineMoveStep.MH_UpDownCylinder_Up:
LogInfo("原点返回:(上升到位,顶升气缸下降,前后气缸回退 )开始");
MoveInfo.NextMoveStep(LineMoveStep.MH_OtherCylinder_Back);
CylinderMove(MoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After);
CylinderMove(MoveInfo, IO_Type.ClampCylinder_Slack, IO_Type.ClampCylinder_Tighten);
break; break;
case LineMoveStep.MH_OtherCylinder_Back:
MoveInfo.EndMove(); case LineMoveStep.MH_OtherCylinder_Back:
LogInfo( "原点返回完成!");
runStatus = LineRunStatus.Runing;
//如果是调试模式,入料装置两个阻挡气缸落下,并且不再移动
if (IsDebug)
{
lineStatus = LineStatus.Debugging;
}
else
{
lineStatus = LineStatus.StoreOnline;
}
break; break;
default: break;
}
}
}
protected override void StopMoveProcess()
{
if (MoveInfo.IsInWait)
{
CheckWait(MoveInfo);
}
if (!MoveInfo.IsInWait )
{
switch (MoveInfo.MoveStep)
{
//流水线各装置复原位,夹料气缸状态不变 //阻挡气缸全部=0 //上下气缸上升,、 //上升到位,顶升气缸下降,前后气缸回退
case LineMoveStep.MH_UpDownCylinder_Up:
{
MoveInfo.NextMoveStep(LineMoveStep.MH_OtherCylinder_Back);
LogInfo( "停止运动: (上升到位,顶升气缸下降,前后气缸回退 )开始");
IOMove(IO_Type.UpDownCylinder_Up, IO_VALUE.LOW);
CylinderMove(MoveInfo, IO_Type.TopCylinder_UP, IO_Type.TopCylinder_Down);
CylinderMove(MoveInfo, IO_Type.BeforeAfterCylinder_Before, IO_Type.BeforeAfterCylinder_After);
break;
}
case LineMoveStep.MH_OtherCylinder_Back:
{
LogInfo("停止运行完成,停止伺服!");
CloseAxis(Config.UpDown_Axis);
CloseAxis(Config.Batch_Axis);
if (UseAxis)
{
LogInfo("停止运动:停止伺服");
ACServerManager.SuddenStop(Config.Batch_Axis);
}
runStatus = LineRunStatus.Runing;
MoveInfo.EndMove();
break;
}
default: break; default: break;
} }
} }
} }
/// <summary>
/// 停止运动
/// </summary>
public override void StopMove()
{
//如果正在出库中,需要减去托盘号
if (MoveInfo.MoveType.Equals(LineMoveType.OutStore))
{
// LogInfo( "停止运动时出库执行中,减去托盘数;");
//减去需要的盘数
// TrayManager.DelNeedEmptyTrayNum();
MoveInfo.EndMove();
}
runStatus = LineRunStatus.Busy;
LogInfo( "停止运动:(上下气缸上升端,阻挡气缸输入=0 )开始 ");
MoveInfo.NewMove(LineMoveType.StopMove); public override void StopMove()
MoveInfo.NextMoveStep(LineMoveStep.MH_UpDownCylinder_Up); {
UpdownUpMove(); }
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW);
}
/// <summary>
/// 上下气缸移动到上升端
/// </summary>
private void UpdownUpMove()
{
if (UseAxis)
{
ACAxisMove(Config.Batch_Axis, Config.BatchAxisP1, Config.BatchAxis_P1Speed);
}
else
{
CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up);
}
}
private void UpdownDownMove(int trayHeight)
{
if (UseAxis)
{
int position = Config.GetUpdownPosition(trayHeight);
ACAxisMove(Config.Batch_Axis, position, Config.BatchAxis_DownSpeed);
}
else
{
CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Up, IO_Type.UpDownCylinder_Down);
}
}
private void UpdownDownBoxMove(int trayHeight)
{
if (UseAxis)
{
int position = Config.GetUpdownBoxPosition(trayHeight);
ACAxisMove(Config.Batch_Axis, position, Config.BatchAxis_DownSpeed);
}
else
{
CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Up, IO_Type.UpDownCylinder_Down);
}
}
private void UpdownHomeMove()
{
if (UseAxis)
{
MoveInfo.NextMoveStep(LineMoveStep.MH_UpDownHomeMove);
ACAxisHomeMove(Config.Batch_Axis);
}
else
{
MoveInfo.NextMoveStep(LineMoveStep.MH_UpDownCylinder_Up);
CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up);
}
}
public override bool StartOutStoreMove(InOutParam param) public override bool StartOutStoreMove(InOutParam param)
{ {
...@@ -387,9 +256,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -387,9 +256,7 @@ namespace OnlineStore.DeviceLibrary
protected override void OutStoreProcess() protected override void OutStoreProcess()
{ {
} }
/// <summary> /// <summary>
/// 是否需要拦截当前托盘进行处理 /// 是否需要拦截当前托盘进行处理
/// </summary> /// </summary>
...@@ -413,19 +280,20 @@ namespace OnlineStore.DeviceLibrary ...@@ -413,19 +280,20 @@ namespace OnlineStore.DeviceLibrary
} }
} }
return false; return false;
} /// <summary> }
/// 下降所有阻挡气缸 /// <summary>
/// </summary> /// 下降所有阻挡气缸
/// </summary>
internal override void OpenStopCylinder() internal override void OpenStopCylinder()
{ {
if (Config.SidesWayNum<=0) if (Config.SidesWayNum <= 0)
{ {
LogInfo("下降阻挡气缸,下降顶升气缸 "); LogInfo("下降阻挡气缸,下降顶升气缸 ");
IOMove(IO_Type.FL_StopCylinder_Down1, IO_VALUE.HIGH); IOMove(IO_Type.FL_StopCylinder_Down1, IO_VALUE.HIGH);
IOMove(IO_Type.FL_StopCylinder_Down2, IO_VALUE.HIGH); IOMove(IO_Type.FL_StopCylinder_Down2, IO_VALUE.HIGH);
//顶升气缸下降 //顶升气缸下降
IOMove(IO_Type.FL_TopCylinder_Up, IO_VALUE.LOW); CylinderMove(null, IO_Type.FL_TopCylinder_Up, IO_Type.FL_TopCylinder_Down);
IOMove(IO_Type.FL_TopCylinder_Down, IO_VALUE.HIGH);
} }
} }
internal override void CloseCylinderStop() internal override void CloseCylinderStop()
...@@ -433,8 +301,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -433,8 +301,8 @@ namespace OnlineStore.DeviceLibrary
if (Config.SidesWayNum <= 0) if (Config.SidesWayNum <= 0)
{ {
LogInfo("上升阻挡气缸,关闭 顶升气缸IO"); LogInfo("上升阻挡气缸,关闭 顶升气缸IO");
IOMove(IO_Type.StopCylinder_Down1, IO_VALUE.LOW); IOMove(IO_Type.FL_StopCylinder_Down1, IO_VALUE.LOW);
IOMove(IO_Type.StopCylinder_Down2, IO_VALUE.LOW); IOMove(IO_Type.FL_StopCylinder_Down2, IO_VALUE.LOW);
//顶升气缸下降 //顶升气缸下降
IOMove(IO_Type.FL_TopCylinder_Up, IO_VALUE.LOW); IOMove(IO_Type.FL_TopCylinder_Up, IO_VALUE.LOW);
......
...@@ -118,11 +118,66 @@ namespace OnlineStore.DeviceLibrary ...@@ -118,11 +118,66 @@ namespace OnlineStore.DeviceLibrary
Wait = 0, Wait = 0,
#region 移栽装置原点返回和重置步骤 #region 流水线入仓操作 100开始
/// <summary>
/// 流水线入仓,开始扫码 扫描枪触发,数据处理
/// </summary>
LI_Scannering = 101,
/// <summary>
/// 流水线入仓,料仓号及库位号发送, 夹具号编码记忆(X5,X6.X7)数据接收
/// </summary>
LI_WaitServerResult = 102,
/// <summary>
/// 等待100毫秒后再放行
/// </summary>
LI_00_Wait100 = 103,
/// <summary>
/// 阻挡气缸0-2下降
/// </summary>
LI_01_StopCylinder2Down = 104,
/// <summary>
/// 检测夹具检测1=0 ) 开始
/// </summary>
LI_02_FixtureCheck = 105,
/// <summary>
/// 阻挡气缸0-2上升
/// </summary>
LI_03_StopCylinder2Up = 106,
/// <summary>
/// 阻挡气缸0-1下降
/// </summary>
LI_04_StopCylinder1Down = 107,
#endregion
#region 流水线出库操作200开始
/// <summary>
/// 流水线出库,等待100毫秒之后在放行
/// </summary>
LO_00_Wait100 = 200,
/// <summary>
/// 流水线出库,阻挡气缸0-2下降
/// </summary>
LO_01_StopCylinder2Down = 201,
/// <summary>
/// 流水线出库, 检测夹具检测1=0
/// </summary>
LO_02_FixtureCheck = 202,
/// <summary>
/// 流水线出库,阻挡气缸0-2上升
/// </summary>
LO_03_StopCylinder2Up = 203,
/// <summary>
/// 阻挡气缸0-1下降
/// </summary>
LO_04_StopCylinder1Up = 204,
#endregion
#region 移栽装置原点返回和重置步骤 2000开始
/// <summary> /// <summary>
/// 上下气缸回原点 /// 上下气缸回原点
/// </summary> /// </summary>
MH_UpDownHomeMove=2000, MH_UpDownHomeMove = 2000,
/// <summary> /// <summary>
/// 料仓移栽装置,上下气缸上升端 /// 料仓移栽装置,上下气缸上升端
/// </summary> /// </summary>
...@@ -134,63 +189,79 @@ namespace OnlineStore.DeviceLibrary ...@@ -134,63 +189,79 @@ namespace OnlineStore.DeviceLibrary
#endregion #endregion
#region 移载装置入库处理 3000-3050
#region 流水线入仓操作 10000开始
/// <summary> /// <summary>
/// 流水线入仓,开始扫码 扫描枪触发,数据处理 ///移载装置入库处理,检测 夹具编码
/// </summary> /// </summary>
LI_Scannering = 10001, MI_05_CodeCheck = 3005,
/// <summary> /// <summary>
/// 流水线入仓,料仓号及库位号发送, 夹具号编码记忆(X5,X6.X7)数据接收 ///移载装置入库处理,编码与仓位一致,上下气缸1下降
/// </summary> /// </summary>
LI_WaitServerResult = 10002, MI_07_UpDownCylinderDown = 3007,
/// <summary> /// <summary>
/// 等待100毫秒后再放行 ///移载装置入库处理,编码与仓位一致,上下气缸1下降后,等待0.3秒,防止没有 下降到位就夹紧
/// </summary> /// </summary>
LI_00_Wait100 = 10003, MI_07_UpDownCylinderDownWait = 3024,
/// <summary> /// <summary>
/// 阻挡气缸0-2下降 ///移载装置入库处理,夹料气缸1夹紧
/// </summary> /// </summary>
LI_01_StopCylinder2Down = 10004, MI_08_ClampCylinderSlack = 3008,
/// <summary> /// <summary>
/// 检测夹具检测1=0 ) 开始 ///移载装置入库处理,上下气缸1上升
/// </summary> /// </summary>
LI_02_FixtureCheck = 10005, MI_09_UpDownCylinderUp = 3009,
/// <summary> /// <summary>
/// 阻挡气缸0-2上升 ///移载装置入库处理,,前后气缸1前进
/// </summary> /// </summary>
LI_03_StopCylinder2Up = 10006, MI_10_BeforeAfterCylinderBefore = 3010,
/// <summary> /// <summary>
/// 阻挡气缸0-1下降 /// 移载装置入库处理,等待box等待状态才能继续操作
/// </summary> /// </summary>
LI_04_StopCylinder1Down = 10007, MI_10_WaitBox = 3006,
#endregion
#region 流水线出库操作
/// <summary> /// <summary>
/// 流水线出库,等待100毫秒之后在放行 ///移载装置入库处理,上下气缸1下降
/// </summary>
MI_11_UpDownCylinderDown = 3011,
/// <summary>
///移载装置入库处理,,夹料气缸1放松
/// </summary> /// </summary>
LO_00_Wait100 = 11000, MI_12_ClampCylinderTighten = 3012,
/// <summary> /// <summary>
/// 流水线出库,阻挡气缸0-2下降 ///移载装置入库处理,上下气缸1上升
/// </summary> /// </summary>
LO_01_StopCylinder2Down = 11001, MI_13_UpdownCylinderUp = 3013,
/// <summary> /// <summary>
/// 流水线出库, 检测夹具检测1=0 ///移载装置入库处理,,前后气缸1后退
/// </summary> /// </summary>
LO_02_FixtureCheck = 11002, MI_14_BeforeAfterCylinderAfter = 3014,
/// <summary> /// <summary>
/// 流水线出库,阻挡气缸0-2上升 ///移载装置入库处理,检测到X102-1=1送料流程完成
/// </summary> /// </summary>
LO_03_StopCylinder2Up = 11003, MI_15_SendEnd = 3015,
/// <summary> /// <summary>
/// 阻挡气缸0-1下降 ///移载装置入库处理,编码不一致,顶升气缸1下降
/// </summary>
MI_20_TopCylinderDown = 3020,
/// <summary>
///移载装置入库处理,阻挡气缸1-2下降
/// </summary>
MI_21_StopCylinderDown = 3021,
/// <summary>
///移载装置入库处理,检测Check4=0,
/// </summary> /// </summary>
LO_04_StopCylinder1Up = 11004, MI_22_FixtureCheck_Low = 3022,
/// <summary>
///移载装置入库处理,,,阻挡气缸1-2 上升,等待200毫秒
/// </summary>
MI_23_StopCylinderReset = 3023,
#endregion #endregion
#region 移栽装置出入库共同模块 3080开始 #region 移栽装置出入库共同模块 3080-3100
/// <summary> /// <summary>
///移载(流水线)装置出入库处理,阻挡气缸1-1下降 ///移载(流水线)装置出入库处理,阻挡气缸1-1下降
/// </summary> /// </summary>
...@@ -230,7 +301,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -230,7 +301,7 @@ namespace OnlineStore.DeviceLibrary
MIO_09_WaitLetFixtureGo=3089, MIO_09_WaitLetFixtureGo=3089,
#endregion #endregion
#region 移栽装置出库处理 3100开始 #region 移栽装置出库处理 3100-3200
/// <summary> /// <summary>
/// 移载(流水线)装置出库处理, 检测夹具编码并记忆,托盘 是空盘,并且BOX在出库等待中,开始移栽料盘 /// 移载(流水线)装置出库处理, 检测夹具编码并记忆,托盘 是空盘,并且BOX在出库等待中,开始移栽料盘
/// </summary> /// </summary>
...@@ -305,76 +376,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -305,76 +376,6 @@ namespace OnlineStore.DeviceLibrary
#endregion #endregion
#region 移载装置入库处理 3000开始
/// <summary>
///移载装置入库处理,检测 夹具编码
/// </summary>
MI_05_CodeCheck = 3005,
/// <summary>
///移载装置入库处理,编码与仓位一致,上下气缸1下降
/// </summary>
MI_07_UpDownCylinderDown = 3007,
/// <summary>
///移载装置入库处理,编码与仓位一致,上下气缸1下降后,等待0.3秒,防止没有 下降到位就夹紧
/// </summary>
MI_07_UpDownCylinderDownWait = 3024,
/// <summary>
///移载装置入库处理,夹料气缸1夹紧
/// </summary>
MI_08_ClampCylinderSlack = 3008,
/// <summary>
///移载装置入库处理,上下气缸1上升
/// </summary>
MI_09_UpDownCylinderUp = 3009,
/// <summary>
///移载装置入库处理,,前后气缸1前进
/// </summary>
MI_10_BeforeAfterCylinderBefore = 3010,
/// <summary>
/// 移载装置入库处理,等待box等待状态才能继续操作
/// </summary>
MI_10_WaitBox = 3006,
/// <summary>
///移载装置入库处理,上下气缸1下降
/// </summary>
MI_11_UpDownCylinderDown = 3011,
/// <summary>
///移载装置入库处理,,夹料气缸1放松
/// </summary>
MI_12_ClampCylinderTighten = 3012,
/// <summary>
///移载装置入库处理,上下气缸1上升
/// </summary>
MI_13_UpdownCylinderUp = 3013,
/// <summary>
///移载装置入库处理,,前后气缸1后退
/// </summary>
MI_14_BeforeAfterCylinderAfter = 3014,
/// <summary>
///移载装置入库处理,检测到X102-1=1送料流程完成
/// </summary>
MI_15_SendEnd = 3015,
/// <summary>
///移载装置入库处理,编码不一致,顶升气缸1下降
/// </summary>
MI_20_TopCylinderDown = 3020,
/// <summary>
///移载装置入库处理,阻挡气缸1-2下降
/// </summary>
MI_21_StopCylinderDown = 3021,
/// <summary>
///移载装置入库处理,检测Check4=0,
/// </summary>
MI_22_FixtureCheck_Low = 3022,
/// <summary>
///移载装置入库处理,,,阻挡气缸1-2 上升,等待200毫秒
/// </summary>
MI_23_StopCylinderReset = 3023,
#endregion
#region 横移轨道处理 5000 开始 #region 横移轨道处理 5000 开始
...@@ -422,6 +423,33 @@ namespace OnlineStore.DeviceLibrary ...@@ -422,6 +423,33 @@ namespace OnlineStore.DeviceLibrary
#endregion #endregion
#region 入料装置原点返回,10000开始
/// <summary>
/// 阻挡气缸复位
/// </summary>
FR_01_StopCylinderMove=10001,
/// <summary>
/// 定位气缸下降
/// </summary>
FR_02_LocationCylinderDown=10002,
/// <summary>
/// 伺服原点返回
/// </summary>
FR_03_AxisHomeMove=10003,
/// <summary>
/// 伺服回待机点
/// </summary>
FR_04_AxisToP1=10004,
#endregion
#region 入料装置入料处理,11000开始
/// <summary>
/// 入口流水线转动
/// </summary>
FI_01_InLineStart=11001,
#endregion
#region 出料装置移栽出料,20000开始 #region 出料装置移栽出料,20000开始
/// <summary> /// <summary>
...@@ -489,6 +517,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -489,6 +517,10 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
DL_R_LineCheck=30100, DL_R_LineCheck=30100,
#endregion #endregion
} }
public enum LineAlarmType public enum LineAlarmType
......
...@@ -33,7 +33,6 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -33,7 +33,6 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("CameraNameList")] [ConfigProAttribute("CameraNameList")]
public string CameraNameList { get; set; } public string CameraNameList { get; set; }
/// <summary> /// <summary>
/// PRO,0,对应的横移模块,SidesWayNum,3,,,,, /// PRO,0,对应的横移模块,SidesWayNum,3,,,,,
/// </summary> /// </summary>
...@@ -45,121 +44,123 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -45,121 +44,123 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
[ConfigProAttribute("UpDownUseAxis")] [ConfigProAttribute("UpDownUseAxis")]
public int UpDownUseAxis { get; set; } public int UpDownUseAxis { get; set; }
/// <summary>
/// PRO 0 批量上料轴在移栽上下降的位置 UpDownPositions 0=180000
/// </summary>
[ConfigProAttribute("UpDownPositions",false) ]
public string UpDownPositions { get; set; }
/// <summary>
/// PRO 0 批量上料轴在料仓门口下降的位置 UpDownBoxPositions 0=116000
/// </summary>
[ConfigProAttribute("UpDownBoxPositions", false)]
public string UpDownBoxPositions { get; set; }
/// <summary> /// <summary>
/// AXIS 0 批量上料轴 UpDown_Axis 2 /// AXIS 0 批量上料轴 UpDown_Axis 2
/// </summary> /// </summary>
[ConfigProAttribute("Batch_Axis", false)] [ConfigProAttribute("Batch_Axis", true)]
public ConfigMoveAxis Batch_Axis { get; set; } public ConfigMoveAxis Batch_Axis { get; set; }
/// <summary> /// <summary>
/// PRO 0 批量上料轴待机点 P1 BatchAxisP1 403000 /// PRO 0 批量上料轴待机点 P1 BatchAxisP1 403000
/// </summary> /// </summary>
[ConfigProAttribute("BatchAxisP1", false)] [ConfigProAttribute("BatchAxisP1", true)]
public int BatchAxisP1 { get; set; } public int BatchAxisP1 { get; set; }
/// <summary> /// <summary>
/// PRO 0 批量上料轴目标速度 BatchAxis_TargetSpeed 150 /// PRO 0 批量上料轴目标速度 BatchAxis_TargetSpeed 150
/// </summary> /// </summary>
[ConfigProAttribute("BatchAxis_TargetSpeed", false)] [ConfigProAttribute("BatchAxis_TargetSpeed", true)]
public int BatchAxis_TargetSpeed { get; set; } public int BatchAxis_TargetSpeed { get; set; }
/// <summary> /// <summary>
/// PRO 0 批量上料轴加速度 BatchAxis_AddSpeed 400 /// PRO 0 批量上料轴加速度 BatchAxis_AddSpeed 400
/// </summary> /// </summary>
[ConfigProAttribute("BatchAxis_AddSpeed", false)] [ConfigProAttribute("BatchAxis_AddSpeed", true)]
public short BatchAxis_AddSpeed { get; set; } public short BatchAxis_AddSpeed { get; set; }
/// <summary> /// <summary>
/// PRO 0 批量上料轴减速度 BatchAxis_DelSpeed 400 /// PRO 0 批量上料轴减速度 BatchAxis_DelSpeed 400
/// </summary> /// </summary>
[ConfigProAttribute("BatchAxis_DelSpeed", false)] [ConfigProAttribute("BatchAxis_DelSpeed", true)]
public short BatchAxis_DelSpeed { get; set; } public short BatchAxis_DelSpeed { get; set; }
/// <summary> /// <summary>
/// PRO 0 批量上料轴原点低速度 BatchAxis_HomeLowSpeed 100 /// PRO 0 批量上料轴原点低速度 BatchAxis_HomeLowSpeed 100
/// </summary> /// </summary>
[ConfigProAttribute("BatchAxis_HomeLowSpeed", false)] [ConfigProAttribute("BatchAxis_HomeLowSpeed", true)]
public int BatchAxis_HomeLowSpeed { get; set; } public int BatchAxis_HomeLowSpeed { get; set; }
/// <summary> /// <summary>
/// PRO 0 批量上料轴原点高速 BatchAxis_HomeHighSpeed 200 /// PRO 0 批量上料轴原点高速 BatchAxis_HomeHighSpeed 200
/// </summary> /// </summary>
[ConfigProAttribute("BatchAxis_HomeHighSpeed", false)] [ConfigProAttribute("BatchAxis_HomeHighSpeed", true)]
public int BatchAxis_HomeHighSpeed { get; set; } public int BatchAxis_HomeHighSpeed { get; set; }
/// <summary> /// <summary>
/// PRO 0 批量上料轴原点加速度 BatchAxis_HomeAddSpeed 200 /// PRO 0 批量上料轴原点加速度 BatchAxis_HomeAddSpeed 200
/// </summary> /// </summary>
[ConfigProAttribute("BatchAxis_HomeAddSpeed", false)] [ConfigProAttribute("BatchAxis_HomeAddSpeed", true)]
public int BatchAxis_HomeAddSpeed { get; set; } public int BatchAxis_HomeAddSpeed { get; set; }
/// <summary> /// <summary>
/// PRO,0,批量上料轴走到待机点速度,BatchAxis_P1Speed,400,,,,, /// PRO 0 移栽上下轴慢速上升速度 BatchAxis_SlowSpeed 200
/// </summary> /// </summary>
[ConfigProAttribute("BatchAxis_P1Speed", false)] [ConfigProAttribute("BatchAxis_SlowSpeed", true)]
public int BatchAxis_SlowSpeed { get; set; }
/// <summary>
///PRO 0 批量上料轴P1速度 BatchAxis_P1Speed 400
/// </summary>
[ConfigProAttribute("BatchAxis_P1Speed", true)]
public int BatchAxis_P1Speed { get; set; } public int BatchAxis_P1Speed { get; set; }
/// <summary> /// <summary>
/// PRO,0,批量上料轴下降速度,BatchAxis_DownSpeed,500,,,,, /// PRO 0 批量上料轴在移栽上下降的位置 UpDownPositions 0=180000
/// </summary> /// </summary>
[ConfigProAttribute("BatchAxis_DownSpeed", false)] [ConfigProAttribute("UpDownPositions", true)]
public int BatchAxis_DownSpeed { get; set; } public string UpDownPositions { get; set; }
/// <summary>
/// PRO 0 批量上料轴在料仓门口下降的位置 UpDownBoxPositions 0=116000
/// </summary>
[ConfigProAttribute("UpDownBoxPositions", true)]
public string UpDownBoxPositions { get; set; }
/// <summary> /// <summary>
/// AXIS 0 移栽上下轴 UpDown_Axis 2 /// AXIS 0 移栽上下轴 UpDown_Axis 2
/// </summary> /// </summary>
[ConfigProAttribute("UpDown_Axis", false)] [ConfigProAttribute("UpDown_Axis", true)]
public ConfigMoveAxis UpDown_Axis { get; set; } public ConfigMoveAxis UpDown_Axis { get; set; }
/// <summary> /// <summary>
/// PRO 0 移栽上下轴待机点 P1 UpDownAxisP1 403000 /// PRO 0 移栽上下轴待机点 P1 UpDownAxisP1 403000
/// </summary> /// </summary>
[ConfigProAttribute("UpDownAxisP1", false)] [ConfigProAttribute("UpDownAxisP1", true)]
public int UpDownAxisP1 { get; set; } public int UpDownAxisP1 { get; set; }
/// <summary> /// <summary>
/// PRO 0 移栽上下轴目标速度 UpdownAxis_TargetSpeed 150 /// PRO 0 移栽上下轴目标速度 UpdownAxis_TargetSpeed 150
/// </summary> /// </summary>
[ConfigProAttribute("UpdownAxis_TargetSpeed", false)] [ConfigProAttribute("UpdownAxis_TargetSpeed", true)]
public int UpdownAxis_TargetSpeed { get; set; } public int UpdownAxis_TargetSpeed { get; set; }
/// <summary> /// <summary>
/// PRO 0 移栽上下轴加速度 UpdownAxis_AddSpeed 400 /// PRO 0 移栽上下轴加速度 UpdownAxis_AddSpeed 400
/// </summary> /// </summary>
[ConfigProAttribute("UpdownAxis_AddSpeed", false)] [ConfigProAttribute("UpdownAxis_AddSpeed", true)]
public short UpdownAxis_AddSpeed { get; set; } public short UpdownAxis_AddSpeed { get; set; }
/// <summary> /// <summary>
/// PRO 0 移栽上下轴减速度 UpdownAxis_DelSpeed 400 /// PRO 0 移栽上下轴减速度 UpdownAxis_DelSpeed 400
/// </summary> /// </summary>
[ConfigProAttribute("UpdownAxis_DelSpeed", false)] [ConfigProAttribute("UpdownAxis_DelSpeed", true)]
public short UpdownAxis_DelSpeed { get; set; } public short UpdownAxis_DelSpeed { get; set; }
/// <summary> /// <summary>
/// PRO 0 移栽上下轴原点低速度 UpdownAxis_HomeLowSpeed 100 /// PRO 0 移栽上下轴原点低速度 UpdownAxis_HomeLowSpeed 100
/// </summary> /// </summary>
[ConfigProAttribute("UpdownAxis_HomeLowSpeed", false)] [ConfigProAttribute("UpdownAxis_HomeLowSpeed", true)]
public int UpdownAxis_HomeLowSpeed { get; set; } public int UpdownAxis_HomeLowSpeed { get; set; }
/// <summary> /// <summary>
/// PRO 0 移栽上下轴原点高速 UpdownAxis_HomeHighSpeed 200 /// PRO 0 移栽上下轴原点高速 UpdownAxis_HomeHighSpeed 200
/// </summary> /// </summary>
[ConfigProAttribute("UpdownAxis_HomeHighSpeed", false)] [ConfigProAttribute("UpdownAxis_HomeHighSpeed", true)]
public int UpdownAxis_HomeHighSpeed { get; set; } public int UpdownAxis_HomeHighSpeed { get; set; }
/// <summary> /// <summary>
/// PRO 0 移栽上下轴原点加速度 UpdownAxis_HomeAddSpeed 200 /// PRO 0 移栽上下轴原点加速度 UpdownAxis_HomeAddSpeed 200
/// </summary> /// </summary>
[ConfigProAttribute("UpdownAxis_HomeAddSpeed", false)] [ConfigProAttribute("UpdownAxis_HomeAddSpeed", true)]
public int UpdownAxis_HomeAddSpeed { get; set; } public int UpdownAxis_HomeAddSpeed { get; set; }
/// <summary> /// <summary>
/// PRO,0,移栽上下轴走到待机点速度,UpdownAxis_P1Speed,400,,,,, /// PRO,0,移栽上下轴走到待机点速度,UpdownAxis_P1Speed,400,,,,,
/// </summary> /// </summary>
[ConfigProAttribute("UpdownAxis_P1Speed", false)] [ConfigProAttribute("UpdownAxis_P1Speed", true)]
public int UpdownAxis_P1Speed { get; set; } public int UpdownAxis_P1Speed { get; set; }
/// <summary> /// <summary>
/// PRO,0,移栽上下轴下降速度,UpdownAxis_DownSpeed,500,,,,, /// PRO,0,移栽上下轴下降速度,UpdownAxis_DownSpeed,500,,,,,
/// </summary> /// </summary>
[ConfigProAttribute("UpdownAxis_DownSpeed", false)] [ConfigProAttribute("UpdownAxis_DownSpeed", true)]
public int UpdownAxis_DownSpeed { get; set; } public int UpdownAxis_DownSpeed { get; set; }
/// <summary> /// <summary>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!