예제 #1
0
 public void Init()
 {
     RobotLocation      = new Location(0, 0, 0, 0, 0, 0);
     RobotGhostLocation = new Location(0, 0, 0, 0, 0, 0);
     WaypointLocations  = new List <PointD> {
     };
     RobotHistorical    = new List <Location> {
         RobotLocation
     };
     OnLocalWorldMapEvent?.Invoke(this, this);
 }
예제 #2
0
 public void ResetRobot(Location location)
 {
     RobotLocation      = location;
     RobotGhostLocation = location;
     WaypointLocations  = new List <PointD> {
     };
     RobotHistorical    = new List <Location> {
         RobotLocation
     };
     OnResetRobotEvent?.Invoke(this, location);
     OnLocalWorldMapEvent?.Invoke(this, this);
 }
예제 #3
0
 // public virtual List<PointD> lidarMap { get; set; }
 // public virtual List<PointD> lidarMapProcessed { get; set; }
 // public virtual Heatmap heatMapStrategy { get; set; }
 // public virtual Heatmap heatMapWaypoint { get; set; }
 #endregion
 #region Constructors
 public LocalWorldMap(int robotId, int teamId)
 {
     RobotId            = robotId;
     TeamId             = teamId;
     RobotLocation      = new Location(0, 0, 0, 0, 0, 0);
     RobotGhostLocation = new Location(0, 0, 0, 0, 0, 0);
     WaypointLocations  = new List <PointD> {
     };
     RobotHistorical    = new List <Location> {
         RobotLocation
     };
     OnLocalWorldMapEvent?.Invoke(this, this);
     LidarCup = new List <Cup>();
 }
예제 #4
0
 public void OnLidarProcessedPointReceived(object sender, List <PolarPointRssiExtended> lidarPoints)
 {
     LidarMapProcessed = lidarPoints.Select(
         x => new PointDExtended(
             new PointD(
                 RobotLocation.X + (x.Pt.Distance * Math.Cos(RobotLocation.Theta + x.Pt.Angle)),
                 RobotLocation.Y + (x.Pt.Distance * Math.Sin(RobotLocation.Theta + x.Pt.Angle))
                 ),
             x.Color,
             x.Width
             )
         ).ToList();
     OnLocalWorldMapEvent?.Invoke(this, this);
 }
예제 #5
0
        public void OnUpdateHistoricalLocation(Location location)
        {
            if (RobotHistorical.Count != 0)
            {
                Location lastHistorical = RobotHistorical[RobotHistorical.Count - 1];

                PointD p1 = new PointD(location.X, location.Y);
                PointD p2 = new PointD(lastHistorical.X, lastHistorical.Y);

                double distance = Toolbox.Distance(p1, p2);
                if (distance >= MINIMAL_WORLD_HISTORICAL_DIST)
                {
                    RobotHistorical.Add(location);
                    OnNewHistoricalPositionEvent?.Invoke(this, location);
                }
            }
            OnLocalWorldMapEvent?.Invoke(this, this);
        }
예제 #6
0
 public void OnGameStateChange(object sender, GameState gameState_a)
 {
     OnLocalWorldMapEvent?.Invoke(this, this);
 }
예제 #7
0
 public void OnLidarProcesObjectsReceived(object sender, List <LidarObjects> lidarObjects)
 {
     LidarObjectList = lidarObjects;
     OnLocalWorldMapEvent?.Invoke(this, this);
 }
예제 #8
0
 public void OnLidarProcessedCupReceived(object sender, List <Cup> cups)
 {
     LidarCup = cups;
     OnLocalWorldMapEvent?.Invoke(this, this);
 }
예제 #9
0
 public void SetGhostRobotLocation(Location location)
 {
     RobotGhostLocation = location;
     OnLocalWorldMapEvent?.Invoke(this, this);
 }
예제 #10
0
 public void DeleteFirstWaypoint()
 {
     WaypointLocations.RemoveAt(0);
     OnLocalWorldMapEvent?.Invoke(this, this);
 }
예제 #11
0
 public void ResetDestination()
 {
     DestinationLocation = null;
     OnLocalWorldMapEvent?.Invoke(this, this);
 }
예제 #12
0
 public void ResetWaypoints()
 {
     WaypointLocations = new List <PointD> {
     };
     OnLocalWorldMapEvent?.Invoke(this, this);
 }
예제 #13
0
 public void SetDestinationLocation(Location location)
 {
     DestinationLocation = location;
     OnLocalWorldMapEvent?.Invoke(this, this);
 }
예제 #14
0
 public void AddNewWaypoints(PointD location)
 {
     WaypointLocations.Add(location);
     OnLocalWorldMapEvent?.Invoke(this, this);
 }