Permalink
Browse files

Added project to muck around with robot testing control.

  • Loading branch information...
1 parent 40e285b commit 6609981eafd27b2dd074792752629adc32c8a427 @CRogers committed Apr 8, 2012
View
@@ -9,6 +9,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{7F229840-C73
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NKH.MindSqualls", "Lib\NKH_MindSqualls_v2_2\NKH.MindSqualls\NKH.MindSqualls.csproj", "{9973018E-FC09-4549-A484-0B702ADE1EE9}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RobotControllerConsole", "RobotControllerConsole\RobotControllerConsole.csproj", "{AD272A5F-D79A-4F2A-8EB7-FD8F7768D323}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -49,6 +51,16 @@ Global
{9973018E-FC09-4549-A484-0B702ADE1EE9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{9973018E-FC09-4549-A484-0B702ADE1EE9}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{9973018E-FC09-4549-A484-0B702ADE1EE9}.Release|x86.ActiveCfg = Release|Any CPU
+ {AD272A5F-D79A-4F2A-8EB7-FD8F7768D323}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {AD272A5F-D79A-4F2A-8EB7-FD8F7768D323}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {AD272A5F-D79A-4F2A-8EB7-FD8F7768D323}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {AD272A5F-D79A-4F2A-8EB7-FD8F7768D323}.Debug|x86.ActiveCfg = Debug|x86
+ {AD272A5F-D79A-4F2A-8EB7-FD8F7768D323}.Debug|x86.Build.0 = Debug|x86
+ {AD272A5F-D79A-4F2A-8EB7-FD8F7768D323}.Release|Any CPU.ActiveCfg = Release|x86
+ {AD272A5F-D79A-4F2A-8EB7-FD8F7768D323}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {AD272A5F-D79A-4F2A-8EB7-FD8F7768D323}.Release|Mixed Platforms.Build.0 = Release|x86
+ {AD272A5F-D79A-4F2A-8EB7-FD8F7768D323}.Release|x86.ActiveCfg = Release|x86
+ {AD272A5F-D79A-4F2A-8EB7-FD8F7768D323}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1,4 +1,4 @@
-using System;
+using System;
namespace NKH.MindSqualls
{
@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using RobotControllerLib;
+using NKH.MindSqualls;
+
+namespace RobotControllerConsole
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ var brick = new NxtBrick(NxtCommLinkType.Bluetooth, 3);
+
+ var motorA = new NxtMotor();
+ brick.MotorA = motorA;
+
+ brick.Connect();
+ Console.WriteLine("Connected to NXTBrick");
+
+ motorA.ResetMotorPosition(false);
+ motorA.PollInterval = 5;
+ motorA.Poll();
+ Console.WriteLine(motorA.PollInterval);
+
+ for (int i = 0; i < 5; i++) {
+ Console.WriteLine("start");
+ motorA.RunUntil(100, 800);
+ Console.WriteLine("end");
+ }
+ /*
+ int rot = 0;
+ byte rotStep = 100;
+ while(true) {
+ motorA.ResetMotorPosition(false);
+ Console.Write("Motor run @ {0} degrees... ", rot += rotStep);
+ motorA.Run(75, rotStep);
+ //motorA.Brake();
+ Console.WriteLine("done (Tacho: {0}, mod: {1})", motorA.TachoCount, motorA.TachoCount%360);
+ Thread.Sleep(2000);
+ motorA.Brake();
+ }*/
+ }
+ }
+
+ public static class NxtMotorExtensions
+ {
+ public static void RunUntil(this NxtMotor motor, sbyte power, uint degrees)
+ {
+ motor.Poll();
+ var initTacho = motor.TachoCount.Value;
+ var endTacho = (uint)(initTacho + degrees);
+
+ Console.WriteLine("tac: start: {0}, end: {1}", initTacho, endTacho);
+
+ Console.WriteLine("running");
+ motor.Run(power, 0);
+
+ Console.WriteLine("waiting");
+ while (true) {
+ Console.WriteLine(motor.TachoCount - initTacho);
+ if (motor.TachoCount + 90 >= endTacho)
+ break;
+ Thread.Sleep(motor.PollInterval);
+ }
+ motor.Brake();
+ Thread.Sleep(1000);
+ Console.WriteLine("fin wait {0}", motor.TachoCount - initTacho);
+ Thread.Sleep(1000);
+ }
+ }
+}
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("RobotControllerConsole")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("RobotControllerConsole")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("eecf2f9d-77fd-4e58-94e4-cf47f28a8c33")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{AD272A5F-D79A-4F2A-8EB7-FD8F7768D323}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>RobotControllerConsole</RootNamespace>
+ <AssemblyName>RobotControllerConsole</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Lib\NKH_MindSqualls_v2_2\NKH.MindSqualls\NKH.MindSqualls.csproj">
+ <Project>{9973018E-FC09-4549-A484-0B702ADE1EE9}</Project>
+ <Name>NKH.MindSqualls</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\RobotControllerLib\RobotControllerLib.csproj">
+ <Project>{21D11E0D-B0A2-45F5-8FBA-319CEC6FC077}</Project>
+ <Name>RobotControllerLib</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>

0 comments on commit 6609981

Please sign in to comment.