Kaynağa Gözat

현장 Update

SK.Kang 6 yıl önce
ebeveyn
işleme
1afba45ba6

+ 5 - 2
Dev/Connection/OHVProtocolServer/OHVConnector/OCSMessage.cs

@@ -104,8 +104,9 @@ namespace OHVConnector
             mb.AppendAscii( this.Kind.ToString() );
             mb.AppendAscii( this.Kind.ToString() );
             mb.AppendAscii( this.Tag );
             mb.AppendAscii( this.Tag );
             mb.AppendAscii( MakeSubcode() );
             mb.AppendAscii( MakeSubcode() );
-            string checkSum = Convert.ToString( GetCheckSum( mb.ToBytes ), 16 ).ToLower();
-            mb.AppendAscii( checkSum );
+            //string checkSum = Convert.ToString( GetCheckSum( mb.ToBytes ), 16 ).ToLower();
+            //mb.AppendAscii( checkSum );
+            mb.Append( GetCheckSum( mb.ToBytes ) );
             mb.Append( ETX );
             mb.Append( ETX );
 
 
             return mb;
             return mb;
@@ -120,6 +121,8 @@ namespace OHVConnector
             mb.AppendAscii( this.Kind.ToString() );
             mb.AppendAscii( this.Kind.ToString() );
             mb.AppendAscii( this.Tag );
             mb.AppendAscii( this.Tag );
             mb.AppendAscii( MakeSubcode() );
             mb.AppendAscii( MakeSubcode() );
+            
+            //string checkSum = Convert.ToString( GetCheckSum( mb.ToBytes ), 16 ).ToLower();
 
 
             return GetCheckSum( mb.ToBytes );
             return GetCheckSum( mb.ToBytes );
         }
         }

BIN
Dev/OHV/Assambly/OHVConnector.dll


BIN
Dev/OHV/Assambly/OHVConnector.pdb


+ 43 - 32
Dev/OHV/Assambly/OHVDrive/OHVdrive.h

@@ -13,46 +13,57 @@
  4. OHVdriveEnd();
  4. OHVdriveEnd();
  5. OHVdriveDelete();
  5. OHVdriveDelete();
 */
 */
-
 extern "C" OHV_DRIVE_API void OHVdriveCreate(void);
 extern "C" OHV_DRIVE_API void OHVdriveCreate(void);
 extern "C" OHV_DRIVE_API void OHVdriveDelete(void);
 extern "C" OHV_DRIVE_API void OHVdriveDelete(void);
 
 
 extern "C" OHV_DRIVE_API void OHVdriveBegin(void);
 extern "C" OHV_DRIVE_API void OHVdriveBegin(void);
 extern "C" OHV_DRIVE_API void OHVdriveEnd(void);
 extern "C" OHV_DRIVE_API void OHVdriveEnd(void);
 
 
-// directional roller, 1 = left, -1 = right
-extern "C" OHV_DRIVE_API int OHVdriveGetDesiredSolenoid(void);
+// steering roller
+// - return value
+//    1 = left, 
+//   -1 = right
+//  others = do nothing.
+extern "C" OHV_DRIVE_API int OHVdriveGetTargetSteering(void);
 
 
+// driving servo driver
+// - return value
+//   1 = Servo On
+//   2 = Servo Off
+//   3 = Servo Stop
+//  -1 = Servo Fault Reset
+// others = do nothing
+extern "C" OHV_DRIVE_API void OHVdriveSetServoCommand(int command);
 
 
-#ifndef OHV_DRIVE_EXPORTS
+// driving servo driver
+// - servo_num = 1 = front, -1 = rear
+// - return value
+//   0 = wrong servo_num
+//   1 = Servo On
+//   2 = Servo Off
+//   3 = Servo Stop
+//   -1 = Servo Fault Reset
+//   others = do nothing
+extern "C" OHV_DRIVE_API int OHVdriveGetServoState(int servo_num);
 
 
+// command when manual operation
+// 1 = go forward
+// -1 = go backward
+// 0 or others = stop
+extern "C" OHV_DRIVE_API void OHVdriveSetManualOperationCommand(int command);
 
 
-#endif
+// operation mode change (manual mode, automatic mode)
+// 1 = change to automatic mode
+// -1 = change to manual mode
+// others = not change
+extern "C" OHV_DRIVE_API void OHVdriveSetOperationMode(int mode);
+extern "C" OHV_DRIVE_API int OHVdriveGetOperationMode(void);
+
+
+// state of the laser scanner for detecting obstacles
+// 0 = normal (no obstacles)
+// 1 = field 1  (e-stop)
+// 2 = field 2  (stop)
+// 3 = filed 3  (slow)
+extern "C" OHV_DRIVE_API void OHVdriveSetLaserScannerField(int field);
 
 
-//extern "C" OHV_DRIVE_API double addDouble(double a, double b);
-
-// The Fibonacci recurrence relation describes a sequence F
-// where F(n) is { n = 0, a
-//               { n = 1, b
-//               { n > 1, F(n-2) + F(n-1)
-// for some initial integral values a and b.
-// If the sequence is initialized F(0) = 1, F(1) = 1,
-// then this relation produces the well-known Fibonacci
-// sequence: 1, 1, 2, 3, 5, 8, 13, 21, 34, ...
-
-//// Initialize a Fibonacci relation sequence
-//// such that F(0) = a, F(1) = b.
-//// This function must be called before any other function.
-//extern "C" OHV_DRIVE_API void fibonacci_init(
-//	const unsigned long long a, const unsigned long long b);
-//
-//// Produce the next value in the sequence.
-//// Returns true on success and updates current value and index;
-//// false on overflow, leaves current value and index unchanged.
-//extern "C" OHV_DRIVE_API bool fibonacci_next();
-//
-//// Get the current value in the sequence.
-//extern "C" OHV_DRIVE_API unsigned long long fibonacci_current();
-//
-//// Get the position of the current value in the sequence.
-//extern "C" OHV_DRIVE_API unsigned fibonacci_index();

+ 38 - 0
Dev/OHV/Assambly/OHVDrive/route_map/ohv_testmap1.json

@@ -0,0 +1,38 @@
+{
+    "name" : "ohv_testmap1",
+    "points" : [
+        { "ID" : 0, "x" : -13000, "y" : 0, "barcode" : 1},
+        { "ID" : 1, "x" : -3325, "y" : 3325, "barcode" : 1},
+        { "ID" : 2, "x" : -3325, "y" : 6375, "barcode" : 1},
+        { "ID" : 3, "x" : -3325, "y" : 9425, "barcode" : 1},
+        { "ID" : 4, "x" : 0, "y" : 12750, "barcode" : 1},
+        { "ID" : 5, "x" : 15000, "y" : 12750, "barcode" : 1},
+        { "ID" : 6, "x" : 30000, "y" : 12750, "barcode" : 1},
+        { "ID" : 7, "x" : 50000, "y" : 12750, "barcode" : 1},
+        { "ID" : 8, "x" : 60000, "y" : 12750, "barcode" : 1},
+        { "ID" : 9, "x" : 80000, "y" : 12750, "barcode" : 1},
+        { "ID" : 10, "x" : 106400, "y" : 12750, "barcode" : 1},
+        { "ID" : 11, "x" : 120000, "y" : 12750, "barcode" : 1},
+        { "ID" : 12, "x" : 140000, "y" : 12750, "barcode" : 1},
+        { "ID" : 13, "x" : 160000, "y" : 12750, "barcode" : 1},
+        { "ID" : 14, "x" : 173400, "y" : 12750, "barcode" : 1}
+    ],
+
+    "segments" : [
+        { "ID" :  0, "route_type" : "line", "speed" : 0.5, "start" : { "pointID" : 5, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 6, "skew" : 0, "slope" : 0} },
+
+        { "ID" :  1, "route_type" : "line", "speed" : 0.5, "start" : { "pointID" : 6, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 7, "skew" : 0, "slope" : 0} },
+
+        { "ID" :  2, "route_type" : "line", "speed" : 0.5, "start" : { "pointID" : 7, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 8, "skew" : 0, "slope" : 0} },
+
+        { "ID" :  3, "route_type" : "line", "speed" : 0.5, "start" : { "pointID" : 8, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 9, "skew" : 0, "slope" : 0} },
+
+        { "ID" :  4, "route_type" : "line", "speed" : 0.5, "start" : { "pointID" : 9, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 10, "skew" : 0, "slope" : 0} },
+
+        { "ID" :  5, "route_type" : "line", "speed" : 0.5, "start" : { "pointID" : 10, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 11, "skew" : 0, "slope" : 0} },
+
+        { "ID" :  6, "route_type" : "line", "speed" : 0.5, "start" : { "pointID" : 11, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 12, "skew" : 0, "slope" : 0} },
+
+        { "ID" :  7, "route_type" : "line", "speed" : 0.5, "start" : { "pointID" : 12, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 13, "skew" : 0, "slope" : 0} }
+    ]
+}

+ 57 - 0
Dev/OHV/Assambly/OHVDrive/route_map/ohv_testmap2.json

@@ -0,0 +1,57 @@
+{
+    "name" : "ohv_testmap2",
+    "points" : [
+        { "ID" : 0,  "x" : -13000, "y" : 0, "barcode" : 0},
+        { "ID" : 1,  "x" :  22180, "y" : 7820, "barcode" : 0},
+        { "ID" : 2,  "x" :  22180, "y" : 8050, "barcode" : 0},
+        { "ID" : 3,  "x" :  22180, "y" : 8280, "barcode" : 0},
+        { "ID" : 4,  "x" :  30000, "y" : 16100, "barcode" : 1026649},
+        { "ID" : 5,  "x" :  33458, "y" : 16100, "barcode" : 1030107},
+        { "ID" : 6,  "x" :  42795, "y" : 16100, "barcode" : 1039444},
+        { "ID" : 7,  "x" :  55685, "y" : 16100, "barcode" : 1052334},
+        { "ID" : 8,  "x" :  76625, "y" : 16100, "barcode" : 1073274},
+        { "ID" : 9,  "x" :  89481, "y" : 16100, "barcode" : 1086130},
+        { "ID" : 10, "x" : 100760, "y" : 16100, "barcode" : 1097318},
+        { "ID" : 11, "x" : 108580, "y" :  8280, "barcode" : 0},
+        { "ID" : 12, "x" : 108580, "y" :  8050, "barcode" : 0},
+        { "ID" : 13, "x" : 108580, "y" :  7820, "barcode" : 0},
+        { "ID" : 14, "x" : 100760, "y" :     0, "barcode" : 2062606},
+        { "ID" : 15, "x" : 100460, "y" :     0, "barcode" : 2062906},
+        { "ID" : 16, "x" :  86760, "y" :     0, "barcode" : 2076606},
+        { "ID" : 17, "x" :  72760, "y" :     0, "barcode" : 2090606},
+        { "ID" : 18, "x" :  44758, "y" :     0, "barcode" : 2118608},
+        { "ID" : 19, "x" :  40793, "y" :     0, "barcode" : 2122573},
+        { "ID" : 20, "x" :  30000, "y" :     0, "barcode" : 2133120}
+    ],
+
+    "segments" : [
+        { "ID" :  0, "route_type" : "line", "speed" : 0.1, "barcode" : "no", "start" : { "pointID" : 1, "skew" : 0, "slope" : 9000}, "end" : { "pointID" : 2, "skew" : 0, "slope" : 9000} },
+        { "ID" :  1, "route_type" : "line", "speed" : 0.1, "barcode" : "no", "start" : { "pointID" : 2, "skew" : 0, "slope" : 9000}, "end" : { "pointID" : 3, "skew" : 0, "slope" : 9000} },
+
+        { "ID" : 2, "route_type" : "arc", "speed" : 0.1, "barcode" : "no", "start" : { "pointID" : 3, "skew" : 0, "slope" :  7496}, "end" : { "pointID" : 4, "skew" : 0, "slope" : 1504 }, "rotate_type" : "cw"},
+
+        { "ID" :  3, "route_type" : "line", "speed" : 0.3, "barcode" : "no", "start" : { "pointID" : 4, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 5, "skew" : 0, "slope" : 0} },
+        { "ID" :  4, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 5, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 6, "skew" : 0, "slope" : 0} },
+        { "ID" :  5, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 6, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 7, "skew" : 0, "slope" : 0} },
+        { "ID" :  6, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 7, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 8, "skew" : 0, "slope" : 0} },
+        { "ID" :  7, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 8, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 9, "skew" : 0, "slope" : 0} },
+        { "ID" :  8, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 9, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 10, "skew" : 0, "slope" : 0} },
+
+        { "ID" : 9, "route_type" : "arc", "speed" : 0.1, "barcode" : "no", "start" : { "pointID" : 10, "skew" : 0, "slope" :  -1504}, "end" : { "pointID" : 11, "skew" : 0, "slope" : -7496 }, "rotate_type" : "cw"},
+
+        { "ID" :  10, "route_type" : "line", "speed" : 0.2, "barcode" : "no", "start" : { "pointID" : 11, "skew" : 0, "slope" : -9000}, "end" : { "pointID" : 12, "skew" : 0, "slope" : -9000} },
+        { "ID" :  11, "route_type" : "line", "speed" : 0.2, "barcode" : "no", "start" : { "pointID" : 12, "skew" : 0, "slope" : -9000}, "end" : { "pointID" : 13, "skew" : 0, "slope" : -9000} },
+
+        { "ID" : 12, "route_type" : "arc", "speed" : 0.1, "barcode" : "no", "start" : { "pointID" : 13, "skew" : 0, "slope" :  -10504}, "end" : { "pointID" : 14, "skew" : 0, "slope" : -16496 }, "rotate_type" : "cw"},
+
+        { "ID" :  13, "route_type" : "line", "speed" : 0.3, "barcode" : "no", "start" : { "pointID" : 14, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 15, "skew" : 0, "slope" : 18000} },
+        { "ID" :  14, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 15, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 16, "skew" : 0, "slope" : 18000} },
+        { "ID" :  15, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 16, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 17, "skew" : 0, "slope" : 18000} },
+        { "ID" :  16, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 17, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 18, "skew" : 0, "slope" : 18000} },
+        { "ID" :  17, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 18, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 19, "skew" : 0, "slope" : 18000} },
+        { "ID" :  18, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 19, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 20, "skew" : 0, "slope" : 18000} },
+
+        { "ID" : 19, "route_type" : "arc", "speed" : 0.1, "barcode" : "no", "start" : { "pointID" : 20, "skew" : 0, "slope" :  16496}, "end" : { "pointID" : 1, "skew" : 0, "slope" : 10504 }, "rotate_type" : "cw"}
+
+    ]
+}

+ 47 - 0
Dev/OHV/Assambly/OHVDrive/route_map/ohv_testmap3.json

@@ -0,0 +1,47 @@
+{
+    "name" : "ohv_testmap2",
+    "points" : [
+        { "ID" : 0,  "x" : -13000, "y" : 0, "barcode" : 0},
+        { "ID" : 1,  "x" :  22180, "y" : 7820, "barcode" : 0},
+        { "ID" : 2,  "x" :  22180, "y" : 8050, "barcode" : 0},
+        { "ID" : 3,  "x" :  22180, "y" : 8280, "barcode" : 0},
+        { "ID" : 4,  "x" :  30000, "y" : 16100, "barcode" : 1026649},
+        { "ID" : 5,  "x" :  33458, "y" : 16100, "barcode" : 1030107},
+        { "ID" : 6,  "x" :  42795, "y" : 16100, "barcode" : 1039444},
+        { "ID" : 7,  "x" :  55685, "y" : 16100, "barcode" : 1052334},
+        { "ID" : 8,  "x" :  76625, "y" : 16100, "barcode" : 1073274},
+        { "ID" : 9,  "x" :  89481, "y" : 16100, "barcode" : 1086130},
+        { "ID" : 10, "x" : 100760, "y" : 16100, "barcode" : 1097318},
+        { "ID" : 11, "x" : 108580, "y" :  8280, "barcode" : 0},
+        { "ID" : 12, "x" : 108580, "y" :  8050, "barcode" : 0},
+        { "ID" : 13, "x" : 108580, "y" :  7820, "barcode" : 0},
+        { "ID" : 14, "x" : 100760, "y" :     0, "barcode" : 2062606},
+        { "ID" : 15, "x" : 100460, "y" :     0, "barcode" : 2062906},
+        { "ID" : 16, "x" :  86760, "y" :     0, "barcode" : 2076606},
+        { "ID" : 17, "x" :  72760, "y" :     0, "barcode" : 2090606},
+        { "ID" : 18, "x" :  44758, "y" :     0, "barcode" : 2118608},
+        { "ID" : 19, "x" :  40793, "y" :     0, "barcode" : 2122573},
+        { "ID" : 20, "x" :  30000, "y" :     0, "barcode" : 2133120}
+    ],
+
+    "segments" : [
+        { "ID" :  0, "route_type" : "line", "speed" : 0.1, "barcode" : "yes", "start" : { "pointID" : 4, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 5, "skew" : 0, "slope" : 0} },
+        { "ID" :  1, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 5, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 6, "skew" : 0, "slope" : 0} },
+        { "ID" :  2, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 6, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 7, "skew" : 0, "slope" : 0} },
+        { "ID" :  3, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 7, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 8, "skew" : 0, "slope" : 0} },
+        { "ID" :  4, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 8, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 9, "skew" : 0, "slope" : 0} },
+        { "ID" :  5, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 9, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 10, "skew" : 0, "slope" : 0} },
+
+        { "ID" : 6, "route_type" : "arc", "speed" : 0.1, "barcode" : "no", "start" : { "pointID" : 10, "skew" : 0, "slope" :  0}, "end" : { "pointID" : 14, "skew" : 0, "slope" : 18000 }, "rotate_type" : "cw"},
+
+        { "ID" :  7, "route_type" : "line", "speed" : 0.1, "barcode" : "yes", "start" : { "pointID" : 14, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 15, "skew" : 0, "slope" : 18000} },
+        { "ID" :  8, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 15, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 16, "skew" : 0, "slope" : 18000} },
+        { "ID" :  9, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 16, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 17, "skew" : 0, "slope" : 18000} },
+        { "ID" :  10, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 17, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 18, "skew" : 0, "slope" : 18000} },
+        { "ID" :  11, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 18, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 19, "skew" : 0, "slope" : 18000} },
+        { "ID" :  12, "route_type" : "line", "speed" : 0.3, "barcode" : "yes", "start" : { "pointID" : 19, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 20, "skew" : 0, "slope" : 18000} },
+
+        { "ID" : 13, "route_type" : "arc", "speed" : 0.1, "barcode" : "no", "start" : { "pointID" : 20, "skew" : 0, "slope" :  18000}, "end" : { "pointID" : 4, "skew" : 0, "slope" : 0 }, "rotate_type" : "cw"}
+
+    ]
+}

+ 48 - 0
Dev/OHV/Assambly/OHVDrive/route_map/ohv_testmap4.json

@@ -0,0 +1,48 @@
+{
+    "name" : "ohv_testmap4",
+    "points" : [
+        { "ID" : 0,  "x" : -13000, "y" : 0, "barcode" : 0},
+        { "ID" : 1,  "x" :  22180, "y" : 7820, "barcode" : 0},
+        { "ID" : 2,  "x" :  22180, "y" : 8050, "barcode" : 0},
+        { "ID" : 3,  "x" :  22180, "y" : 8280, "barcode" : 0},
+        { "ID" : 4,  "x" :  30000, "y" : 16100, "barcode" : 1026649},
+        { "ID" : 5,  "x" :  33500, "y" : 16100, "barcode" : 1030149},
+        { "ID" : 6,  "x" :  42795, "y" : 16100, "barcode" : 1039444},
+        { "ID" : 7,  "x" :  55685, "y" : 16100, "barcode" : 1052334},
+        { "ID" : 8,  "x" :  76625, "y" : 16100, "barcode" : 1073274},
+        { "ID" : 9,  "x" :  89481, "y" : 16100, "barcode" : 1086130},
+        { "ID" : 10, "x" : 100760, "y" : 16100, "barcode" : 1097318},
+        { "ID" : 11, "x" : 108580, "y" :  8280, "barcode" : 0},
+        { "ID" : 12, "x" : 108580, "y" :  8050, "barcode" : 0},
+        { "ID" : 13, "x" : 108580, "y" :  7820, "barcode" : 0},
+        { "ID" : 14, "x" : 100760, "y" :     0, "barcode" : 2062606},
+        { "ID" : 15, "x" :  97260, "y" :     0, "barcode" : 2066106},
+        { "ID" : 16, "x" :  86760, "y" :     0, "barcode" : 2076606},
+        { "ID" : 17, "x" :  72760, "y" :     0, "barcode" : 2090606},
+        { "ID" : 18, "x" :  44758, "y" :     0, "barcode" : 2118608},
+        { "ID" : 19, "x" :  40793, "y" :     0, "barcode" : 2122573},
+        { "ID" : 20, "x" :  30000, "y" :     0, "barcode" : 2133120}
+    ],
+
+    "segments" : [
+        { "ID" :  0, "route_type" : "line", "speed" : 0.8, "barcode" : "yes", "start" : { "pointID" : 5, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 6, "skew" : 0, "slope" : 0} },
+        { "ID" :  1, "route_type" : "line", "speed" : 0.8, "barcode" : "yes", "start" : { "pointID" : 6, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 7, "skew" : 0, "slope" : 0} },
+        { "ID" :  2, "route_type" : "line", "speed" : 0.8, "barcode" : "yes", "start" : { "pointID" : 7, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 8, "skew" : 0, "slope" : 0} },
+        { "ID" :  3, "route_type" : "line", "speed" : 0.8, "barcode" : "yes", "start" : { "pointID" : 8, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 9, "skew" : 0, "slope" : 0} },
+        { "ID" :  4, "route_type" : "line", "speed" : 0.8, "barcode" : "yes", "start" : { "pointID" : 9, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 10, "skew" : 0, "slope" : 0} },
+
+        { "ID" : 5, "route_type" : "ohcurve", "speed" : 0.3, "barcode" : "no", "start" : { "pointID" : 10, "skew" : 0, "slope" :  0}, "middle" : {"pointID" : 14, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 15, "skew" : 0, "slope" : 18000 }, "rotate_type" : "cw"},
+
+        { "ID" :  6, "route_type" : "line", "speed" : 0.8, "barcode" : "yes", "start" : { "pointID" : 15, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 16, "skew" : 0, "slope" : 18000} },
+        { "ID" :  7, "route_type" : "line", "speed" : 0.8, "barcode" : "yes", "start" : { "pointID" : 16, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 17, "skew" : 0, "slope" : 18000} },
+        { "ID" :  8, "route_type" : "line", "speed" : 0.8, "barcode" : "yes", "start" : { "pointID" : 17, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 18, "skew" : 0, "slope" : 18000} },
+        { "ID" :  9, "route_type" : "line", "speed" : 0.8, "barcode" : "yes", "start" : { "pointID" : 18, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 19, "skew" : 0, "slope" : 18000} },
+        { "ID" :  10, "route_type" : "line", "speed" : 0.8, "barcode" : "yes", "start" : { "pointID" : 19, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 20, "skew" : 0, "slope" : 18000} },
+
+        { "ID" : 11, "route_type" : "ohcurve", "speed" : 0.3, "barcode" : "no", "start" : { "pointID" : 20, "skew" : 0, "slope" :  18000}, "middle" : { "pointID" : 4, "skew" : 0, "slope" : 0 },"end" : { "pointID" : 5, "skew" : 0, "slope" : 0 }, "rotate_type" : "cw"},
+
+        { "ID" :  12, "route_type" : "line", "speed" : 0.8, "barcode" : "yes", "start" : { "pointID" : 4, "skew" : 0, "slope" : 0}, "end" : { "pointID" : 5, "skew" : 0, "slope" : 0} },
+        { "ID" :  13, "route_type" : "line", "speed" : 0.8, "barcode" : "yes", "start" : { "pointID" : 14, "skew" : 0, "slope" : 18000}, "end" : { "pointID" : 15, "skew" : 0, "slope" : 18000} }
+
+    ]
+}

+ 2 - 0
Dev/OHV/OHV.Common/Events/MessageEventArgs.cs

@@ -36,6 +36,7 @@ namespace OHV.Common.Events
 
 
             RspPIOConveyor,
             RspPIOConveyor,
             RspPIOBatteryCharge,
             RspPIOBatteryCharge,
+            RsqPIOBatteryChargeStop,
 
 
             RspObstaclePatternChg,
             RspObstaclePatternChg,
             RspObstaclePatternNo,
             RspObstaclePatternNo,
@@ -87,6 +88,7 @@ namespace OHV.Common.Events
             
             
             ReqPIOConveyor,
             ReqPIOConveyor,
             ReqPIOBatteryCharge,
             ReqPIOBatteryCharge,
+            ReqPIOBatteryChargeStop,
 
 
             ReqObstaclePatternChg,
             ReqObstaclePatternChg,
             ReqObstaclePatternNo,
             ReqObstaclePatternNo,

Dosya farkı çok büyük olduğundan ihmal edildi
+ 10 - 10
Dev/OHV/OHV.Module.Interactivity/NotificatioinView.xaml


+ 18 - 17
Dev/OHV/OHV.Module.Interactivity/PopUp/ConveyorControlView.xaml

@@ -9,8 +9,7 @@
              prism:ViewModelLocator.AutoWireViewModel="True"
              prism:ViewModelLocator.AutoWireViewModel="True"
              xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
              xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
              Background="#263238"
              Background="#263238"
-             Height="750"
-             Width="900">
+             Height="790" Width="900" >
 
 
     <prism:Dialog.WindowStyle>
     <prism:Dialog.WindowStyle>
         <Style TargetType="Window">
         <Style TargetType="Window">
@@ -18,16 +17,9 @@
             <Setter Property="Background" Value="Transparent"/>
             <Setter Property="Background" Value="Transparent"/>
             <Setter Property="AllowsTransparency" Value="True"/>
             <Setter Property="AllowsTransparency" Value="True"/>
             <Setter Property="ResizeMode" Value="NoResize"/>
             <Setter Property="ResizeMode" Value="NoResize"/>
+            <Setter Property="SizeToContent" Value="WidthAndHeight"/>
             <Setter Property="WindowStyle" Value="None"/>
             <Setter Property="WindowStyle" Value="None"/>
             <Setter Property="BorderThickness" Value="1"/>
             <Setter Property="BorderThickness" Value="1"/>
-            <Setter Property="BorderBrush" Value="{DynamicResource BorderSolidNormal}"/>
-            <Setter Property="Template" Value="{DynamicResource WindowTemplateKey}"/>
-
-            <!--<Style.Triggers>
-                <Trigger Property="ResizeMode" Value="CanResizeWithGrip">
-                    <Setter Property="Template" Value="{StaticResource WindowTemplateKey}"/>
-                </Trigger>
-            </Style.Triggers>-->
         </Style>
         </Style>
     </prism:Dialog.WindowStyle>
     </prism:Dialog.WindowStyle>
 
 
@@ -49,11 +41,11 @@
             <Grid Grid.Row="1">
             <Grid Grid.Row="1">
                 <Grid Margin="15" Background="#37474f">
                 <Grid Margin="15" Background="#37474f">
                     <Grid.RowDefinitions>
                     <Grid.RowDefinitions>
-                        <RowDefinition Height="*"/>
+                        <RowDefinition Height="2*"/>
                         <RowDefinition Height="*"/>
                         <RowDefinition Height="*"/>
                     </Grid.RowDefinitions>
                     </Grid.RowDefinitions>
 
 
-                    <Rectangle Grid.Row="1" Stroke="Gray" Margin="0,84,0,0" RadiusY="23.833" RadiusX="23.833"/>
+                    <!--<Rectangle Grid.Row="1" Stroke="Gray" Margin="0,112,0,0" RadiusY="23.833" RadiusX="23.833"/>-->
 
 
                     <StackPanel VerticalAlignment="Top" HorizontalAlignment="Center" Margin="250,0,0,0">
                     <StackPanel VerticalAlignment="Top" HorizontalAlignment="Center" Margin="250,0,0,0">
                         <Button Content="Batch Command" Foreground="Orange" Background="{x:Null}" FontSize="20"
                         <Button Content="Batch Command" Foreground="Orange" Background="{x:Null}" FontSize="20"
@@ -266,11 +258,20 @@
                                         <TextBlock Text="PIO Battery Charge" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
                                         <TextBlock Text="PIO Battery Charge" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
                                     </StackPanel>
                                     </StackPanel>
                                 </Button>
                                 </Button>
+
+                                <Button Style="{StaticResource MaterialDesignRaisedButton}" materialDesign:ButtonAssist.CornerRadius="10" Height="Auto" Width="Auto" Margin="10" Command="{Binding PIOCharge}"
+                            CommandParameter="PBStop">
+                                    <StackPanel RenderTransformOrigin="0.5,0.5" >
+                                        <materialDesign:PackIcon Kind="BatteryOutline" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
+                                        <TextBlock Text="PIO Battery Stop" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
+                                    </StackPanel>
+                                </Button>
+
                             </StackPanel>
                             </StackPanel>
                         </Grid>
                         </Grid>
                     </Grid>
                     </Grid>
 
 
-                    <StackPanel Grid.Row="1" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="20">
+                    <StackPanel Grid.Row="1" VerticalAlignment="Top" Width="200" Margin="250,40,0,0">
                         <Button Content="Clamp Control" Foreground="Orange" Background="{x:Null}" FontSize="20" Width="Auto" Height="50"
                         <Button Content="Clamp Control" Foreground="Orange" Background="{x:Null}" FontSize="20" Width="Auto" Height="50"
                              Style="{StaticResource MaterialDesignRaisedButton}"
                              Style="{StaticResource MaterialDesignRaisedButton}"
                             materialDesign:ButtonAssist.CornerRadius="10"/>
                             materialDesign:ButtonAssist.CornerRadius="10"/>
@@ -287,7 +288,7 @@
                         <Grid Grid.Column="0">
                         <Grid Grid.Column="0">
                             <StackPanel VerticalAlignment="Bottom"
                             <StackPanel VerticalAlignment="Bottom"
                                     HorizontalAlignment="Center"
                                     HorizontalAlignment="Center"
-                                    Margin="20">
+                                    Margin="0,0,0,20">
 
 
                                 <Button Background="{x:Null}">
                                 <Button Background="{x:Null}">
                                     <StackPanel Orientation="Horizontal">
                                     <StackPanel Orientation="Horizontal">
@@ -337,7 +338,7 @@
 
 
                             <StackPanel Orientation="Horizontal"
                             <StackPanel Orientation="Horizontal"
                                 HorizontalAlignment="Center" VerticalAlignment="Bottom"
                                 HorizontalAlignment="Center" VerticalAlignment="Bottom"
-                                    Margin="0,0,0,70">
+                                    Margin="-46,0,46,20">
 
 
                                 <Button Margin="15" 
                                 <Button Margin="15" 
                                 Width="154" Height="Auto"
                                 Width="154" Height="Auto"
@@ -377,7 +378,7 @@
             <Grid Grid.Column="1" Grid.RowSpan="2" Background="#263238">
             <Grid Grid.Column="1" Grid.RowSpan="2" Background="#263238">
                 <Border Margin="1" BorderBrush="#FF00FFD3" BorderThickness="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
                 <Border Margin="1" BorderBrush="#FF00FFD3" BorderThickness="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
                 <StackPanel VerticalAlignment="Bottom">
                 <StackPanel VerticalAlignment="Bottom">
-                    <Button Margin="10,0,10,10" HorizontalAlignment="Stretch" Height="90" BorderBrush="Gray" BorderThickness="2" Command="{Binding CloseDialogCommand}" CommandParameter="true">
+                    <Button Margin="10,0,10,20" HorizontalAlignment="Stretch" Height="90" BorderBrush="Gray" BorderThickness="2" Command="{Binding CloseDialogCommand}" CommandParameter="true">
                         <StackPanel>
                         <StackPanel>
                             <materialDesign:PackIcon Kind="ExitToApp" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
                             <materialDesign:PackIcon Kind="ExitToApp" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
                             <TextBlock Text="Close" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
                             <TextBlock Text="Close" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
@@ -387,5 +388,5 @@
             </Grid>
             </Grid>
         </Grid>
         </Grid>
     </Border>
     </Border>
-   
+
 </UserControl>
 </UserControl>

+ 8 - 0
Dev/OHV/OHV.Module.Interactivity/PopUp/ConveyorControlViewModel.cs

@@ -177,6 +177,14 @@ namespace OHV.Module.Interactivity.PopUp
                         };
                         };
                         this.eventAggregator.GetEvent<VCSMessagePubSubEvent>().Publish( msg );
                         this.eventAggregator.GetEvent<VCSMessagePubSubEvent>().Publish( msg );
                     }
                     }
+                    else
+                    {
+                        var msg = new VCSMessageEventArgs()
+                        {
+                            Kind = VCSMessageEventArgs.eVCSMessageKind.ReqPIOBatteryChargeStop,
+                        };
+                        this.eventAggregator.GetEvent<VCSMessagePubSubEvent>().Publish( msg );
+                    }
                 }
                 }
             } );
             } );
         }
         }

+ 3 - 1
Dev/OHV/OHV.Module.Interactivity/PopUp/InOutView.xaml

@@ -9,7 +9,7 @@
              xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
              xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
              xmlns:prism="http://prismlibrary.com/"
              xmlns:prism="http://prismlibrary.com/"
              prism:ViewModelLocator.AutoWireViewModel="True"
              prism:ViewModelLocator.AutoWireViewModel="True"
-             Width="1000" Height="600"
+             Width="1000" Height="800"
              Background="#455a64">
              Background="#455a64">
 
 
     <prism:Dialog.WindowStyle>
     <prism:Dialog.WindowStyle>
@@ -18,6 +18,7 @@
             <Setter Property="Background" Value="Transparent"/>
             <Setter Property="Background" Value="Transparent"/>
             <Setter Property="AllowsTransparency" Value="True"/>
             <Setter Property="AllowsTransparency" Value="True"/>
             <Setter Property="ResizeMode" Value="NoResize"/>
             <Setter Property="ResizeMode" Value="NoResize"/>
+            <Setter Property="SizeToContent" Value="WidthAndHeight"/>
             <Setter Property="WindowStyle" Value="None"/>
             <Setter Property="WindowStyle" Value="None"/>
             <Setter Property="BorderThickness" Value="1"/>
             <Setter Property="BorderThickness" Value="1"/>
             <Setter Property="BorderBrush" Value="{DynamicResource BorderSolidNormal}"/>
             <Setter Property="BorderBrush" Value="{DynamicResource BorderSolidNormal}"/>
@@ -52,5 +53,6 @@
                 </Button>
                 </Button>
             </StackPanel>
             </StackPanel>
         </Grid>
         </Grid>
+
     </Grid>
     </Grid>
 </UserControl>
 </UserControl>

+ 2 - 2
Dev/OHV/OHV.Module.MainViews/Views/HistoryView.xaml

@@ -38,7 +38,7 @@
 
 
                         <DataGrid.Columns>
                         <DataGrid.Columns>
 
 
-                            <materialDesign:DataGridTextColumn Header="OccurTime" Width="150" Binding="{Binding OccurTime }" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}">
+                            <materialDesign:DataGridTextColumn Header="OccurTime" Width="170" Binding="{Binding OccurTime, StringFormat='{}{0:yy/MM/dd - HH:mm:ss}' }" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}">
                                 <DataGridTextColumn.HeaderStyle>
                                 <DataGridTextColumn.HeaderStyle>
                                     <Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}">
                                     <Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}">
                                         <Setter Property="VerticalContentAlignment" Value="Center"/>
                                         <Setter Property="VerticalContentAlignment" Value="Center"/>
@@ -78,7 +78,7 @@
                                 </DataGridTextColumn.HeaderStyle>
                                 </DataGridTextColumn.HeaderStyle>
                             </materialDesign:DataGridTextColumn>-->
                             </materialDesign:DataGridTextColumn>-->
 
 
-                            <materialDesign:DataGridTextColumn Header="Text" Width="300" Binding="{Binding Text}" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}">
+                            <materialDesign:DataGridTextColumn Header="Text" Width="450" Binding="{Binding Text}" EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}">
                                 <DataGridTextColumn.HeaderStyle>
                                 <DataGridTextColumn.HeaderStyle>
                                     <Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}">
                                     <Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}">
                                         <Setter Property="VerticalContentAlignment" Value="Center"/>
                                         <Setter Property="VerticalContentAlignment" Value="Center"/>

+ 3 - 3
Dev/OHV/OHV.Vehicle/Concept/D_MainWindowViewModel.cs

@@ -413,14 +413,14 @@ namespace OHV.Vehicle.Concept
             {
             {
                 this.StartEnable = false;
                 this.StartEnable = false;
                 this.StopEnable = true;
                 this.StopEnable = true;
-                this.IsManualMode = false;
-                regionManager.RequestNavigate( RegionNames.MainView, "AutoView" );
+                //this.IsManualMode = false;
+                //regionManager.RequestNavigate( RegionNames.MainView, "AutoView" );
             }
             }
             else
             else
             {
             {
                 this.StartEnable = true;
                 this.StartEnable = true;
                 this.StopEnable = false;
                 this.StopEnable = false;
-                this.IsManualMode = true;
+                //this.IsManualMode = true;
             }
             }
         }
         }
 
 

+ 1 - 1
Dev/OHV/OHV.Vehicle/Config/log4net.xml

@@ -42,7 +42,7 @@
     <appendToFile value="true" />
     <appendToFile value="true" />
     <rollingStyle value="Date" />
     <rollingStyle value="Date" />
     <backupDays value="20" />
     <backupDays value="20" />
-    <datePattern value="-MMdd'.log'" />
+    <datePattern value="-MMdd_HH:mm'.log'" />
     <layout type="log4net.Layout.PatternLayout">
     <layout type="log4net.Layout.PatternLayout">
       <conversionPattern value="%d{MM-dd HH:mm:ss.fff} %2t %p %m%n" />
       <conversionPattern value="%d{MM-dd HH:mm:ss.fff} %2t %p %m%n" />
     </layout>
     </layout>

+ 4 - 0
Dev/OHV/VehicleControlSystem/ControlLayer/Clamp.cs

@@ -464,9 +464,13 @@ namespace VehicleControlSystem.ControlLayer
             {
             {
                 if ( axis.IsAmpFault() )
                 if ( axis.IsAmpFault() )
                     axis.ResetAmpFault();
                     axis.ResetAmpFault();
+
+                Thread.Sleep( 500 );
+
                 if ( axis.IsServoOff() )
                 if ( axis.IsServoOff() )
                     axis.ServoOn();
                     axis.ServoOn();
             } );
             } );
+            Thread.Sleep( 500 );
 
 
             result = LeftOriginReturn();
             result = LeftOriginReturn();
             if ( result != EziMOTIONPlusELib.FMM_OK )
             if ( result != EziMOTIONPlusELib.FMM_OK )

+ 173 - 37
Dev/OHV/VehicleControlSystem/ControlLayer/Motion/GSIDrive.cs

@@ -1,4 +1,5 @@
 using GSG.NET.Concurrent;
 using GSG.NET.Concurrent;
+using GSG.NET.Extensions;
 using GSG.NET.Logging;
 using GSG.NET.Logging;
 using OHV.Common.Shareds;
 using OHV.Common.Shareds;
 using OHV.SqliteDAL;
 using OHV.SqliteDAL;
@@ -14,9 +15,20 @@ namespace VehicleControlSystem.ControlLayer.Drive
 {
 {
     public class GSIDrive : ControlObjectBase
     public class GSIDrive : ControlObjectBase
     {
     {
+        public enum eDriveServoState
+        {
+            ServoFault = -1,
+            WrongServoNum = 0,
+            ServoOn = 1,
+            ServoOff = 2,
+            ServoStop = 3,
+            None,
+        }
+
+
         #region Dll Import
         #region Dll Import
         [DllImport( "OHVdrive.dll" )]
         [DllImport( "OHVdrive.dll" )]
-        static extern void OHVdriveCreate( );
+        static extern void OHVdriveCreate();
 
 
         [DllImport( "OHVdrive.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl )]
         [DllImport( "OHVdrive.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl )]
         static extern void OHVdriveBegin();
         static extern void OHVdriveBegin();
@@ -27,8 +39,57 @@ namespace VehicleControlSystem.ControlLayer.Drive
         [DllImport( "OHVdrive.dll" )]
         [DllImport( "OHVdrive.dll" )]
         static extern void OHVdriveDelete();
         static extern void OHVdriveDelete();
 
 
+        //
+        [DllImport( "OHVdrive.dll" )]
+        static extern int OHVdriveGetTargetSteering();
+
+        // driving servo driver
+        // - servo_num = 1 = front, -1 = rear
+        // - return value
+        //   0 = wrong servo_num
+        //   1 = Servo On
+        //   2 = Servo Off
+        //   3 = Servo Stop
+        //   -1 = Servo Fault Reset
+        //   others = do nothing
+        [DllImport( "OHVdrive.dll" )]
+        static extern int OHVdriveGetServoState( int servo_num );
+
+        // driving servo driver
+        // - return value
+        //   1 = Servo On
+        //   2 = Servo Off
+        //   3 = Servo Stop
+        //  -1 = Servo Fault Reset
+        // others = do nothing
+        [DllImport( "OHVdrive.dll" )]
+        static extern void OHVdriveSetServoCommand( int command );
+
+        // command when manual operation
+        // 1 = go forward
+        // -1 = go backward
+        // 0 or others = stop
+        [DllImport( "OHVdrive.dll" )]
+        static extern void OHVdriveSetManualOperationCommand( int command );
+
+        // operation mode change (manual mode, automatic mode)
+        // 1 = change to automatic mode
+        // -1 = change to manual mode
+        // others = not change
         [DllImport( "OHVdrive.dll" )]
         [DllImport( "OHVdrive.dll" )]
-        static extern int OHVdriveGetDesiredSolenoid();
+        static extern void OHVdriveSetOperationMode( int mode );
+
+        [DllImport( "OHVdrive.dll" )]
+        static extern int OHVdriveGetOperationMode();
+
+        // state of the laser scanner for detecting obstacles
+        // 0 = normal (no obstacles)
+        // 1 = field 1  (e-stop)
+        // 2 = field 2  (stop)
+        // 3 = filed 3  (slow)
+        [DllImport( "OHVdrive.dll" )]
+        static extern int OHVdriveSetLaserScannerField( int field );
+
         #endregion
         #endregion
 
 
         Logger logger = Logger.GetLogger();
         Logger logger = Logger.GetLogger();
@@ -36,47 +97,64 @@ namespace VehicleControlSystem.ControlLayer.Drive
         public bool IsStop { get; set; }
         public bool IsStop { get; set; }
 
 
         double currentPos = 0;
         double currentPos = 0;
-        public double CurrentPos { get { return this.currentPos; } set { SetField(ref this.currentPos, value); } }
+        public double CurrentPos { get { return this.currentPos; } set { SetField( ref this.currentPos, value ); } }
 
 
         private string currentTag;
         private string currentTag;
-        public string CurrentTag { get { return currentTag; } set { SetField(ref this.currentTag, value); } }
+        public string CurrentTag { get { return currentTag; } set { SetField( ref this.currentTag, value ); } }
 
 
         private double currentSpeed = 0;
         private double currentSpeed = 0;
-        public double CurrentSpeed { get { return currentSpeed; } set { SetField(ref this.currentSpeed, value); } }
+        public double CurrentSpeed { get { return currentSpeed; } set { SetField( ref this.currentSpeed, value ); } }
 
 
         private double currentTorque = 0;
         private double currentTorque = 0;
-        public double CurrentTorque { get { return currentTorque; } set { SetField(ref this.currentTorque, value); } }
+        public double CurrentTorque { get { return currentTorque; } set { SetField( ref this.currentTorque, value ); } }
 
 
         public bool IsErrorOn { get; set; }
         public bool IsErrorOn { get; set; }
 
 
         eSteeringState reqSteeringState = eSteeringState.None;
         eSteeringState reqSteeringState = eSteeringState.None;
         public eSteeringState ReqSteeringState { get { return this.reqSteeringState; } set { SetField( ref this.reqSteeringState, value ); } }
         public eSteeringState ReqSteeringState { get { return this.reqSteeringState; } set { SetField( ref this.reqSteeringState, value ); } }
 
 
+
+        private eDriveServoState driveServoState;
+
+        public eDriveServoState DriveServoState
+        {
+            get { return driveServoState; }
+            set { SetField( ref driveServoState, value ); }
+        }
+
         TaskCancel taskCancel = new TaskCancel();
         TaskCancel taskCancel = new TaskCancel();
         ThreadCancel threadCancel = new ThreadCancel();
         ThreadCancel threadCancel = new ThreadCancel();
         SqliteManager sql = null;
         SqliteManager sql = null;
 
 
-        public GSIDrive(SqliteManager sql)
+        public GSIDrive( SqliteManager sql )
         {
         {
             this.sql = sql;
             this.sql = sql;
         }
         }
 
 
         public void Init()
         public void Init()
         {
         {
+#if SIMULATION
+            return;
+#else
             //OHVdriveCreate();
             //OHVdriveCreate();
             //OHVdriveBegin();
             //OHVdriveBegin();
 
 
             //this.threadCancel.AddGo( Thread_DriveStateChcker );
             //this.threadCancel.AddGo( Thread_DriveStateChcker );
+#endif
         }
         }
 
 
         public void Dispose()
         public void Dispose()
         {
         {
+#if SIMULATION
+            return;
+#else
             //this.threadCancel.Cancel();
             //this.threadCancel.Cancel();
             //LockUtils.Wait( 50 );
             //LockUtils.Wait( 50 );
             //this.threadCancel.StopWaitAll();
             //this.threadCancel.StopWaitAll();
 
 
             //OHVdriveEnd();
             //OHVdriveEnd();
             //OHVdriveDelete();
             //OHVdriveDelete();
+#endif
         }
         }
 
 
         void Thread_DriveStateChcker()
         void Thread_DriveStateChcker()
@@ -89,6 +167,7 @@ namespace VehicleControlSystem.ControlLayer.Drive
                 {
                 {
                     LockUtils.Wait( 10 );
                     LockUtils.Wait( 10 );
                     this.GetReqSteeringState();
                     this.GetReqSteeringState();
+                    //this.GetServoState();
                 }
                 }
                 catch ( Exception )
                 catch ( Exception )
                 {
                 {
@@ -102,63 +181,120 @@ namespace VehicleControlSystem.ControlLayer.Drive
 
 
         void GetReqSteeringState()
         void GetReqSteeringState()
         {
         {
-            var gV = OHVdriveGetDesiredSolenoid();
-            if ( gV < 0 )
+            var gV = OHVdriveGetTargetSteering();
+            if ( gV == -1 )
                 this.ReqSteeringState = eSteeringState.Right;
                 this.ReqSteeringState = eSteeringState.Right;
-            else
+            else if ( gV == 1 )
                 this.ReqSteeringState = eSteeringState.Left;
                 this.ReqSteeringState = eSteeringState.Left;
+            else { }
         }
         }
 
 
-        public bool MoveToPoint(string point, double velocity)
+        void GetServoState()
         {
         {
-            //var task = Task.Factory.StartNew(() =>
-            //{
-            //    int index = 0;
-            //    while (true)
-            //    {
-            //        LockUtils.Wait(500);
-            //        this.CurrentPos = index++;
-
-            //        if (CurrentPos > 20)
-            //            break;
-            //    }
-            //});
+            int fState = OHVdriveGetServoState( 1 );
+            int rState = OHVdriveGetServoState( -1 );
+
+            if ( fState == 1 && rState == 1 )
+                this.DriveServoState = eDriveServoState.ServoOn;
+            else if ( fState == 2 && rState == 2 )
+                this.DriveServoState = eDriveServoState.ServoOff;
+            else if ( fState == 3 && rState == 3 )
+                this.DriveServoState = eDriveServoState.ServoStop;
+            else if ( fState == -1 || rState == -1 )
+                this.DriveServoState = eDriveServoState.ServoFault;
+            else
+                this.DriveServoState = eDriveServoState.None;
+        }
 
 
-            return true;
+        public void SetDriveOperationMode( eOperatationMode mode )
+        {
+#if SIMULATION
+#else
+            return;
+
+            if ( mode == eOperatationMode.ManualMode )
+                OHVdriveSetOperationMode( -1 );
+            else if ( mode == eOperatationMode.AutoMode )
+                OHVdriveSetOperationMode( 1 );
+            else { }
+#endif
         }
         }
 
 
-        public void EStop()
+        public eOperatationMode GetDriveOperationMode()
         {
         {
+            eOperatationMode mode = eOperatationMode.InitialMode;
 
 
+            int result = OHVdriveGetOperationMode();
+            if ( result == 1 )
+                mode = eOperatationMode.AutoMode;
+            else if ( result == -1 )
+                mode = eOperatationMode.ManualMode;
+            else { }
+
+            return mode;
         }
         }
 
 
-        public bool Stop()
+        public int MoveToPoint( string point, double velocity )
         {
         {
-            return true;
+            if ( this.DriveServoState != eDriveServoState.ServoStop )
+                return 9999;
+
+
+            //ToDo: 이동 명령 실행.
+
+            return 0;
         }
         }
 
 
-        public bool SlowStop()
+        /// <summary>
+        /// 급정시 사용.
+        /// </summary>
+        public void EStop() => OHVdriveSetServoCommand(3);
+
+        /// <summary>
+        /// Manual 상태에서 가감속 Stop
+        /// </summary>
+        public void Stop()
         {
         {
-            return true;
+            OHVdriveSetManualOperationCommand( 0 );
         }
         }
 
 
+        public void JogForWard() => OHVdriveSetManualOperationCommand( 1 );
+        public void JogBackward() => OHVdriveSetManualOperationCommand( -1 );
+        public void ServoOn() => OHVdriveSetServoCommand( 1 );
+        public void ServoOff() => OHVdriveSetServoCommand( 2 );
+        public void AmpFaultReset() => OHVdriveSetServoCommand( -1 );
+
         public void SetObstacleState( eObstacleState state )
         public void SetObstacleState( eObstacleState state )
         {
         {
-
+            int field = 0;
+            switch ( state )
+            {
+                case eObstacleState.Normal:
+                    field = 0;
+                    break;
+                case eObstacleState.Abnormal:
+                    field = 1;
+                    break;
+                case eObstacleState.Blocked:
+                    field = 2;
+                    break;
+                case eObstacleState.Decelerate:
+                    field = 3;
+                    break;
+                default:
+                    break;
+            }
+            OHVdriveSetLaserScannerField( field );
         }
         }
 
 
-        public bool VelocityChainge(double velocity)
+        public bool VelocityChainge( double velocity )
         {
         {
             return true;
             return true;
         }
         }
 
 
-        public bool AmpFaultReset()
-        {
-            return true;
-        }
 
 
-        #region Test Method
+#region Test Method
 
 
-        #endregion
+#endregion
     }
     }
 }
 }

+ 29 - 2
Dev/OHV/VehicleControlSystem/ControlLayer/Serial/BatteryTabos/BMUManager.cs

@@ -161,7 +161,7 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
             //Todo: 변경 된 내용 처리.
             //Todo: 변경 된 내용 처리.
             if ( 0 == collectNo )
             if ( 0 == collectNo )
             {
             {
-                //this.qq.Enqueue( new QoConnect { Arg0 = this.BMUConfig.ID } );
+                this.qq.Enqueue( new QoConnect { Arg0 = this.BMUConfig.ID, Arg1 = true } );
                 var ll = this.ReceivedDataDic.Values.ToList();
                 var ll = this.ReceivedDataDic.Values.ToList();
                 DelegateUtils.Invoke( OnFirstColtd, ll );
                 DelegateUtils.Invoke( OnFirstColtd, ll );
             }
             }
@@ -215,6 +215,24 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
     #region Public Method
     #region Public Method
         public void Connect(eCANSelect select)
         public void Connect(eCANSelect select)
         {
         {
+#if SIMULATION
+            //외부 전달 시작
+            this.cancel.AddGo( _ThPullQueue );
+
+            //읽기 시작.
+
+            switch ( select )
+            {
+                case eCANSelect.Advantech:
+                    this.can = new Advantech( this, "can1" );
+                    //this.cancel.AddGo( this.can._ThreadPoolingReceiveData );
+                    break;
+                case eCANSelect.Peak:
+                    this.can = new Peak( this );
+                    //this.cancel.AddGo( this.can._ThreadPoolingReceiveData );
+                    break;
+            }
+#else
             //외부 전달 시작
             //외부 전달 시작
             this.cancel.AddGo( _ThPullQueue );
             this.cancel.AddGo( _ThPullQueue );
 
 
@@ -231,15 +249,24 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
                     this.cancel.AddGo( this.can._ThreadPoolingReceiveData );
                     this.cancel.AddGo( this.can._ThreadPoolingReceiveData );
                     break;
                     break;
             }
             }
+#endif
         }
         }
 
 
         public void Disconnect()
         public void Disconnect()
         {
         {
+#if SIMULATION
+            collectNo = 0;
+            //Thread Stop
+            this.cancel.Cancel();
+            this.qq.Enqueue( new QoDispose() );
+            this.cancel.StopWaitAll();
+#else
             collectNo = 0;
             collectNo = 0;
             //Thread Stop
             //Thread Stop
             this.cancel.Cancel();
             this.cancel.Cancel();
             this.qq.Enqueue( new QoDispose() );
             this.qq.Enqueue( new QoDispose() );
             this.cancel.StopWaitAll();
             this.cancel.StopWaitAll();
+#endif
         }
         }
 
 
         public void test()
         public void test()
@@ -247,6 +274,6 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
             var clone = this.ReceivedDataDic.Values.FirstOrDefault(); 
             var clone = this.ReceivedDataDic.Values.FirstOrDefault(); 
             this.qq.Enqueue( new QoReceivedDataChanged { Arg0 = clone } );
             this.qq.Enqueue( new QoReceivedDataChanged { Arg0 = clone } );
         }
         }
-    #endregion
+#endregion
     }
     }
 }
 }

+ 0 - 1
Dev/OHV/VehicleControlSystem/ControlLayer/Serial/BatteryTabos/Peak/Peak.cs

@@ -216,7 +216,6 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
             } );
             } );
 
 
         }
         }
-
         
         
         int Write(eSendMode mode)
         int Write(eSendMode mode)
         {
         {

+ 251 - 80
Dev/OHV/VehicleControlSystem/ControlLayer/Vehicle.cs

@@ -22,6 +22,7 @@ using VehicleControlSystem.ControlLayer.IO;
 using VehicleControlSystem.ControlLayer.Serial.BatteryTabos;
 using VehicleControlSystem.ControlLayer.Serial.BatteryTabos;
 using VehicleControlSystem.ControlLayer.Serial.DataModel;
 using VehicleControlSystem.ControlLayer.Serial.DataModel;
 using VehicleControlSystem.Managers;
 using VehicleControlSystem.Managers;
+using static VehicleControlSystem.ControlLayer.Drive.GSIDrive;
 
 
 namespace VehicleControlSystem.ControlLayer
 namespace VehicleControlSystem.ControlLayer
 {
 {
@@ -328,6 +329,7 @@ namespace VehicleControlSystem.ControlLayer
             this.iO.OnChangedIO += IO_OnChangedIO;
             this.iO.OnChangedIO += IO_OnChangedIO;
             this.sql = sqliteManager;
             this.sql = sqliteManager;
             this.autoManager = auto;
             this.autoManager = auto;
+            this.autoManager.OnOperationModeChanged += AutoManager_OnOperationModeChanged;
 
 
             this.obstacleBitList.AddRange( new string[]
             this.obstacleBitList.AddRange( new string[]
             {
             {
@@ -348,6 +350,7 @@ namespace VehicleControlSystem.ControlLayer
             this.eventAggregator.GetEvent<ObstacleControlPubSubEvent>().Subscribe( ObstacleReceiveEvent );
             this.eventAggregator.GetEvent<ObstacleControlPubSubEvent>().Subscribe( ObstacleReceiveEvent );
         }
         }
 
 
+
         private void ObstacleReceiveEvent( ObstacleControlEventArgs obj )
         private void ObstacleReceiveEvent( ObstacleControlEventArgs obj )
         {
         {
             if ( this.autoManager.OperationModeProperty != eOperatationMode.ManualMode )
             if ( this.autoManager.OperationModeProperty != eOperatationMode.ManualMode )
@@ -599,12 +602,14 @@ namespace VehicleControlSystem.ControlLayer
 
 
         void ReqJog( DriveControlEventArgs _args )
         void ReqJog( DriveControlEventArgs _args )
         {
         {
-            var drive = string.Empty;
-
             if ( _args.JogDir == DriveControlEventArgs.eJogMoveDir.Positive )
             if ( _args.JogDir == DriveControlEventArgs.eJogMoveDir.Positive )
-                drive = "POSITIVE";
+            {
+                this.drive.JogForWard();
+            }
             else
             else
-                drive = "NEGATIVE";
+            {
+                this.drive.JogBackward();
+            }
         }
         }
 
 
         void ReqCurrentPos()
         void ReqCurrentPos()
@@ -810,6 +815,8 @@ namespace VehicleControlSystem.ControlLayer
 
 
             this.taskMoveCancel.Add( CheckCrossPoint() );
             this.taskMoveCancel.Add( CheckCrossPoint() );
 
 
+            PhysicalCheckupLogger.Instance.SetPLCStartDrive();
+            this.VehicleStateProperty = eVehicleState.Move;
             //this.BuzzerOnOff(true, eBuzzerKind.Moving);
             //this.BuzzerOnOff(true, eBuzzerKind.Moving);
             this.drive.MoveToPoint( pointID, 100 );
             this.drive.MoveToPoint( pointID, 100 );
 
 
@@ -819,11 +826,13 @@ namespace VehicleControlSystem.ControlLayer
             this.taskMoveCancel.Cancel();
             this.taskMoveCancel.Cancel();
             this.taskMoveCancel.WaitAll();
             this.taskMoveCancel.WaitAll();
 
 
+            //Drive 에서 정지 확인 후 상태 변경
             if ( drive.IsStop )
             if ( drive.IsStop )
             {
             {
                 this.IsMoving = false;
                 this.IsMoving = false;
                 this.OnMoveFinish?.Invoke();
                 this.OnMoveFinish?.Invoke();
 
 
+                PhysicalCheckupLogger.Instance.ResetPLCStartDrive();
                 this.VehicleStateProperty = eVehicleState.Idle;
                 this.VehicleStateProperty = eVehicleState.Idle;
             }
             }
 
 
@@ -919,12 +928,14 @@ namespace VehicleControlSystem.ControlLayer
                 return false; //Alarm
                 return false; //Alarm
             }
             }
 
 
-            int result = this.clamp.Unlock_Sync();
-            if ( result != 0 )
-            {
-                this.OccurVehicleAlarm( result );
-                return false;
-            }
+            //PIO 내부로 이동.
+            //int result = this.clamp.Unlock_Sync();
+            //if ( result != 0 )
+            //{
+            //    this.OccurVehicleAlarm( result );
+            //    return false;
+            //}
+            int result = 0;
 
 
             this.iO.OutputOff( "OUT_PIO_SENSOR_ONOFF" );
             this.iO.OutputOff( "OUT_PIO_SENSOR_ONOFF" );
             result = this.PIOAndLoad( sub.TargetID );
             result = this.PIOAndLoad( sub.TargetID );
@@ -936,12 +947,13 @@ namespace VehicleControlSystem.ControlLayer
             }
             }
             this.iO.OutputOn( "OUT_PIO_SENSOR_ONOFF" );
             this.iO.OutputOn( "OUT_PIO_SENSOR_ONOFF" );
 
 
-            result = this.clamp.Lock_Sync();
-            if ( result != 0 )
-            {
-                this.OccurVehicleAlarm( result );
-                return false;
-            }
+            //PIO 내부 이동.
+            //result = this.clamp.Lock_Sync();
+            //if ( result != 0 )
+            //{
+            //    this.OccurVehicleAlarm( result );
+            //    return false;
+            //}
 
 
             //Load, Unload 가 끝나면 메인 Command 를 완료 했다고 판단.
             //Load, Unload 가 끝나면 메인 Command 를 완료 했다고 판단.
             sql.CommandDAL.UpdateState( sub.CmdID, eCommandState.Complete );
             sql.CommandDAL.UpdateState( sub.CmdID, eCommandState.Complete );
@@ -964,15 +976,17 @@ namespace VehicleControlSystem.ControlLayer
                 return false; //Alarm
                 return false; //Alarm
             }
             }
 
 
-            int result = this.clamp.Unlock_Sync();
-            if ( result != 0 )
-            {
-                this.OccurVehicleAlarm( result );
-                return false;
-            }
+            //PIO 내부로 이동.
+            //int result = this.clamp.Unlock_Sync();
+            //if ( result != 0 )
+            //{
+            //    this.OccurVehicleAlarm( result );
+            //    return false;
+            //}
 
 
             this.iO.OutputOff( "OUT_PIO_SENSOR_ONOFF" );
             this.iO.OutputOff( "OUT_PIO_SENSOR_ONOFF" );
 
 
+            int result = 0;
             result = this.PIOAndUnload( sub.TargetID );
             result = this.PIOAndUnload( sub.TargetID );
             if ( result != 0 )
             if ( result != 0 )
             {
             {
@@ -1080,31 +1094,140 @@ namespace VehicleControlSystem.ControlLayer
             return 0;
             return 0;
         }
         }
 
 
+        public bool IsCharging { get; set; } = true;
+        public void ManualBatteryCharge()
+        {
+            this.VehicleStateProperty = eVehicleState.Charge;
+
+            var pioTimeout = sql.ConfigDal.GetValueToInt( ConstString.PIOTimeOut );
+
+            PIOClear();
+            if ( !this.iO.IsOn( "IN_PIO_READY" ) )
+            {
+                loggerPIO.E( "[Port] - 1 Ready not On" );
+                this.OccurVehicleAlarm( 25 );
+                return;
+            }
+
+            this.iO.WriteOutputIO( "OUT_PIO_READY", true );
+            loggerPIO.I( "[Vehicle] - 1 Ready On" );
+
+            if ( !this.iO.WaitChangeInputIO( true, pioTimeout, "IN_PIO_RECEIVE_RUN" ) )
+            {
+                PIOClear();
+                loggerPIO.E( "[Port] - 2 Receive CV Run Timeout" );
+                this.OccurVehicleAlarm( 26 );
+                return;
+            }
+
+            this.iO.WriteOutputIO( "OUT_PIO_SENDING_RUN", true );
+            loggerPIO.I( "[Vehicle] - 2 Send Run On" );
+
+            var sTime = SwUtils.CurrentTimeMillis;
+            while ( true )
+            {
+                LockUtils.Wait( 10 );
+
+                if ( !this.iO.IsOn( "IN_PIO_READY" ) || this.iO.IsOn( "IN_PIO_RECEIVE_RUN" ) )
+                    break;
+
+                if ( !this.IsCharging )
+                    break;
+            }
+            this.IsCharging = true;
+
+            if ( !this.iO.WaitChangeInputIO( true, pioTimeout, "IN_PIO_RECEIVE_COMPLITE" ) )
+            {
+                PIOClear();
+                loggerPIO.E( "[Port] - 3 Receive Complete Timeout" );
+                this.OccurVehicleAlarm( 26 );
+                return;
+            }
+
+            PIOClear();
+
+            this.iO.WriteOutputIO( "OUT_PIO_SEND_COMPLITE", true );
+            Thread.Sleep( 1000 );
+            this.iO.WriteOutputIO( "OUT_PIO_SEND_COMPLITE", false );
+
+            this.VehicleStateProperty = eVehicleState.Idle;
+        }
+
+        public void StartBatteryCharge()
+        {
+            var pioTimeout = sql.ConfigDal.GetValueToInt( ConstString.PIOTimeOut );
+
+            PIOClear();
+            loggerPIO.I( $"Start Battery Charge PIO" );
+
+            this.iO.WriteOutputIO( "OUT_PIO_RECEIVABLE", true );
+            loggerPIO.I( "[Vehicle] - 4 Receivable" );
+
+            if ( !this.iO.WaitChangeInputIO( true, pioTimeout, "IN_PIO_SENDABLE" ) )
+            {
+                PIOClear();
+                loggerPIO.E( "[Port] - 4 Ready Time Out" );
+                return;
+            }
+            loggerPIO.E( "[Port] - 4 Ready On" );
+
+            this.iO.WriteOutputIO( "OUT_PIO_RECEIVE_RUN", true, 1000 ); //1Sec 이후 On
+            loggerPIO.I( "[Vehicle] - Conveyor Run" );
+            this.OnConveyorStart?.Invoke( true );
+
+            if ( !this.iO.WaitChangeInputIO( true, pioTimeout, "IN_PIO_SEND_RUN" ) )
+            {
+                PIOClear();
+                loggerPIO.E( "[Port] - 5 Sending Run Time Out" );
+                return;
+            }
+            loggerPIO.I( "[Port] - 5 Sending Run On" );
+
+            this.VehicleStateProperty = eVehicleState.Charge;
+        }
+
+        public void StopBatteryCharge()
+        {
+            loggerPIO.I( $"Stop Battery Charge PIO" );
+
+            var pioTimeout = sql.ConfigDal.GetValueToInt( ConstString.PIOTimeOut );
+
+            this.PIOClear();
+
+            this.iO.WriteOutputIO( "OUT_PIO_RECIVE_COMPLITE", true );
+            loggerPIO.I( "[Vehicle] Receive Complete On" );
+            if ( !this.iO.WaitChangeInputIO( true, pioTimeout, "IN_PIO_SEND_COMPLITE" ) )
+            {
+                this.iO.WriteOutputIO( "OUT_PIO_RECIVE_COMPLITE", false );
+                loggerPIO.E( "[Port]  IN_PIO_SEND_COMPLITE On Time Out" );
+            }
+            loggerPIO.I( "[Port] Send Complete On" );
+
+            this.iO.WriteOutputIO( "OUT_PIO_RECIVE_COMPLITE", false, 1000 );
+
+            this.VehicleStateProperty = eVehicleState.Idle;
+        }
+
         #endregion
         #endregion
 
 
         #region Check Method
         #region Check Method
         bool CheckObstacle()
         bool CheckObstacle()
         {
         {
-            //if ( this.iO.IsOn( "IN_OBSTRUCTION_DETECT_SAFETY" ) || this.iO.IsOn( "IN_OBSTRUCTION_DETECT_ERROR" ) )
-            //{
-            //    this.ObstacleStateProperty = eObstacleState.Abnormal;
-            //    this.motion.SetObstacleState( this.ObstacleStateProperty );
-            //    return true;
-            //}
+            if ( this.iO.IsOn( "IN_OBSTRUCTION_DETECT_SAFETY" ) || this.iO.IsOn( "IN_OBSTRUCTION_DETECT_ERROR" ) )
+            {
+                this.ObstacleStateProperty = eObstacleState.Abnormal;
+                this.OccurVehicleAlarm( 9999 );
+            }
 
 
-            //if ( this.iO.IsOn( "IN_OBSTRUCTION_DETECT_STOP" ) )
-            //{
-            //    this.ObstacleStateProperty = eObstacleState.Blocked;
-            //    this.motion.SetObstacleState( this.ObstacleStateProperty );
-            //    return true;
-            //}
+            if ( this.iO.IsOn( "IN_OBSTRUCTION_DETECT_STOP" ) )
+            {
+                this.ObstacleStateProperty = eObstacleState.Blocked;
+            }
 
 
-            //if ( this.iO.IsOn( "IN_OBSTRUCTION_DETECT_SLOW" ) )
-            //{
-            //    this.ObstacleStateProperty = eObstacleState.Decelerate;
-            //    this.motion.SetObstacleState( this.ObstacleStateProperty );
-            //    return true;
-            //}
+            if ( this.iO.IsOn( "IN_OBSTRUCTION_DETECT_SLOW" ) )
+            {
+                this.ObstacleStateProperty = eObstacleState.Decelerate;
+            }
 
 
             this.ObstacleStateProperty = eObstacleState.Normal;
             this.ObstacleStateProperty = eObstacleState.Normal;
             this.drive.SetObstacleState( this.ObstacleStateProperty );
             this.drive.SetObstacleState( this.ObstacleStateProperty );
@@ -1129,6 +1252,11 @@ namespace VehicleControlSystem.ControlLayer
 
 
         #region Mechanical Method
         #region Mechanical Method
 
 
+        #region Drive
+        public void DriveServoOff() => this.drive.ServoOff();
+        public void DriveServoOn() => this.drive.ServoOn();
+        #endregion
+
         #region Conveyor
         #region Conveyor
 
 
         public int ConveyorLoad() => this.conveyor.ConveyorLoad();
         public int ConveyorLoad() => this.conveyor.ConveyorLoad();
@@ -1162,6 +1290,14 @@ namespace VehicleControlSystem.ControlLayer
             Thread.Sleep( 1000 );
             Thread.Sleep( 1000 );
             this.OnLoadComplete?.Invoke();
             this.OnLoadComplete?.Invoke();
 #else
 #else
+
+            int result = this.clamp.Unlock_Sync();
+            if ( result != 0 )
+            {
+                this.OccurVehicleAlarm( result );
+                return result;
+            }
+
             var pioTimeout = sql.ConfigDal.GetValueToInt( ConstString.PIOTimeOut );
             var pioTimeout = sql.ConfigDal.GetValueToInt( ConstString.PIOTimeOut );
 
 
             if ( this.conveyor.IsInverterError() )
             if ( this.conveyor.IsInverterError() )
@@ -1274,6 +1410,12 @@ namespace VehicleControlSystem.ControlLayer
 
 
             loggerPIO.I( $"End Load PIO - [{targetName}]" );
             loggerPIO.I( $"End Load PIO - [{targetName}]" );
 #endif
 #endif
+            result = this.clamp.Lock_Sync();
+            if ( result != 0 )
+            {
+                this.OccurVehicleAlarm( result );
+                return result;
+            }
 
 
             return 0;
             return 0;
         }
         }
@@ -1294,13 +1436,21 @@ namespace VehicleControlSystem.ControlLayer
             this.OnConveyorStart?.Invoke( false );
             this.OnConveyorStart?.Invoke( false );
 
 
             Thread.Sleep( 10000 );
             Thread.Sleep( 10000 );
-            this.OnOffConveyor( false ); //Stop
+            this.conveyor.OnOffConveyor( false ); //Stop
             this.OnConveyorStop?.Invoke( false );
             this.OnConveyorStop?.Invoke( false );
             PIOClear();
             PIOClear();
 
 
             Thread.Sleep( 1000 );
             Thread.Sleep( 1000 );
             this.OnUnloadComplete?.Invoke();
             this.OnUnloadComplete?.Invoke();
 #else
 #else
+
+            int result = this.clamp.Unlock_Sync();
+            if ( result != 0 )
+            {
+                this.OccurVehicleAlarm( result );
+                return result;
+            }
+
             var pioTimeout = sql.ConfigDal.GetValueToInt( ConstString.PIOTimeOut );
             var pioTimeout = sql.ConfigDal.GetValueToInt( ConstString.PIOTimeOut );
 
 
             if ( this.conveyor.IsInverterError() )
             if ( this.conveyor.IsInverterError() )
@@ -1595,51 +1745,71 @@ namespace VehicleControlSystem.ControlLayer
         #endregion
         #endregion
 
 
         #region Event Subscribe 
         #region Event Subscribe 
+        private void AutoManager_OnOperationModeChanged( eOperatationMode obj )
+        {
+            this.drive.SetDriveOperationMode( obj );
+        }
+
         private void Motion_PropertyChanged( object sender, System.ComponentModel.PropertyChangedEventArgs e )
         private void Motion_PropertyChanged( object sender, System.ComponentModel.PropertyChangedEventArgs e )
         {
         {
             var property = sender.GetType().GetProperty( e.PropertyName );
             var property = sender.GetType().GetProperty( e.PropertyName );
             var newValue = property.GetValue( sender, null );
             var newValue = property.GetValue( sender, null );
 
 
-            if ( e.PropertyName.Equals( "CurrentPos" ) )
+            switch ( e.PropertyName )
             {
             {
-                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;
-            }
-
-            if ( e.PropertyName.Equals( "ReqSteeringState" ) )
-            {
-                var v = CastTo<eSteeringState>.From<object>( newValue );
-                switch ( v )
-                {
-                    case eSteeringState.None:
-                        break;
-                    case eSteeringState.Left:
-                        this.steering.ControlSteering(true);
-                        break;
-                    case eSteeringState.Right:
-                        this.steering.ControlSteering();
-                        break;
-                    default:
-                        break;
-                }
+                case "CurrentPos":
+                    {
+                        var v = CastTo<double>.From<object>( newValue );
+                        this.CurrentPosition = v;
+                    }
+                    break;
+                case "CurrentTag":
+                    {
+                        var v = CastTo<string>.From<object>( newValue );
+                        this.CurrentTag = v;
+                    }
+                    break;
+                case "CurrentSpeed":
+                    {
+                        var v = CastTo<double>.From<object>( newValue );
+                        this.CurrentSpeed = v;
+                    }
+                    break;
+                case "CurrentTorque":
+                    {
+                        var v = CastTo<double>.From<object>( newValue );
+                        this.CurrentTorque = v;
+                    }
+                    break;
+                case "ReqSteeringState":
+                    {
+                        var v = CastTo<eSteeringState>.From<object>( newValue );
+                        switch ( v )
+                        {
+                            case eSteeringState.None:
+                                break;
+                            case eSteeringState.Left:
+                                this.steering.ControlSteering( true );
+                                break;
+                            case eSteeringState.Right:
+                                this.steering.ControlSteering();
+                                break;
+                            default:
+                                break;
+                        }
+                    }
+                    break;
+                case "DriveServoState":
+                    {
+                        var v = CastTo<eDriveServoState>.From<object>( newValue );
+                        if ( v == eDriveServoState.ServoOn )
+                            this.iO.OutputOn( "OUT_DRIVE_BRAKE_OFF" );
+                        else
+                            this.iO.OutputOff( "OUT_DRIVE_BRAKE_OFF" );
+                    }
+                    break;
+                default:
+                    break;
             }
             }
         }
         }
 
 
@@ -1697,6 +1867,7 @@ namespace VehicleControlSystem.ControlLayer
             }
             }
 
 
         }
         }
+
         #endregion
         #endregion
     }
     }
 }
 }

+ 22 - 6
Dev/OHV/VehicleControlSystem/VCSystem.cs

@@ -175,6 +175,9 @@ namespace VehicleControlSystem
                 case VCSMessageEventArgs.eVCSMessageKind.ReqPIOBatteryCharge:
                 case VCSMessageEventArgs.eVCSMessageKind.ReqPIOBatteryCharge:
                     this.ReqPIOBattery( msg );
                     this.ReqPIOBattery( msg );
                     break;
                     break;
+                case VCSMessageEventArgs.eVCSMessageKind.ReqPIOBatteryChargeStop:
+                    ReqPIOBatteryChargeStop();
+                    break;
                 default:
                 default:
                     break;
                     break;
             }
             }
@@ -233,9 +236,17 @@ namespace VehicleControlSystem
 
 
             /*PIO Load// Unload*/
             /*PIO Load// Unload*/
             if ( msg.MessageText.Equals( "PL" ) )
             if ( msg.MessageText.Equals( "PL" ) )
+            {
+                //this.vehicle.DriveServoOff();
                 result = this.vehicle.PIOAndLoad( "" );
                 result = this.vehicle.PIOAndLoad( "" );
+                //this.vehicle.DriveServoOn();
+            }
             else
             else
+            {
+                //this.vehicle.DriveServoOff();
                 result = this.vehicle.PIOAndUnload( "" );
                 result = this.vehicle.PIOAndUnload( "" );
+                //this.vehicle.DriveServoOn();
+            }
 
 
             //실행 결과 확인 
             //실행 결과 확인 
             if ( result <= 0 )
             if ( result <= 0 )
@@ -261,14 +272,19 @@ namespace VehicleControlSystem
             subCmd.Type = eSubCommandType.Charge;
             subCmd.Type = eSubCommandType.Charge;
 
 
             //result = this.vehicle.PIOBatteryCharge( subCmd );
             //result = this.vehicle.PIOBatteryCharge( subCmd );
-            this.vehicle.BatteryCharge( subCmd );
+            this.vehicle.ManualBatteryCharge( );
 
 
-            if ( result <= 0 )
-                reply.Result = FluentResults.Results.Ok();
-            else
-                reply.Result = FluentResults.Results.Fail( "Battery Charge Fail" );
+            //if ( result <= 0 )
+            //    reply.Result = FluentResults.Results.Ok();
+            //else
+            //    reply.Result = FluentResults.Results.Fail( "Battery Charge Fail" );
 
 
-            GUIMessageEventPublish( reply );
+            //GUIMessageEventPublish( reply );
+        }
+
+        void ReqPIOBatteryChargeStop()
+        {
+            this.vehicle.IsCharging = false;
         }
         }
 
 
         private void ReqTest()
         private void ReqTest()