Getting close
This commit is contained in:
@@ -10,7 +10,16 @@ namespace ConsoleApp.Sim
|
||||
Graph graph,
|
||||
Coordinate2D centerCoordinate,
|
||||
int detectorRadius,
|
||||
GlobalDirection direction) => graph.GetRange(centerCoordinate, detectorRadius);
|
||||
int vehicleTurnRadius)
|
||||
{
|
||||
var detectorCells = graph.GetRange(centerCoordinate, detectorRadius);
|
||||
// var vehicleCells = graph.GetRange(centerCoordinate, vehicleTurnRadius);
|
||||
// foreach (var vehicleCell in vehicleCells)
|
||||
// {
|
||||
// detectorCells.Remove(vehicleCell);
|
||||
// }
|
||||
return detectorCells;
|
||||
}
|
||||
|
||||
public static List<Cell> GetCoveredCells(
|
||||
ISquareMap squareMap,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using ConsoleApp.Maps;
|
||||
using HexCore;
|
||||
|
||||
namespace ConsoleApp.Sim
|
||||
{
|
||||
@@ -6,11 +7,9 @@ namespace ConsoleApp.Sim
|
||||
{
|
||||
int Length { get; }
|
||||
int Width { get; }
|
||||
int DetectorOffset { get;}
|
||||
int TurnRadius { get; }
|
||||
int DetectorRadius { get;}
|
||||
HexCore.Coordinate2D CurrentHexCell { get; set; }
|
||||
Heading HexHeading { get; set; }
|
||||
Heading SquareHeading { get; set; }
|
||||
Coordinate2D CurrentHexCell { get; set; }
|
||||
ICell CurrentSquareCell { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ConsoleApp.Maps;
|
||||
|
||||
namespace ConsoleApp.Sim
|
||||
@@ -6,12 +8,9 @@ namespace ConsoleApp.Sim
|
||||
{
|
||||
public int Length { get; }
|
||||
public int Width { get; }
|
||||
|
||||
public int DetectorOffset { get;}
|
||||
public int TurnRadius { get; }
|
||||
public int DetectorRadius { get;}
|
||||
public HexCore.Coordinate2D CurrentHexCell { get; set; }
|
||||
public Heading HexHeading { get; set; }
|
||||
public Heading SquareHeading { get; set; }
|
||||
public ICell CurrentSquareCell { get; set; }
|
||||
|
||||
|
||||
@@ -20,12 +19,17 @@ namespace ConsoleApp.Sim
|
||||
public Vehicle(IJsonDeserializor jsonDeserializor)
|
||||
{
|
||||
var config = jsonDeserializor.DeserializeObject<VehicleConfiguration>("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Sim/VehicleConfiguration.json");
|
||||
Length = config.Length;
|
||||
Width = config.Width;
|
||||
DetectorRadius = config.DetectorRadius;
|
||||
DetectorOffset = config.DetectorOffset;
|
||||
CurrentHexCell = default;
|
||||
CurrentSquareCell = default;
|
||||
var length = config.Length;
|
||||
length *= 100;
|
||||
Length = (int)Math.Ceiling((decimal)length/ 25);
|
||||
var width = config.Width;
|
||||
width *= 100;
|
||||
Width = (int)Math.Ceiling((decimal)width/ 25);
|
||||
DetectorRadius = (int)Math.Floor(((decimal)config.DetectorRadius * 100)/25)/2;
|
||||
TurnRadius = (int)Math.Ceiling(Math.Sqrt(Math.Pow(config.Length, 2) * Math.Pow(config.Width, 2))/2);
|
||||
// if (DetectorRadius <= TurnRadius)
|
||||
// throw new ArgumentException("Detection radius must be larger than the vehicle turn radius");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,5 @@ namespace ConsoleApp.Sim
|
||||
public int Length { get; set; }
|
||||
public int Width { get; set; }
|
||||
public int DetectorRadius { get; set; }
|
||||
public int DetectorOffset { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"Length": 3,
|
||||
"Width": 2,
|
||||
"DetectorRadius": 3,
|
||||
"DetectorOffset": 2
|
||||
}
|
||||
"Length": 1,
|
||||
"Width": 1,
|
||||
"DetectorRadius": 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user