Back up
This commit is contained in:
11
.idea/.idea.RobotIntelFinal/.idea/contentModel.xml
generated
11
.idea/.idea.RobotIntelFinal/.idea/contentModel.xml
generated
@@ -11,7 +11,6 @@
|
|||||||
<e p="IModule.cs" t="Include" />
|
<e p="IModule.cs" t="Include" />
|
||||||
<e p="ISimRunner.cs" t="Include" />
|
<e p="ISimRunner.cs" t="Include" />
|
||||||
<e p="IUserConsole.cs" t="Include" />
|
<e p="IUserConsole.cs" t="Include" />
|
||||||
<e p="IVehicle.cs" t="Include" />
|
|
||||||
<e p="JsonDeserializor.cs" t="Include" />
|
<e p="JsonDeserializor.cs" t="Include" />
|
||||||
<e p="Maps" t="Include">
|
<e p="Maps" t="Include">
|
||||||
<e p="Cell.cs" t="Include" />
|
<e p="Cell.cs" t="Include" />
|
||||||
@@ -39,9 +38,13 @@
|
|||||||
<e p="Program.cs" t="Include" />
|
<e p="Program.cs" t="Include" />
|
||||||
<e p="SimRunner.cs" t="Include" />
|
<e p="SimRunner.cs" t="Include" />
|
||||||
<e p="UserConsole.cs" t="Include" />
|
<e p="UserConsole.cs" t="Include" />
|
||||||
<e p="Vehicle.cs" t="Include" />
|
<e p="Vehicle" t="Include">
|
||||||
<e p="VehicleConfiguration.cs" t="Include" />
|
<e p="DetectionHead.cs" t="Include" />
|
||||||
<e p="VehicleConfiguration.json" t="Include" />
|
<e p="IVehicle.cs" t="Include" />
|
||||||
|
<e p="Vehicle.cs" t="Include" />
|
||||||
|
<e p="VehicleConfiguration.cs" t="Include" />
|
||||||
|
<e p="VehicleConfiguration.json" t="Include" />
|
||||||
|
</e>
|
||||||
</e>
|
</e>
|
||||||
<e p="packages" t="ExcludeRecursive" />
|
<e p="packages" t="ExcludeRecursive" />
|
||||||
<e p="RobotIntelFinal.sln" t="IncludeFlat" />
|
<e p="RobotIntelFinal.sln" t="IncludeFlat" />
|
||||||
|
|||||||
49
.idea/.idea.RobotIntelFinal/.idea/workspace.xml
generated
49
.idea/.idea.RobotIntelFinal/.idea/workspace.xml
generated
@@ -18,19 +18,23 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="dafcaeb7-80aa-43a3-a480-786fafb78c0b" name="Default Changelist" comment="">
|
<list default="true" id="dafcaeb7-80aa-43a3-a480-786fafb78c0b" name="Default Changelist" comment="">
|
||||||
|
<change afterPath="$PROJECT_DIR$/ConsoleApp/Vehicle/DetectionHead.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/IVehicle.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/IVehicle.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/ConsoleApp.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/ConsoleApp.csproj" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/CoreModule.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/CoreModule.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/IVehicle.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Vehicle/IVehicle.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/IHexMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/IHexMap.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/IHexMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/IHexMap.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/IMap.cs" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/IMapFactory.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/IMapFactory.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/ISquareMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/ISquareMap.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/ISquareMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/ISquareMap.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/MapFactory.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/MapFactory.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/MapFactory.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/MapFactory.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/PathPlanners/IPathPlanner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/PathPlanners/IPathPlanner.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/PathPlanners/IPathPlanner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/PathPlanners/IPathPlanner.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Vehicle.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Vehicle.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/Vehicle.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Vehicle/Vehicle.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/VehicleConfiguration.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Vehicle/VehicleConfiguration.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/VehicleConfiguration.json" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Vehicle/VehicleConfiguration.json" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -77,15 +81,21 @@
|
|||||||
<option value="$PROJECT_DIR$/ConsoleApp/Maps/MapFactory.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/MapFactory.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IMapFactory.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IMapFactory.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/IVehicle.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/IVehicle.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Vehicle.cs" />
|
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/IPathPlanner.cs" />
|
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IMap.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IMap.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/UserConsole.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Maps/ISquareMap.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Program.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Vehicle.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/IPathPlanner.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" />
|
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IHexMap.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IHexMap.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/ISquareMap.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Vehicle/DetectionHead.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Vehicle/Vehicle.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Vehicle/VehicleConfiguration.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Vehicle/IVehicle.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" />
|
||||||
</changedPaths>
|
</changedPaths>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectId" id="1lIZ7IfsUjzqV2Jb1obOFvGFAfp" />
|
<component name="ProjectId" id="1lIZ7IfsUjzqV2Jb1obOFvGFAfp" />
|
||||||
@@ -163,7 +173,7 @@
|
|||||||
<workItem from="1607982179018" duration="634000" />
|
<workItem from="1607982179018" duration="634000" />
|
||||||
<workItem from="1607983288378" duration="86000" />
|
<workItem from="1607983288378" duration="86000" />
|
||||||
<workItem from="1607983862958" duration="7777000" />
|
<workItem from="1607983862958" duration="7777000" />
|
||||||
<workItem from="1607993290571" duration="16131000" />
|
<workItem from="1607993290571" duration="28469000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
@@ -195,14 +205,27 @@
|
|||||||
<line>34</line>
|
<line>34</line>
|
||||||
<properties documentPath="$PROJECT_DIR$/ConsoleApp/PathPlanner.cs" initialLine="34" containingFunctionPresentation="method 'GenerateOptimalSquarePath'">
|
<properties documentPath="$PROJECT_DIR$/ConsoleApp/PathPlanner.cs" initialLine="34" containingFunctionPresentation="method 'GenerateOptimalSquarePath'">
|
||||||
<startOffsets>
|
<startOffsets>
|
||||||
<option value="1466" />
|
<option value="1512" />
|
||||||
</startOffsets>
|
</startOffsets>
|
||||||
<endOffsets>
|
<endOffsets>
|
||||||
<option value="1482" />
|
<option value="1528" />
|
||||||
</endOffsets>
|
</endOffsets>
|
||||||
</properties>
|
</properties>
|
||||||
<option name="timeStamp" value="24" />
|
<option name="timeStamp" value="24" />
|
||||||
</line-breakpoint>
|
</line-breakpoint>
|
||||||
|
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||||
|
<url>file://$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs</url>
|
||||||
|
<line>61</line>
|
||||||
|
<properties documentPath="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" initialLine="62" containingFunctionPresentation="method 'GenerateOptimalHexPath'">
|
||||||
|
<startOffsets>
|
||||||
|
<option value="2509" />
|
||||||
|
</startOffsets>
|
||||||
|
<endOffsets>
|
||||||
|
<option value="2530" />
|
||||||
|
</endOffsets>
|
||||||
|
</properties>
|
||||||
|
<option name="timeStamp" value="34" />
|
||||||
|
</line-breakpoint>
|
||||||
</breakpoints>
|
</breakpoints>
|
||||||
</breakpoint-manager>
|
</breakpoint-manager>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="VehicleConfiguration.json">
|
<None Update="Vehicle\VehicleConfiguration.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using HexCore;
|
using HexCore;
|
||||||
|
using ImTools;
|
||||||
|
|
||||||
namespace ConsoleApp.Maps
|
namespace ConsoleApp.Maps
|
||||||
{
|
{
|
||||||
@@ -13,6 +15,10 @@ namespace ConsoleApp.Maps
|
|||||||
|
|
||||||
public Graph Graph { get; }
|
public Graph Graph { get; }
|
||||||
|
|
||||||
|
public OffsetTypes OffsetType { get; }
|
||||||
|
public MovementType DefaultMovement { get; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate Hex map with cells of 25cm X 25cm
|
/// Generate Hex map with cells of 25cm X 25cm
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -20,6 +26,8 @@ namespace ConsoleApp.Maps
|
|||||||
/// <param name="y"></param>
|
/// <param name="y"></param>
|
||||||
public HexMap(int x, int y)
|
public HexMap(int x, int y)
|
||||||
{
|
{
|
||||||
|
//Set Offset Type for 2d -> 3d conversion
|
||||||
|
OffsetType = OffsetTypes.OddRowsRight;
|
||||||
//convert to cm
|
//convert to cm
|
||||||
x *= 100;
|
x *= 100;
|
||||||
y *= 100;
|
y *= 100;
|
||||||
@@ -34,12 +42,12 @@ namespace ConsoleApp.Maps
|
|||||||
var unclearedTerrain = new TerrainType(1, "uncleared");
|
var unclearedTerrain = new TerrainType(1, "uncleared");
|
||||||
var clearedTerrain = new TerrainType(2, "cleared");
|
var clearedTerrain = new TerrainType(2, "cleared");
|
||||||
|
|
||||||
var movement = new MovementType(1, "default");
|
DefaultMovement = new MovementType(1, "default");
|
||||||
var movementTypes = new MovementTypes(
|
var movementTypes = new MovementTypes(
|
||||||
new ITerrainType[] { unclearedTerrain, clearedTerrain },
|
new ITerrainType[] { unclearedTerrain, clearedTerrain },
|
||||||
new Dictionary<IMovementType, Dictionary<ITerrainType, int>>
|
new Dictionary<IMovementType, Dictionary<ITerrainType, int>>
|
||||||
{
|
{
|
||||||
[movement] = new Dictionary<ITerrainType, int>
|
[DefaultMovement] = new Dictionary<ITerrainType, int>
|
||||||
{
|
{
|
||||||
[unclearedTerrain] = 1,
|
[unclearedTerrain] = 1,
|
||||||
[clearedTerrain] = 2
|
[clearedTerrain] = 2
|
||||||
@@ -49,5 +57,6 @@ namespace ConsoleApp.Maps
|
|||||||
Graph = GraphFactory.CreateRectangularGraph(Width, Height, movementTypes, unclearedTerrain);
|
Graph = GraphFactory.CreateRectangularGraph(Width, Height, movementTypes, unclearedTerrain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,5 +5,9 @@ namespace ConsoleApp.Maps
|
|||||||
public interface IHexMap
|
public interface IHexMap
|
||||||
{
|
{
|
||||||
Graph Graph { get; }
|
Graph Graph { get; }
|
||||||
|
OffsetTypes OffsetType { get; }
|
||||||
|
int Width { get; }
|
||||||
|
int Height { get; }
|
||||||
|
MovementType DefaultMovement { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,5 +12,6 @@ namespace ConsoleApp.Maps
|
|||||||
Cell GetCell(int x, int y);
|
Cell GetCell(int x, int y);
|
||||||
int Height { get; }
|
int Height { get; }
|
||||||
int Width { get; }
|
int Width { get; }
|
||||||
|
List<Cell> GetRange(Cell centerCell, int radius);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using ConsoleApp.Vehicle;
|
||||||
|
|
||||||
namespace ConsoleApp.Maps
|
namespace ConsoleApp.Maps
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using HexCore;
|
|
||||||
using ImTools;
|
|
||||||
|
|
||||||
namespace ConsoleApp.Maps
|
namespace ConsoleApp.Maps
|
||||||
{
|
{
|
||||||
@@ -20,7 +19,6 @@ namespace ConsoleApp.Maps
|
|||||||
/// <param name="y"></param>
|
/// <param name="y"></param>
|
||||||
public SquareMap(int x, int y)
|
public SquareMap(int x, int y)
|
||||||
{
|
{
|
||||||
HexGraph = default;
|
|
||||||
//convert to cm
|
//convert to cm
|
||||||
x *= 100;
|
x *= 100;
|
||||||
y *= 100;
|
y *= 100;
|
||||||
@@ -64,7 +62,48 @@ namespace ConsoleApp.Maps
|
|||||||
return possibles;
|
return possibles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Graph HexGraph { get; }
|
public List<Cell> GetRange(Cell centerCell, int radius)
|
||||||
|
{
|
||||||
|
var inRange = new List<Cell>();
|
||||||
|
var cx = centerCell.X;
|
||||||
|
var cy = centerCell.Y;
|
||||||
|
var topLeft = GetTopCellInBoundingBox(cx, cy, radius);
|
||||||
|
var bottomRight = GetBottomCellInBoundingBox(cx, cy, radius);
|
||||||
|
for (var i = topLeft.X; i < bottomRight.X; i++)
|
||||||
|
{
|
||||||
|
for (var j = bottomRight.Y; j < topLeft.Y; j++)
|
||||||
|
{
|
||||||
|
if (Math.Pow(i - cx, 2) + Math.Pow(j - cy, 2) < Math.Pow(radius,2))
|
||||||
|
{
|
||||||
|
inRange.Add(Map[i,j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return inRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Cell GetTopCellInBoundingBox(int cx, int cy, int radius)
|
||||||
|
{
|
||||||
|
int topX, topY;
|
||||||
|
if (cy + radius > Height) topY = Height;
|
||||||
|
else
|
||||||
|
topY = cy + radius;
|
||||||
|
if (cx - radius < 0) topX = 0;
|
||||||
|
else
|
||||||
|
topX = cx - radius;
|
||||||
|
return Map[topX, topY];
|
||||||
|
}
|
||||||
|
private Cell GetBottomCellInBoundingBox(int cx, int cy, int radius)
|
||||||
|
{
|
||||||
|
int bottomX, bottomY;
|
||||||
|
if (cy - radius > 0) bottomY = 0;
|
||||||
|
else
|
||||||
|
bottomY = cy - radius;
|
||||||
|
if (cx + radius < Width) bottomX = Width;
|
||||||
|
else
|
||||||
|
bottomX = cx + radius;
|
||||||
|
return Map[bottomX, bottomY];
|
||||||
|
}
|
||||||
|
|
||||||
public Cell GetCell(int x, int y) => Map[x, y];
|
public Cell GetCell(int x, int y) => Map[x, y];
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using ConsoleApp.Maps;
|
using ConsoleApp.Maps;
|
||||||
|
using ConsoleApp.Vehicle;
|
||||||
|
|
||||||
namespace ConsoleApp.PathPlanners
|
namespace ConsoleApp.PathPlanners
|
||||||
{
|
{
|
||||||
public interface IPathPlanner
|
public interface IPathPlanner
|
||||||
{
|
{
|
||||||
Queue<ICell> GenerateOptimalSquarePath(ISquareMap map, IVehicle vehicle);
|
Queue<ICell> GenerateOptimalSquarePath(ISquareMap map, IVehicle vehicle);
|
||||||
Queue<ICell> GenerateOptimalHexPath(HexMap hexMap, IVehicle vehicle);
|
Queue<ICell> GenerateOptimalHexPath(IHexMap hexMap, IVehicle vehicle);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using ConsoleApp.Maps;
|
using ConsoleApp.Maps;
|
||||||
|
using ConsoleApp.Vehicle;
|
||||||
|
using HexCore;
|
||||||
|
|
||||||
namespace ConsoleApp.PathPlanners
|
namespace ConsoleApp.PathPlanners
|
||||||
{
|
{
|
||||||
@@ -11,7 +13,7 @@ namespace ConsoleApp.PathPlanners
|
|||||||
var path = new Queue<ICell>();
|
var path = new Queue<ICell>();
|
||||||
var myCell = map.StartingCell;
|
var myCell = map.StartingCell;
|
||||||
var finished = false;
|
var finished = false;
|
||||||
var width_cm = (double)(vehicle.DetectorWidth) * 100;
|
var width_cm = (double)(vehicle.DetectorRadius) * 100 * 2;
|
||||||
var swathOffset = (int)Math.Floor((decimal) (width_cm) / 25) + 1;
|
var swathOffset = (int)Math.Floor((decimal) (width_cm) / 25) + 1;
|
||||||
var currentHeading = GlobalDirection.North;
|
var currentHeading = GlobalDirection.North;
|
||||||
while (!finished)
|
while (!finished)
|
||||||
@@ -53,8 +55,11 @@ namespace ConsoleApp.PathPlanners
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Queue<ICell> GenerateOptimalHexPath(HexMap hexMap, IVehicle vehicle)
|
public Queue<ICell> GenerateOptimalHexPath(IHexMap hexMap, IVehicle vehicle)
|
||||||
{
|
{
|
||||||
|
// var t = hexMap.Graph.GetMovementRange(
|
||||||
|
// new Coordinate2D(0, 0, hexMap.OffsetType), 2, hexMap.DefaultMovement);
|
||||||
|
// Console.WriteLine(t);
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ConsoleApp.Maps;
|
using ConsoleApp.Maps;
|
||||||
using ConsoleApp.PathPlanners;
|
using ConsoleApp.PathPlanners;
|
||||||
|
using ConsoleApp.Vehicle;
|
||||||
using HexCore;
|
using HexCore;
|
||||||
|
|
||||||
namespace ConsoleApp
|
namespace ConsoleApp
|
||||||
@@ -39,7 +40,7 @@ namespace ConsoleApp
|
|||||||
{
|
{
|
||||||
var hexMap = _mapFactory.GetHexMap();
|
var hexMap = _mapFactory.GetHexMap();
|
||||||
_vehicle.CurrentHexCell = new Coordinate2D(0, 0, OffsetTypes.OddRowsRight);
|
_vehicle.CurrentHexCell = new Coordinate2D(0, 0, OffsetTypes.OddRowsRight);
|
||||||
//var optimalPath = _pathPlanner.GenerateOptimalHexPath(hexMap, _vehicle);
|
var optimalPath = _pathPlanner.GenerateOptimalHexPath(hexMap, _vehicle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
20
ConsoleApp/Vehicle/DetectionHead.cs
Normal file
20
ConsoleApp/Vehicle/DetectionHead.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using ConsoleApp.Maps;
|
||||||
|
using HexCore;
|
||||||
|
|
||||||
|
namespace ConsoleApp.Vehicle
|
||||||
|
{
|
||||||
|
public class DetectionHead
|
||||||
|
{
|
||||||
|
public List<Coordinate2D> GetCoveredCells(
|
||||||
|
Graph graph,
|
||||||
|
Coordinate2D centerCoordinate,
|
||||||
|
int detectorRadius,
|
||||||
|
GlobalDirection direction) => graph.GetRange(centerCoordinate, detectorRadius);
|
||||||
|
|
||||||
|
public List<Cell> GetCoveredCells(
|
||||||
|
ISquareMap squareMap,
|
||||||
|
Cell centerCell,
|
||||||
|
int detectorRadius) => squareMap.GetRange(centerCell, detectorRadius);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
using ConsoleApp.Maps;
|
using ConsoleApp.Maps;
|
||||||
|
|
||||||
namespace ConsoleApp
|
namespace ConsoleApp.Vehicle
|
||||||
{
|
{
|
||||||
public interface IVehicle
|
public interface IVehicle
|
||||||
{
|
{
|
||||||
int Length { get; }
|
int Length { get; }
|
||||||
int Width { get; }
|
int Width { get; }
|
||||||
int DetectorOffset { get;}
|
int DetectorOffset { get;}
|
||||||
int DetectorWidth { get;}
|
int DetectorRadius { get;}
|
||||||
HexCore.Coordinate2D CurrentHexCell { get; set; }
|
HexCore.Coordinate2D CurrentHexCell { get; set; }
|
||||||
Heading HexHeading { get; set; }
|
Heading HexHeading { get; set; }
|
||||||
Heading SquareHeading { get; set; }
|
Heading SquareHeading { get; set; }
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
|
||||||
using ConsoleApp.Maps;
|
using ConsoleApp.Maps;
|
||||||
|
|
||||||
namespace ConsoleApp
|
namespace ConsoleApp.Vehicle
|
||||||
{
|
{
|
||||||
public class Vehicle : IVehicle
|
public class Vehicle : IVehicle
|
||||||
{
|
{
|
||||||
@@ -9,25 +8,25 @@ namespace ConsoleApp
|
|||||||
public int Width { get; }
|
public int Width { get; }
|
||||||
|
|
||||||
public int DetectorOffset { get;}
|
public int DetectorOffset { get;}
|
||||||
public int DetectorWidth { get;}
|
public int DetectorRadius { get;}
|
||||||
public HexCore.Coordinate2D CurrentHexCell { get; set; }
|
public HexCore.Coordinate2D CurrentHexCell { get; set; }
|
||||||
public Heading HexHeading { get; set; }
|
public Heading HexHeading { get; set; }
|
||||||
public Heading SquareHeading { get; set; }
|
public Heading SquareHeading { get; set; }
|
||||||
public ICell CurrentSquareCell { get; set; }
|
public ICell CurrentSquareCell { get; set; }
|
||||||
|
public DetectionHead DetectionHead { get; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Vehicle(IJsonDeserializor jsonDeserializor)
|
public Vehicle(IJsonDeserializor jsonDeserializor)
|
||||||
{
|
{
|
||||||
var config = jsonDeserializor.DeserializeObject<VehicleConfiguration>("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/VehicleConfiguration.json");
|
var config = jsonDeserializor.DeserializeObject<VehicleConfiguration>("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Vehicle/VehicleConfiguration.json");
|
||||||
Length = config.Length;
|
Length = config.Length;
|
||||||
Width = config.Width;
|
Width = config.Width;
|
||||||
DetectorWidth = config.DetectorWidth;
|
DetectorRadius = config.DetectorRadius;
|
||||||
DetectorOffset = config.DetectorOffset;
|
DetectorOffset = config.DetectorOffset;
|
||||||
CurrentHexCell = default;
|
CurrentHexCell = default;
|
||||||
CurrentSquareCell = default;
|
CurrentSquareCell = default;
|
||||||
HexHeading = default;
|
DetectionHead = new DetectionHead();
|
||||||
SquareHeading = default;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
namespace ConsoleApp
|
namespace ConsoleApp.Vehicle
|
||||||
{
|
{
|
||||||
public class VehicleConfiguration
|
public class VehicleConfiguration
|
||||||
{
|
{
|
||||||
public int Length { get; set; }
|
public int Length { get; set; }
|
||||||
public int Width { get; set; }
|
public int Width { get; set; }
|
||||||
public int DetectorWidth { get; set; }
|
public int DetectorRadius { get; set; }
|
||||||
public int DetectorOffset { get; set; }
|
public int DetectorOffset { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user