Commit 179c6ed8 LN

1

1 个父辈 5df80339
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C147236C-D1E7-4CD1-9344-79C948110F8F}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>ABBRobotTest</RootNamespace>
<AssemblyName>ABBRobotTest</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ABB.Robotics.Controllers.PC">
<HintPath>..\dll\ABB\ABB.Robotics.Controllers.PC.dll</HintPath>
</Reference>
<Reference Include="RobotStudio.Services.RobApi">
<HintPath>..\dll\ABB\RobotStudio.Services.RobApi.dll</HintPath>
</Reference>
<Reference Include="RobotStudio.Services.RobApi.Desktop">
<HintPath>..\dll\ABB\RobotStudio.Services.RobApi.Desktop.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FrmRobotTest.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmRobotTest.Designer.cs">
<DependentUpon>FrmRobotTest.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FrmRobotTest.resx">
<DependentUpon>FrmRobotTest.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
\ No newline at end of file
namespace ABBRobotTest
{
partial class FrmRobotTest
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.button4 = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.button5 = new System.Windows.Forms.Button();
this.listView1 = new System.Windows.Forms.ListView();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(11, 195);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(108, 46);
this.button1.TabIndex = 0;
this.button1.Text = "启动";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(23, 383);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(108, 46);
this.button2.TabIndex = 2;
this.button2.Text = "IO set";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(148, 383);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(108, 46);
this.button3.TabIndex = 3;
this.button3.Text = "IO reset";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// timer1
//
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// button4
//
this.button4.Location = new System.Drawing.Point(469, 195);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(108, 46);
this.button4.TabIndex = 5;
this.button4.Text = "get io List";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// comboBox1
//
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Items.AddRange(new object[] {
"di_start",
"di_startatmain",
"di_stop",
"aaa"});
this.comboBox1.Location = new System.Drawing.Point(23, 330);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 28);
this.comboBox1.TabIndex = 6;
//
// button5
//
this.button5.Location = new System.Drawing.Point(148, 195);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(108, 46);
this.button5.TabIndex = 7;
this.button5.Text = "停止";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// listView1
//
this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
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(11, 12);
this.listView1.MultiSelect = false;
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(864, 177);
this.listView1.TabIndex = 192;
this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.View = System.Windows.Forms.View.Details;
this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged_1);
//
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(469, 271);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(322, 261);
this.richTextBox1.TabIndex = 193;
this.richTextBox1.Text = "";
//
// FrmRobotTest
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(887, 595);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.listView1);
this.Controls.Add(this.button5);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "FrmRobotTest";
this.Text = "network scanning";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmRobotTest_FormClosing);
this.Load += new System.EventHandler(this.FrmRobotTest_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.RichTextBox richTextBox1;
}
}
using ABB.Robotics.Controllers;
using ABB.Robotics.Controllers.Discovery;
using ABB.Robotics.Controllers.EventLogDomain;
using ABB.Robotics.Controllers.IOSystemDomain;
using ABB.Robotics.Controllers.RapidDomain;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ABBRobotTest
{
public partial class FrmRobotTest : Form
{
public FrmRobotTest()
{
InitializeComponent();
}
private NetworkScanner scanner = null;
private Controller controller = null;
private Task[] tasks = null;
private NetworkWatcher networkwatcher = null;
private List<Controller> controllerList = new List<Controller>();
private void FrmRobotTest_Load(object sender, EventArgs e)
{
LoadListView();
LoadController();
timer1.Start();
comboBox1.SelectedIndex = 0;
}
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 LoadController()
{
this.scanner = new NetworkScanner();
this.scanner.Scan();
ControllerInfoCollection controllers = scanner.Controllers;
int i = 0;
foreach (ControllerInfo controllerInfo in controllers)
{
ListViewItem item = new ListViewItem(controllerInfo.IPAddress.ToString());
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);
Controller con = ControllerFactory.CreateFrom(controllerInfo);
con.Logon(UserInfo.DefaultUser);
ControllerState state = con.State;
controllerList.Add(con);
item.Tag = controllerInfo;
item.SubItems.Add(state.ToString());
this.listView1.Items.Add(item);
this.listView1.Items[i].Selected = true;
controller = con;
i++;
}
this.networkwatcher = new NetworkWatcher(scanner.Controllers);
this.networkwatcher.Found += new EventHandler<NetworkWatcherEventArgs>(HandleFoundEvent);
this.networkwatcher.Lost += new EventHandler<NetworkWatcherEventArgs>(HandleLostEvent);
this.networkwatcher.EnableRaisingEvents = true;
}
private void HandleLostEvent(object sender, NetworkWatcherEventArgs e)
{
}
void HandleFoundEvent(object sender, NetworkWatcherEventArgs e)
{
this.Invoke(new
EventHandler<NetworkWatcherEventArgs>(AddControllerToListView),
new Object[] { this, e });
}
private void AddControllerToListView(object sender, NetworkWatcherEventArgs e)
{
ControllerInfo controllerInfo = e.Controller; ListViewItem item
= new ListViewItem(controllerInfo.IPAddress.ToString());
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;
}
private void button1_Click(object sender, EventArgs e)
{
try
{
if (controller.OperatingMode == ControllerOperatingMode.Auto)
{
tasks = controller.Rapid.GetTasks();
using (Mastership m = Mastership.Request(controller.Rapid))
{
tasks[0].SetProgramPointer("aaa", "main");
controller.State = ControllerState.MotorsOn;
controller.Rapid.Start();
//Perform operation
//tasks[0].Start();
m.Dispose();
}
}
else
{
MessageBox.Show("Automatic mode is required to start execution from a remote client.");
}
}
catch (System.InvalidOperationException ex)
{
MessageBox.Show("Mastership is held by another client." + ex.Message);
}
catch (System.Exception ex)
{
MessageBox.Show("Unexpected error occurred: " + ex.Message);
}
}
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void listView1_DoubleClick(object sender, EventArgs e)
{
//ListViewItem item = this.listView1.SelectedItems[0];
//if (item.Tag != null)
//{
// ControllerInfo controllerInfo = (ControllerInfo)item.Tag;
// if
// (controllerInfo.Availability == Availability.Available)
// {
// if (this.controller != null)
// {
// this.controller.Logoff();
// this.controller.Dispose();
// this.controller = null;
// }
// this.controller = ControllerFactory.CreateFrom(controllerInfo);
// this.controller.Logon(UserInfo.DefaultUser);
// }
// else
// {
// MessageBox.Show("Selected controller not available.");
// }
//}
}
private void button2_Click(object sender, EventArgs e)
{
string name = comboBox1.Text;
Signal singalValue = controller.IOSystem.GetSignal(name);
DigitalSignal digitalSig = (DigitalSignal)singalValue;
digitalSig.Set();
}
private void button3_Click(object sender, EventArgs e)
{
string name = comboBox1.Text;
Signal singalValue = controller.IOSystem.GetSignal(name);
DigitalSignal digitalSig = (DigitalSignal)singalValue;
digitalSig.Reset();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (controller != null)
{
int i = 0;
foreach(Controller con in controllerList)
{
ControllerState state = con.State;
listView1.Items[i].SubItems[7] .Text= state.ToString();
i++;
}
}
}
private void button4_Click(object sender, EventArgs e)
{
IOFilterTypes aSigFilter = IOFilterTypes.Digital | IOFilterTypes.Input;
SignalCollection signals = controller.IOSystem.GetSignals(aSigFilter);
//string name = "di_startatmain";
//Signal singalValue = controller.IOSystem.GetSignal(name);
//DigitalSignal digitalSig = (DigitalSignal)singalValue;
//digitalSig.Set();
richTextBox1.Clear();
List<Signal> signalList = signals.ToList<Signal>();
foreach(Signal s in signalList)
{
richTextBox1.AppendText(s.ToString()+ Environment.NewLine);
}
}
private void button5_Click(object sender, EventArgs e)
{
try
{
if (controller.OperatingMode == ControllerOperatingMode.Auto)
{
tasks = controller.Rapid.GetTasks();
using (Mastership m = Mastership.Request(controller.Rapid))
{
//tasks[0].SetProgramPointer("aaa", "main");
//controller.State = ControllerState.MotorsOn;
//controller.Rapid.Start();
//Perform operation
//tasks[0].Start();
controller.Rapid.Stop();
m.Dispose();
}
}
else
{
MessageBox.Show("Automatic mode is required to start execution from a remote client.");
}
}
catch (System.InvalidOperationException ex)
{
MessageBox.Show("Mastership is held by another client." + ex.Message);
}
catch (System.Exception ex)
{
MessageBox.Show("Unexpected error occurred: " + ex.Message);
}
}
private void FrmRobotTest_FormClosing(object sender, FormClosingEventArgs e)
{
foreach(Controller con in controllerList)
{
con.Logoff();
con.Dispose();
}
}
private void listView1_SelectedIndexChanged_1(object sender, EventArgs e)
{
if (listView1.SelectedItems != null && listView1.SelectedItems.Count > 0)
{
int index = listView1.SelectedItems[0].Index;
controller = controllerList[index];
}
}
}
}
<?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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ABBRobotTest
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FrmRobotTest());
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ABBRobotTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ABBRobotTest")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("c147236c-d1e7-4cd1-9344-79c948110f8f")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace ABBRobotTest.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ABBRobotTest.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 覆盖当前线程的 CurrentUICulture 属性
/// 使用此强类型的资源类的资源查找。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ABBRobotTest.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
......@@ -17,6 +17,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLineClient", "sourc
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLineSystem", "source\AssemblyLineSystem\AssemblyLineSystem.csproj", "{7DE7A34B-77A5-465B-985B-1219FE0A9615}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ABBRobotTest", "ABBRobotTest\ABBRobotTest.csproj", "{C147236C-D1E7-4CD1-9344-79C948110F8F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -51,6 +53,10 @@ Global
{7DE7A34B-77A5-465B-985B-1219FE0A9615}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7DE7A34B-77A5-465B-985B-1219FE0A9615}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7DE7A34B-77A5-465B-985B-1219FE0A9615}.Release|Any CPU.Build.0 = Release|Any CPU
{C147236C-D1E7-4CD1-9344-79C948110F8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C147236C-D1E7-4CD1-9344-79C948110F8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C147236C-D1E7-4CD1-9344-79C948110F8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C147236C-D1E7-4CD1-9344-79C948110F8F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
此文件类型无法预览
此文件类型无法预览
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]];
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 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 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 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 p6:=[[825.4576,0.000000659,815.8895],[0.03072799,-0.000000008,-0.9995278,-0.000000006],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p7:=[[825.4576,-0.000000347,875.2359],[0.03072807,0.000000004,-0.9995278,0.000000003],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p8:=[[825.4576,0.000001138,914.6687],[0.03072812,-0.000000014,-0.9995278,-0.000000011],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p9:=[[825.4576,0.000000481,954.2989],[0.03072822,-0.000000006,-0.9995278,-0.000000004],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p10:=[[825.4576,-0.00000035,996.6124],[0.03072831,0.000000004,-0.9995278,0.000000003],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p11:=[[753.764,243.6931,840.0185],[0.2205171,0.3584949,-0.9055654,0.05296053],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p12:=[[753.764,243.6931,775.1548],[0.2205171,0.3584949,-0.9055655,0.05296054],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p13:=[[753.764,243.6931,695.0086],[0.2205171,0.3584949,-0.9055654,0.05296058],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p14:=[[753.764,243.6932,621.1562],[0.2205171,0.3584949,-0.9055654,0.0529606],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p15:=[[753.764,243.6932,509.4409],[0.2205171,0.3584949,-0.9055654,0.05296064],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p16:=[[753.764,243.6931,436.6886],[0.2205173,0.3584949,-0.9055654,0.05296063],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p17:=[[980.7636,243.6931,777.0938],[0.2205173,0.3584949,-0.9055654,0.05296072],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p18:=[[980.7637,243.6931,676.0527],[0.2205175,0.3584949,-0.9055654,0.05296073],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p19:=[[980.7637,243.6931,547.9425],[0.2205175,0.3584949,-0.9055654,0.05296074],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p20:=[[980.7636,243.693,422.2361],[0.2205177,0.3584948,-0.9055653,0.05296072],[0,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget p21:=[[943.39,251.39,232.51],[0.325692,0.363748,-0.871897,0.0375142],[0,0,-1,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
CONST robtarget p22:=[[933.30,286.58,232.51],[0.324931,0.380032,-0.864924,0.043614],[0,0,-1,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
CONST robtarget p23:=[[943.52,289.36,269.92],[0.303826,0.380911,-0.872016,0.0467343],[0,0,-1,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
CONST robtarget p24:=[[951.67,291.58,305.65],[0.283752,0.381565,-0.878309,0.0496596],[0,0,-1,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
CONST robtarget p25:=[[957.63,293.21,337.45],[0.265933,0.381999,-0.883532,0.0522222],[0,0,-1,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
CONST robtarget p26:=[[961.87,294.37,365.18],[0.250414,0.382266,-0.887808,0.0544283],[0,0,-1,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
CONST robtarget p27:=[[966.30,295.57,403.79],[0.228818,0.38247,-0.893341,0.057459],[0,0,-1,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
CONST robtarget p28:=[[968.46,296.16,431.77],[0.213148,0.382496,-0.897056,0.0596298],[0,0,-1,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
CONST robtarget p29:=[[969.95,296.57,468.46],[0.192573,0.382378,-0.901556,0.0624448],[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];
VAR socketdev socket_server;
VAR socketdev socket_client;
PERS string str_address:="127.0.0.1";
PERS num n_port:=21;
VAR string strReceive:="p1,L,100";
VAR string strSend:="OK";
VAR socketstatus status;
VAR num starBit1:=0;
VAR num endBit1:=0;
VAR num LengBit1:=0;
VAR num starBit2:=0;
VAR num endBit2:=0;
VAR num LengBit2:=0;
VAR num starBit3:=0;
VAR num endBit3:=0;
VAR num LengBit3:=0;
VAR num endBit4:=0;
VAR num LengBit4:=0;
VAR num starBit4:=0;
PERS string s1_1:="movep";
PERS string s1_2:="p27";
PERS string s1_3:="l";
PERS string s1_4:="345";
VAR bool flag1:=false;
PERS num value_1:=700;
PERS num value_2:=50;
PERS num value_3:=345;
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]];
PERS bool bLinear:=TRUE;
PERS bool dataOk:=TRUE;
VAR num len:=0;
PROC modifyPoint()
MoveL p1,speed1,z50,MyTool\WObj:=wobj0;
MoveL p2,speed1,z50,MyTool\WObj:=wobj0;
MoveL p3,speed1,z50,MyTool\WObj:=wobj0;
MoveL p4,speed1,z50,MyTool\WObj:=wobj0;
MoveL p5,speed1,z50,MyTool\WObj:=wobj0;
MoveL p6,speed1,z50,MyTool\WObj:=wobj0;
MoveL p7,speed1,z50,MyTool\WObj:=wobj0;
MoveL p8,speed1,z50,MyTool\WObj:=wobj0;
MoveL p9,speed1,z50,MyTool\WObj:=wobj0;
MoveL p10,speed1,z50,MyTool\WObj:=wobj0;
MoveL p11,speed1,z50,MyTool\WObj:=wobj0;
MoveL p12,speed1,z50,MyTool\WObj:=wobj0;
MoveL p13,speed1,z50,MyTool\WObj:=wobj0;
MoveL p14,speed1,z50,MyTool\WObj:=wobj0;
MoveL p15,speed1,z50,MyTool\WObj:=wobj0;
MoveL p16,speed1,z50,MyTool\WObj:=wobj0;
MoveL p17,speed1,z50,MyTool\WObj:=wobj0;
MoveL p18,speed1,z50,MyTool\WObj:=wobj0;
MoveL p19,speed1,z50,MyTool\WObj:=wobj0;
MoveL p20,speed1,z50,MyTool\WObj:=wobj0;
MoveL p21, speed1, z50, MyTool\WObj:=wobj0;
MoveL p22,speed1,z50,MyTool\WObj:=wobj0;
MoveL p23,speed1,z50,MyTool\WObj:=wobj0;
MoveL p24,speed1,z50,MyTool\WObj:=wobj0;
MoveL p25,speed1,z50,MyTool\WObj:=wobj0;
MoveL p26,speed1,z50,MyTool\WObj:=wobj0;
MoveL p27,speed1,z50,MyTool\WObj:=wobj0;
MoveL p28,speed1,z50,MyTool\WObj:=wobj0;
MoveL p29,speed1,z50,MyTool\WObj:=wobj0;
MoveL p30,speed1,z50,MyTool\WObj:=wobj0;
ENDPROC
PROC main()
SocketPro;
error
IF ERRNO=ERR_SOCK_TIMEOUT THEN
! socketclose socket_client;
! socketcreate socket_client;
! SocketConnect socket_client,str_address,n_port\Time:=5;
! ResetRetrycount;
! RETRY;
! ELSEIF ERRNO=ERR_SOCK_CLOSED THEN
! socketclose socket_client;
! socketcreate socket_client;
! SocketConnect socket_client,str_address,n_port\Time:=5;
! ResetRetrycount;
! RETRY;
ELSE
SocketPro;
RETURN ;
ENDIF
ENDPROC
! PROC Reconnect()
! TPErase;
! SocketCreate socket_client;
! SocketConnect socket_client,str_address,n_port\Time:=2;
! WHILE TRUE DO
! WaitTime 1;
! SocketReceive socket_client\Str:=strReceive;
! SocketSend socket_client\Str:=strSend;
! strSend:=strSend+"a";
! ENDWHILE
! ERROR
! IF ERRNO=ERR_SOCK_TIMEOUT THEN
! ResetRetryCount;
! RETRY;
! ELSEIF ERRNO=ERR_SOCK_CLOSED THEN
! socketRecover;
! ResetRetryCount;
! RETRY;
! ENDIF
! ENDPROC
PROC socketRecover()
SocketClose socket_client;
SocketCreate socket_client;
SocketConnect socket_client,str_address,n_port\Time:=5;
ERROR
IF ERRNO=ERR_SOCK_TIMEOUT THEN
ResetRetryCount;
RETRY;
ENDIF
ENDPROC
PROC SocketPro()
TPErase;
SocketClose socket_client;
!create client
SocketCreate socket_client;
!connect server
SocketConnect socket_client,str_address,n_port\Time:=WAIT_MAX;
WHILE TRUE DO
pTarget:=CRobT(\Tool:=MyTool);
ptemp:=pTarget;
!receive instruction
label1:
SocketReceive socket_client\Str:=strReceive;
dataOk:=FALSE;
strParse strReceive;
IF dataOk THEN
! GOTO label1;
IF s1_1="movep" THEN
IF bLinear THEN
MoveL pTarget,speed1,fine,MyTool\WObj:=wobj0;
ELSE
MoveJ pTarget,speed1,fine,MyTool\WObj:=wobj0;
ENDIF
SocketSend socket_client\Str:=strReceive+strSend;
SocketSend socket_client\Str:=s1_1+","+s1_2+","+strSend;
ELSEIF s1_1="move2" THEN
IF bLinear THEN
MoveL Offs(pTarget,0,0,10),speed1,fine,MyTool\WObj:=wobj0;
MoveL pTarget,speed1,fine,MyTool\WObj:=wobj0;
MoveL Offs(pTarget,-50,0,0),speed1,fine,MyTool\WObj:=wobj0;
MoveL Offs(pTarget,0,60,0),speed1,fine,MyTool\WObj:=wobj0;
ELSE
MoveJ pTarget,speed1,fine,MyTool\WObj:=wobj0;
ENDIF
SocketSend socket_client\Str:=strReceive+strSend;
SocketSend socket_client\Str:=s1_1+","+s1_2+","+strSend;
ENDIF
ELSE
SocketSend socket_client\Str:=strReceive+" DATA ERROR ";
ENDIF
ENDWHILE
ERROR
IF ERRNO=ERR_SOCK_TIMEOUT THEN
ResetRetryCount;
RETRY;
ELSEIF ERRNO=ERR_SOCK_CLOSED THEN
socketRecover;
ResetRetryCount;
RETRY;
ENDIF
ENDPROC
PROC strParse(string string1)
lable2:
len:=StrLen(string1);
starBit1:=1;
endBit1:=StrFind(string1,starBit1,",");
LengBit1:=endBit1-starBit1;
starBit2:=endBit1+1;
IF starBit2>len THEN
RETURN ;
ENDIF
endBit2:=StrFind(string1,starBit2,",");
LengBit2:=endBit2-starBit2;
starBit3:=endBit2+1;
IF starBit3>len THEN
RETURN ;
ENDIF
endBit3:=StrFind(string1,starBit3,",");
LengBit3:=endBit3-starBit3;
starBit4:=endBit3+1;
IF starBit4>len THEN
RETURN ;
ENDIF
endBit4:=StrFind(string1,starBit4,",");
LengBit4:=endBit4-starBit4;
s1_1:=StrPart(string1,starBit1,LengBit1);
s1_2:=StrPart(string1,starBit2,LengBit2);
s1_3:=StrPart(string1,starBit3,LengBit3);
s1_4:=StrPart(string1,starBit4,LengBit4);
!capture target
GetDataVal s1_2,ptemp;
pTarget:=ptemp;
!determine L or J
IF s1_3="L" THEN
bLinear:=TRUE;
ELSEIF s1_3="J" THEN
bLinear:=FALSE;
ENDIF
! get speed
flag1:=StrToVal(s1_4,value_3);
speed1.v_tcp:=value_3;
dataOk:=TRUE;
ERROR
IF errno=ERR_SOCK_CLOSED THEN
ELSE
dataOk:=FALSE;
RETURN ;
ENDIF
ENDPROC
PROC Path_10()
! MoveL Target_10,v1000,z100,MyTool\WObj:=wobj0;
! MoveL Target_20,v1000,z100,MyTool\WObj:=wobj0;
ENDPROC
ENDMODULE
\ No newline at end of file
......@@ -3,6 +3,7 @@ PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,1,,,,,
,,,,,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,0,,,,,
PRO,0,移栽上下移动料盘高度对应的上升位置,UpDownPositions,12=1000;16=1300;20=2000;24=2000;36=3000;,,,,,
,,,,,,,,,
AXIS,0,批量上料轴,Batch_Axis,2,COM1,0,,,
PRO,0,批量上料轴待机点 P1,BatchAxisP1,2000,,,,,
PRO,0,批量上料轴目标速度,BatchAxis_TargetSpeed,150,,,,,
......@@ -12,4 +13,13 @@ PRO,0,批量上料轴原点低速度,BatchAxis_HomeLowSpeed,100,,,,,
PRO,0,批量上料轴原点高速,BatchAxis_HomeHighSpeed,200,,,,,
PRO,0,批量上料轴原点加速度,BatchAxis_HomeAddSpeed,200,,,,,
,,,,,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,2,COM1,0,,,
PRO,0,移栽上下轴待机点 P1,UpDownAxisP1,2000,,,,,
PRO,0,移栽上下轴目标速度,UpdownAxis_TargetSpeed,150,,,,,
PRO,0,移栽上下轴加速度,UpdownAxis_AddSpeed,400,,,,,
PRO,0,移栽上下轴减速度,UpdownAxis_DelSpeed,400,,,,,
PRO,0,移栽上下轴原点低速度,UpdownAxis_HomeLowSpeed,100,,,,,
PRO,0,移栽上下轴原点高速,UpdownAxis_HomeHighSpeed,200,,,,,
PRO,0,移栽上下轴原点加速度,UpdownAxis_HomeAddSpeed,200,,,,,
,,,,,,,,,
PRO,0,扫码的相机名称(多个用#分隔),CameraNameList,Name1#Name1,,,,,
......@@ -96,7 +96,7 @@ namespace OnlineStore.DeviceLibrary
//先初始化设备
//初始化摄像机配置
CodeManager.LoadConfig(ConfigAppSettings.GetValue(Setting_Init.CameraName), ConfigAppSettings.GetValue(Setting_Init.CodeType));
CodeManager.LoadConfig();
Task.Factory.StartNew(delegate
{
......
......@@ -14,7 +14,7 @@ namespace OnlineStore.DeviceLibrary
public class CodeManager
{
public static List<string> cameraNameList = new List<string>();
// public static List<string> cameraNameList = new List<string>();
public static List<string> codeTypeList = new List<string>();
public static List<string> balserNameList = new List<string>();
......@@ -24,21 +24,21 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 初始化摄像机名称和二维码类型
/// </summary>
/// <param name="nameStr">摄像机名称,多个用#分割</param>
/// <param name="codeStr">二维码类型,多个用#分割</param>
public static void LoadConfig(string nameStr, string codeStr)
public static void LoadConfig( )
{
cameraNameList = new List<string>();
// string nameStr = ConfigAppSettings.GetValue(Setting_Init.CameraName);
string codeStr = ConfigAppSettings.GetValue(Setting_Init.CodeType);
// cameraNameList = new List<string>();
codeTypeList = new List<string>();
HDLogUtil.LogName = "RollingLogFileAppender";
try
{
string[] nameArray = nameStr.Split(spiltChar);
foreach (string str in nameArray)
{
LogUtil.info("加载到配置摄像机名称:" + str.Trim());
cameraNameList.Add(str.Trim());
}
//string[] nameArray = nameStr.Split(spiltChar);
//foreach (string str in nameArray)
//{
// LogUtil.info("加载到配置摄像机名称:" + str.Trim());
// cameraNameList.Add(str.Trim());
//}
string[] codeArray = codeStr.Split(spiltChar);
foreach (string str in codeArray)
{
......@@ -47,7 +47,7 @@ namespace OnlineStore.DeviceLibrary
}
LoadCamera(false);
CodeLibrary.HDCodeLearnHelper.LoadConfig(nameStr, codeStr);
CodeLibrary.HDCodeLearnHelper.LoadConfig("", codeStr);
}
catch (Exception ex)
......@@ -143,11 +143,14 @@ namespace OnlineStore.DeviceLibrary
}
[HandleProcessCorruptedStateExceptions]
public static List<string> CameraScan()
public static List<string> CameraScan(List<string> cameraNameList = null)
{
List<string> codeList = new List<string>();
//List<CodeInfo> allCodeList = new List<CodeInfo>();
if (cameraNameList == null)
{
return codeList;
}
try
{
foreach (string cameraName in cameraNameList)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!