detect Extreme40 boat class and adjust hull length; use three instead of two hull lengths for maneuver detection

This commit is contained in:
Axel Uhl
2012-11-24 00:35:42 +01:00
parent f3e93b1c25
commit deab25d20f
5 changed files with 14 additions and 4 deletions
@@ -126,7 +126,7 @@ public class ManeuverAnalysis505Test extends AbstractManeuverDetectionTestCase {
assertManeuver(maneuvers, ManeuverType.JIBE,
new MillisecondsTimePoint(dateFormat.parse("06/23/2011-16:13:28")), JIBE_TOLERANCE);
assertManeuver(maneuvers, ManeuverType.JIBE,
new MillisecondsTimePoint(dateFormat.parse("06/23/2011-16:18:37")), JIBE_TOLERANCE);
new MillisecondsTimePoint(dateFormat.parse("06/23/2011-16:18:27")), JIBE_TOLERANCE);
assertManeuver(maneuvers, ManeuverType.JIBE,
new MillisecondsTimePoint(dateFormat.parse("06/23/2011-16:21:28")), JIBE_TOLERANCE);
@@ -82,6 +82,7 @@ public class ManeuverDetectionOnKielerWoche505Race2DataTest extends OnlineTracTr
List<Maneuver> maneuvers = getTrackedRace().getManeuvers(hasso, hassosMarkPassings.first().getTimePoint(),
hassosMarkPassings.last().getTimePoint(), /* waitForLatest */ true);
Calendar c = new GregorianCalendar(TimeZone.getTimeZone("Europe/Berlin"));
c.clear();
c.set(2011, 6-1, 23, 16, 5, 49);
assertManeuver(maneuvers, ManeuverType.TACK, Tack.STARBOARD, new MillisecondsTimePoint(c.getTime()), /* tolerance in milliseconds */ 3000);
c.set(2011, 6-1, 23, 16, 8, 37);
@@ -42,7 +42,10 @@ public class BoatClassImpl extends NamedImpl implements BoatClass {
super(name);
this.typicallyStartsUpwind = typicallyStartsUpwind;
approximateManeuverDurationInMilliseconds = 8000; // as discussed with Dennis Gehrlein
hullLength = new MeterDistance(5); // a good average for the olympic classes...
// TODO see bug 911: these values need to come from a master data base
hullLength = name.toLowerCase().contains("extreme") && name.contains("40")
? new MeterDistance(40*12*2.54/100)
: new MeterDistance(5); // a good average for the olympic classes...
}
@Override
@@ -582,6 +582,10 @@ public class TrackedLegOfCompetitorImpl implements TrackedLegOfCompetitor {
@Override
public Distance getManeuverLoss(TimePoint timePointBeforeManeuver,
TimePoint timePointAfterManeuver) throws NoWindException {
// FIXME bug 156: the timePointAfterManeuver is not a good one to select the outbound speed from:
// instead, the outbound speed should be chosen as the maximum speed reached after the acceleration phase
// after the maneuver, at least withing some reasonable threshold like five times the approximate
// "maneuver duration", whatever this means
assert timePointBeforeManeuver != null;
assert timePointAfterManeuver != null;
Distance result;
@@ -1846,7 +1846,7 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
List<Maneuver> result = new ArrayList<Maneuver>();
List<Pair<GPSFixMoving, CourseChange>> group = new ArrayList<Pair<GPSFixMoving, CourseChange>>();
if (!courseChangeSequenceInSameDirection.isEmpty()) {
Distance twoHullLengths = competitor.getBoat().getBoatClass().getHullLength().scale(2);
Distance threeHullLengths = competitor.getBoat().getBoatClass().getHullLength().scale(3);
SpeedWithBearing beforeGroupOnApproximation = speedWithBearingOnApproximationAtBeginning; // speed/bearing before group
SpeedWithBearing beforeCurrentCourseChangeOnApproximation = beforeGroupOnApproximation; // speed/bearing before current course change
Iterator<Pair<GPSFixMoving, CourseChange>> iter = courseChangeSequenceInSameDirection.iterator();
@@ -1858,11 +1858,13 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
Pair<GPSFixMoving, CourseChange> currentFixAndCourseChange = iter.next();
if (!group.isEmpty()
// TODO use different maneuver times for upwind / reaching / downwind / cross-leg (mark passing)
// group contains complete maneuver if the next fix is too late or too far away to belong to the same maneuver
// FIXME penalty circles slow down the boat so much that time limit may get exceeded although distance limit is matched
&& currentFixAndCourseChange.getA().getTimePoint().asMillis()
- group.get(group.size() - 1).getA().getTimePoint().asMillis() > getApproximateManeuverDurationInMilliseconds()
&& currentFixAndCourseChange.getA().getPosition()
.getDistance(group.get(group.size() - 1).getA().getPosition())
.compareTo(twoHullLengths) > 0) {
.compareTo(threeHullLengths) > 0) {
// if next is more then approximate maneuver duration later or further apart than two hull lengths,
// turn the current group into a maneuver and add to result
Maneuver maneuver = createManeuverFromGroupOfCourseChanges(competitor, beforeGroupOnApproximation,