Explorar o código

optitrack working

videowall-pc-user %!s(int64=5) %!d(string=hai) anos
pai
achega
c39a2397a0

+ 10 - 0
SketchAssistant/SketchAssistant.sln

@@ -10,17 +10,27 @@ EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
+		Debug|x86 = Debug|x86
 		Release|Any CPU = Release|Any CPU
+		Release|x86 = Release|x86
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 		{EE53AE79-2AA0-4F43-9638-1789B189D5C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{EE53AE79-2AA0-4F43-9638-1789B189D5C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{EE53AE79-2AA0-4F43-9638-1789B189D5C3}.Debug|x86.ActiveCfg = Debug|x86
+		{EE53AE79-2AA0-4F43-9638-1789B189D5C3}.Debug|x86.Build.0 = Debug|x86
 		{EE53AE79-2AA0-4F43-9638-1789B189D5C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{EE53AE79-2AA0-4F43-9638-1789B189D5C3}.Release|Any CPU.Build.0 = Release|Any CPU
+		{EE53AE79-2AA0-4F43-9638-1789B189D5C3}.Release|x86.ActiveCfg = Release|x86
+		{EE53AE79-2AA0-4F43-9638-1789B189D5C3}.Release|x86.Build.0 = Release|x86
 		{EB09C624-91F2-465F-825B-559BF7A7D5CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{EB09C624-91F2-465F-825B-559BF7A7D5CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{EB09C624-91F2-465F-825B-559BF7A7D5CB}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{EB09C624-91F2-465F-825B-559BF7A7D5CB}.Debug|x86.Build.0 = Debug|Any CPU
 		{EB09C624-91F2-465F-825B-559BF7A7D5CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{EB09C624-91F2-465F-825B-559BF7A7D5CB}.Release|Any CPU.Build.0 = Release|Any CPU
+		{EB09C624-91F2-465F-825B-559BF7A7D5CB}.Release|x86.ActiveCfg = Release|Any CPU
+		{EB09C624-91F2-465F-825B-559BF7A7D5CB}.Release|x86.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 2 - 2
SketchAssistant/SketchAssistantWPF/Frame.cs

@@ -1,4 +1,4 @@
-namespace OptiTrack
+namespace OptiTrack
 {
     public class Frame
     {
@@ -36,4 +36,4 @@
             Z = z;
         }
     }
-}
+}

+ 19 - 16
SketchAssistant/SketchAssistantWPF/MVP_Model.cs

@@ -119,6 +119,11 @@ namespace SketchAssistantWPF
             rightImageSize = new ImageDimension(0, 0);
             leftImageSize = new ImageDimension(0, 0);
 			connector = new OptiTrackConnector();
+            if (connector.Init(@"C:\Users\videowall-pc-user\Documents\BP-SketchAssistant\SketchAssistant\optitrack_setup.ttp"))
+            {
+
+                connector.StartTracking(InnerMethod);
+            }
         }
 
         /**************************/
@@ -373,27 +378,25 @@ namespace SketchAssistantWPF
             UpdateUI();
         }
 
+        String returnString = null;
+
+        void InnerMethod(OptiTrack.Frame frame)
+        {
+            Console.WriteLine(frame.Trackables.Length);
+            float x = frame.Trackables[0].X;
+            float y = frame.Trackables[0].Y;
+            float z = frame.Trackables[0].Z;
+            returnString = ("X: " + x + "Y: " + y + "Z: " + z);
+        }
         /// <summary>
         /// Method to be called every tick. Updates the current Line, or checks for Lines to delete, depending on the drawing mode.
         /// </summary>
         public void Tick()
         {
-            String returnString = null;
-			if(inDrawingMode)
-			{
-				if (connector.Init(@"C:\Users\videowall-pc-user\Documents\BP-SketchAssistant\SketchAssistant\optitrack_setup.ttp"))
-				{
-					connector.StartTracking(InnerMethod);
-                    programPresenter.PassOptiTrackMessage(returnString);
-				}
-			}
-            void InnerMethod(OptiTrack.Frame frame)
-            {
-                float x = frame.Trackables[0].X;
-                float y = frame.Trackables[0].Y;
-                float z = frame.Trackables[0].Z;
-                returnString= ("X: " + x + "Y: " + y + "Z: " + z);
-            }
+			
+            
+            programPresenter.PassOptiTrackMessage(returnString);
+            
 
             if (cursorPositions.Count > 0) { previousCursorPosition = cursorPositions.Dequeue(); }
             else { previousCursorPosition = currentCursorPosition; }

+ 1 - 1
SketchAssistant/SketchAssistantWPF/MVP_Presenter.cs

@@ -356,7 +356,7 @@ namespace SketchAssistantWPF
 
 		public void PassOptiTrackMessage(String stringToPass)
 		{
-            MessageBox.Show(stringToPass);
+            programView.SetOptiTrackText(stringToPass);
             //programView.SetOptiTrackText("X: ");// + x + "Y: " + y + "Z: " + z);
         }
 

+ 1 - 1
SketchAssistant/SketchAssistantWPF/MainWindow.xaml.cs

@@ -392,7 +392,7 @@ namespace SketchAssistantWPF
         /// <param name="message">The new contents</param>
         public void SetOptiTrackText(string message)
         {
-            OptiTrackBox.Text = "test";
+            OptiTrackBox.Text = message;
         }
 
         /// <summary>

+ 2 - 2
SketchAssistant/SketchAssistantWPF/OptiTrackConnector.cs

@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Runtime.InteropServices;
 using System.Threading;
 
@@ -192,4 +192,4 @@ namespace OptiTrack
         public static extern int TT_TrackableMarkerCount(int index);
 
     }
-}
+}

+ 20 - 0
SketchAssistant/SketchAssistantWPF/SketchAssistantWPF.csproj

@@ -51,6 +51,26 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>true</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <Prefer32Bit>true</Prefer32Bit>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.Data" />

BIN=BIN
SketchAssistant/optitrack_setup.ttp