|
|
@@ -46,22 +46,24 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
static Logger loggerPIO = Logger.GetLogger("PIO");
|
|
|
|
|
|
#region Properties
|
|
|
- private double currentPosition;
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// Tag 위치
|
|
|
/// </summary>
|
|
|
- private int currentTag;
|
|
|
-
|
|
|
- public int CurrentTag
|
|
|
+ private string currentTag;
|
|
|
+ public string CurrentTag
|
|
|
{
|
|
|
get { return currentTag; }
|
|
|
- set { SetField(ref this.currentTag, value); }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ if ( SetField(ref this.currentTag, value))
|
|
|
+ this.OnCurrentTagChanged?.Invoke(value);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// Scale Value
|
|
|
/// </summary>
|
|
|
+ private double currentPosition;
|
|
|
public double CurrentPosition
|
|
|
{
|
|
|
get { return currentPosition; }
|
|
|
@@ -69,21 +71,38 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
{
|
|
|
if (SetField(ref this.currentPosition, value))
|
|
|
{
|
|
|
- this.currentPosition = value;
|
|
|
- this.OnCurrentPotisionChanged?.Invoke((int)value);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private eSteeringState steeringState;
|
|
|
+ private double currentSpeed;
|
|
|
+ public double CurrentSpeed
|
|
|
+ {
|
|
|
+ get { return currentSpeed; }
|
|
|
+ set { SetField(ref this.currentSpeed, value); }
|
|
|
+ }
|
|
|
|
|
|
+ private double currentTorque;
|
|
|
+ public double CurrentTorque
|
|
|
+ {
|
|
|
+ get { return currentTorque; }
|
|
|
+ set { SetField(ref this.currentTorque, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool isContain;
|
|
|
+ public bool IsContain
|
|
|
+ {
|
|
|
+ get { return isContain; }
|
|
|
+ set { SetField(ref this.isContain, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private eSteeringState steeringState;
|
|
|
public eSteeringState SteeringState
|
|
|
{
|
|
|
get { return steeringState; }
|
|
|
set { SetField(ref this.steeringState, value); }
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//이동
|
|
|
public bool Busy
|
|
|
{
|
|
|
@@ -97,12 +116,11 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
public bool IsMoving { get; set; }
|
|
|
public double BatteryVolt { get; set; }
|
|
|
public bool IsError { get; set; }
|
|
|
- public bool IsContain { get { return this.IsDetectedCenter(); } }
|
|
|
|
|
|
public SubCmd CurrentSubCommand { get; private set; }
|
|
|
#endregion
|
|
|
|
|
|
- #region Event
|
|
|
+ #region Event
|
|
|
public event Action OnMoveReady;
|
|
|
public event Action OnMoving;
|
|
|
public event Action OnMoveFinish;
|
|
|
@@ -119,7 +137,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
public event Action OnLoadComplete;
|
|
|
public event Action OnUnloadComplete;
|
|
|
|
|
|
- public event Action<int> OnCurrentPotisionChanged;
|
|
|
+ public event Action<string> OnCurrentTagChanged;
|
|
|
|
|
|
public event Action OnManualMove;
|
|
|
public event Action OnManualLoad;
|
|
|
@@ -129,7 +147,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
public event Action<eFailCode> OnFailReport;
|
|
|
#endregion
|
|
|
|
|
|
- IIO iO = null;
|
|
|
+ EzIO iO = null;
|
|
|
GSIMotion motion = null;
|
|
|
SqliteManager sql = null;
|
|
|
Clamp clamp = null;
|
|
|
@@ -163,8 +181,8 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
|
|
|
public Vehicle(IIO io, SqliteManager sqliteManager, IEventAggregator ea, AutoManager auto)
|
|
|
{
|
|
|
- this.iO = io;
|
|
|
- this.motion = new GSIMotion();
|
|
|
+ this.iO = io as EzIO;
|
|
|
+ this.iO.OnChangedIO += IO_OnChangedIO;
|
|
|
this.sql = sqliteManager;
|
|
|
this.autoManager = auto;
|
|
|
|
|
|
@@ -267,8 +285,6 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
//private void DriveControlEventPublish( DriveControlEventArgs args ) { }
|
|
|
|
|
|
private void DriveControlEventPublish(DriveControlEventArgs args)
|
|
|
@@ -766,7 +782,7 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
- #region Machanical Method
|
|
|
+ #region Mechanical Method
|
|
|
|
|
|
#region Conveyor
|
|
|
int OnOffConveyor(bool isOn, bool isCW = false)
|
|
|
@@ -1108,24 +1124,16 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
this.steering.OnSteeringError += Steering_OnSteeringError;
|
|
|
this.steering.PropertyChanged += Steering_PropertyChanged;
|
|
|
}
|
|
|
-
|
|
|
- private void Steering_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
|
|
- {
|
|
|
- var property = sender.GetType().GetProperty(e.PropertyName);
|
|
|
- var newValue = property.GetValue(sender, null);
|
|
|
-
|
|
|
- if (e.PropertyName.Equals("SteeringState"))
|
|
|
- {
|
|
|
- var v = CastTo<eSteeringState>.From<object>(newValue);
|
|
|
- this.SteeringState = v;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
void CreateClamp()
|
|
|
{
|
|
|
this.clamp = new Clamp(this.sql, this.eventAggregator);
|
|
|
this.clamp.Init();
|
|
|
}
|
|
|
+ void CreateDrive()
|
|
|
+ {
|
|
|
+ this.motion = new GSIMotion(this.sql);
|
|
|
+ this.motion.PropertyChanged += Motion_PropertyChanged;
|
|
|
+ }
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
@@ -1192,6 +1200,58 @@ namespace VehicleControlSystem.ControlLayer
|
|
|
#endregion
|
|
|
|
|
|
#region Event Subscribe
|
|
|
+ private void Motion_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
|
|
+ {
|
|
|
+ var property = sender.GetType().GetProperty(e.PropertyName);
|
|
|
+ var newValue = property.GetValue(sender, null);
|
|
|
+
|
|
|
+ if (e.PropertyName.Equals("CurrentPos"))
|
|
|
+ {
|
|
|
+ var v = CastTo<double>.From<object>(newValue);
|
|
|
+ this.CurrentPosition = v;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (e.PropertyName.Equals("CurrentTag"))
|
|
|
+ {
|
|
|
+ var v = CastTo<string>.From<object>(newValue);
|
|
|
+ this.CurrentTag = v;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (e.PropertyName.Equals("CurrentSpeed"))
|
|
|
+ {
|
|
|
+ var v = CastTo<double>.From<object>(newValue);
|
|
|
+ this.CurrentSpeed = v;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (e.PropertyName.Equals("CurrentTorque"))
|
|
|
+ {
|
|
|
+ var v = CastTo<double>.From<object>(newValue);
|
|
|
+ this.CurrentTorque = v;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void Steering_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
|
|
+ {
|
|
|
+ var property = sender.GetType().GetProperty(e.PropertyName);
|
|
|
+ var newValue = property.GetValue(sender, null);
|
|
|
+
|
|
|
+ //Todo: 나중에 Test 하자
|
|
|
+ //var ownPropperty = this.GetType().GetProperty(e.PropertyName);
|
|
|
+ if (e.PropertyName.Equals("SteeringState"))
|
|
|
+ {
|
|
|
+ var v = CastTo<eSteeringState>.From<object>(newValue);
|
|
|
+ this.SteeringState = v;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void IO_OnChangedIO(BitBlock bit)
|
|
|
+ {
|
|
|
+ if (bit.Tag.Equals("IN_CV_DETECT_01"))
|
|
|
+ {
|
|
|
+ this.IsContain = bit.IsBitOn;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void Steering_OnSteeringError(object sender, int e)
|
|
|
{
|
|
|
if (e != 0)
|