Commit 715ebee6 authored by 潘栩锋's avatar 潘栩锋 🚴

修复 电脑算AD盒的速度写错了,没有 使用double,都被取整了

修复 AD盒设置界面,RunToCmd 写错为RuntoCmd, 导致无效果
删除 样品取样 GetSample 删除 Interval,Timer
修复 边界查找,第1次正向扫描时,边界显示很大,因为忘记-探头半径了
优化 FLY.Thick.Base/Server/GM_ScanMotion 运行逻辑 修改为 归0取样阶段 与正常扫描阶段, 归0间隔为 min
parent 5fb77f45
......@@ -73,7 +73,7 @@ namespace FlyADBase
() =>
{
//速度是错了,需要自己计算
double scale = 1000 / sw_calSpeed.ElapsedMilliseconds;
double scale = 1000.0 / sw_calSpeed.ElapsedMilliseconds;
sw_calSpeed.Restart();
......
......@@ -137,7 +137,7 @@
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Content="运行至" Command="{Binding RuntoCmd}" />
<Button Content="运行至" Command="{Binding RunToCmd}" />
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="目标位置" />
<StackPanel Orientation="Horizontal">
......
......@@ -238,7 +238,6 @@ namespace FLY.Thick.Base.UI
this.getSampleService.Enable = this.Enable;
this.getSampleService.Interval = this.Interval;
this.getSampleService.Range = this.Range;
this.getSampleService.Velocity = this.Velocity;
this.getSampleService.Window = this.Window;
......@@ -301,7 +300,6 @@ namespace FLY.Thick.Base.UI
Enable = true;
Interval = 20;
Samples[0].Enable = true;
Features[0].Enable = true;
......@@ -315,10 +313,6 @@ namespace FLY.Thick.Base.UI
/// </summary>
public bool Enable { get; set; }
/// <summary>
/// 参数:间隔
/// </summary>
public int Interval { get; set; }
/// <summary>
/// 参数:速度
......
......@@ -27,18 +27,6 @@ namespace FLY.Thick.Base.Client
[JsonProperty]
public bool Enable { get; set; }
/// <summary>
/// 参数:间隔
/// </summary>
[JsonProperty]
public int Interval { get; set; }
/// <summary>
/// 采样计数
/// </summary>
[JsonProperty]
public int Timer { get; set; }
/// <summary>
/// 参数:速度
/// </summary>
......@@ -107,7 +95,6 @@ namespace FLY.Thick.Base.Client
GETSAMPLE_OBJ_INTERFACE.Pack_Params p = new GETSAMPLE_OBJ_INTERFACE.Pack_Params
{
enable = Enable,
interval = Interval,
velocity = Velocity,
range = Range,
window = Window,
......@@ -189,7 +176,6 @@ namespace FLY.Thick.Base.Client
Enable = p.enable;
Interval = p.interval;
Range = p.range;
Velocity = p.velocity;
Window = p.window;
......
......@@ -20,10 +20,7 @@ namespace FLY.Thick.Base.IService
/// </summary>
bool Enable { get; set; }
/// <summary>
/// 参数:间隔
/// </summary>
int Interval { get; set; }
/// <summary>
/// 参数:速度
......
......@@ -27,7 +27,6 @@ namespace FLY.Thick.Base.OBJ_INTERFACE
public class Pack_Params
{
public bool enable;
public int interval;
public UInt32 velocity;
public int range;
public int window;
......
......@@ -30,20 +30,12 @@ namespace FLY.Thick.Base.Server.OBJProxy
this.AD2Thick = AD2Thick;
mFlyAD.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(mFlyAD_PropertyChanged);
}
static string[] propertyname_params = new string[] {
"LocalEP","HasCRC","GridSmooth","IsCalSpeed","PosOfGrid","PosLen","MotorType","Ratio01","Ratio02","PosOffset","JogVelocity"
};
void mFlyAD_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if ((e.PropertyName == "LocalEP") ||
(e.PropertyName == "HasCRC") ||
(e.PropertyName == "GridSmooth") ||
(e.PropertyName == "IsCalSpeed") ||
(e.PropertyName == "PosOfGrid") ||
(e.PropertyName == "PosLen") ||
(e.PropertyName == "MotorType") ||
(e.PropertyName == "Ratio01") ||
(e.PropertyName == "Ratio02") ||
(e.PropertyName == "PosOffset") ||
(e.PropertyName == "JogVelocity"))
if (propertyname_params.Contains(e.PropertyName))
{
FObjBase.PollModule.Current.Poll_JustOnce(
new PollModule.PollHandler(delegate()
......
......@@ -120,7 +120,6 @@ namespace FLY.Thick.Base.Server.OBJProxy
GETSAMPLE_OBJ_INTERFACE.Pack_Params p = new GETSAMPLE_OBJ_INTERFACE.Pack_Params()
{
enable = mGetSampleService.Enable,
interval = mGetSampleService.Interval,
range = mGetSampleService.Range,
velocity = mGetSampleService.Velocity,
window = mGetSampleService.Window,
......@@ -192,7 +191,6 @@ namespace FLY.Thick.Base.Server.OBJProxy
var p = Newtonsoft.Json.JsonConvert.DeserializeObject<GETSAMPLE_OBJ_INTERFACE.Pack_Params>(json);
mGetSampleService.Enable = p.enable;
mGetSampleService.Interval = p.interval;
mGetSampleService.Range = p.range;
mGetSampleService.Velocity = p.velocity;
mGetSampleService.Window = p.window;
......
......@@ -632,29 +632,18 @@ namespace FLY.Thick.Base.Server
border[idx].Begin = (borderbegin_grid + gridBegin) * posOfGrid;
border[idx].End = (borderend_grid +gridBegin) * posOfGrid;
if (Misc.MyBase.ISVALIDATA(border[0].Begin) && Misc.MyBase.ISVALIDATA(border[1].Begin))
if (border.All(b => b.IsValid))
{
Border.Begin = (border[0].Begin + border[1].Begin) / 2 + SensorWidth / 2;
Border.End = (border[0].End + border[1].End) / 2 - SensorWidth / 2;
Width = Border.Width;
Mid = Border.Mid;
Border.Begin = (int)(border.Average(b => b.Begin) + SensorWidth / 2.0);
Border.End = (int)(border.Average(b => b.End) - SensorWidth / 2.0);
}
else if (Misc.MyBase.ISVALIDATA(border[0].Begin))
else if (border[idx].IsValid)
{
Border.Copy(border[0]);
Width = Border.Width;
Mid = Border.Mid;
}
else if (Misc.MyBase.ISVALIDATA(border[1].Begin))
{
Border.Copy(border[1]);
Width = Border.Width;
Mid = Border.Mid;
Border.Begin = border[idx].Begin + SensorWidth / 2;
Border.End = border[idx].End - SensorWidth / 2;
}
//膜宽
Width = Border.Width;
Mid = Border.Mid;
return true;
}
......
......@@ -2,6 +2,7 @@
using Misc;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
......@@ -30,6 +31,7 @@ namespace FLY.Thick.Base.Server
//把数据记录下来
getViewReponse = new BorderSearchGetViewReponse()
{
direction = direction,
posOfGrid = posOfGrid,
gridBegin = gridBegin,
dat = dat
......@@ -119,30 +121,18 @@ namespace FLY.Thick.Base.Server
border[idx].Begin = (borderbegin_grid + gridBegin) * posOfGrid - SensorWidth / 2;
border[idx].End = (borderend_grid + gridBegin) * posOfGrid + SensorWidth / 2;
if (Misc.MyBase.ISVALIDATA(border[0].Begin) && Misc.MyBase.ISVALIDATA(border[1].Begin))
if (border.All(b => b.IsValid))
{
Border.Begin = (border[0].Begin + border[1].Begin) / 2 + SensorWidth / 2;
Border.End = (border[0].End + border[1].End) / 2 - SensorWidth / 2;
Width = Border.Width;
Mid = Border.Mid;
}
else if (Misc.MyBase.ISVALIDATA(border[0].Begin))
{
Border.Copy(border[0]);
Width = Border.Width;
Mid = Border.Mid;
Border.Begin = (int)(border.Average(b => b.Begin) + SensorWidth / 2.0);
Border.End = (int)(border.Average(b => b.End) - SensorWidth / 2.0);
}
else if (Misc.MyBase.ISVALIDATA(border[1].Begin))
else if (border[idx].IsValid)
{
Border.Copy(border[1]);
Width = Border.Width;
Mid = Border.Mid;
Border.Begin = border[idx].Begin + SensorWidth / 2;
Border.End = border[idx].End - SensorWidth / 2;
}
//膜宽
Width = Border.Width;
Mid = Border.Mid;
return true;
}
}
......
......@@ -143,7 +143,7 @@ namespace FLY.Thick.Base.Server
bool b = base.Start();
if (!b)
return false;
mFlyAD.SetPosParam(Velocity, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
mFlyAD.SetVelocity(Velocity);
mFlyAD.Runto(pos);
return true;
}
......@@ -170,8 +170,7 @@ namespace FLY.Thick.Base.Server
bool b = base.Start();
if (!b)
return false;
mFlyAD.SetPosParam( Velocity, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
mFlyAD.SetVelocity(Velocity);
mFlyAD.RuntoMax();
return true;
}
......@@ -198,7 +197,7 @@ namespace FLY.Thick.Base.Server
bool b = base.Start();
if (!b)
return false;
mFlyAD.SetPosParam(Velocity, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
mFlyAD.SetVelocity(Velocity);
mFlyAD.RuntoMin();
return true;
}
......
......@@ -28,18 +28,6 @@ namespace FLY.Thick.Base.Server
[JsonProperty]
public bool Enable { get; set; } = true;
/// <summary>
/// 参数:间隔
/// </summary>
[JsonProperty]
public int Interval { get; set; } = 5;
/// <summary>
/// 采样计数
/// </summary>
public int Timer { get; set; }
/// <summary>
/// 参数:速度
/// </summary>
......@@ -131,7 +119,6 @@ namespace FLY.Thick.Base.Server
Enable = true;
Interval = 5;//采样间隔
Range = 100;//样品范围
Velocity = 200;//取样速度
Window = 3;//移动窗口
......@@ -142,16 +129,16 @@ namespace FLY.Thick.Base.Server
Samples[0] = new SampleCell()
{
Enable = true,
Position = 0,
OrgAD = 0
Position = 200,
OrgAD = 50300
};
directions[0] = DIRECTION.BACKWARD;
Samples[1] = new SampleCell()
{
Enable = false,
Position = 2006,
OrgAD = 30000
Position = 0,
OrgAD = 0
};
directions[1] = DIRECTION.FORWARD;
......@@ -223,8 +210,6 @@ namespace FLY.Thick.Base.Server
sample.AD = -1;
tempFilters[i].Reset();
}
Timer = Interval;
}
/// <summary>
......@@ -239,29 +224,8 @@ namespace FLY.Thick.Base.Server
sample.AD = -1;
tempFilters[i].Reset();
}
Timer = Interval;
}
/// <summary>
/// 检测是否要样品校正
/// </summary>
/// <returns></returns>
public virtual bool Check()
{
if (!Samples.Any(s => s.Enable))
{
return false;
}
if (Timer < Interval)
{
Timer++;
return false;
}
else
{
return true;
}
}
/// <summary>
/// 获取样品测量范围
/// </summary>
......@@ -527,9 +491,7 @@ namespace FLY.Thick.Base.Server
if (isFailure)//样品获取失败,下次继续!!!
return;
//只有当所有都成功,Timer=0
if(Samples.All(s => (s.Enable && s.AD > 0) || (!s.Enable)))
Timer = 0;
}
/// <summary>
......@@ -571,11 +533,6 @@ namespace FLY.Thick.Base.Server
SampleChangedEvent?.Invoke(this);
//只有当所有都成功,Timer=0
if (Samples.All(s => (s.Enable && s.AD > 0) || (!s.Enable)))
Timer = 0;
}
/// <summary>
/// 重新获取样品
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment