Skip to content

Commit

Permalink
Small change to the zones handling to work also with _waiting
Browse files Browse the repository at this point in the history
  • Loading branch information
Karatekuh committed Dec 11, 2023
1 parent 0dfe7cf commit 363d0a4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Docker Container Build

on:
push:
branches: [ "master"]
branches: [ "master", "mqtt-test"]
pull_request:
branches: [ "master" ]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: .NET build and test

on:
push:
branches: [ "master", "dominik_wip" ]
branches: [ "master", "mqtt-test"]
pull_request:
branches: [ "master" ]

Expand Down
4 changes: 4 additions & 0 deletions Simulator/Utility/ZonesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ public Zone GetWaypoint(string target, string machinepoint = "")
result = (Zone)Enum.Parse(typeof(Zone), target.Replace("_", "").Substring(0, 5));
else
result = (Zone)Enum.Parse(typeof(Zone), target.Replace("_", "").Substring(0, 4));*/
if(target.Contains("C_Z") || target.Contains("M_Z"))
{
target = target.Substring(0, 5);
}
result = (Zone)Enum.Parse(typeof(Zone), target.Replace("_", ""));
MyLogger.Log("Is a Zone Waypoint!");
}
Expand Down
24 changes: 24 additions & 0 deletions Simulatortests/ZonesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,5 +188,29 @@ public void PathPlaningFieldCyan()
_mpsManager.StopAllMachines();
robot.RobotStop();
}
[TestMethod]
public void PathPlanningWaitingZoneGrips()
{
_configurations = new Configurations();
_configurations.AddConfig(new RobotConfig("TestBot", jersey, team, "Test"));
_configurations.AddConfig(TeamConfig);
_mpsManager = new MpsManager(_configurations, false);
_robotManager = new RobotManager(_configurations, _mpsManager);
_zonesManager = ZonesManager.GetInstance();
var initialZone = _zonesManager.GetZone(Zone.CZ11);
var robot = _robotManager.Robots[0];
robot.SetZone(initialZone);
Assert.AreEqual(robot.GetZone().ZoneId, initialZone.ZoneId);
var targetZone = _zonesManager.GetZone(Zone.CZ12);
var task = new AgentTask();
task.Move = new Move()
{
Waypoint = "C_Z12_waiting"
};
robot.SetAgentTasks(task);
Thread.Sleep(1 * _configurations.RobotMoveZoneDuration + 1300);
Assert.AreEqual(robot.GetZone().ZoneId, targetZone.ZoneId);
robot.RobotStop();
}
}
}

0 comments on commit 363d0a4

Please sign in to comment.