コード例 #1
0
ファイル: Robot.cs プロジェクト: yingted/Myro
 public static void Init(string manifestFile, int httpPort, int dsspPort)
 {
     if (bank == null)
     {
         Robot.httpPort = httpPort;
         Robot.dsspPort = dsspPort;
         FileAttributes att = File.GetAttributes(manifestFile);
         if ((att & (FileAttributes.Device | FileAttributes.Directory | FileAttributes.Offline)) != 0)
         {
             throw new IOException("Manifest file is not a normal file");
         }
         Console.Write("Starting DSS environment...");
         DssEnvironment.Initialize(httpPort, dsspPort, "file://" + manifestFile);
         Console.WriteLine("Done");
         bank = new AdapterBank(new List <IAdapterFactory>()
         {
             new Myro.Adapters.DriveAdapterFactory(),
             new Myro.Adapters.VectorAdapterFactory(),
             new Myro.Adapters.WebcamAdapterFactory(),
             new Myro.Adapters.CamControlAdapterFactory()
         });
         driveAdapter      = bank.GetAdapterSpec <DriveAdapter>("drive");
         soundAdapter      = bank.GetAdapterSpec <VectorAdapter>("tonegen");
         webcamAdapter     = bank.GetAdapterSpec <WebcamAdapter>("webcam");
         camcontrolAdapter = bank.GetAdapterSpec <CamControlAdapter>("camcontrol");
     }
     else
     {
         throw new Exception("Myro is already initialized");
     }
 }
コード例 #2
0
ファイル: Robot.cs プロジェクト: yingted/Myro
 /// <summary>
 /// This is an internal helper method that creates the AdapterBank, and
 /// caches the pre-known adapters.
 /// </summary>
 private static void createAdapters()
 {
     bank = new AdapterBank(new List <IAdapterFactory>()
     {
         new Myro.Adapters.DriveAdapterFactory(),
         new Myro.Adapters.VectorAdapterFactory(),
         new Myro.Adapters.WebcamAdapterFactory(),
         new Myro.Adapters.FlukeControlAdapterFactory()
     });
     driveAdapter   = bank.GetAdapterSpec <DriveAdapter>("drive");
     soundAdapter   = bank.GetAdapterSpec <VectorAdapter>("tonegen");
     webcamAdapter  = bank.GetAdapterSpec <WebcamAdapter>("webcam");
     controlAdapter = bank.GetAdapterSpec <FlukeControlAdapter>("flukecontrol");
 }
コード例 #3
0
 public double[] get(string name)
 {
     //try
     //{
     return(((Myro.Adapters.VectorAdapter)bank.GetAdapterSpec(name).Adapter).GetAllElements().ToArray());
     //}
     //catch (Exception)
     //{ return new double[] { 0.0 }; }
 }
コード例 #4
0
ファイル: Robot.cs プロジェクト: SamLin95/cs3630
 /// <summary>
 /// This is an internal helper method that creates the AdapterBank, and
 /// caches the pre-known adapters.
 /// </summary>
 private static void createAdapters()
 {
     bank = new AdapterBank(new List<IAdapterFactory>() {
         new Myro.Adapters.DriveAdapterFactory(),
         new Myro.Adapters.VectorAdapterFactory(),
         new Myro.Adapters.WebcamAdapterFactory(),
         new Myro.Adapters.FlukeControlAdapterFactory()
     });
     driveAdapter = bank.GetAdapterSpec<DriveAdapter>("drive");
     soundAdapter = bank.GetAdapterSpec<VectorAdapter>("tonegen");
     webcamAdapter = bank.GetAdapterSpec<WebcamAdapter>("webcam");
     controlAdapter = bank.GetAdapterSpec<FlukeControlAdapter>("flukecontrol");
 }
コード例 #5
0
ファイル: MyroSensors.cs プロジェクト: yingted/Myro
 public double[] Get(string name)
 {
     return(bank.GetAdapterSpec <VectorAdapter>(name).Adapter.GetAllElements().ToArray());
 }