84 lines
2.4 KiB
C#
84 lines
2.4 KiB
C#
using RobotApp.Common.Shares;
|
|
using RobotApp.Interfaces;
|
|
using RobotApp.Services.Robot.Simulation;
|
|
|
|
namespace RobotApp.Services.Robot;
|
|
|
|
public class Xloc
|
|
{
|
|
public double X { get; set; }
|
|
public double Y { get; set; }
|
|
public double Theta { get; set; }
|
|
public string SlamState { get; set; } = string.Empty;
|
|
public string SlamStateDetail { get; set; } = string.Empty;
|
|
public string CurrentActiveMap { get; set; } = string.Empty;
|
|
public double Reliability { get; set; }
|
|
public double MatchingScore { get; set; }
|
|
public bool IsReady { get; set; }
|
|
}
|
|
|
|
public class RobotLocalization(RobotConfiguration RobotConfiguration, SimulationVisualization SimVisualization) : ILocalization
|
|
{
|
|
public double X => IsSimulation ? SimVisualization.X : Xloc.X;
|
|
|
|
public double Y => IsSimulation ? SimVisualization.Y : Xloc.Y;
|
|
|
|
public double Theta => IsSimulation ? SimVisualization.Theta * Math.PI / 180 : Xloc.Theta;
|
|
|
|
public string SlamState => IsSimulation ? "Localization" : Xloc.SlamState;
|
|
|
|
public string SlamStateDetail => IsSimulation ? "" : Xloc.SlamStateDetail;
|
|
|
|
public string CurrentActiveMap => IsSimulation ? "" : Xloc.CurrentActiveMap;
|
|
|
|
public double Reliability => IsSimulation ? 100 : Xloc.Reliability;
|
|
|
|
public double MatchingScore => IsSimulation ? 100 : Xloc.MatchingScore;
|
|
|
|
public bool IsReady => IsSimulation || Xloc.IsReady;
|
|
|
|
|
|
private readonly Xloc Xloc = new();
|
|
private readonly bool IsSimulation = RobotConfiguration.IsSimulation;
|
|
|
|
public MessageResult ActivateMap(string mapName)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public MessageResult ChangeMapOrigin(double x, double y, double theta)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public MessageResult SetInitializePosition(double x, double y, double theta)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public MessageResult StartLocalization()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public MessageResult StartMapping(double resolution)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public MessageResult StopLocalization()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public MessageResult StopMapping(string mapName)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public MessageResult SwitchMap(string mapName, double x, double y, double theta)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|