adjust navigation and statemachine

main
Simon Frei 4 years ago
parent 6d8603c454
commit 2a889cfbbb
  1. 11
      ADIS_Csharp/RaspiControl/Application.cs
  2. 8
      ADIS_Csharp/RaspiControl/NavigationConstants.cs
  3. 2
      ADIS_Csharp/RaspiControl/RaspiControl.csproj
  4. 7
      ADIS_Csharp/RaspiControl/StateMachine.cs

@ -54,10 +54,11 @@ namespace RaspiControl {
} }
public void Status_PresentChanged(object? sender, PresentEventArgs e) { public void Status_PresentChanged(object? sender, PresentEventArgs e) {
if(this.sm.CurrentState == ProcessState.Auto) { //if(this.sm.CurrentState == ProcessState.Auto) {
this.PresentCounter++; this.challenge.RobotStationary.SplitFlap.Display(e.Present.ToString().PadLeft(4, '0'));
this.challenge.RobotStationary.SplitFlap.Display(this.PresentCounter.ToString().PadLeft(4,'0')); log.Debug(e.Present.ToString());
} log.Debug(e.Present.ToString().PadLeft(4, '0'));
//}
} }
public void Run() { public void Run() {
@ -141,7 +142,7 @@ namespace RaspiControl {
this.PresentCounter = 0; this.PresentCounter = 0;
this.stopwatch.Stop(); this.stopwatch.Stop();
long elapsedTime = stopwatch.ElapsedMilliseconds / 1000; long elapsedTime = stopwatch.ElapsedMilliseconds / 1000;
this.challenge.RobotStationary.SplitFlap.Display(elapsedTime.ToString().PadLeft(4,'0')); this.challenge.RobotStationary.SplitFlap.Display($"{elapsedTime.ToString().PadLeft(3, '0')}S");
break; break;
case ProcessState.Error: case ProcessState.Error:
//this.PresentCounter = 0; //this.PresentCounter = 0;

@ -1,9 +1,9 @@
namespace RaspiControl { namespace RaspiControl {
public static class NavigationConstants { public static class NavigationConstants {
public const int TURN_ANGLE_LEFT = -10; public const int TURN_ANGLE_LEFT = -15;
public const int TURN_ANGLE_RIGHT = 10; public const int TURN_ANGLE_RIGHT = 15;
public const int SPEED_FORWARD = 100; public const int SPEED_FORWARD = 350;
public const int SPEED_BACKWARD = -100; public const int SPEED_BACKWARD = -350;
public const bool STOP = true; public const bool STOP = true;
} }
} }

@ -8,7 +8,7 @@
</PropertyGroup> </PropertyGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="cd &quot;$(TargetDir)&quot;&#xD;&#xA;&quot;$(SolutionDir)\SecureUpload.exe&quot; . pi-home:ADIS/$(ProjectName)" /> <Exec Command="cd &quot;$(TargetDir)&quot;&#xD;&#xA;&quot;$(SolutionDir)\SecureUpload.exe&quot; . pi-hslu:ADIS/$(ProjectName)" />
</Target> </Target>
<ItemGroup> <ItemGroup>

@ -94,22 +94,19 @@ namespace RaspiControl {
{new StateTransition(ProcessState.MoveManual, Command.JoystickRight), ProcessState.MoveManualR }, {new StateTransition(ProcessState.MoveManual, Command.JoystickRight), ProcessState.MoveManualR },
{new StateTransition(ProcessState.MoveManual, Command.JoystickCenter), ProcessState.StopManual }, {new StateTransition(ProcessState.MoveManual, Command.JoystickCenter), ProcessState.StopManual },
{new StateTransition(ProcessState.MoveManual, Command.autoMode), ProcessState.Auto }, {new StateTransition(ProcessState.MoveManual, Command.autoMode), ProcessState.Auto },
{new StateTransition(ProcessState.MoveManual, Command.finished), ProcessState.Final },
{new StateTransition(ProcessState.StopManual,Command.JoystickUp), ProcessState.ResumeMoveManual }, {new StateTransition(ProcessState.StopManual,Command.JoystickUp), ProcessState.ResumeMoveManual },
{new StateTransition(ProcessState.StopManual,Command.JoystickDown), ProcessState.ResumeMoveManual }, {new StateTransition(ProcessState.StopManual,Command.JoystickDown), ProcessState.ResumeMoveManual },
{new StateTransition(ProcessState.StopManual,Command.JoystickLeft), ProcessState.ResumeMoveManual }, {new StateTransition(ProcessState.StopManual,Command.JoystickLeft), ProcessState.ResumeMoveManual },
{new StateTransition(ProcessState.StopManual,Command.JoystickRight), ProcessState.ResumeMoveManual }, {new StateTransition(ProcessState.StopManual,Command.JoystickRight), ProcessState.ResumeMoveManual },
{new StateTransition(ProcessState.StopManual, Command.autoMode), ProcessState.Auto }, {new StateTransition(ProcessState.StopManual, Command.autoMode), ProcessState.Auto },
{new StateTransition(ProcessState.StopManual, Command.finished), ProcessState.Final },
{new StateTransition(ProcessState.ResumeMoveManual, Command.none),ProcessState.MoveManual }, {new StateTransition(ProcessState.ResumeMoveManual, Command.none),ProcessState.MoveManual },
{new StateTransition(ProcessState.ResumeMoveManual, Command.autoMode), ProcessState.Auto }, {new StateTransition(ProcessState.ResumeMoveManual, Command.autoMode), ProcessState.Auto },
{new StateTransition(ProcessState.Auto, Command.finished), ProcessState.Final }, {new StateTransition(ProcessState.Auto, Command.finished), ProcessState.Final },
//{new StateTransition(ProcessState.Auto, Command.JoystickUp), ProcessState.StartMoveManual },
//{new StateTransition(ProcessState.Auto, Command.JoystickDown), ProcessState.StartMoveManual },
//{new StateTransition(ProcessState.Auto, Command.JoystickLeft), ProcessState.StartMoveManual },
//{new StateTransition(ProcessState.Auto, Command.JoystickRight), ProcessState.StartMoveManual },
//{new StateTransition(ProcessState.Auto, Command.JoystickCenter), ProcessState.StartMoveManual },
{new StateTransition(ProcessState.Auto, Command.failure), ProcessState.Error }, {new StateTransition(ProcessState.Auto, Command.failure), ProcessState.Error },
{new StateTransition(ProcessState.Auto, Command.manualMode), ProcessState.ResumeMoveManual }, {new StateTransition(ProcessState.Auto, Command.manualMode), ProcessState.ResumeMoveManual },

Loading…
Cancel
Save