示例#1
0
        public override async Task<bool> EmergencyStop(RobotStateArgs args)
        {
            await base.EmergencyStop(args);

            await args.Context.Controller.StopMotorsAll();

            return await args.Context.NextState(new ReadyState());
        }
示例#2
0
 public override async Task<bool> Disconnect(RobotStateArgs args)
 {
     try
     {
         args.Context.Controller.Disconnect();
     }
     catch(Exception ex)
     {
         Debug.WriteLine("Disconnect Exception: " + ex.Message);
     }
     finally
     {
         await args.Context.NextState(new OfflineState());
     }
     return true;
 }
示例#3
0
        public override async Task<bool> HandleRobotDataChange(RobotStateArgs args)
        {
            await base.HandleRobotDataChange(args);

            if (args.Context.Data.ActiveButton > 0)
            {
                RemoteButton button = (RemoteButton)args.Context.Data.ActiveButton;
                switch (button)
                {
                    case RemoteButton.RedTop:  //Emergency stop button
                        {
                            return await EmergencyStop(args);
                        }
                }
            }
            return true;
        }
示例#4
0
 public virtual Task<bool> StartCleaning(RobotStateArgs args) { return Task.FromResult(true);; }
示例#5
0
 public virtual Task<bool> TurnCleanerStop(RobotStateArgs args) { return Task.FromResult(true);; }
示例#6
0
 public virtual Task<bool> TurnHeadDownStart(RobotStateArgs args) { return Task.FromResult(true);; }
示例#7
0
 public virtual Task<bool> DriveStop(RobotStateArgs args) { return Task.FromResult(true);; }
示例#8
0
 public virtual Task<bool> DriveBackwardStart(RobotStateArgs args) { return Task.FromResult(true);; }
示例#9
0
 public override async Task<bool> TurnHeadDownStart(RobotStateArgs args)
 {
     await args.Context.Controller.TurnHeadDownStart();
     return true;
 }
示例#10
0
 public virtual Task<bool> HandleUltraSonicDataChange(RobotStateArgs args) { return Task.FromResult(true); }
示例#11
0
 public virtual Task<bool> HandleAngleChange(RobotStateArgs args) { return Task.FromResult(true); }
示例#12
0
 public virtual Task<bool> Disconnect(RobotStateArgs args) { return Task.FromResult(true); }
示例#13
0
 public virtual Task<bool> InitState(RobotStateArgs args) { return Task.FromResult(true); }
示例#14
0
        public override async Task<bool> HandleRobotDataChange(RobotStateArgs args)
        {
            await base.HandleRobotDataChange(args);

            if (args.Context.Data.ActiveButton > 0)
            {
                RemoteButton button = (RemoteButton)args.Context.Data.ActiveButton;
                switch (button)
                {
                    case RemoteButton.BlueTop: 
                        {
                            return await StartCleaning(args);
                        }
                }
            }
            return true;
        }
示例#15
0
 public override async Task<bool> StartCleaning(RobotStateArgs args)
 {
     return await args.Context.NextState(new DriveForwardState(DriveForwardState.Mode.NextTurnRight));
 }
示例#16
0
 public override async Task<bool> TurnCleanerStop(RobotStateArgs args)
 {
     await args.Context.Controller.TurnCleanerStop();
     return true;
 }
示例#17
0
 public virtual Task<bool> EmergencyStop(RobotStateArgs args) { return Task.FromResult(true); }
示例#18
0
 public override async Task<bool> DriveStop(RobotStateArgs args)
 {
     await args.Context.Controller.DriveStop();
     return true;
 }