Esempio n. 1
0
 static void Control(bool runServer)
 {
     var client = new CvarcClient<object, SimpleMovementCommand>();
     client.Configurate(runServer, 14000, new ConfigurationProposal
     {
         LoadingData = new LoadingData { AssemblyName = "Demo", Level = "Collision" },
         SettingsProposal = new SettingsProposal
         {
             Controllers = new List<ControllerSettings>
               {
                   new ControllerSettings { ControllerId="Left", Type= ControllerType.Client, Name="This" },
                   new ControllerSettings { ControllerId="Right", Type= ControllerType.Bot, Name="Detail" }
               }
         }
     });
     client.Act(SimpleMovementCommand.Action("Grip"));
     client.Act(SimpleMovementCommand.Rotate(Angle.Pi, 1));
     client.Act(SimpleMovementCommand.Exit());
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            int port = 14000;

            while (true)
            {
                try
                {
                    Console.Write("Attempting to connect ");
                    var client = new CvarcClient<object, MoveAndGripCommand>();

                    var loadingData = new LoadingData { AssemblyName = "Demo", Level = "Movement" };

                    var settings = new SettingsProposal
                    {
                        TimeLimit=3,
                        Controllers = new List<ControllerSettings> 
                        {
                            new ControllerSettings
                            {
                                 ControllerId=TwoPlayersId.Left, Name="This", Type= ControllerType.Client
                            }
                        }
                    };
                    
                    var state=KnownWorldStates.EmptyWithOneRobot(false);
                    var rules=new MoveAndGripRules();
                
                    client.Configurate(port, new ConfigurationProposal { LoadingData=loadingData, SettingsProposal=settings}, state);

                    client.Act(rules.Move(30));
                    client.Act(rules.Rotate(Angle.Pi));
                    client.Exit();
                    Console.WriteLine("Success");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
                Thread.Sleep(1000);
            }
        }
Esempio n. 3
0
 static void Control(int port)
 {
     var client = new CvarcClient<DemoSensorsData, MoveAndGripCommand>();
     client.Configurate(port, new ConfigurationProposal
     {
         LoadingData = new LoadingData { AssemblyName = "Demo", Level = "Demo" },
         SettingsProposal = new SettingsProposal
         {
             TimeLimit=3,
             Controllers = new List<ControllerSettings>
               {
                   new ControllerSettings { ControllerId="Left", Type= ControllerType.Client, Name="This" },
                   new ControllerSettings { ControllerId="Right", Type= ControllerType.Bot, Name="Stand" }
               }
         }
     }, KnownWorldStates.EmptyWithOneRobot(false));
     var rules = new MoveAndGripRules();
     var sensors = client.Act(rules.Move(10));
     sensors = client.Act(rules.Rotate(Angle.Pi));
     client.Exit();
 }
Esempio n. 4
0
 static void Control(bool runServer)
 {
     var client = new CvarcClient<SensorsWithCamera, SimpleMovementCommand>();
     client.Configurate(runServer, 14000, new ConfigurationProposal
     {
         LoadingData = new LoadingData { AssemblyName = "Demo", Level = "Camera" },
         SettingsProposal = new SettingsProposal
         {
             Controllers = new List<ControllerSettings>
               {
                   new ControllerSettings { ControllerId="Left", Type= ControllerType.Client, Name="This" },
                   new ControllerSettings { ControllerId="Right", Type= ControllerType.Bot, Name="Random" }
               }
         }
     });
     for (int i = 0; i < 100; i++)
     {
         var sensorsData = client.Act(SimpleMovementCommand.Rotate(Angle.Pi/20,0.1));
         var stream = new MemoryStream(sensorsData.Image);
         var bitmap = (Bitmap)Bitmap.FromStream(stream);
         form.UpdateBitmap(bitmap);
     }
 }