public bool HitGoal(VehicleState state, Coordinates goal, IAreaSubtypeWaypointId id) { // check if forced if (this.EntryParameters.HasValue && this.EntryParameters.Value.ForcedOpposing) { // get other way ArbiterWay other = this.OpposingLane.Way.WayId.Number == 1 ? this.OpposingLane.Way.Segment.Way2 : this.OpposingLane.Way.Segment.Way1; // check goal in other way if (id is ArbiterWaypointId && ((ArbiterWaypointId)id).LaneId.WayId.Equals(other.WayId)) { // center Coordinates vehicleCenter = state.Front - state.Heading.Normalize(TahoeParams.VL / 2.0); // check all lanes foreach (ArbiterLane al in other.Lanes.Values) { // get closest point to the center of this vehicle bool b = al.LanePath().GetClosestPoint(vehicleCenter).Location.DistanceTo( al.LanePath().GetClosestPoint(goal).Location) < TahoeParams.VL / 2.0; if (b) { return(true); } } } } return(false); }
public bool HitGoal(VehicleState state, Coordinates goal, IAreaSubtypeWaypointId id) { // check if forced if (this.EntryParameters.HasValue && this.EntryParameters.Value.ForcedOpposing) { // get other way ArbiterWay other = this.OpposingLane.Way.WayId.Number == 1 ? this.OpposingLane.Way.Segment.Way2 : this.OpposingLane.Way.Segment.Way1; // check goal in other way if(id is ArbiterWaypointId && ((ArbiterWaypointId)id).LaneId.WayId.Equals(other.WayId)) { // center Coordinates vehicleCenter = state.Front - state.Heading.Normalize(TahoeParams.VL / 2.0); // check all lanes foreach (ArbiterLane al in other.Lanes.Values) { // get closest point to the center of this vehicle bool b = al.LanePath().GetClosestPoint(vehicleCenter).Location.DistanceTo( al.LanePath().GetClosestPoint(goal).Location) < TahoeParams.VL / 2.0; if (b) return true; } } } return false; }
/// <summary> /// Constructor /// </summary> /// <param name="number"></param> /// <param name="id"></param> public ArbiterCheckpoint(int number, IAreaSubtypeWaypointId id, CheckpointType type) { this.CheckpointNumber = number; this.WaypointId = id; this.Type = type; }
/// <summary> /// Constructor /// </summary> /// <param name="number"></param> /// <param name="id"></param> public ArbiterCheckpoint(int number, IAreaSubtypeWaypointId id) { this.CheckpointNumber = number; this.WaypointId = id; this.Type = CheckpointType.Normal; }
/// <summary> /// Constructor /// </summary> /// <param name="initial"></param> /// <param name="final"></param> public ArbiterInterconnectId(IAreaSubtypeWaypointId initialId, IAreaSubtypeWaypointId finalId) { this.initialId = initialId; this.finalId = finalId; }