mirror of
https://gitee.com/dashuaibran/jyker
synced 2025-09-27 03:09:12 +08:00
新版jyker
This commit is contained in:
parent
aba6ccaefb
commit
39ca4f4430
85
.gitignore
vendored
85
.gitignore
vendored
@ -1,5 +1,82 @@
|
||||
################################################################################
|
||||
# 此 .gitignore 文件已由 Microsoft(R) Visual Studio 自动创建。
|
||||
################################################################################
|
||||
# Build and Object Folders
|
||||
bin/
|
||||
obj/
|
||||
|
||||
# Nuget packages directory
|
||||
packages/
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*
|
||||
|
||||
# NCrunch
|
||||
*.ncrunch*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help
|
||||
UpgradeLog*.XML
|
||||
|
||||
# Lightswitch
|
||||
_Pvt_Extensions
|
||||
GeneratedArtifacts
|
||||
*.xap
|
||||
ModelManifest.xml
|
||||
|
||||
#Backup file
|
||||
*.bak
|
||||
|
||||
#zzzili
|
||||
v15/
|
||||
|
||||
|
||||
/HMIcode/BigProject/.vs/BigProject/v17/.suo
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -67,6 +67,7 @@
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Security.AccessControl, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.AccessControl.5.0.0\lib\net461\System.Security.AccessControl.dll</HintPath>
|
||||
</Reference>
|
||||
@ -124,12 +125,10 @@
|
||||
<Compile Include="Devices\Arm\Kinematic\Models\Joint6D_t.cs" />
|
||||
<Compile Include="Devices\Arm\Kinematic\Models\Pose6D_t.cs" />
|
||||
<Compile Include="Devices\BaseDevice.cs" />
|
||||
<Compile Include="Devices\Fan\FanDevice.cs" />
|
||||
<Compile Include="Devices\NightLight\NightLightDevice.cs" />
|
||||
<Compile Include="Devices\WallPainting\WallPaintingDevice.cs" />
|
||||
<Compile Include="JointMoveRecord\JointRecordModel.cs" />
|
||||
<Compile Include="JointMoveRecord\JointRecordRes.cs" />
|
||||
<Compile Include="Logger\Log.cs" />
|
||||
<Compile Include="Serials\ArmSerial.cs" />
|
||||
<Compile Include="Serials\AssistantSerial.cs" />
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@ -139,7 +138,6 @@
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Core.cs" />
|
||||
<Compile Include="Devices\DeskLamp\DeskLampDevice.cs" />
|
||||
<Compile Include="Devices\IDevice.cs" />
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
|
@ -1,13 +1,12 @@
|
||||
using BigProject.Devices;
|
||||
using BigProject.Devices.Arm;
|
||||
using BigProject.Devices.Arm.Config;
|
||||
using BigProject.Devices.DeskLamp;
|
||||
using BigProject.Devices.Fan;
|
||||
using BigProject.Devices.NightLight;
|
||||
using BigProject.Devices.WallPainting;
|
||||
using BigProject.JointMoveRecord;
|
||||
using BigProject.Logger;
|
||||
using BigProject.Serials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
@ -24,118 +23,37 @@ namespace BigProject
|
||||
public List<BaseDevice> Devices = new List<BaseDevice>();
|
||||
//接收的数据
|
||||
Byte[] buffer = new Byte[4096];
|
||||
//语音助手
|
||||
public AssistantSerial assistantSerial;
|
||||
//机械臂助手
|
||||
public ArmSerial armSerial;
|
||||
public ArmSerial ArmSerial;
|
||||
//配置信息
|
||||
public ArmConfig ArmConfig { get; set; }
|
||||
//机械臂控制
|
||||
public ArmContrl armContrl { get; set; }
|
||||
//机械臂夹爪
|
||||
public ArmClaw armClaw { get; set; }
|
||||
//机械臂灯光
|
||||
public ArmLed armLed { get; set; }
|
||||
public ArmContrl ArmContrl { get; set; }
|
||||
//轴移动记录
|
||||
public ObservableCollection<JointRecordModel> JointRecords = new ObservableCollection<JointRecordModel>();
|
||||
public Core()
|
||||
{
|
||||
InitDevice();
|
||||
InitAssistant();
|
||||
InitArm();
|
||||
}
|
||||
|
||||
|
||||
//初始化设备
|
||||
public void InitDevice()
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Parallel.For(2, 255, (i) =>
|
||||
{
|
||||
string ip = $"{ipBegin}{i}";
|
||||
if (Devices.Exists(t => t.Ip == ip))
|
||||
return;
|
||||
//如果不存在该ip ,尝试连接
|
||||
Ping pingSender = new Ping();
|
||||
PingReply reply = pingSender.Send(ip, 500);
|
||||
if (reply.Status != IPStatus.Success)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Task.Run(() => {
|
||||
TcpClient client = new TcpClient();
|
||||
try
|
||||
{
|
||||
client.Connect(ip, 10086);
|
||||
NetworkStream stream = client.GetStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytesRead;
|
||||
while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
|
||||
{
|
||||
if (bytesRead == 5)
|
||||
{
|
||||
int id = (int)buffer[1];
|
||||
switch (buffer[0])
|
||||
{
|
||||
case 1:
|
||||
var nl = new NightLightDevice(client, id, ip);
|
||||
nl.Init();
|
||||
Devices.Add(nl);
|
||||
break;
|
||||
case 2:
|
||||
var dl = new DeskLampDevice(client, id, ip);
|
||||
dl.Init();
|
||||
Devices.Add(dl);
|
||||
break;
|
||||
case 3:
|
||||
var fan = new FanDevice(client, id, ip);
|
||||
fan.Init();
|
||||
Devices.Add(fan);
|
||||
break;
|
||||
case 4:
|
||||
var wp = new WallPaintingDevice(client, id, ip);
|
||||
wp.Init();
|
||||
Devices.Add(wp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Thread.Sleep(5000);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//初始化语音助手
|
||||
public void InitAssistant()
|
||||
{
|
||||
assistantSerial = new AssistantSerial();
|
||||
}
|
||||
|
||||
//初始化机械臂
|
||||
private void InitArm()
|
||||
public bool InitArm(string comName)
|
||||
{
|
||||
armSerial = new ArmSerial();
|
||||
ArmConfig = new ArmConfig() { D_BASE = 0, L_BASE = 158.5, L_ARM = 148, D_ELBOW = 71, L_FOREARM = 94.345443, L_WRIST = 182 };
|
||||
armContrl = new ArmContrl(ArmConfig, armSerial);
|
||||
armClaw = new ArmClaw();
|
||||
Devices.Add(armClaw);
|
||||
armLed = new ArmLed();
|
||||
Devices.Add(armLed);
|
||||
ArmSerial = new ArmSerial(comName,out bool Resutl);
|
||||
if(!Resutl)
|
||||
{
|
||||
Log.Info($"串口{comName}连接失败");
|
||||
return false;
|
||||
}
|
||||
ArmConfig = new ArmConfig() { D_BASE = 0, L_BASE = 161.5, L_ARM = 170, D_ELBOW = 70, L_FOREARM = 117, L_WRIST = 97 };
|
||||
ArmContrl = new ArmContrl(ArmConfig, ArmSerial);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ArmDispose()
|
||||
{
|
||||
return ArmSerial.SerialDispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,13 +11,13 @@ namespace BigProject.Devices.Arm
|
||||
//开启夹爪
|
||||
public void Open()
|
||||
{
|
||||
App.Core.armSerial.CtrClaw(40,140,40);
|
||||
App.Core.ArmSerial.CtrClaw(40,140,40);
|
||||
}
|
||||
|
||||
//关闭夹爪
|
||||
public void Close()
|
||||
{
|
||||
App.Core.armSerial.CtrClaw(80, 110, 80);
|
||||
App.Core.ArmSerial.CtrClaw(80, 110, 80);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,10 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BigProject.Serials;
|
||||
using BigProject.Logger;
|
||||
using System.IO.Ports;
|
||||
using System.Collections;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
using Masuit.Tools;
|
||||
|
||||
namespace BigProject.Devices.Arm
|
||||
{
|
||||
@ -30,11 +34,11 @@ namespace BigProject.Devices.Arm
|
||||
{
|
||||
dof6Solver = new Dof6kinematic(armConfig);
|
||||
motorJ = new CtrlStepMotor[6] {
|
||||
new CtrlStepMotor(){ AngleLimitMin =-90.1,AngleLimitMax = 0.1 }
|
||||
,new CtrlStepMotor(){ AngleLimitMin = -90.1,AngleLimitMax = 90.1 , Direction =1, OffsetAngle = -90 }
|
||||
,new CtrlStepMotor(){ AngleLimitMin = -0.1,AngleLimitMax= 180.1,OffsetAngle = 180 }
|
||||
new CtrlStepMotor(){ AngleLimitMin =-90.1,AngleLimitMax = 90.1}
|
||||
,new CtrlStepMotor(){ AngleLimitMin = -90.1,AngleLimitMax = 90.1 , Direction =1, OffsetAngle = -90,Reduction=50 }
|
||||
,new CtrlStepMotor(){ AngleLimitMin = -0.1,AngleLimitMax= 180.1,OffsetAngle = 180 , Direction = 1}
|
||||
,new CtrlStepMotor(){ AngleLimitMin = -0.1,AngleLimitMax = 180.1 , Direction =1}
|
||||
,new CtrlStepMotor(){ AngleLimitMin = -90.1 , AngleLimitMax = 0.1}
|
||||
,new CtrlStepMotor(){ AngleLimitMin = -90.1 , AngleLimitMax = 90.1}
|
||||
,new CtrlStepMotor() { AngleLimitMin = -180.1,AngleLimitMax = 180.1}
|
||||
};
|
||||
serialControl = armSerial;
|
||||
@ -44,7 +48,7 @@ namespace BigProject.Devices.Arm
|
||||
|
||||
}
|
||||
//轴移动默认速度
|
||||
private double jointSpeed = 50;
|
||||
private double jointSpeed = 100;
|
||||
|
||||
/// <summary>
|
||||
/// 根据角度移动轴
|
||||
@ -171,7 +175,7 @@ namespace BigProject.Devices.Arm
|
||||
serialControl.Zero(4);
|
||||
Thread.Sleep(50);
|
||||
|
||||
serialControl.EditZeroParams(addr: 3, direction: 1);
|
||||
serialControl.EditZeroParams(addr: 3, direction: 0);
|
||||
Thread.Sleep(50);
|
||||
serialControl.Zero(3);
|
||||
Thread.Sleep(50);
|
||||
@ -198,20 +202,46 @@ namespace BigProject.Devices.Arm
|
||||
/// <param name="stepMotor"></param>
|
||||
public void MoveJoints()
|
||||
{
|
||||
bool valid = true;
|
||||
for (int j = 0; j < 6; j++)
|
||||
{
|
||||
if (currentJoints.a[j] > motorJ[j].AngleLimitMax ||
|
||||
currentJoints.a[j] < motorJ[j].AngleLimitMin)
|
||||
{
|
||||
valid = false;
|
||||
Log.Info($"角度{j + 1} 限制为{motorJ[j].AngleLimitMin}到{motorJ[j].AngleLimitMax} 当前为{currentJoints.a[j]},无法移动");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (valid)
|
||||
{
|
||||
//计算每轴速度
|
||||
var angleList = (currentJoints - lastJoints).a;
|
||||
|
||||
var maxAngle = AbsMaxOf6(angleList, out int _index);
|
||||
if (maxAngle == 0) return;
|
||||
//这里的时间计算忽略加速度影响
|
||||
double time = maxAngle * (double)(motorJ[_index].Reduction) / jointSpeed;
|
||||
for (int j = 0; j < 6; j++)
|
||||
{
|
||||
motorJ[j].Speed = (int)Math.Abs(angleList[j] * 1.0f * motorJ[j].Reduction / time);
|
||||
}
|
||||
}
|
||||
|
||||
//发送移动轴命令
|
||||
for (int i = 0; i < motorJ.Length; i++)
|
||||
{
|
||||
var pulse = (int)((currentJoints.a[i] - lastJoints.a[i]) * DEG_TO_PULSE * motorJ[i].Reduction);
|
||||
Log.Info($"轴{i + 1}速度为{motorJ[i].Speed}");
|
||||
var pulse = (int)Math.Abs(((currentJoints.a[i] - Joint6D_t.defult.a[i]) * DEG_TO_PULSE * motorJ[i].Reduction));
|
||||
int direction = motorJ[i].Direction;
|
||||
if (pulse < 0)
|
||||
{
|
||||
direction = direction == 1 ? 0 : 1;
|
||||
}
|
||||
serialControl.LocationControl(i+1, direction, (int)(motorJ[i].Speed), (int)motorJ[i].Acceleration, Math.Abs(pulse));
|
||||
serialControl.LocationControl(i+1, direction, (int)(motorJ[i].Speed), (int)motorJ[i].Acceleration, pulse,RelativeOrAbsolute.Absolute);
|
||||
Thread.Sleep(50);
|
||||
}
|
||||
serialControl.CallMotion();
|
||||
lastJoints = currentJoints;
|
||||
lastJoints = currentJoints.DeepClone();
|
||||
}
|
||||
|
||||
private double AbsMaxOf6(double[] targetJointsTmp, out int _index)
|
||||
@ -240,7 +270,7 @@ namespace BigProject.Devices.Arm
|
||||
//获取编码器当前值
|
||||
byte[] send = new byte[3] { 0x06, 0x31, 0x6B };
|
||||
serialControl.recCount = 5;
|
||||
serialControl.SendMsg(send);
|
||||
serialControl.SendMsgForResult(send, out byte[] resMsg);
|
||||
while (serialControl.DataReceived.Count == 0)
|
||||
{
|
||||
Thread.Sleep(50);
|
||||
@ -265,7 +295,7 @@ namespace BigProject.Devices.Arm
|
||||
public void ArmStopNow()
|
||||
{
|
||||
byte[] send = new byte[5] { 0x00, 0xFE, 0x98, 0x00, 0x6B };
|
||||
serialControl.SendMsg(send);
|
||||
serialControl.SendMsgForResult(send, out byte[] resMsg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -276,7 +306,7 @@ namespace BigProject.Devices.Arm
|
||||
//01 0A 6D 6B
|
||||
byte[] send = new byte[4] { 0x00, 0x0A ,0x6D, 0x6B };
|
||||
send[0] = (byte)addr;
|
||||
serialControl.SendMsg(send);
|
||||
serialControl.SendMsgForResult(send, out byte[] resMsg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -284,23 +314,97 @@ namespace BigProject.Devices.Arm
|
||||
/// </summary>
|
||||
/// <param name="addr">地址</param>
|
||||
/// <returns></returns>
|
||||
public double GetCurrentAngle(int addr, CtrlStepMotor ctrlStep)
|
||||
public bool GetCurrentAngle(int addr, CtrlStepMotor ctrlStep,out double angle)
|
||||
{
|
||||
//01 36 6B
|
||||
serialControl.recCount = 8;
|
||||
byte[] send = new byte[3] { 0x00, 0x36, 0x6B };
|
||||
send[0] = (byte)addr;
|
||||
serialControl.SendMsg(send);
|
||||
while (serialControl.DataReceived.Count == 0)
|
||||
angle = 0;
|
||||
byte[] data = new byte[3] { (byte)addr, 0x36, 0x6B };
|
||||
var res =serialControl.SendMsgForResult(data, out byte[] result,8);
|
||||
if(!res)
|
||||
{
|
||||
Thread.Sleep(50);
|
||||
return false;
|
||||
}
|
||||
var rec = serialControl.DataReceived;
|
||||
int zhengfu = rec[2];
|
||||
int anglePulse = ((int)rec[3])*255*255*255 + ((int)rec[4]) * 255 * 255 + ((int)rec[5]) * 255 + rec[6];
|
||||
var angle = anglePulse * 1.0 / 65536;
|
||||
ctrlStep.CurrentAngle = angle / ctrlStep.Reduction + ctrlStep.OffsetAngle;
|
||||
return 0;
|
||||
if (result[1] == 0x00 && result[2] == 0xee)
|
||||
{
|
||||
//返回错误
|
||||
return false;
|
||||
}
|
||||
|
||||
byte[] byteArray = { result[6], result[5], result[4], result[3] };
|
||||
if (ctrlStep.Direction == 0)
|
||||
{
|
||||
angle = BitConverter.ToInt32(byteArray, 0)* 360.0 / 65536;
|
||||
}
|
||||
else
|
||||
{
|
||||
angle = BitConverter.ToInt32(byteArray, 0) * -360.0 / 65536;
|
||||
}
|
||||
Log.Info($"获取角度{addr}__{angle}");
|
||||
//默认的0 位,加上电机读数偏移量
|
||||
if(addr==3)
|
||||
{
|
||||
ctrlStep.CurrentAngle = Joint6D_t.defult.a[addr - 1] - Math.Abs(angle / ctrlStep.Reduction);
|
||||
}
|
||||
else if(ctrlStep.Direction==1)
|
||||
{
|
||||
ctrlStep.CurrentAngle = Joint6D_t.defult.a[addr - 1] - (angle / ctrlStep.Reduction);
|
||||
}
|
||||
else
|
||||
{
|
||||
ctrlStep.CurrentAngle = Joint6D_t.defult.a[addr - 1] + (angle / ctrlStep.Reduction);
|
||||
}
|
||||
angle = ctrlStep.CurrentAngle;
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// 设置电机使能状态
|
||||
/// </summary>
|
||||
/// <param name="status"></param>
|
||||
/// <returns></returns>
|
||||
public bool SetIfEnable(int addr,bool status)
|
||||
{
|
||||
int flag = status ? 1 : 0;
|
||||
byte[] data = new byte[6] { (byte)addr, 0xF3, 0xAB, (byte)flag, 0x00, 0x6B };
|
||||
var res = serialControl.SendMsgForResult(data, out byte[] result, 4);
|
||||
if (!res)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (result[1] == 0xF3 && result[2] == 0xee)
|
||||
{
|
||||
//返回错误
|
||||
return false;
|
||||
}
|
||||
if (result[1] == 0xF3 && result[2] == 0xE2)
|
||||
{
|
||||
Log.Info($"电机{addr}使能条件不满足");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//机械臂是否已经移动完成
|
||||
public bool IsMoveOver()
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
byte[] data = new byte[3] { (byte)(i+1), 0x35, 0x6B };
|
||||
var res = serialControl.SendMsgForResult(data, out byte[] result, 6);
|
||||
if (!res)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (result[1] == 0x00&& result[2] == 0xee)
|
||||
{
|
||||
//返回错误
|
||||
return false;
|
||||
}
|
||||
if (result[3]!=0|| result[4] !=0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,19 +12,18 @@ namespace BigProject.Devices.Arm
|
||||
{
|
||||
public ArmLed() {
|
||||
DeviceType = DeviceType.ArmLed;
|
||||
Log.Info($"机械臂灯{this.Id} 已连接");
|
||||
}
|
||||
|
||||
//开启机械臂的灯
|
||||
public void Open()
|
||||
{
|
||||
App.Core.armSerial.LedOpen();
|
||||
App.Core.ArmSerial.LedOpen();
|
||||
}
|
||||
|
||||
//关闭机械臂的灯
|
||||
public void Close()
|
||||
{
|
||||
App.Core.armSerial.LedClose();
|
||||
App.Core.ArmSerial.LedClose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace BigProject.Devices.Arm.CtrlStep
|
||||
/// <summary>
|
||||
/// 加速度
|
||||
/// </summary>
|
||||
public double Acceleration { get; set; } = 20;
|
||||
public double Acceleration { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 速度
|
||||
/// </summary>
|
||||
@ -44,7 +44,7 @@ namespace BigProject.Devices.Arm.CtrlStep
|
||||
/// <summary>
|
||||
/// 电机方向
|
||||
/// </summary>
|
||||
public int Direction { get; set; } = 1;
|
||||
public int Direction { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 3200个脉冲转一圈
|
||||
/// </summary>
|
||||
|
@ -190,6 +190,10 @@ namespace BigProject.Devices.Arm.Kinematic
|
||||
pose.A = (float)(P06[3] * RAD_TO_DEG);
|
||||
pose.B = (float)(P06[4] * RAD_TO_DEG);
|
||||
pose.C = (float)(P06[5] * RAD_TO_DEG);
|
||||
|
||||
//pose.A = (float)(P06[3]);
|
||||
//pose.B = (float)(P06[4]);
|
||||
//pose.C = (float)(P06[5]);
|
||||
pose.R = R06.ToArray();
|
||||
|
||||
return true;
|
||||
|
@ -26,6 +26,6 @@ namespace BigProject.Devices.Arm.Kinematic.Models
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public static Joint6D_t defult = new Joint6D_t(0, -90, 180, 0, 0, 0);
|
||||
public static Joint6D_t defult = new Joint6D_t(-90, -90, 180, 0, -90, 0);
|
||||
}
|
||||
}
|
||||
|
@ -1,59 +0,0 @@
|
||||
using BigProject.Logger;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BigProject.Devices.DeskLamp
|
||||
{
|
||||
public class DeskLampDevice : BaseDevice
|
||||
{
|
||||
public DeskLampDevice(TcpClient _client,int _id,string _ip)
|
||||
{
|
||||
this.Client = _client;
|
||||
this.Id = _id;
|
||||
this.Ip = _ip;
|
||||
DeviceType = DeviceType.DeskLamp;
|
||||
Log.Info($"台灯{this.Id} 已连接");
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
//Task.Run(() => {
|
||||
// NetworkStream stream = Client.GetStream();
|
||||
// byte[] buffer = new byte[1024];
|
||||
// int bytesRead;
|
||||
// while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
|
||||
// {
|
||||
// Accep(buffer.Take(bytesRead).ToArray());
|
||||
// }
|
||||
//});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void Loop()
|
||||
{
|
||||
}
|
||||
|
||||
//获取传入数据
|
||||
public void Accep(byte[] buffer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//打开台灯
|
||||
public void Open()
|
||||
{
|
||||
SendMsg(new byte[] { 0x00, 0x02, 0 });
|
||||
}
|
||||
|
||||
//关闭台灯
|
||||
public void Close()
|
||||
{
|
||||
SendMsg(new byte[] { 0x00, 0x01, 0 });
|
||||
}
|
||||
}
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
using BigProject.Logger;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BigProject.Devices.Fan
|
||||
{
|
||||
public class FanDevice : BaseDevice
|
||||
{
|
||||
private int PWM = 10;
|
||||
private int PWMLimit = 100;
|
||||
|
||||
public FanDevice(TcpClient _client, int _id, string _ip)
|
||||
{
|
||||
this.Client = _client;
|
||||
this.Id = _id;
|
||||
this.Ip = _ip;
|
||||
DeviceType = DeviceType.NightLight;
|
||||
Log.Info($"风扇 {this.Id} 已连接");
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
//Task.Run(() => {
|
||||
// NetworkStream stream = Client.GetStream();
|
||||
// byte[] buffer = new byte[1024];
|
||||
// int bytesRead;
|
||||
// while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
|
||||
// {
|
||||
// Accep(buffer.Take(bytesRead).ToArray());
|
||||
// }
|
||||
//});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void Loop()
|
||||
{
|
||||
}
|
||||
|
||||
//获取传入数据
|
||||
public void Accep(byte[] buffer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//打开风扇
|
||||
public void Open()
|
||||
{
|
||||
SendMsg(new byte[] { 0x00, 0x01, (byte)PWM });
|
||||
}
|
||||
|
||||
//关闭风扇
|
||||
public void Close()
|
||||
{
|
||||
SendMsg(new byte[] { 0x00, 0x01, 0 });
|
||||
}
|
||||
|
||||
//调大一点
|
||||
public void LevelUp()
|
||||
{
|
||||
PWM += 10;
|
||||
if(PWM> PWMLimit) PWM = PWMLimit;
|
||||
SendMsg(new byte[] { 0x00, 0x01, (byte)PWM });
|
||||
}
|
||||
|
||||
//调小一点
|
||||
public void LevelDown()
|
||||
{
|
||||
PWM -= 10;
|
||||
if (PWM < 10) PWM = 10;
|
||||
SendMsg(new byte[] { 0x00, 0x01, (byte)PWM });
|
||||
}
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
using BigProject.Logger;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BigProject.Devices.NightLight
|
||||
{
|
||||
public class NightLightDevice:BaseDevice
|
||||
{
|
||||
public NightLightDevice(TcpClient _client, int _id, string _ip) {
|
||||
this.Client = _client;
|
||||
this.Id = _id;
|
||||
this.Ip = _ip;
|
||||
DeviceType = DeviceType.NightLight;
|
||||
Log.Info($"小灯 {this.Id} 已连接");
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
//Task.Run(() => {
|
||||
// NetworkStream stream = Client.GetStream();
|
||||
// byte[] buffer = new byte[1024];
|
||||
// int bytesRead;
|
||||
// while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
|
||||
// {
|
||||
// Accep(buffer.Take(bytesRead).ToArray());
|
||||
// }
|
||||
//});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void Loop()
|
||||
{
|
||||
}
|
||||
|
||||
//获取传入数据
|
||||
public void Accep(byte[] buffer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//打开小灯
|
||||
public void Open()
|
||||
{
|
||||
SendMsg(new byte[] { 0x00, 0x02, 0 });
|
||||
}
|
||||
|
||||
//关闭小灯
|
||||
public void Close()
|
||||
{
|
||||
SendMsg(new byte[] { 0x00, 0x01, 0 });
|
||||
}
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
using BigProject.Logger;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BigProject.Devices.WallPainting
|
||||
{
|
||||
public class WallPaintingDevice : BaseDevice
|
||||
{
|
||||
|
||||
public WallPaintingDevice(TcpClient _client, int _id, string _ip)
|
||||
{
|
||||
this.Client = _client;
|
||||
this.Id = _id;
|
||||
this.Ip = _ip;
|
||||
DeviceType = DeviceType.WallPainting;
|
||||
Log.Info($"壁画 {this.Id} 已连接");
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
//Task.Run(() => {
|
||||
// NetworkStream stream = Client.GetStream();
|
||||
// byte[] buffer = new byte[1024];
|
||||
// int bytesRead;
|
||||
// while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
|
||||
// {
|
||||
// Accep(buffer.Take(bytesRead).ToArray());
|
||||
// }
|
||||
//});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void Loop()
|
||||
{
|
||||
}
|
||||
|
||||
//获取传入数据
|
||||
public void Accep(byte[] buffer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//打开壁画
|
||||
public void Open()
|
||||
{
|
||||
SendMsg(new byte[] { 0x00, 0x02, 0 });
|
||||
}
|
||||
|
||||
//关闭壁画
|
||||
public void Close()
|
||||
{
|
||||
SendMsg(new byte[] { 0x00, 0x01, 0 });
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BigProject.JointMoveRecord
|
||||
{
|
||||
public class JointRecordModel
|
||||
{
|
||||
public double J1 { get; set; }
|
||||
public double J2 { get; set; }
|
||||
public double J3 { get; set; }
|
||||
public double J4 { get; set; }
|
||||
public double J5 { get; set; }
|
||||
public double J6 { get; set; }
|
||||
|
||||
|
||||
public double X { get; set; }
|
||||
public double Y { get; set; }
|
||||
public double Z { get; set; }
|
||||
public double A { get; set; }
|
||||
public double B { get; set; }
|
||||
public double C { get; set; }
|
||||
|
||||
public DateTime AddTime { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BigProject.JointMoveRecord
|
||||
{
|
||||
public class JointRecordRes
|
||||
{
|
||||
private static string DataDic = "./DATA";
|
||||
private static string ReadConfigFile = $"{DataDic}/JointRecordModel.data";
|
||||
|
||||
/// <summary>
|
||||
/// 读取产型数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ObservableCollection<JointRecordModel> Read()
|
||||
{
|
||||
lock (DataDic)
|
||||
{
|
||||
if (!Directory.Exists(DataDic))
|
||||
{
|
||||
Directory.CreateDirectory(DataDic);
|
||||
}
|
||||
if (!File.Exists(ReadConfigFile))
|
||||
{
|
||||
using (File.Create(ReadConfigFile)) { }
|
||||
}
|
||||
var json = File.ReadAllText(ReadConfigFile, Encoding.UTF8);
|
||||
var conf = JsonConvert.DeserializeObject<ObservableCollection<JointRecordModel>>(json);
|
||||
if (conf == null)
|
||||
{
|
||||
return new ObservableCollection<JointRecordModel>();
|
||||
}
|
||||
return conf;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 写入产型数据
|
||||
/// </summary>
|
||||
/// <param name="productTypes"></param>
|
||||
public static void Write(ObservableCollection<JointRecordModel> list)
|
||||
{
|
||||
lock (DataDic)
|
||||
{
|
||||
if (!Directory.Exists(DataDic))
|
||||
{
|
||||
Directory.CreateDirectory(DataDic);
|
||||
}
|
||||
if (!File.Exists(ReadConfigFile))
|
||||
{
|
||||
File.Create(ReadConfigFile);
|
||||
}
|
||||
using (FileStream fileStream = File.Create(ReadConfigFile)) //打开文件流
|
||||
{
|
||||
var str = JsonConvert.SerializeObject(list, Formatting.Indented); //序列化工程文件
|
||||
byte[] by = ASCIIEncoding.UTF8.GetBytes(str); //把序列化的工程文件转成字节流
|
||||
fileStream.Write(by, 0, by.Length); //字节流写入到文件
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -11,60 +11,62 @@
|
||||
d:DesignHeight="1024"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Title="JYKER" >
|
||||
<Grid rubyer:GridHelper.ColumnDefinitions="*,300">
|
||||
<Grid rubyer:GridHelper.ColumnDefinitions="*,600,300">
|
||||
<Grid Grid.Column="0" Margin="10">
|
||||
<Image x:Name="ImageBig" ></Image>
|
||||
<Grid rubyer:GridHelper.ColumnDefinitions="*" VerticalAlignment="Top" HorizontalAlignment="Right">
|
||||
<TextBlock FontSize="60" Grid.Column="0" Foreground="Red" Panel.ZIndex="3" x:Name="ResultTextInPic" ></TextBlock>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1" rubyer:GridHelper.RowDefinitions="300,*">
|
||||
<GroupBox Header="点位循环记录">
|
||||
<DataGrid x:Name="dg_JointRecord" rubyer:ControlHelper.FocusedForegroundBrush="{StaticResource Accent}" AutoGenerateColumns="False" BorderThickness="1" CanUserAddRows="False" GridLinesVisibility="All" IsReadOnly="True" SelectionMode="Single">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding J1}" Header="J1" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding J2}" Header="J2" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding J3}" Header="J3" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding J4}" Header="J4" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding J5}" Header="J5" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding J6}" Header="J6" />
|
||||
|
||||
<Grid Grid.Column="1" rubyer:GridHelper.RowDefinitions="140,580,*" Margin="5,2,5,5">
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding X}" Header="X" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding Y}" Header="Y" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding Z}" Header="Z" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding A}" Header="A" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding B}" Header="B" />
|
||||
<DataGridTextColumn Width="auto" Binding="{Binding C}" Header="C" />
|
||||
<DataGridTextColumn Visibility="Collapsed" x:Name="AddTime" Binding="{Binding AddTime}" Header="AddTime" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
<Grid Grid.Column="2" rubyer:GridHelper.RowDefinitions="100,610,*" Margin="5,2,5,5">
|
||||
|
||||
<GroupBox Grid.Row="0" Header="硬件连接情况" Margin="5,0,5,0">
|
||||
<GroupBox Grid.Row="0" Header="机器手连接" Margin="5,0,5,0">
|
||||
<Grid rubyer:GridHelper.RowDefinitions="30,30,30,*">
|
||||
<Grid rubyer:GridHelper.ColumnDefinitions="*,*">
|
||||
<Grid Grid.Column="0" >
|
||||
<Ellipse HorizontalAlignment="Left" Height="20" Fill="Green" Stroke="Black" Width="20" x:Name="X706"/>
|
||||
<TextBlock Margin="25,0,0,0" FontWeight="Bold">台灯</TextBlock>
|
||||
<Grid rubyer:GridHelper.ColumnDefinitions="auto,*">
|
||||
<Grid Margin="2">
|
||||
<Label>端口:</Label>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1" >
|
||||
<Ellipse HorizontalAlignment="Left" Height="20" Fill="Green" Stroke="Black" Width="20" x:Name="X0"/>
|
||||
<TextBlock Margin="25,0,0,0" FontWeight="Bold">风扇</TextBlock>
|
||||
<Grid Margin="2" Grid.Column="1">
|
||||
<ComboBox x:Name="cb_ComList" />
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
<Grid Grid.Row="1" rubyer:GridHelper.ColumnDefinitions="*,*">
|
||||
<Grid Grid.Column="0">
|
||||
<Ellipse HorizontalAlignment="Left" Height="20" Fill="Green" Stroke="Black" Width="20" x:Name="X1"/>
|
||||
<TextBlock Margin="25,0,0,0" FontWeight="Bold">夜灯1</TextBlock>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1" >
|
||||
<Ellipse HorizontalAlignment="Left" Height="20" Fill="Green" Stroke="Black" Width="20" x:Name="X2"/>
|
||||
<TextBlock Margin="25,0,0,0" FontWeight="Bold">夜灯2</TextBlock>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid rubyer:GridHelper.ColumnDefinitions="*,*" Grid.Row="2">
|
||||
<Grid Grid.Column="0" >
|
||||
<Ellipse HorizontalAlignment="Left" Height="20" Fill="Green" Stroke="Black" Width="20" x:Name="X4"/>
|
||||
<TextBlock Margin="25,0,0,0" FontWeight="Bold">海报</TextBlock>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1" >
|
||||
<Ellipse HorizontalAlignment="Left" Height="20" Fill="Green" Stroke="Black" Width="20" x:Name="X5"/>
|
||||
<TextBlock Margin="25,0,0,0" FontWeight="Bold">机械臂</TextBlock>
|
||||
</Grid>
|
||||
<Button x:Name="bt_Link" Margin="2">手动连接</Button>
|
||||
<Button x:Name="bt_LinkAuto" Margin="2" Grid.Column="1">自动连接</Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
<GroupBox Grid.Row="1" Header="操作" Margin="5,0,5,0">
|
||||
<Grid rubyer:GridHelper.RowDefinitions="30,30,30,30,30,30,20,30,30,30,30,30,30,30,30,30,30,30,*">
|
||||
<Grid rubyer:GridHelper.RowDefinitions="30,30,30,30,30,30,20,30,30,30,30,30,30,30,30,30,30,30,30,*">
|
||||
|
||||
<Grid rubyer:GridHelper.ColumnDefinitions="*,*" Grid.Row="0">
|
||||
<Grid Grid.Column="0" Margin="2">
|
||||
<TextBlock>X:</TextBlock>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1" Margin="2">
|
||||
<TextBox x:Name="tb_X">100</TextBox>
|
||||
<TextBox x:Name="tb_X">0</TextBox>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid rubyer:GridHelper.ColumnDefinitions="*,*" Grid.Row="1">
|
||||
@ -72,7 +74,7 @@
|
||||
<TextBlock>Y:</TextBlock>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1" Margin="2">
|
||||
<TextBox x:Name="tb_Y">100</TextBox>
|
||||
<TextBox x:Name="tb_Y">0</TextBox>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid rubyer:GridHelper.ColumnDefinitions="*,*" Grid.Row="2">
|
||||
@ -80,7 +82,7 @@
|
||||
<TextBlock>Z:</TextBlock>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1" Margin="2">
|
||||
<TextBox x:Name="tb_Z">100</TextBox>
|
||||
<TextBox x:Name="tb_Z">0</TextBox>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid rubyer:GridHelper.ColumnDefinitions="*,*" Grid.Row="3">
|
||||
@ -182,18 +184,23 @@
|
||||
</Grid>
|
||||
<Grid rubyer:GridHelper.ColumnDefinitions="*,*" Grid.Row="16">
|
||||
<Grid Grid.Column="0" Margin="2">
|
||||
<Button x:Name="bt_OpenClaw">打开夹爪</Button>
|
||||
<Button x:Name="bt_MoveArmHand" Click="bt_MoveArmHand_Click">手动移动机械臂</Button>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1" Margin="2">
|
||||
<Button x:Name="bt_CloseClaw">关闭夹爪</Button>
|
||||
<Button x:Name="bt_AddRecord" Click="bt_AddRecord_Click">记录点位</Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid rubyer:GridHelper.ColumnDefinitions="*,*" Grid.Row="17">
|
||||
<Grid Grid.Column="0" Margin="2">
|
||||
<Button x:Name="bt_MoveToDesk">运动到目标点</Button>
|
||||
<Button x:Name="bt_MoveLoop" Click="bt_MoveLoop_Click">循环运动</Button>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1" Margin="2">
|
||||
<Button x:Name="bt_MoveToMan">运动到我这</Button>
|
||||
<Button x:Name="bt_MoveLoopStop" Click="bt_MoveLoopStop_Click" Cursor="Hand">停止循环</Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid rubyer:GridHelper.ColumnDefinitions="*,*" Grid.Row="18">
|
||||
<Grid Grid.Column="0" Margin="2">
|
||||
<Button x:Name="bt_DeleteRecord" Click="bt_DeleteRecord_Click">删除记录</Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
@ -1,10 +1,13 @@
|
||||
using BigProject.Devices.Arm.Kinematic.Models;
|
||||
using BigProject.Logger;
|
||||
using BigProject.Serials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
@ -16,6 +19,15 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Xml.Linq;
|
||||
using System.Management;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Drawing;
|
||||
using BigProject.Devices.Arm;
|
||||
using Rubyer;
|
||||
using BigProject.JointMoveRecord;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace BigProject
|
||||
{
|
||||
@ -50,7 +62,12 @@ namespace BigProject
|
||||
//添加日志输出
|
||||
Log.MessageEvent += Log_MessageEvent;
|
||||
|
||||
//按钮事件
|
||||
//手动连接
|
||||
bt_Link.Click += Bt_Link_Click;
|
||||
//自动连接
|
||||
bt_LinkAuto.Click += Bt_LinkAuto_Click;
|
||||
|
||||
|
||||
//回零
|
||||
bt_Home.Click += Bt_Home_Click;
|
||||
//立即停止
|
||||
@ -65,87 +82,251 @@ namespace BigProject
|
||||
bt_GetCurrentAngle.Click += Bt_GetCurrentAngle_Click;
|
||||
//赋值当前角度位置
|
||||
//MainWindow_UpdateJointAngle();
|
||||
bt_OpenClaw.Click += Bt_OpenClaw_Click;
|
||||
bt_CloseClaw.Click += Bt_CloseClaw_Click;
|
||||
|
||||
bt_MoveToDesk.Click += Bt_MoveToDesk_Click;
|
||||
bt_MoveToMan.Click += Bt_MoveToMan_Click;
|
||||
//加载串口列表
|
||||
LoadComList();
|
||||
//设置按钮不可按
|
||||
SetButtomState(false);
|
||||
//加载记录列表
|
||||
LoadJointRecords();
|
||||
|
||||
}
|
||||
|
||||
//运动到我这
|
||||
private void Bt_MoveToMan_Click(object sender, RoutedEventArgs e)
|
||||
//加载记录列表
|
||||
private void LoadJointRecords()
|
||||
{
|
||||
var a1 = -45;
|
||||
var a2 = 45;
|
||||
var a3 = 60;
|
||||
var a4 = 0;
|
||||
var a5 = 0;
|
||||
var a6 = 0;
|
||||
|
||||
App.Core.armContrl.MoveJ(a1, a2, a3, a4, a5, a6);
|
||||
var pose6 = App.Core.armContrl.currentPose6D;
|
||||
var joint = App.Core.armContrl.currentJoints;
|
||||
|
||||
tb_X.Text = Math.Round(pose6.X, 2) + "";
|
||||
tb_Y.Text = Math.Round(pose6.Y, 2) + "";
|
||||
tb_Z.Text = Math.Round(pose6.Z, 2) + "";
|
||||
tb_A.Text = Math.Round(pose6.A, 2) + "";
|
||||
tb_B.Text = Math.Round(pose6.B, 2) + "";
|
||||
tb_C.Text = Math.Round(pose6.C, 2) + "";
|
||||
|
||||
tb_Joint1.Text = Math.Round(joint.a[0], 2) + "";
|
||||
tb_Joint2.Text = Math.Round(joint.a[1], 2) + "";
|
||||
tb_Joint3.Text = Math.Round(joint.a[2], 2) + "";
|
||||
tb_Joint4.Text = Math.Round(joint.a[3], 2) + "";
|
||||
tb_Joint5.Text = Math.Round(joint.a[4], 2) + "";
|
||||
tb_Joint6.Text = Math.Round(joint.a[5], 2) + "";
|
||||
|
||||
App.Core.armContrl.MoveJoints();
|
||||
App.Core.JointRecords = JointRecordRes.Read();
|
||||
dg_JointRecord.ItemsSource = App.Core.JointRecords;
|
||||
}
|
||||
|
||||
//运动到桌面为止
|
||||
private void Bt_MoveToDesk_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
//设置手动移动机械臂
|
||||
private void bt_MoveArmHand_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var a1 = -10;
|
||||
var a2 = 18;
|
||||
var a3 = 160;
|
||||
var a4 = 0;
|
||||
var a5 = 0;
|
||||
var a6 = 0;
|
||||
|
||||
App.Core.armContrl.MoveJ(a1, a2, a3, a4, a5, a6);
|
||||
var pose6 = App.Core.armContrl.currentPose6D;
|
||||
var joint = App.Core.armContrl.currentJoints;
|
||||
|
||||
tb_X.Text = Math.Round(pose6.X, 2) + "";
|
||||
tb_Y.Text = Math.Round(pose6.Y, 2) + "";
|
||||
tb_Z.Text = Math.Round(pose6.Z, 2) + "";
|
||||
tb_A.Text = Math.Round(pose6.A, 2) + "";
|
||||
tb_B.Text = Math.Round(pose6.B, 2) + "";
|
||||
tb_C.Text = Math.Round(pose6.C, 2) + "";
|
||||
|
||||
tb_Joint1.Text = Math.Round(joint.a[0], 2) + "";
|
||||
tb_Joint2.Text = Math.Round(joint.a[1], 2) + "";
|
||||
tb_Joint3.Text = Math.Round(joint.a[2], 2) + "";
|
||||
tb_Joint4.Text = Math.Round(joint.a[3], 2) + "";
|
||||
tb_Joint5.Text = Math.Round(joint.a[4], 2) + "";
|
||||
tb_Joint6.Text = Math.Round(joint.a[5], 2) + "";
|
||||
|
||||
App.Core.armContrl.MoveJoints();
|
||||
this.Dispatcher.Invoke(() => {
|
||||
var motorJ = App.Core.ArmContrl.motorJ;
|
||||
for (int i = 0; i < motorJ.Length; i++)
|
||||
{
|
||||
if (!App.Core.ArmContrl.SetIfEnable(i+1,false))
|
||||
{
|
||||
Log.Info($"电机{i + 1}设置失能状态失败");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//关闭夹爪
|
||||
private void Bt_CloseClaw_Click(object sender, RoutedEventArgs e)
|
||||
//记录机械臂当前位置
|
||||
private void bt_AddRecord_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
App.Core.armClaw.Close();
|
||||
}
|
||||
MainWindow_UpdateJointAngle();
|
||||
this.Dispatcher.Invoke(() => {
|
||||
var pose6 = App.Core.ArmContrl.currentPose6D;
|
||||
var joint = App.Core.ArmContrl.currentJoints;
|
||||
App.Core.JointRecords.Add(new JointMoveRecord.JointRecordModel
|
||||
{
|
||||
AddTime = DateTime.Now,
|
||||
J1 = Math.Round(joint.a[0], 2),
|
||||
J2 = Math.Round(joint.a[1], 2),
|
||||
J3 = Math.Round(joint.a[2], 2),
|
||||
J4 = Math.Round(joint.a[3], 2),
|
||||
J5 = Math.Round(joint.a[4], 2),
|
||||
J6 = Math.Round(joint.a[5], 2),
|
||||
|
||||
//打开夹爪
|
||||
private void Bt_OpenClaw_Click(object sender, RoutedEventArgs e)
|
||||
X = Math.Round(pose6.X, 2),
|
||||
Y = Math.Round(pose6.Y, 2),
|
||||
Z = Math.Round(pose6.Z, 2),
|
||||
A = Math.Round(pose6.A, 2),
|
||||
B = Math.Round(pose6.B, 2),
|
||||
C = Math.Round(pose6.C, 2),
|
||||
});
|
||||
dg_JointRecord.ItemsSource = App.Core.JointRecords;
|
||||
JointRecordRes.Write(App.Core.JointRecords);
|
||||
});
|
||||
|
||||
}
|
||||
//循环运动机械臂
|
||||
bool JointLoopIsRun = false;
|
||||
private void bt_MoveLoop_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
App.Core.armClaw.Open();
|
||||
if (JointLoopIsRun) return;
|
||||
var motorJ = App.Core.ArmContrl.motorJ;
|
||||
for (int i = 0; i < motorJ.Length; i++)
|
||||
{
|
||||
if (!App.Core.ArmContrl.SetIfEnable(i + 1, true))
|
||||
{
|
||||
Log.Info($"电机{i + 1}设置使能状态失败");
|
||||
}
|
||||
}
|
||||
JointLoopIsRun = true;
|
||||
Task.Run(() => {
|
||||
while (JointLoopIsRun)
|
||||
{
|
||||
Thread.Sleep(50);
|
||||
foreach (var rec in App.Core.JointRecords)
|
||||
{
|
||||
if (!JointLoopIsRun) return;
|
||||
this.Dispatcher.Invoke(() =>
|
||||
{
|
||||
dg_JointRecord.SelectedItem = rec;
|
||||
});
|
||||
App.Core.ArmContrl.currentJoints.a[0] = rec.J1;
|
||||
App.Core.ArmContrl.currentJoints.a[1] = rec.J2;
|
||||
App.Core.ArmContrl.currentJoints.a[2] = rec.J3;
|
||||
App.Core.ArmContrl.currentJoints.a[3] = rec.J4;
|
||||
App.Core.ArmContrl.currentJoints.a[4] = rec.J5;
|
||||
App.Core.ArmContrl.currentJoints.a[5] = rec.J6;
|
||||
App.Core.ArmContrl.MoveJoints();
|
||||
Thread.Sleep(100);
|
||||
while (!App.Core.ArmContrl.IsMoveOver())
|
||||
{
|
||||
if (!JointLoopIsRun) return;
|
||||
Thread.Sleep(2000);
|
||||
}
|
||||
}
|
||||
}
|
||||
App.Core.ArmContrl.ArmStopNow();
|
||||
});
|
||||
}
|
||||
//停止循环
|
||||
private void bt_MoveLoopStop_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
JointLoopIsRun = false;
|
||||
}
|
||||
//删除记录
|
||||
private void bt_DeleteRecord_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if(dg_JointRecord.SelectedItem==null)
|
||||
{
|
||||
MessageBoxR.Show("请先选择一条记录.");
|
||||
return;
|
||||
}
|
||||
var rec = dg_JointRecord.SelectedItem as JointRecordModel;
|
||||
App.Core.JointRecords.Remove(rec);
|
||||
dg_JointRecord.ItemsSource = App.Core.JointRecords;
|
||||
JointRecordRes.Write(App.Core.JointRecords);
|
||||
}
|
||||
//设置按钮状态
|
||||
private void SetButtomState(bool State = false)
|
||||
{
|
||||
this.Dispatcher.Invoke(() =>
|
||||
{
|
||||
bt_Home.IsEnabled = State;
|
||||
bt_StopNow.IsEnabled = State;
|
||||
bt_FK.IsEnabled = State;
|
||||
bt_IK.IsEnabled = State;
|
||||
bt_MoveJoint.IsEnabled = State;
|
||||
bt_GetCurrentAngle.IsEnabled = State;
|
||||
bt_AddRecord.IsEnabled = State;
|
||||
bt_MoveArmHand.IsEnabled = State;
|
||||
bt_MoveLoop.IsEnabled = State;
|
||||
bt_MoveLoopStop.IsEnabled = State;
|
||||
bt_DeleteRecord.IsEnabled = State;
|
||||
});
|
||||
}
|
||||
//加载串口列表
|
||||
private List<string> LoadComList()
|
||||
{
|
||||
// 查询所有串口设备
|
||||
ManagementObjectSearcher searcher = new ManagementObjectSearcher(
|
||||
"SELECT * FROM Win32_PnPEntity WHERE Caption LIKE '%(COM%)' AND Caption LIKE '%USB%'");
|
||||
var list = new List<string>();
|
||||
this.Dispatcher.Invoke(() => {
|
||||
cb_ComList.Items.Clear();
|
||||
foreach (var port in searcher.Get())
|
||||
{
|
||||
string caption = port["Caption"]?.ToString() ?? "无描述";
|
||||
Match match = Regex.Match(caption, @"COM\d+");
|
||||
if (match.Success)
|
||||
{
|
||||
string comPortName = match.Value; // 提取匹配到的 COM 名称
|
||||
cb_ComList.Items.Add(comPortName);
|
||||
list.Add(comPortName);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
//自动连接
|
||||
private void Bt_LinkAuto_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var list = LoadComList();
|
||||
//连接
|
||||
|
||||
Task.Run(() => {
|
||||
//加载串口列表
|
||||
try
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
Log.Info($"尝试连接{item}...");
|
||||
var result = App.Core.InitArm(item);
|
||||
if (result)
|
||||
{
|
||||
var res =App.Core.ArmSerial.SendMsgForResult(new byte[3] { 0x01, 0x33, 0x6b },out byte[] resMsg);
|
||||
Thread.Sleep(500);
|
||||
if (res&&resMsg[0] > 0)
|
||||
{
|
||||
Log.Info($"{item}连接成功,找到jyker机械臂");
|
||||
this.Dispatcher.Invoke(() => {
|
||||
cb_ComList.SelectedItem = item;
|
||||
bt_LinkAuto.IsEnabled = false;
|
||||
cb_ComList.IsEnabled = false;
|
||||
bt_Link.Content = "断开连接";
|
||||
SetButtomState(true);
|
||||
|
||||
//读取位置信息并赋值
|
||||
MainWindow_UpdateJointAngle();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if(result)
|
||||
{
|
||||
App.Core.ArmDispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Info(ex.ToString());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
//手动连接
|
||||
private void Bt_Link_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (bt_Link.Content.ToString() == "断开连接")
|
||||
{
|
||||
bt_LinkAuto.IsEnabled = true;
|
||||
cb_ComList.IsEnabled = true;
|
||||
bt_Link.Content = "手动连接";
|
||||
App.Core.ArmDispose();
|
||||
SetButtomState(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
var name = cb_ComList.SelectedItem + "";
|
||||
var result = App.Core.InitArm(name);
|
||||
if (result)
|
||||
{
|
||||
bt_LinkAuto.IsEnabled = false;
|
||||
cb_ComList.IsEnabled = false;
|
||||
bt_Link.Content = "断开连接";
|
||||
SetButtomState(true);
|
||||
//读取位置信息并赋值
|
||||
MainWindow_UpdateJointAngle();
|
||||
}
|
||||
}
|
||||
}
|
||||
//获取当前电机目标位置
|
||||
private void Bt_GetCurrentAngle_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MainWindow_UpdateJointAngle();
|
||||
@ -154,50 +335,49 @@ namespace BigProject
|
||||
//获取当前角度位置
|
||||
private void MainWindow_UpdateJointAngle()
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
this.Dispatcher.Invoke(() => {
|
||||
var motorJ = App.Core.armContrl.motorJ;
|
||||
for (int i = 0; i < motorJ.Length; i++)
|
||||
this.Dispatcher.Invoke(() => {
|
||||
var motorJ = App.Core.ArmContrl.motorJ;
|
||||
for (int i = 0; i < motorJ.Length; i++)
|
||||
{
|
||||
if(!App.Core.ArmContrl.GetCurrentAngle(i + 1, motorJ[i],out double angle))
|
||||
{
|
||||
App.Core.armContrl.GetCurrentAngle(i + 1, motorJ[i]);
|
||||
Log.Info($"电机{i + 1}角度获取失败");
|
||||
}
|
||||
}
|
||||
|
||||
var a1 = motorJ[0].CurrentAngle;
|
||||
var a2 = motorJ[1].CurrentAngle;
|
||||
var a3 = motorJ[2].CurrentAngle;
|
||||
var a4 = motorJ[3].CurrentAngle;
|
||||
var a5 = motorJ[4].CurrentAngle;
|
||||
var a6 = motorJ[5].CurrentAngle;
|
||||
var a1 = motorJ[0].CurrentAngle;
|
||||
var a2 = motorJ[1].CurrentAngle;
|
||||
var a3 = motorJ[2].CurrentAngle;
|
||||
var a4 = motorJ[3].CurrentAngle;
|
||||
var a5 = motorJ[4].CurrentAngle;
|
||||
var a6 = motorJ[5].CurrentAngle;
|
||||
|
||||
App.Core.armContrl.MoveJ(a1, a2, a3, a4, a5, a6);
|
||||
var pose6 = App.Core.armContrl.currentPose6D;
|
||||
var joint = App.Core.armContrl.currentJoints;
|
||||
App.Core.armContrl.lastJoints = App.Core.armContrl.currentJoints;
|
||||
App.Core.ArmContrl.MoveJ(a1, a2, a3, a4, a5, a6);
|
||||
var pose6 = App.Core.ArmContrl.currentPose6D;
|
||||
var joint = App.Core.ArmContrl.currentJoints;
|
||||
|
||||
tb_X.Text = Math.Round(pose6.X, 2) + "";
|
||||
tb_Y.Text = Math.Round(pose6.Y, 2) + "";
|
||||
tb_Z.Text = Math.Round(pose6.Z, 2) + "";
|
||||
tb_A.Text = Math.Round(pose6.A, 2) + "";
|
||||
tb_B.Text = Math.Round(pose6.B, 2) + "";
|
||||
tb_C.Text = Math.Round(pose6.C, 2) + "";
|
||||
tb_X.Text = Math.Round(pose6.X, 2) + "";
|
||||
tb_Y.Text = Math.Round(pose6.Y, 2) + "";
|
||||
tb_Z.Text = Math.Round(pose6.Z, 2) + "";
|
||||
tb_A.Text = Math.Round(pose6.A, 2) + "";
|
||||
tb_B.Text = Math.Round(pose6.B, 2) + "";
|
||||
tb_C.Text = Math.Round(pose6.C, 2) + "";
|
||||
|
||||
tb_Joint1.Text = Math.Round(joint.a[0], 2) + "";
|
||||
tb_Joint2.Text = Math.Round(joint.a[1], 2) + "";
|
||||
tb_Joint3.Text = Math.Round(joint.a[2], 2) + "";
|
||||
tb_Joint4.Text = Math.Round(joint.a[3], 2) + "";
|
||||
tb_Joint5.Text = Math.Round(joint.a[4], 2) + "";
|
||||
tb_Joint6.Text = Math.Round(joint.a[5], 2) + "";
|
||||
});
|
||||
tb_Joint1.Text = Math.Round(joint.a[0], 2) + "";
|
||||
tb_Joint2.Text = Math.Round(joint.a[1], 2) + "";
|
||||
tb_Joint3.Text = Math.Round(joint.a[2], 2) + "";
|
||||
tb_Joint4.Text = Math.Round(joint.a[3], 2) + "";
|
||||
tb_Joint5.Text = Math.Round(joint.a[4], 2) + "";
|
||||
tb_Joint6.Text = Math.Round(joint.a[5], 2) + "";
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//让机械臂运动
|
||||
private void Bt_MoveJoint_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
App.Core.armContrl.MoveJoints();
|
||||
App.Core.ArmContrl.MoveJoints();
|
||||
}
|
||||
|
||||
//逆解计算
|
||||
@ -210,12 +390,12 @@ namespace BigProject
|
||||
double.TryParse(tb_B.Text, out double b);
|
||||
double.TryParse(tb_C.Text, out double c);
|
||||
|
||||
var res =App.Core.armContrl.MoveL(x, y, z, a, b, c);
|
||||
var res =App.Core.ArmContrl.MoveL(x, y, z, a, b, c);
|
||||
if(!res)
|
||||
{
|
||||
Log.Info("逆解无解");
|
||||
}
|
||||
var joint = App.Core.armContrl.currentJoints;
|
||||
var joint = App.Core.ArmContrl.currentJoints;
|
||||
|
||||
tb_Joint1.Text = Math.Round(joint.a[0],2) + "";
|
||||
tb_Joint2.Text = Math.Round(joint.a[1],2) + "";
|
||||
@ -235,12 +415,12 @@ namespace BigProject
|
||||
double.TryParse(tb_Joint6.Text, out double a6);
|
||||
|
||||
|
||||
bool isSole = App.Core.armContrl.MoveJ(a1, a2, a3, a4, a5, a6);
|
||||
bool isSole = App.Core.ArmContrl.MoveJ(a1, a2, a3, a4, a5, a6);
|
||||
if(!isSole)
|
||||
{
|
||||
Log.Info("角度限制无法解除");
|
||||
}
|
||||
var pose6 = App.Core.armContrl.currentPose6D;
|
||||
var pose6 = App.Core.ArmContrl.currentPose6D;
|
||||
|
||||
tb_X.Text = Math.Round(pose6.X, 2) + "";
|
||||
tb_Y.Text = Math.Round(pose6.Y, 2) + "";
|
||||
@ -253,34 +433,46 @@ namespace BigProject
|
||||
//立即停止
|
||||
private void Bt_StopNow_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
App.Core.armContrl.ArmStopNow();
|
||||
App.Core.ArmContrl.ArmStopNow();
|
||||
}
|
||||
|
||||
//回零操作
|
||||
private void Bt_Home_Click(object sender, RoutedEventArgs e)
|
||||
private async void Bt_Home_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
App.Core.armContrl.Homing();
|
||||
var result = await MessageBoxR.Show("注意!非金属减速机版本请手动回零,否则容易损坏减速器!确定要回零吗?",
|
||||
"确认操作",
|
||||
MessageBoxButton.OKCancel,
|
||||
MessageBoxType.Question);
|
||||
if(result == MessageBoxResult.OK)
|
||||
{
|
||||
App.Core.ArmContrl.Homing();
|
||||
|
||||
//回零之后更新正逆解参数
|
||||
App.Core.armContrl.MoveJ(0, -90, 180,0, 0, 0);
|
||||
var pose6 = App.Core.armContrl.currentPose6D;
|
||||
var joint = App.Core.armContrl.currentJoints;
|
||||
//回零之后更新正逆解参数
|
||||
App.Core.ArmContrl.MoveJ(0, -90, 180, 0, 90, 0);
|
||||
var pose6 = App.Core.ArmContrl.currentPose6D;
|
||||
var joint = App.Core.ArmContrl.currentJoints;
|
||||
|
||||
tb_X.Text = Math.Round(pose6.X, 2) + "";
|
||||
tb_Y.Text = Math.Round(pose6.Y, 2) + "";
|
||||
tb_Z.Text = Math.Round(pose6.Z, 2) + "";
|
||||
tb_A.Text = Math.Round(pose6.A, 2) + "";
|
||||
tb_B.Text = Math.Round(pose6.B, 2) + "";
|
||||
tb_C.Text = Math.Round(pose6.C, 2) + "";
|
||||
tb_X.Text = Math.Round(pose6.X, 2) + "";
|
||||
tb_Y.Text = Math.Round(pose6.Y, 2) + "";
|
||||
tb_Z.Text = Math.Round(pose6.Z, 2) + "";
|
||||
tb_A.Text = Math.Round(pose6.A, 2) + "";
|
||||
tb_B.Text = Math.Round(pose6.B, 2) + "";
|
||||
tb_C.Text = Math.Round(pose6.C, 2) + "";
|
||||
|
||||
tb_Joint1.Text = Math.Round(joint.a[0], 2) + "";
|
||||
tb_Joint2.Text = Math.Round(joint.a[1], 2) + "";
|
||||
tb_Joint3.Text = Math.Round(joint.a[2], 2) + "";
|
||||
tb_Joint4.Text = Math.Round(joint.a[3], 2) + "";
|
||||
tb_Joint5.Text = Math.Round(joint.a[4], 2) + "";
|
||||
tb_Joint6.Text = Math.Round(joint.a[5], 2) + "";
|
||||
tb_Joint1.Text = Math.Round(joint.a[0], 2) + "";
|
||||
tb_Joint2.Text = Math.Round(joint.a[1], 2) + "";
|
||||
tb_Joint3.Text = Math.Round(joint.a[2], 2) + "";
|
||||
tb_Joint4.Text = Math.Round(joint.a[3], 2) + "";
|
||||
tb_Joint5.Text = Math.Round(joint.a[4], 2) + "";
|
||||
tb_Joint6.Text = Math.Round(joint.a[5], 2) + "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region 托盘右键菜单
|
||||
|
||||
private void MainWindow_StateChanged(object sender, EventArgs e)
|
||||
{
|
||||
ws = this.WindowState;
|
||||
@ -302,7 +494,7 @@ namespace BigProject
|
||||
this.notifyIcon.Icon = icon;
|
||||
this.notifyIcon.Visible = true;
|
||||
notifyIcon.MouseDoubleClick += OnNotifyIconDoubleClick;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -312,9 +504,6 @@ namespace BigProject
|
||||
this.Show();
|
||||
WindowState = wsl;
|
||||
}
|
||||
|
||||
|
||||
#region 托盘右键菜单
|
||||
private void contextMenu()
|
||||
{
|
||||
ContextMenuStrip cms = new ContextMenuStrip();
|
||||
@ -375,6 +564,10 @@ namespace BigProject
|
||||
richTextLine++;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Interop;
|
||||
|
||||
@ -17,37 +18,53 @@ namespace BigProject.Serials
|
||||
public int recCount = 8;
|
||||
public List<byte> DataReceived = new List<byte>();
|
||||
private System.IO.Ports.SerialPort serialPort1 = new System.IO.Ports.SerialPort();
|
||||
public ArmSerial(string name1 = "COM12")
|
||||
public ArmSerial(string name1,out bool OpenResult)
|
||||
{
|
||||
|
||||
if (!serialPort1.IsOpen)
|
||||
try
|
||||
{
|
||||
serialPort1.BaudRate = 115200;
|
||||
serialPort1.PortName = name1;
|
||||
serialPort1.Open();
|
||||
serialPort1.DataReceived += SerialPort1_DataReceived;
|
||||
|
||||
if (!serialPort1.IsOpen)
|
||||
{
|
||||
serialPort1.BaudRate = 115200;
|
||||
serialPort1.PortName = name1;
|
||||
serialPort1.Open();
|
||||
serialPort1.ReadTimeout = 500; // 设置读取超时时间(毫秒)
|
||||
serialPort1.WriteTimeout = 500; // 设置写入超时时间(毫秒)
|
||||
//serialPort1.DataReceived += SerialPort1_DataReceived;
|
||||
|
||||
}
|
||||
OpenResult = true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
OpenResult = false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public bool SerialDispose()
|
||||
{
|
||||
serialPort1.Close();
|
||||
return true;
|
||||
}
|
||||
|
||||
//开启机械臂灯光
|
||||
public void LedOpen()
|
||||
{
|
||||
LightBrightness = 10;
|
||||
SendMsg(new byte[] { 0xFF, 0xFF, 0, 0, 0, 10,0x6B });
|
||||
SendMsgForResult(new byte[] { 0xFF, 0xFF, 0, 0, 0, 10,0x6B }, out byte[] msg);
|
||||
}
|
||||
|
||||
//关闭机械臂灯光
|
||||
public void LedClose()
|
||||
{
|
||||
LightBrightness = 0;
|
||||
SendMsg(new byte[] { 0xFF, 0xFF, 0, 0, 0, 0, 0x6B });
|
||||
SendMsgForResult(new byte[] { 0xFF, 0xFF, 0, 0, 0, 0, 0x6B }, out byte[] msg);
|
||||
}
|
||||
|
||||
public void CtrClaw(int angleA, int angleB,int angleC)
|
||||
{
|
||||
SendMsg(new byte[] { 0xFF, 0xFF, (byte)angleA, (byte)angleB, (byte)angleC, (byte)LightBrightness, 0x6B });
|
||||
SendMsgForResult(new byte[] { 0xFF, 0xFF, (byte)angleA, (byte)angleB, (byte)angleC, (byte)LightBrightness, 0x6B },out byte[] msg);
|
||||
}
|
||||
|
||||
//接收byte数据
|
||||
@ -60,11 +77,11 @@ namespace BigProject.Serials
|
||||
{
|
||||
return;
|
||||
}
|
||||
DataReceived.AddRange(rec.Take(recCount).ToArray());
|
||||
DataReceived.AddRange(rec);
|
||||
}
|
||||
|
||||
//发送数据
|
||||
public void SendMsg(byte[] msg)
|
||||
public void SendMsgOnly(byte[] msg)
|
||||
{
|
||||
DataReceived.Clear();
|
||||
string x = "";
|
||||
@ -77,6 +94,41 @@ namespace BigProject.Serials
|
||||
serialPort1.Write(msg, 0, msg.Length);
|
||||
}
|
||||
|
||||
public bool SendMsgForResult(byte[] msg ,out byte[] recMsg, int readLenth=128)
|
||||
{
|
||||
recMsg = new byte[readLenth];
|
||||
try
|
||||
{
|
||||
string x = "";
|
||||
for (int i = 0; i < msg.Length; i++)
|
||||
{
|
||||
x += msg[i].ToString("x2") + " ";
|
||||
}
|
||||
//Log.Info($"数据发送_{x}");
|
||||
if (!serialPort1.IsOpen)
|
||||
{
|
||||
return false;
|
||||
|
||||
}
|
||||
serialPort1.Write(msg, 0, msg.Length);
|
||||
Thread.Sleep(20);
|
||||
serialPort1.Read(recMsg, 0, recMsg.Length);
|
||||
Thread.Sleep(20);
|
||||
string y = "";
|
||||
for (int i = 0; i < recMsg.Length; i++)
|
||||
{
|
||||
y += recMsg[i].ToString("x2") + " ";
|
||||
}
|
||||
//Log.Info($"数据返回_{y}");
|
||||
return true;
|
||||
}
|
||||
catch (System.TimeoutException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//多圈堵转回零
|
||||
public bool Zero(int addr = 1)
|
||||
{
|
||||
@ -87,7 +139,7 @@ namespace BigProject.Serials
|
||||
//其他默认字节
|
||||
bytes.AddRange(new byte[] { 0x9A, 0x02, 0x00, 0x6B });
|
||||
//发送命令
|
||||
SendMsg(bytes.ToArray());
|
||||
SendMsgForResult(bytes.ToArray(), out byte[] resMsg);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -102,7 +154,7 @@ namespace BigProject.Serials
|
||||
//其他默认字节
|
||||
bytes.AddRange(new byte[] { 0x93, 0x88, 0x01, 0x6B });
|
||||
//发送命令
|
||||
SendMsg(bytes.ToArray());
|
||||
SendMsgForResult(bytes.ToArray(), out byte[] resMsg);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -137,7 +189,7 @@ namespace BigProject.Serials
|
||||
//校验位
|
||||
bytes.AddRange(new byte[] { 0x6B });
|
||||
//发送命令
|
||||
SendMsg(bytes.ToArray());
|
||||
SendMsgForResult(bytes.ToArray(),out byte[] resMsg);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -177,7 +229,7 @@ namespace BigProject.Serials
|
||||
//校验位
|
||||
bytes.AddRange(new byte[] { 0x6B });
|
||||
//发送命令
|
||||
SendMsg(bytes.ToArray());
|
||||
SendMsgForResult(bytes.ToArray(), out byte[] resMsg);
|
||||
|
||||
}
|
||||
|
||||
@ -188,7 +240,7 @@ namespace BigProject.Serials
|
||||
{
|
||||
byte[] bytes = new byte[4] { 0x00, 0xFF, 0x66, 0x6B };
|
||||
//发送命令
|
||||
SendMsg(bytes.ToArray());
|
||||
SendMsgForResult(bytes.ToArray(), out byte[] resMsg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1,199 +0,0 @@
|
||||
using BigProject.Devices;
|
||||
using BigProject.Devices.Arm;
|
||||
using BigProject.Devices.DeskLamp;
|
||||
using BigProject.Devices.Fan;
|
||||
using BigProject.Devices.NightLight;
|
||||
using BigProject.Devices.WallPainting;
|
||||
using BigProject.Logger;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BigProject.Serials
|
||||
{
|
||||
public class AssistantSerial
|
||||
{
|
||||
private System.IO.Ports.SerialPort serialPort1 = new System.IO.Ports.SerialPort();
|
||||
public AssistantSerial(string name1 = "COM17")
|
||||
{
|
||||
|
||||
if (!serialPort1.IsOpen)
|
||||
{
|
||||
serialPort1.BaudRate = 9600;
|
||||
serialPort1.PortName = name1;
|
||||
serialPort1.Open();
|
||||
serialPort1.DataReceived += SerialPort1_DataReceived;
|
||||
Log.Info($"语音助手已连接");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//接收byte数据
|
||||
private void SerialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
|
||||
{
|
||||
SerialPort sp = (SerialPort)sender;
|
||||
byte[] rec = new byte[sp.ReadBufferSize];
|
||||
int lenth = sp.Read(rec, 0, sp.ReadBufferSize);
|
||||
AssistantContrl(rec[0]);
|
||||
Log.Info($"Assistant send {rec[0]}");
|
||||
}
|
||||
|
||||
public void AssistantContrl(int contrlWord)
|
||||
{
|
||||
switch (contrlWord)
|
||||
{
|
||||
case 1:
|
||||
var dlList = App.Core.Devices.Where(t => t.DeviceType == Devices.DeviceType.DeskLamp);
|
||||
foreach (var dl in dlList)
|
||||
{
|
||||
var one = dl as DeskLampDevice;
|
||||
one.Open();
|
||||
Log.Info($"台灯{one.Id} 已打开");
|
||||
}
|
||||
|
||||
break;
|
||||
case 2:
|
||||
var _dlList = App.Core.Devices.Where(t => t.DeviceType == Devices.DeviceType.DeskLamp);
|
||||
foreach (var dl in _dlList)
|
||||
{
|
||||
var one = dl as DeskLampDevice;
|
||||
one.Close();
|
||||
Log.Info($"台灯{one.Id} 已关闭");
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
var fans1 = App.Core.Devices.Where(t => t.DeviceType == Devices.DeviceType.Fan);
|
||||
foreach (var fan in fans1)
|
||||
{
|
||||
var one = fan as FanDevice;
|
||||
one.Open();
|
||||
Log.Info($"风扇{one.Id} 已开启");
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
var fans2 = App.Core.Devices.Where(t => t.DeviceType == Devices.DeviceType.Fan);
|
||||
foreach (var fan in fans2)
|
||||
{
|
||||
var one = fan as FanDevice;
|
||||
one.Close();
|
||||
Log.Info($"风扇{one.Id} 已关闭");
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
var fans3 = App.Core.Devices.Where(t => t.DeviceType == Devices.DeviceType.Fan);
|
||||
foreach (var fan in fans3)
|
||||
{
|
||||
var one = fan as FanDevice;
|
||||
one.LevelDown();
|
||||
Log.Info($"风扇{one.Id} 已调小");
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
var fans4 = App.Core.Devices.Where(t => t.DeviceType == Devices.DeviceType.Fan);
|
||||
foreach (var fan in fans4)
|
||||
{
|
||||
var one = fan as FanDevice;
|
||||
one.LevelUp();
|
||||
Log.Info($"风扇{one.Id} 已调大");
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
var wps1 = App.Core.Devices.Where(t => t.DeviceType == Devices.DeviceType.WallPainting);
|
||||
foreach (var wp in wps1)
|
||||
{
|
||||
var one = wp as WallPaintingDevice;
|
||||
one.Open();
|
||||
Log.Info($"壁画{one.Id} 已开启");
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
var wps2 = App.Core.Devices.Where(t => t.DeviceType == Devices.DeviceType.WallPainting);
|
||||
foreach (var wp in wps2)
|
||||
{
|
||||
var one = wp as WallPaintingDevice;
|
||||
one.Close();
|
||||
Log.Info($"壁画{one.Id} 已关闭");
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
var lights1 = App.Core.Devices.Where(t => t.DeviceType == Devices.DeviceType.NightLight);
|
||||
foreach (var li in lights1)
|
||||
{
|
||||
var one = li as NightLightDevice;
|
||||
one.Open();
|
||||
Log.Info($"小灯{one.Id} 已开启");
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
var lights2 = App.Core.Devices.Where(t => t.DeviceType == Devices.DeviceType.NightLight);
|
||||
foreach (var li in lights2)
|
||||
{
|
||||
var one = li as NightLightDevice;
|
||||
one.Close();
|
||||
Log.Info($"小灯{one.Id} 已关闭");
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
//夜间模式
|
||||
foreach (var dev in App.Core.Devices)
|
||||
{
|
||||
if(dev.DeviceType == DeviceType.NightLight)
|
||||
{
|
||||
var one = dev as NightLightDevice;
|
||||
one.Open();
|
||||
Log.Info($"小灯{one.Id} 已打开");
|
||||
}
|
||||
if(dev.DeviceType == DeviceType.DeskLamp)
|
||||
{
|
||||
var one = dev as DeskLampDevice;
|
||||
one.Open();
|
||||
Log.Info($"台灯{one.Id} 已打开");
|
||||
}
|
||||
if(dev.DeviceType == DeviceType.ArmLed)
|
||||
{
|
||||
var one = dev as ArmLed;
|
||||
one.Open();
|
||||
Log.Info($"机械臂灯 {one.Id} 已打开");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
case 18:
|
||||
//单机模式,除了电脑,全部关闭
|
||||
foreach (var dev in App.Core.Devices)
|
||||
{
|
||||
if (dev.DeviceType == DeviceType.NightLight)
|
||||
{
|
||||
var one = dev as NightLightDevice;
|
||||
one.Close();
|
||||
Log.Info($"小灯{one.Id} 已关闭");
|
||||
}
|
||||
if (dev.DeviceType == DeviceType.DeskLamp)
|
||||
{
|
||||
var one = dev as DeskLampDevice;
|
||||
one.Close();
|
||||
Log.Info($"台灯{one.Id} 已关闭");
|
||||
}
|
||||
if (dev.DeviceType == DeviceType.ArmLed)
|
||||
{
|
||||
var one = dev as ArmLed;
|
||||
one.Close();
|
||||
Log.Info($"机械臂灯 {one.Id} 已关闭");
|
||||
}
|
||||
if(dev.DeviceType == DeviceType.WallPainting)
|
||||
{
|
||||
var one = dev as WallPaintingDevice;
|
||||
one.Close();
|
||||
Log.Info($"壁画 {one.Id} 已关闭");
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
||||
0887f202feb865367143b5863f0a719ee104bbe5
|
||||
0af15420b0e278c1069a5fdacc65c91cac9b968d
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -12,8 +12,8 @@ DEBUG;TRACE
|
||||
D:\Ducument\mywork\jyker\gitbanben\jyker\HMIcode\BigProject\BigProject\App.xaml
|
||||
1219584333
|
||||
11221526090
|
||||
24-260348658
|
||||
35-670795799
|
||||
21631888184
|
||||
36-144057187
|
||||
MainWindow.xaml;
|
||||
|
||||
False
|
||||
|
@ -4,17 +4,17 @@
|
||||
winexe
|
||||
C#
|
||||
.cs
|
||||
D:\Ducument\mywork\jyker\HMI\code\BigProject\BigProject\obj\Debug\
|
||||
D:\Ducument\mywork\jyker\gitbanben\jyker\HMIcode\BigProject\BigProject\obj\Debug\
|
||||
BigProject
|
||||
none
|
||||
false
|
||||
DEBUG;TRACE
|
||||
D:\Ducument\mywork\jyker\HMI\code\BigProject\BigProject\App.xaml
|
||||
D:\Ducument\mywork\jyker\gitbanben\jyker\HMIcode\BigProject\BigProject\App.xaml
|
||||
1219584333
|
||||
11221526090
|
||||
251952530020
|
||||
35409930802
|
||||
22-1450200434
|
||||
36-144057187
|
||||
MainWindow.xaml;
|
||||
|
||||
False
|
||||
True
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "871E0E6AF0FBED28C1E648AF4BE87A0D591A80F8011048BC21AA6BAC07D2F234"
|
||||
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "5081B605B8FB759B1727DF15C058D47880AB32717238EDBB266C043BD530BD89"
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
@ -59,55 +59,47 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 28 "..\..\MainWindow.xaml"
|
||||
#line 23 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Shapes.Ellipse X706;
|
||||
internal System.Windows.Controls.DataGrid dg_JointRecord;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 32 "..\..\MainWindow.xaml"
|
||||
#line 38 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Shapes.Ellipse X0;
|
||||
internal System.Windows.Controls.DataGridTextColumn AddTime;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 39 "..\..\MainWindow.xaml"
|
||||
#line 52 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Shapes.Ellipse X1;
|
||||
internal System.Windows.Controls.ComboBox cb_ComList;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 43 "..\..\MainWindow.xaml"
|
||||
#line 56 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Shapes.Ellipse X2;
|
||||
internal System.Windows.Controls.Button bt_Link;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 49 "..\..\MainWindow.xaml"
|
||||
#line 57 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Shapes.Ellipse X4;
|
||||
internal System.Windows.Controls.Button bt_LinkAuto;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 53 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Shapes.Ellipse X5;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 67 "..\..\MainWindow.xaml"
|
||||
#line 69 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_X;
|
||||
|
||||
@ -115,7 +107,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 75 "..\..\MainWindow.xaml"
|
||||
#line 77 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_Y;
|
||||
|
||||
@ -123,7 +115,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 83 "..\..\MainWindow.xaml"
|
||||
#line 85 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_Z;
|
||||
|
||||
@ -131,7 +123,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 91 "..\..\MainWindow.xaml"
|
||||
#line 93 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_A;
|
||||
|
||||
@ -139,7 +131,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 99 "..\..\MainWindow.xaml"
|
||||
#line 101 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_B;
|
||||
|
||||
@ -147,7 +139,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 107 "..\..\MainWindow.xaml"
|
||||
#line 109 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_C;
|
||||
|
||||
@ -155,7 +147,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 116 "..\..\MainWindow.xaml"
|
||||
#line 118 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_Joint1;
|
||||
|
||||
@ -163,7 +155,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 124 "..\..\MainWindow.xaml"
|
||||
#line 126 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_Joint2;
|
||||
|
||||
@ -171,7 +163,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 132 "..\..\MainWindow.xaml"
|
||||
#line 134 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_Joint3;
|
||||
|
||||
@ -179,7 +171,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 140 "..\..\MainWindow.xaml"
|
||||
#line 142 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_Joint4;
|
||||
|
||||
@ -187,7 +179,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 148 "..\..\MainWindow.xaml"
|
||||
#line 150 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_Joint5;
|
||||
|
||||
@ -195,7 +187,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 156 "..\..\MainWindow.xaml"
|
||||
#line 158 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_Joint6;
|
||||
|
||||
@ -203,7 +195,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 161 "..\..\MainWindow.xaml"
|
||||
#line 163 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_Home;
|
||||
|
||||
@ -211,7 +203,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 164 "..\..\MainWindow.xaml"
|
||||
#line 166 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_StopNow;
|
||||
|
||||
@ -219,7 +211,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 169 "..\..\MainWindow.xaml"
|
||||
#line 171 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_FK;
|
||||
|
||||
@ -227,7 +219,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 172 "..\..\MainWindow.xaml"
|
||||
#line 174 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_IK;
|
||||
|
||||
@ -235,7 +227,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 177 "..\..\MainWindow.xaml"
|
||||
#line 179 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_MoveJoint;
|
||||
|
||||
@ -243,7 +235,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 180 "..\..\MainWindow.xaml"
|
||||
#line 182 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_GetCurrentAngle;
|
||||
|
||||
@ -251,39 +243,47 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 185 "..\..\MainWindow.xaml"
|
||||
#line 187 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_OpenClaw;
|
||||
internal System.Windows.Controls.Button bt_MoveArmHand;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 188 "..\..\MainWindow.xaml"
|
||||
#line 190 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_CloseClaw;
|
||||
internal System.Windows.Controls.Button bt_AddRecord;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 193 "..\..\MainWindow.xaml"
|
||||
#line 195 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_MoveToDesk;
|
||||
internal System.Windows.Controls.Button bt_MoveLoop;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 196 "..\..\MainWindow.xaml"
|
||||
#line 198 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_MoveToMan;
|
||||
internal System.Windows.Controls.Button bt_MoveLoopStop;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 202 "..\..\MainWindow.xaml"
|
||||
#line 203 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_DeleteRecord;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 209 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tbLog;
|
||||
|
||||
@ -327,88 +327,118 @@ namespace BigProject {
|
||||
this.ResultTextInPic = ((System.Windows.Controls.TextBlock)(target));
|
||||
return;
|
||||
case 3:
|
||||
this.X706 = ((System.Windows.Shapes.Ellipse)(target));
|
||||
this.dg_JointRecord = ((System.Windows.Controls.DataGrid)(target));
|
||||
return;
|
||||
case 4:
|
||||
this.X0 = ((System.Windows.Shapes.Ellipse)(target));
|
||||
this.AddTime = ((System.Windows.Controls.DataGridTextColumn)(target));
|
||||
return;
|
||||
case 5:
|
||||
this.X1 = ((System.Windows.Shapes.Ellipse)(target));
|
||||
this.cb_ComList = ((System.Windows.Controls.ComboBox)(target));
|
||||
return;
|
||||
case 6:
|
||||
this.X2 = ((System.Windows.Shapes.Ellipse)(target));
|
||||
this.bt_Link = ((System.Windows.Controls.Button)(target));
|
||||
return;
|
||||
case 7:
|
||||
this.X4 = ((System.Windows.Shapes.Ellipse)(target));
|
||||
this.bt_LinkAuto = ((System.Windows.Controls.Button)(target));
|
||||
return;
|
||||
case 8:
|
||||
this.X5 = ((System.Windows.Shapes.Ellipse)(target));
|
||||
return;
|
||||
case 9:
|
||||
this.tb_X = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 10:
|
||||
case 9:
|
||||
this.tb_Y = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 11:
|
||||
case 10:
|
||||
this.tb_Z = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 12:
|
||||
case 11:
|
||||
this.tb_A = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 13:
|
||||
case 12:
|
||||
this.tb_B = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 14:
|
||||
case 13:
|
||||
this.tb_C = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 15:
|
||||
case 14:
|
||||
this.tb_Joint1 = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 16:
|
||||
case 15:
|
||||
this.tb_Joint2 = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 17:
|
||||
case 16:
|
||||
this.tb_Joint3 = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 18:
|
||||
case 17:
|
||||
this.tb_Joint4 = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 19:
|
||||
case 18:
|
||||
this.tb_Joint5 = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 20:
|
||||
case 19:
|
||||
this.tb_Joint6 = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 21:
|
||||
case 20:
|
||||
this.bt_Home = ((System.Windows.Controls.Button)(target));
|
||||
return;
|
||||
case 22:
|
||||
case 21:
|
||||
this.bt_StopNow = ((System.Windows.Controls.Button)(target));
|
||||
return;
|
||||
case 23:
|
||||
case 22:
|
||||
this.bt_FK = ((System.Windows.Controls.Button)(target));
|
||||
return;
|
||||
case 24:
|
||||
case 23:
|
||||
this.bt_IK = ((System.Windows.Controls.Button)(target));
|
||||
return;
|
||||
case 25:
|
||||
case 24:
|
||||
this.bt_MoveJoint = ((System.Windows.Controls.Button)(target));
|
||||
return;
|
||||
case 26:
|
||||
case 25:
|
||||
this.bt_GetCurrentAngle = ((System.Windows.Controls.Button)(target));
|
||||
return;
|
||||
case 26:
|
||||
this.bt_MoveArmHand = ((System.Windows.Controls.Button)(target));
|
||||
|
||||
#line 187 "..\..\MainWindow.xaml"
|
||||
this.bt_MoveArmHand.Click += new System.Windows.RoutedEventHandler(this.bt_MoveArmHand_Click);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
return;
|
||||
case 27:
|
||||
this.bt_OpenClaw = ((System.Windows.Controls.Button)(target));
|
||||
this.bt_AddRecord = ((System.Windows.Controls.Button)(target));
|
||||
|
||||
#line 190 "..\..\MainWindow.xaml"
|
||||
this.bt_AddRecord.Click += new System.Windows.RoutedEventHandler(this.bt_AddRecord_Click);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
return;
|
||||
case 28:
|
||||
this.bt_CloseClaw = ((System.Windows.Controls.Button)(target));
|
||||
this.bt_MoveLoop = ((System.Windows.Controls.Button)(target));
|
||||
|
||||
#line 195 "..\..\MainWindow.xaml"
|
||||
this.bt_MoveLoop.Click += new System.Windows.RoutedEventHandler(this.bt_MoveLoop_Click);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
return;
|
||||
case 29:
|
||||
this.bt_MoveToDesk = ((System.Windows.Controls.Button)(target));
|
||||
this.bt_MoveLoopStop = ((System.Windows.Controls.Button)(target));
|
||||
|
||||
#line 198 "..\..\MainWindow.xaml"
|
||||
this.bt_MoveLoopStop.Click += new System.Windows.RoutedEventHandler(this.bt_MoveLoopStop_Click);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
return;
|
||||
case 30:
|
||||
this.bt_MoveToMan = ((System.Windows.Controls.Button)(target));
|
||||
this.bt_DeleteRecord = ((System.Windows.Controls.Button)(target));
|
||||
|
||||
#line 203 "..\..\MainWindow.xaml"
|
||||
this.bt_DeleteRecord.Click += new System.Windows.RoutedEventHandler(this.bt_DeleteRecord_Click);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
return;
|
||||
case 31:
|
||||
this.tbLog = ((System.Windows.Controls.TextBox)(target));
|
||||
|
@ -1,4 +1,4 @@
|
||||
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "871E0E6AF0FBED28C1E648AF4BE87A0D591A80F8011048BC21AA6BAC07D2F234"
|
||||
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "5081B605B8FB759B1727DF15C058D47880AB32717238EDBB266C043BD530BD89"
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
@ -59,55 +59,47 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 28 "..\..\MainWindow.xaml"
|
||||
#line 23 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Shapes.Ellipse X706;
|
||||
internal System.Windows.Controls.DataGrid dg_JointRecord;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 32 "..\..\MainWindow.xaml"
|
||||
#line 38 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Shapes.Ellipse X0;
|
||||
internal System.Windows.Controls.DataGridTextColumn AddTime;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 39 "..\..\MainWindow.xaml"
|
||||
#line 52 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Shapes.Ellipse X1;
|
||||
internal System.Windows.Controls.ComboBox cb_ComList;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 43 "..\..\MainWindow.xaml"
|
||||
#line 56 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Shapes.Ellipse X2;
|
||||
internal System.Windows.Controls.Button bt_Link;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 49 "..\..\MainWindow.xaml"
|
||||
#line 57 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Shapes.Ellipse X4;
|
||||
internal System.Windows.Controls.Button bt_LinkAuto;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 53 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Shapes.Ellipse X5;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 67 "..\..\MainWindow.xaml"
|
||||
#line 69 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_X;
|
||||
|
||||
@ -115,7 +107,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 75 "..\..\MainWindow.xaml"
|
||||
#line 77 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_Y;
|
||||
|
||||
@ -123,7 +115,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 83 "..\..\MainWindow.xaml"
|
||||
#line 85 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_Z;
|
||||
|
||||
@ -131,7 +123,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 91 "..\..\MainWindow.xaml"
|
||||
#line 93 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_A;
|
||||
|
||||
@ -139,7 +131,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 99 "..\..\MainWindow.xaml"
|
||||
#line 101 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_B;
|
||||
|
||||
@ -147,7 +139,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 107 "..\..\MainWindow.xaml"
|
||||
#line 109 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_C;
|
||||
|
||||
@ -155,7 +147,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 116 "..\..\MainWindow.xaml"
|
||||
#line 118 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_Joint1;
|
||||
|
||||
@ -163,7 +155,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 124 "..\..\MainWindow.xaml"
|
||||
#line 126 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_Joint2;
|
||||
|
||||
@ -171,7 +163,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 132 "..\..\MainWindow.xaml"
|
||||
#line 134 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_Joint3;
|
||||
|
||||
@ -179,7 +171,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 140 "..\..\MainWindow.xaml"
|
||||
#line 142 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_Joint4;
|
||||
|
||||
@ -187,7 +179,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 148 "..\..\MainWindow.xaml"
|
||||
#line 150 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_Joint5;
|
||||
|
||||
@ -195,7 +187,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 156 "..\..\MainWindow.xaml"
|
||||
#line 158 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tb_Joint6;
|
||||
|
||||
@ -203,7 +195,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 161 "..\..\MainWindow.xaml"
|
||||
#line 163 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_Home;
|
||||
|
||||
@ -211,7 +203,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 164 "..\..\MainWindow.xaml"
|
||||
#line 166 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_StopNow;
|
||||
|
||||
@ -219,7 +211,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 169 "..\..\MainWindow.xaml"
|
||||
#line 171 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_FK;
|
||||
|
||||
@ -227,7 +219,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 172 "..\..\MainWindow.xaml"
|
||||
#line 174 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_IK;
|
||||
|
||||
@ -235,7 +227,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 177 "..\..\MainWindow.xaml"
|
||||
#line 179 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_MoveJoint;
|
||||
|
||||
@ -243,7 +235,7 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 180 "..\..\MainWindow.xaml"
|
||||
#line 182 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_GetCurrentAngle;
|
||||
|
||||
@ -251,39 +243,47 @@ namespace BigProject {
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 185 "..\..\MainWindow.xaml"
|
||||
#line 187 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_OpenClaw;
|
||||
internal System.Windows.Controls.Button bt_MoveArmHand;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 188 "..\..\MainWindow.xaml"
|
||||
#line 190 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_CloseClaw;
|
||||
internal System.Windows.Controls.Button bt_AddRecord;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 193 "..\..\MainWindow.xaml"
|
||||
#line 195 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_MoveToDesk;
|
||||
internal System.Windows.Controls.Button bt_MoveLoop;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 196 "..\..\MainWindow.xaml"
|
||||
#line 198 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_MoveToMan;
|
||||
internal System.Windows.Controls.Button bt_MoveLoopStop;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 202 "..\..\MainWindow.xaml"
|
||||
#line 203 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.Button bt_DeleteRecord;
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
|
||||
#line 209 "..\..\MainWindow.xaml"
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
||||
internal System.Windows.Controls.TextBox tbLog;
|
||||
|
||||
@ -327,88 +327,118 @@ namespace BigProject {
|
||||
this.ResultTextInPic = ((System.Windows.Controls.TextBlock)(target));
|
||||
return;
|
||||
case 3:
|
||||
this.X706 = ((System.Windows.Shapes.Ellipse)(target));
|
||||
this.dg_JointRecord = ((System.Windows.Controls.DataGrid)(target));
|
||||
return;
|
||||
case 4:
|
||||
this.X0 = ((System.Windows.Shapes.Ellipse)(target));
|
||||
this.AddTime = ((System.Windows.Controls.DataGridTextColumn)(target));
|
||||
return;
|
||||
case 5:
|
||||
this.X1 = ((System.Windows.Shapes.Ellipse)(target));
|
||||
this.cb_ComList = ((System.Windows.Controls.ComboBox)(target));
|
||||
return;
|
||||
case 6:
|
||||
this.X2 = ((System.Windows.Shapes.Ellipse)(target));
|
||||
this.bt_Link = ((System.Windows.Controls.Button)(target));
|
||||
return;
|
||||
case 7:
|
||||
this.X4 = ((System.Windows.Shapes.Ellipse)(target));
|
||||
this.bt_LinkAuto = ((System.Windows.Controls.Button)(target));
|
||||
return;
|
||||
case 8:
|
||||
this.X5 = ((System.Windows.Shapes.Ellipse)(target));
|
||||
return;
|
||||
case 9:
|
||||
this.tb_X = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 10:
|
||||
case 9:
|
||||
this.tb_Y = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 11:
|
||||
case 10:
|
||||
this.tb_Z = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 12:
|
||||
case 11:
|
||||
this.tb_A = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 13:
|
||||
case 12:
|
||||
this.tb_B = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 14:
|
||||
case 13:
|
||||
this.tb_C = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 15:
|
||||
case 14:
|
||||
this.tb_Joint1 = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 16:
|
||||
case 15:
|
||||
this.tb_Joint2 = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 17:
|
||||
case 16:
|
||||
this.tb_Joint3 = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 18:
|
||||
case 17:
|
||||
this.tb_Joint4 = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 19:
|
||||
case 18:
|
||||
this.tb_Joint5 = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 20:
|
||||
case 19:
|
||||
this.tb_Joint6 = ((System.Windows.Controls.TextBox)(target));
|
||||
return;
|
||||
case 21:
|
||||
case 20:
|
||||
this.bt_Home = ((System.Windows.Controls.Button)(target));
|
||||
return;
|
||||
case 22:
|
||||
case 21:
|
||||
this.bt_StopNow = ((System.Windows.Controls.Button)(target));
|
||||
return;
|
||||
case 23:
|
||||
case 22:
|
||||
this.bt_FK = ((System.Windows.Controls.Button)(target));
|
||||
return;
|
||||
case 24:
|
||||
case 23:
|
||||
this.bt_IK = ((System.Windows.Controls.Button)(target));
|
||||
return;
|
||||
case 25:
|
||||
case 24:
|
||||
this.bt_MoveJoint = ((System.Windows.Controls.Button)(target));
|
||||
return;
|
||||
case 26:
|
||||
case 25:
|
||||
this.bt_GetCurrentAngle = ((System.Windows.Controls.Button)(target));
|
||||
return;
|
||||
case 26:
|
||||
this.bt_MoveArmHand = ((System.Windows.Controls.Button)(target));
|
||||
|
||||
#line 187 "..\..\MainWindow.xaml"
|
||||
this.bt_MoveArmHand.Click += new System.Windows.RoutedEventHandler(this.bt_MoveArmHand_Click);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
return;
|
||||
case 27:
|
||||
this.bt_OpenClaw = ((System.Windows.Controls.Button)(target));
|
||||
this.bt_AddRecord = ((System.Windows.Controls.Button)(target));
|
||||
|
||||
#line 190 "..\..\MainWindow.xaml"
|
||||
this.bt_AddRecord.Click += new System.Windows.RoutedEventHandler(this.bt_AddRecord_Click);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
return;
|
||||
case 28:
|
||||
this.bt_CloseClaw = ((System.Windows.Controls.Button)(target));
|
||||
this.bt_MoveLoop = ((System.Windows.Controls.Button)(target));
|
||||
|
||||
#line 195 "..\..\MainWindow.xaml"
|
||||
this.bt_MoveLoop.Click += new System.Windows.RoutedEventHandler(this.bt_MoveLoop_Click);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
return;
|
||||
case 29:
|
||||
this.bt_MoveToDesk = ((System.Windows.Controls.Button)(target));
|
||||
this.bt_MoveLoopStop = ((System.Windows.Controls.Button)(target));
|
||||
|
||||
#line 198 "..\..\MainWindow.xaml"
|
||||
this.bt_MoveLoopStop.Click += new System.Windows.RoutedEventHandler(this.bt_MoveLoopStop_Click);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
return;
|
||||
case 30:
|
||||
this.bt_MoveToMan = ((System.Windows.Controls.Button)(target));
|
||||
this.bt_DeleteRecord = ((System.Windows.Controls.Button)(target));
|
||||
|
||||
#line 203 "..\..\MainWindow.xaml"
|
||||
this.bt_DeleteRecord.Click += new System.Windows.RoutedEventHandler(this.bt_DeleteRecord_Click);
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
return;
|
||||
case 31:
|
||||
this.tbLog = ((System.Windows.Controls.TextBox)(target));
|
||||
|
3
armcode/.vscode/settings.json
vendored
3
armcode/.vscode/settings.json
vendored
@ -5,6 +5,7 @@
|
||||
"system_error": "cpp",
|
||||
"random": "cpp",
|
||||
"cstddef": "cpp",
|
||||
"new": "cpp"
|
||||
"new": "cpp",
|
||||
"*.tcc": "cpp"
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@ void ledsetup() {
|
||||
/* code */
|
||||
leds[i] = CRGB::White;
|
||||
}
|
||||
FastLED.show();
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,8 +10,9 @@
|
||||
|
||||
[env:upesy_wroom]
|
||||
platform = espressif32
|
||||
board = upesy_wroom
|
||||
board = hornbill32dev
|
||||
framework = arduino
|
||||
monitor_speed = 115200
|
||||
lib_deps =
|
||||
madhephaestus/ESP32Servo@^3.0.5
|
||||
fastled/FastLED@^3.8.0
|
||||
|
@ -1,114 +1,33 @@
|
||||
#include <Arduino.h>
|
||||
|
||||
#include <HardwareSerial.h> //导入ESP32串口操作库
|
||||
|
||||
#include <led.h>
|
||||
#include <claw.h>
|
||||
#include<WiFi.h>
|
||||
#include <AsyncTCP.h>
|
||||
#include "config.h"
|
||||
#include <Ticker.h>
|
||||
String WIFI_Name = "牛嘿嘿"; //WIFI名字
|
||||
String WIFI_Key = "asdzxc123"; //密码
|
||||
HardwareSerial MySerial(2);
|
||||
AsyncClient* client;
|
||||
char buffer[100];
|
||||
int bufferIndex = 0;
|
||||
bool receivingData = false;
|
||||
Ticker ledTimer;
|
||||
Ticker clawTimer;
|
||||
|
||||
char recFormC[20];
|
||||
int recCount = 0;
|
||||
|
||||
|
||||
void processData(char* data,int len) {
|
||||
// 这里对接收到的数据进行处理,可以根据具体的数据格式进行解析
|
||||
client->add(data, len);
|
||||
client->send();
|
||||
}
|
||||
|
||||
|
||||
static void replyToServer(void* arg) {
|
||||
AsyncClient* client = reinterpret_cast<AsyncClient*>(arg);
|
||||
// send reply
|
||||
if (client->space() > 32 && client->canSend()) {
|
||||
char message[2];
|
||||
message[0] = 4; //类型
|
||||
message[1] = 1; //地址
|
||||
client->add(message, strlen(message));
|
||||
client->send();
|
||||
}
|
||||
}
|
||||
|
||||
/* event callbacks */
|
||||
static void handleData(void* arg, AsyncClient* client, void *data, size_t len) {
|
||||
Serial.printf("\n data received from %s \n", client->remoteIP().toString().c_str());
|
||||
Serial.write((uint8_t*)data, len);
|
||||
}
|
||||
|
||||
void onClient(void* arg, AsyncClient* client) {
|
||||
Serial.printf("\n client connected ! %s",client->remoteIP().toString().c_str());
|
||||
client->onData(&handleData, client);
|
||||
replyToServer(client);
|
||||
}
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
MySerial.begin(115200, SERIAL_8N1, 16, 17);
|
||||
// WiFi.begin(WIFI_Name, WIFI_Key);
|
||||
// while (WiFi.status()!= WL_CONNECTED) {
|
||||
// delay(1000);
|
||||
// Serial.println("Connecting to WiFi...");
|
||||
// }
|
||||
// Serial.println("Connected to WiFi");
|
||||
|
||||
// AsyncServer* server = new AsyncServer(10086);
|
||||
// server->onClient(&onClient,server);
|
||||
// server->begin();
|
||||
em_motor_init();
|
||||
ledsetup();
|
||||
Serial.begin(115200);
|
||||
//em_motor_init();
|
||||
ledsetup();
|
||||
while (!Serial) {
|
||||
; // wait for serial port to connect. Needed for native USB port only
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void loop() {
|
||||
if(Serial.available())
|
||||
{
|
||||
int r = Serial.read();
|
||||
recFormC[recCount] = r;
|
||||
recCount++;
|
||||
if(r==0x6B)
|
||||
{
|
||||
if(recFormC[0] ==0xff&&recFormC[1] ==0xff)
|
||||
{
|
||||
em_motor_run_by_angle(recFormC[2],recFormC[3],recFormC[4]);
|
||||
setBrightness(recFormC[5]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < recCount; i++)
|
||||
{
|
||||
MySerial.write(recFormC[i]);
|
||||
//Serial.printf("%x ",recFormC[i]);
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < recCount; i++)
|
||||
{
|
||||
/* code */
|
||||
recFormC[i] = 0;
|
||||
|
||||
}
|
||||
recCount= 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(MySerial.available())
|
||||
{
|
||||
int r = MySerial.read();
|
||||
Serial.write(r);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
316453
models/Arm/STEP/机械臂总成.STEP
Normal file
316453
models/Arm/STEP/机械臂总成.STEP
Normal file
File diff suppressed because one or more lines are too long
BIN
models/Arm/STL/joint1.3mf
Normal file
BIN
models/Arm/STL/joint1.3mf
Normal file
Binary file not shown.
BIN
models/Arm/STL/joint1.STL
Normal file
BIN
models/Arm/STL/joint1.STL
Normal file
Binary file not shown.
BIN
models/Arm/STL/joint1_另一部分.STL
Normal file
BIN
models/Arm/STL/joint1_另一部分.STL
Normal file
Binary file not shown.
BIN
models/Arm/STL/joint2_v2.STL
Normal file
BIN
models/Arm/STL/joint2_v2.STL
Normal file
Binary file not shown.
BIN
models/Arm/STL/joint2_盖子v2.STL
Normal file
BIN
models/Arm/STL/joint2_盖子v2.STL
Normal file
Binary file not shown.
BIN
models/Arm/STL/joint3_v2.STL
Normal file
BIN
models/Arm/STL/joint3_v2.STL
Normal file
Binary file not shown.
BIN
models/Arm/STL/joint3_左v2.STL
Normal file
BIN
models/Arm/STL/joint3_左v2.STL
Normal file
Binary file not shown.
BIN
models/Arm/STL/joint4.STL
Normal file
BIN
models/Arm/STL/joint4.STL
Normal file
Binary file not shown.
BIN
models/Arm/STL/joint5.STL
Normal file
BIN
models/Arm/STL/joint5.STL
Normal file
Binary file not shown.
BIN
models/Arm/STL/底座.STL
Normal file
BIN
models/Arm/STL/底座.STL
Normal file
Binary file not shown.
BIN
models/Arm/STL/底座灯环.STL
Normal file
BIN
models/Arm/STL/底座灯环.STL
Normal file
Binary file not shown.
BIN
models/Arm/STL/底座灯环盖.STL
Normal file
BIN
models/Arm/STL/底座灯环盖.STL
Normal file
Binary file not shown.
BIN
models/Arm/STL/电路板配合部分.STL
Normal file
BIN
models/Arm/STL/电路板配合部分.STL
Normal file
Binary file not shown.
42266
models/Reducer/STEP/减速器底部不出轴.STEP
Normal file
42266
models/Reducer/STEP/减速器底部不出轴.STEP
Normal file
File diff suppressed because it is too large
Load Diff
42398
models/Reducer/STEP/减速器底部出轴.STEP
Normal file
42398
models/Reducer/STEP/减速器底部出轴.STEP
Normal file
File diff suppressed because it is too large
Load Diff
BIN
models/Reducer/STL/42底盖第四版.STL
Normal file
BIN
models/Reducer/STL/42底盖第四版.STL
Normal file
Binary file not shown.
BIN
models/Reducer/STL/42柔轮内第四版.STL
Normal file
BIN
models/Reducer/STL/42柔轮内第四版.STL
Normal file
Binary file not shown.
BIN
models/Reducer/STL/42柔轮第四版.STL
Normal file
BIN
models/Reducer/STL/42柔轮第四版.STL
Normal file
Binary file not shown.
BIN
models/Reducer/STL/42波发生器第四版.STL
Normal file
BIN
models/Reducer/STL/42波发生器第四版.STL
Normal file
Binary file not shown.
BIN
models/Reducer/STL/42波发生器第四版底部中空.STL
Normal file
BIN
models/Reducer/STL/42波发生器第四版底部中空.STL
Normal file
Binary file not shown.
BIN
models/Reducer/STL/42钢轮第四版.STL
Normal file
BIN
models/Reducer/STL/42钢轮第四版.STL
Normal file
Binary file not shown.
BIN
models/Reducer/STL/42顶盖第四版.STL
Normal file
BIN
models/Reducer/STL/42顶盖第四版.STL
Normal file
Binary file not shown.
163982
models/机械臂总成2.STEP
163982
models/机械臂总成2.STEP
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in New Issue
Block a user