Index: common/polar_diagram_test.cc =================================================================== --- common/polar_diagram_test.cc (revision 212) +++ common/polar_diagram_test.cc (working copy) @@ -105,7 +105,21 @@ LogPolarDiagram(); } +TEST(PolarDiagramTest, BestSailable) { + // alpha_star, alpha_true + EXPECT_FLOAT_EQ(0, BestSailableHeadingDeg(0, 0)); + EXPECT_FLOAT_EQ(0, BestSailableHeadingDeg(0, 90)); + EXPECT_FLOAT_EQ(0, BestSailableHeadingDeg(0, 120)); + EXPECT_FLOAT_EQ(TackZoneDeg(), BestSailableHeadingDeg(0, 180)); + EXPECT_FLOAT_EQ(TackZoneDeg() - 1, BestSailableHeadingDeg(0, 179)); + EXPECT_FLOAT_EQ(1 - TackZoneDeg(), BestSailableHeadingDeg(0, -179)); + + EXPECT_FLOAT_EQ(50, BestSailableHeadingDeg(50, 0)); + +} + int main(int argc, char* argv[]) { PolarDiagramTest_All(); + PolarDiagramTest_BestSailable(); return 0; } Index: common/polar_diagram.cc =================================================================== --- common/polar_diagram.cc (revision 212) +++ common/polar_diagram.cc (working copy) @@ -97,7 +97,7 @@ return Deg2Rad(kJibeZoneDeg); } -double BestSailableHeading(double alpha_star,double alpha_true) { +double BestSailableHeading(double alpha_star, double alpha_true) { // Stay in sailable zone double tack_zone_min = Reverse(alpha_true) - TackZoneRad(); double tack_zone_max = Reverse(alpha_true) + TackZoneRad(); Index: vskipper/skipper_main.cc =================================================================== --- vskipper/skipper_main.cc (revision 212) +++ vskipper/skipper_main.cc (working copy) @@ -144,7 +144,7 @@ case 'T': us.timestamp_ms = atoll(optarg); break; case 'A': us.position = LatLon::Degrees(atof(optarg), us.position.lon_deg()); break; case 'O': us.position = LatLon::Degrees(us.position.lat_deg(), atof(optarg)); break; - case 'W': us.wind = Bearing::Degrees(atof(optarg)); break; + case 'W': us.wind_from = Bearing::Degrees(atof(optarg)); break; case 'S': us.wind_speed_m_s = atof(optarg); break; case 'P': us.target = Bearing::Degrees(atof(optarg)); break; case 'h': Index: vskipper/vskipper_test.cc =================================================================== --- vskipper/vskipper_test.cc (revision 212) +++ vskipper/vskipper_test.cc (working copy) @@ -17,7 +17,7 @@ AvalonState state; state.position = LatLon::Degrees(42, -15); state.target = Bearing::West(); - state.wind = Bearing::Degrees(180); + state.wind_from = Bearing::Degrees(180); state.wind_speed_m_s = 10; return state; } @@ -34,7 +34,7 @@ return res; } -double ExpectedVelocity(Bearing wind, double wind_speed_m_s, Bearing avalon) { +double ExpectedVelocity(Bearing wind_from, double wind_speed_m_s, Bearing avalon) { if (wind_speed_m_s < 1e-9) { // TODO(zis): why ReadPolarDiagram doesn't do it? return 0; @@ -42,7 +42,7 @@ double speed_m_s; bool dead_tack; bool dead_jibe; - ReadPolarDiagram(wind.deg() - avalon.deg(), wind_speed_m_s, + ReadPolarDiagram(wind_from.deg() - avalon.deg(), wind_speed_m_s, &dead_tack, &dead_jibe, &speed_m_s); return speed_m_s; } @@ -56,7 +56,9 @@ for (int tick = 0; tick < ticks; ++tick) { Bearing bearing = RunVSkipper(avalon, ships, 0); - double v = ExpectedVelocity(avalon.wind, avalon.wind_speed_m_s, bearing); + double v = ExpectedVelocity(avalon.wind_from, + avalon.wind_speed_m_s, + bearing); double min_dist = 1e11; for (size_t i = 0; i < ships.size(); ++i) { Bearing a_b; @@ -87,6 +89,27 @@ EXPECT_NEAR(270, 5, actual.deg()); } +/* +ATEST(VSkipper, Smoke45) { + AvalonState state = DefaultState(); + state.target = Bearing::Degrees(45); + Bearing actual = RunVSkipper(state, std::vector(), 0); + + EXPECT_NEAR(45, 5, actual.deg()); +} +*/ + +ATEST(VSkipper, Around) { + AvalonState state = DefaultState(); + for (int target = -180; target < 180; ++target) { + state.target = Bearing::Degrees(target); + Bearing actual = RunVSkipper(state, std::vector(), 0); + if (fabs(target - actual.deg())> 1) + fprintf(stderr, "target: %d , out %g\n", target, actual.deg()); + //EXPECT_NEAR(target, 1, actual.deg()); + } +} + ATEST(VSkipper, TreeInTheWay) { AvalonState state = DefaultState(); std::vector ships; Index: vskipper/vskipper.cc =================================================================== --- vskipper/vskipper.cc (revision 212) +++ vskipper/vskipper.cc (working copy) @@ -9,6 +9,7 @@ #include #include #include +#include using namespace std; @@ -72,7 +73,9 @@ SphericalShortestPath(us.position, pos, &out->us_them, &out->distance_m); } -double ExpectedVelocity(Bearing wind, double wind_speed_m_s, Bearing avalon) { +double ExpectedVelocity(Bearing wind_from, + double wind_speed_m_s, + Bearing avalon) { if (wind_speed_m_s < 1e-9) { // TODO(zis): why doesn't ReadPolarDiagram do this? return 0; @@ -80,7 +83,7 @@ double speed_m_s; bool dead_tack; bool dead_jibe; - ReadPolarDiagram(wind.deg() - avalon.deg(), wind_speed_m_s, + ReadPolarDiagram(wind_from.deg() - avalon.deg(), wind_speed_m_s, &dead_tack, &dead_jibe, &speed_m_s); return speed_m_s; } @@ -149,7 +152,7 @@ CandidateBearing& c = candidates[i]; c.expected_velocity_m_s = - ExpectedVelocity(now.wind, now.wind_speed_m_s, c.bearing); + ExpectedVelocity(now.wind_from, now.wind_speed_m_s, c.bearing); c.expected_velocity_to_target_m_s = c.expected_velocity_m_s * cos(now.target.rad() - c.bearing.rad()); @@ -191,6 +194,9 @@ Bearing RunVSkipper(const AvalonState& now, const std::vector& ais_in, int debug) { + + fprintf(stderr, "in: %g\n", now.target.deg()); + std::vector ships(ais_in.size()); for (size_t i = 0; i < ais_in.size(); ++i) { ComputeLocalAis(ais_in[i], now, &ships[i]); @@ -208,6 +214,7 @@ } } + fprintf(stderr, "out: %g\n", out.deg()); return out; } Index: vskipper/vskipper.h =================================================================== --- vskipper/vskipper.h (revision 212) +++ vskipper/vskipper.h (working copy) @@ -18,7 +18,7 @@ // Desired direction (according to global planner) Bearing target; // Current wind (used to estimate expected speed in every direction) - Bearing wind; // Where the wind is coming FROM + Bearing wind_from; // Where the wind is coming FROM double wind_speed_m_s; AvalonState() : timestamp_ms(0), target(Bearing::West()), wind_speed_m_s(0) {} Index: skipper/skipper_internal_test.cc =================================================================== --- skipper/skipper_internal_test.cc (revision 212) +++ skipper/skipper_internal_test.cc (working copy) @@ -15,14 +15,15 @@ #include "skipper/lat_lon.h" #include "skipper/target_circle.h" #include "skipper/plans.h" +#include "vskipper/vskipper.h" +#include "vskipper/util.h" - const static double kDays = 3600 * 24; TEST(SkipperInternal, All) { double end_time = 0; SkipperInput in; - std::vector ais; + std::vector ais; double alpha_star; // no wind, default direction @@ -68,7 +69,7 @@ TEST(SkipperInternal, SukkulentenhausPlan) { double end_time = 0; SkipperInput in; - std::vector ais; + std::vector ais; double alpha_star; in.angle_true_deg = 120; // so we cannot sail south @@ -104,12 +105,10 @@ } - - TEST(SkipperInternal, ThalwilOpposingWind) { double end_time = 0; SkipperInput in; - std::vector ais; + std::vector ais; double alpha_star; // Thalwil test, with bad opposing wind @@ -148,7 +147,7 @@ TEST(SkipperInternal, Atlantic) { double end_time = 0; SkipperInput in; - std::vector ais; + std::vector ais; double alpha_star; // Atlantic test, with constantly bad opposing wind in.angle_true_deg = 45; // so we cannot sail south-west directly @@ -193,7 +192,7 @@ TEST(SkipperInternal, ChangingAtlantic) { double end_time = 0; SkipperInput in; - std::vector ais; + std::vector ais; double alpha_star; // Atlantic test, with changing winds and erratic storms throwing us off // track. @@ -245,7 +244,7 @@ TEST(SkipperInternal, StormyAtlantic) { double end_time = 0; SkipperInput in; - std::vector ais; + std::vector ais; double alpha_star; // Stormy Atlantic test, with changing winds and erratic storms throwing us Index: skipper/target_circle.h =================================================================== --- skipper/target_circle.h (revision 212) +++ skipper/target_circle.h (working copy) @@ -84,5 +84,4 @@ double radius_squared_; }; - #endif // SKIPPER_TARGET_CIRCLE_H Index: skipper/skipper_internal.cc =================================================================== --- skipper/skipper_internal.cc (revision 212) +++ skipper/skipper_internal.cc (working copy) @@ -6,21 +6,54 @@ #include "skipper/skipper_internal.h" #include "common/unknown.h" +#include "common/convert.h" #include "common/polar_diagram.h" #include "helmsman/normal_controller.h" #include "lib/fm/log.h" #include "skipper/planner.h" void SkipperInternal::Run(const SkipperInput& in, - const vector& ais, - double* alpha_star_deg) { - double alpha_planner = Planner::ToDeg(in.latitude_deg, in.longitude_deg); + const vector& ais, + double* alpha_star_deg) { + double planned = Planner::ToDeg(in.latitude_deg, in.longitude_deg); - double feasible = 225; - if (in.angle_true_deg != kUnknown && in.mag_true_kn> 1) - feasible = BestSailableHeadingDeg(alpha_planner, in.angle_true_deg); // TODO move to common - if (fabs(alpha_planner - feasible)> 0.1) - FM_LOG_INFO("Override %8.6g with %8.6g because it is not sailable.", alpha_planner, feasible); + if (in.angle_true_deg == kUnknown || + in.mag_true_kn == kUnknown || + isnan(in.angle_true_deg) || + isnan(in.mag_true_kn)) { + *alpha_star_deg = 225; // Southwest is our general direction. + fprintf(stderr, "No true wind info so far, going SW.\n"); + return; + } + if (in.longitude_deg == kUnknown || + in.latitude_deg == kUnknown || + isnan(in.longitude_deg) || + isnan(in.latitude_deg)) { + *alpha_star_deg = 225; // Southwest is our general direction. + fprintf(stderr, "No position info so far, going SW.\n"); + return; + } + if (in.mag_true_kn < 1) { + *alpha_star_deg = 225; // Southwest is our general direction. + fprintf(stderr, "Not enough wind strength, going SW.\n"); + return; + } + + // Remove comment when it works! + // double safe = RunCollisionAvoider(planned, in, ais); + double safe = planned; + if (fabs(planned - safe)> 0.1) + fprintf(stderr, + "Override %8.6g with %8.6g because it is not collision free.\n", + planned, safe); + + double feasible = BestSailableHeadingDeg(safe, in.angle_true_deg); + if (fabs(safe - feasible)> 0.1) + fprintf(stderr, "Override %8.6g with %8.6g because it is not sailable.\n", + safe, feasible); + fprintf(stderr, "planner %g , alpha* %g, true wind: %g, feasible: %g\n", + planned, safe, in.angle_true_deg, feasible); + *alpha_star_deg = feasible; } @@ -32,3 +65,19 @@ return Planner::TargetReached(lat_lon); } +double SkipperInternal::RunCollisionAvoider( + double planned, + const SkipperInput& in, + const vector& ais) { + skipper::AvalonState avalon; + avalon.timestamp_ms = ais.size() ? ais[0].timestamp_ms : 0; + avalon.position = skipper::LatLon(in.longitude_deg, in.latitude_deg); + avalon.target = skipper::Bearing::Degrees(planned); + avalon.wind_from = skipper::Bearing::Degrees(in.angle_true_deg + 180); + avalon.wind_speed_m_s = KnotsToMeterPerSecond(in.mag_true_kn); + skipper::Bearing skipper_out = RunVSkipper(avalon, ais, 0); + return skipper_out.deg(); +} + + + Index: skipper/skipper_internal.h =================================================================== --- skipper/skipper_internal.h (revision 212) +++ skipper/skipper_internal.h (working copy) @@ -10,16 +10,20 @@ #include "helmsman/skipper_input.h" #include "skipper/ais.h" #include "skipper/lat_lon.h" +#include "vskipper/vskipper.h" class SkipperInternal { public: // Run this occasionally, when new skipper input or AIS information is available. static void Run(const SkipperInput& in, - const std::vector& ais, + const std::vector& ais, double* alpha_star_deg); static void Init(const SkipperInput& in); - static bool TargetReached(const LatLon& lat_lon); - + static bool TargetReached(const ::LatLon& lat_lon); + private: + static double RunCollisionAvoider(double alpha_planner_deg, + const SkipperInput& in, + const std::vector& ais ); }; #endif // SKIPPER_SKIPPER_INTERNAL_H Index: skipper/target_circle_cascade.h =================================================================== --- skipper/target_circle_cascade.h (revision 212) +++ skipper/target_circle_cascade.h (working copy) @@ -32,6 +32,8 @@ // Each center has to lie within exactly one other TargetCircle, // except for the center of the first TargetCircle, which must not be within any other. struct TargetCirclePoint { + TargetCirclePoint(double lat, double lon, double radius_deg) + : lat_lon(lat, lon), radius_deg(radius_deg) {} LatLon lat_lon; double radius_deg; }; Index: skipper/plans.h =================================================================== --- skipper/plans.h (revision 212) +++ skipper/plans.h (working copy) @@ -21,95 +21,96 @@ 48.2 -5 0.25 ]; % W of Brest */ +typedef const TargetCirclePoint TCP; const TargetCirclePoint caribbean_plan[] = { -{{ 16.877, -61.7721}, 0.09}, -{{ 16.877, -61.7144}, 0.09125}, -{{ 16.877, -61.656}, 0.0925}, -{{ 16.877, -61.5967}, 0.09375}, -{{ 16.877, -61.5367}, 0.095}, -{{ 16.877, -61.4759}, 0.09625}, -{{ 16.877, -61.4143}, 0.0975}, -{{ 16.877, -61.3519}, 0.09875}, -{{ 16.877, -61.2887}, 0.1}, -{{ 16.8854, -61.2007}, 0.157143}, -{{ 16.8969, -61.0806}, 0.214286}, -{{ 16.9114, -60.9285}, 0.271429}, -{{ 16.929, -60.7444}, 0.328571}, -{{ 16.9496, -60.5283}, 0.385714}, -{{ 16.9733, -60.2802}, 0.442857}, -{{ 17, -60}, 0.5}, -{{ 17.15, -59.7}, 0.6}, -{{ 17.325, -59.35}, 0.7}, -{{ 17.525, -58.95}, 0.8}, -{{ 17.75, -58.5}, 0.9}, -{{ 18, -58}, 1}, -{{ 18.1272, -57.2368}, 1.08696}, -{{ 18.2646, -56.4126}, 1.17391}, -{{ 18.4121, -55.5273}, 1.26087}, -{{ 18.5698, -54.5809}, 1.34783}, -{{ 18.7377, -53.5735}, 1.43478}, -{{ 18.9158, -52.5051}, 1.52174}, -{{ 19.1041, -51.3756}, 1.6087}, -{{ 19.3025, -50.185}, 1.69565}, -{{ 19.5111, -48.9334}, 1.78261}, -{{ 19.7299, -47.6207}, 1.86957}, -{{ 19.9588, -46.247}, 1.95652}, -{{ 20.198, -44.8122}, 2.04348}, -{{ 20.4473, -43.3164}, 2.13043}, -{{ 20.7068, -41.7595}, 2.21739}, -{{ 20.9764, -40.1415}, 2.30435}, -{{ 21.2562, -38.4625}, 2.3913}, -{{ 21.5463, -36.7225}, 2.47826}, -{{ 21.8464, -34.9214}, 2.56522}, -{{ 22.1568, -33.0592}, 2.65217}, -{{ 22.4773, -31.136}, 2.73913}, -{{ 22.808, -29.1517}, 2.82609}, -{{ 23.1489, -27.1064}, 2.91304}, -{{ 23.5, -25}, 3}, -{{ 25.0966, -24.1597}, 2.85714}, -{{ 26.6134, -23.3613}, 2.71429}, -{{ 28.0504, -22.605}, 2.57143}, -{{ 29.4076, -21.8908}, 2.42857}, -{{ 30.6849, -21.2185}, 2.28571}, -{{ 31.8824, -20.5882}, 2.14286}, -{{ 33, -20}, 2}, -{{ 34.1932, -19.4034}, 1.90909}, -{{ 35.3295, -18.8352}, 1.81818}, -{{ 36.4091, -18.2955}, 1.72727}, -{{ 37.4318, -17.7841}, 1.63636}, -{{ 38.3977, -17.3011}, 1.54545}, -{{ 39.3068, -16.8466}, 1.45455}, -{{ 40.1591, -16.4205}, 1.36364}, -{{ 40.9545, -16.0227}, 1.27273}, -{{ 41.6932, -15.6534}, 1.18182}, -{{ 42.375, -15.3125}, 1.09091}, -{{ 43, -15}, 1}, -{{ 43.4, -14.6}, 1}, -{{ 43.8, -14.2}, 1}, -{{ 44.2, -13.8}, 1}, -{{ 44.6, -13.4}, 1}, -{{ 45, -13}, 1}, -{{ 45.2673, -12.3318}, 0.960526}, -{{ 45.5236, -11.6911}, 0.921053}, -{{ 45.7689, -11.0778}, 0.881579}, -{{ 46.0032, -10.492}, 0.842105}, -{{ 46.2265, -9.93364}, 0.802632}, -{{ 46.4389, -9.40275}, 0.763158}, -{{ 46.6403, -8.89931}, 0.723684}, -{{ 46.8307, -8.42334}, 0.684211}, -{{ 47.0101, -7.97483}, 0.644737}, -{{ 47.1785, -7.55378}, 0.605263}, -{{ 47.3359, -7.16018}, 0.565789}, -{{ 47.4824, -6.79405}, 0.526316}, -{{ 47.6178, -6.45538}, 0.486842}, -{{ 47.7423, -6.14416}, 0.447368}, -{{ 47.8558, -5.86041}, 0.407895}, -{{ 47.9584, -5.60412}, 0.368421}, -{{ 48.0499, -5.37529}, 0.328947}, -{{ 48.1304, -5.17391}, 0.289474}, -{{ 48.2, -5}, 0.25}, -{{0, 0}, 0} // end marker +TCP( 16.877, -61.7721, 0.09), +TCP( 16.877, -61.7144, 0.09125), +TCP( 16.877, -61.656, 0.0925), +TCP( 16.877, -61.5967, 0.09375), +TCP( 16.877, -61.5367, 0.095), +TCP( 16.877, -61.4759, 0.09625), +TCP( 16.877, -61.4143, 0.0975), +TCP( 16.877, -61.3519, 0.09875), +TCP( 16.877, -61.2887, 0.1), +TCP(16.8854, -61.2007, 0.157143), +TCP(16.8969, -61.0806, 0.214286), +TCP(16.9114, -60.9285, 0.271429), +TCP( 16.929, -60.7444, 0.328571), +TCP(16.9496, -60.5283, 0.385714), +TCP(16.9733, -60.2802, 0.442857), +TCP( 17, -60, 0.5), +TCP( 17.15, -59.7, 0.6), +TCP( 17.325, -59.35, 0.7), +TCP( 17.525, -58.95, 0.8), +TCP( 17.75, -58.5, 0.9), +TCP( 18, -58, 1), +TCP(18.1272, -57.2368, 1.08696), +TCP(18.2646, -56.4126, 1.17391), +TCP(18.4121, -55.5273, 1.26087), +TCP(18.5698, -54.5809, 1.34783), +TCP(18.7377, -53.5735, 1.43478), +TCP(18.9158, -52.5051, 1.52174), +TCP(19.1041, -51.3756, 1.6087), +TCP(19.3025, -50.185, 1.69565), +TCP(19.5111, -48.9334, 1.78261), +TCP(19.7299, -47.6207, 1.86957), +TCP(19.9588, -46.247, 1.95652), +TCP( 20.198, -44.8122, 2.04348), +TCP(20.4473, -43.3164, 2.13043), +TCP(20.7068, -41.7595, 2.21739), +TCP(20.9764, -40.1415, 2.30435), +TCP(21.2562, -38.4625, 2.3913), +TCP(21.5463, -36.7225, 2.47826), +TCP(21.8464, -34.9214, 2.56522), +TCP(22.1568, -33.0592, 2.65217), +TCP(22.4773, -31.136, 2.73913), +TCP( 22.808, -29.1517, 2.82609), +TCP(23.1489, -27.1064, 2.91304), +TCP( 23.5, -25, 3), +TCP(25.0966, -24.1597, 2.85714), +TCP(26.6134, -23.3613, 2.71429), +TCP(28.0504, -22.605, 2.57143), +TCP(29.4076, -21.8908, 2.42857), +TCP(30.6849, -21.2185, 2.28571), +TCP(31.8824, -20.5882, 2.14286), +TCP( 33, -20, 2), +TCP(34.1932, -19.4034, 1.90909), +TCP(35.3295, -18.8352, 1.81818), +TCP(36.4091, -18.2955, 1.72727), +TCP(37.4318, -17.7841, 1.63636), +TCP(38.3977, -17.3011, 1.54545), +TCP(39.3068, -16.8466, 1.45455), +TCP(40.1591, -16.4205, 1.36364), +TCP(40.9545, -16.0227, 1.27273), +TCP(41.6932, -15.6534, 1.18182), +TCP( 42.375, -15.3125, 1.09091), +TCP( 43, -15, 1), +TCP( 43.4, -14.6, 1), +TCP( 43.8, -14.2, 1), +TCP( 44.2, -13.8, 1), +TCP( 44.6, -13.4, 1), +TCP( 45, -13, 1), +TCP(45.2673, -12.3318, 0.960526), +TCP(45.5236, -11.6911, 0.921053), +TCP(45.7689, -11.0778, 0.881579), +TCP(46.0032, -10.492, 0.842105), +TCP(46.2265, -9.93364, 0.802632), +TCP(46.4389, -9.40275, 0.763158), +TCP(46.6403, -8.89931, 0.723684), +TCP(46.8307, -8.42334, 0.684211), +TCP(47.0101, -7.97483, 0.644737), +TCP(47.1785, -7.55378, 0.605263), +TCP(47.3359, -7.16018, 0.565789), +TCP(47.4824, -6.79405, 0.526316), +TCP(47.6178, -6.45538, 0.486842), +TCP(47.7423, -6.14416, 0.447368), +TCP(47.8558, -5.86041, 0.407895), +TCP(47.9584, -5.60412, 0.368421), +TCP(48.0499, -5.37529, 0.328947), +TCP(48.1304, -5.17391, 0.289474), +TCP( 48.2, -5, 0.25), +TCP(0, 0, 0) // end marker }; const TargetCircle caribbean_final(caribbean_plan[0].lat_lon, 0.09); @@ -118,46 +119,48 @@ // kilchberg thalwil horgen au waedenswil wollerau const TargetCirclePoint sukku_plan[] = { -{{ 47.3477, 8.5431}, 0.005}, -{{0, 0}, 0}}; // end marker +TCP(47.3477, 8.5431, 0.005), +TCP(0, 0, 0)}; // end marker const TargetCircle sukku(sukku_plan[0].lat_lon, 0.02); const TargetCirclePoint kilchberg_plan[] = { -{{ 47.3250, 8.5623}, 0.005}, -{{0, 0}, 0}}; // end marker +TCP(47.3250, 8.5623, 0.005), +TCP(0, 0, 0)}; // end marker const TargetCircle kilchberg(kilchberg_plan[0].lat_lon, 0.02); const TargetCirclePoint thalwil_plan[] = { -{{ 47.2962, 8.5812}, 0.005}, -{{0, 0}, 0}}; // end marker +TCP(47.2962, 8.5812, 0.005), +TCP(0, 0, 0)}; // end marker const TargetCircle thalwil(thalwil_plan[0].lat_lon, 0.02); const TargetCirclePoint horgen_plan[] = { -{{ 47.2699, 8.6052}, 0.005}, -{{0, 0}, 0}}; // end marker +TCP(47.2699, 8.6052, 0.005), +TCP(0, 0, 0)}; // end marker const TargetCircle horgen(horgen_plan[0].lat_lon, 0.02); const TargetCirclePoint au_plan[] = { -{{ 47.2584, 8.6468}, 0.005}, -{{0, 0}, 0}}; // end marker +TCP(47.2584, 8.6468, 0.005), +TCP(0, 0, 0)}; // end marker const TargetCircle au(au_plan[0].lat_lon, 0.02); const TargetCirclePoint waedenswil_plan[] = { -{{ 47.2379, 8.6862}, 0.005}, -{{0, 0}, 0}}; // end marker +TCP(47.2379, 8.6862, 0.005), +TCP(0, 0, 0)}; // end marker const TargetCircle waedenswil(waedenswil_plan[0].lat_lon, 0.02); const TargetCirclePoint wollerau_plan[] = { -{{ 47.2207, 8.7220}, 0.005}, -{{0, 0}, 0}}; // end marker +TCP(47.2207, 8.7220, 0.005), +TCP(0, 0, 0)}; // end marker const TargetCircle wollerau(wollerau_plan[0].lat_lon, 0.02); // for checks of the correct initial GPS data const TargetCirclePoint brest_check[] = { -{{ 48.2390, -4.7698}, 1}, -{{0, 0}, 0}}; // end marker +TargetCirclePoint( 48.2390, -4.7698, 1.0), +TargetCirclePoint(0, 0, 0)}; // end marker const TargetCircle brest(brest_check[0].lat_lon, brest_check[0].radius_deg); + + #endif // SKIPPER_PLANS_H Index: skipper/skipper_main.cc =================================================================== --- skipper/skipper_main.cc (revision 212) +++ skipper/skipper_main.cc (working copy) @@ -82,7 +82,7 @@ int clsockopen(const char* path) { int fd = socket(AF_LOCAL, SOCK_STREAM, 0); if (fd < 0) crash("socket"); - struct sockaddr_un addr = { AF_LOCAL, 0 }; + struct sockaddr_un addr = { {AF_LOCAL}, 0 }; strncpy(addr.sun_path, path, sizeof(addr.sun_path)); if (connect(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0) { close(fd); @@ -215,7 +215,7 @@ bool skipper_out_pending = false; SkipperInput skipper_input; // reported back from helmsman - std::vector ais; + std::vector ais; double alpha_star_deg; // Main loop @@ -247,8 +247,8 @@ if (FD_ISSET(fileno(held), &rfds)) { char line[1024]; while (fgets(line, sizeof line, held)) { - int n = sscan_skipper_input(line, &skipper_input); - if (!n && debug) fprintf(stderr, "Ignoring garbage from helmsmand: %s\n", line); + int n = sscan_skipper_input(line, &skipper_input); + if (!n && debug) fprintf(stderr, "Ignoring garbage from helmsmand: %s\n", line); } if (feof(held) || (ferror(held) && errno!= EAGAIN)) crash("reading from helmsmand"); } Index: skipper/lat_lon.h =================================================================== --- skipper/lat_lon.h (revision 212) +++ skipper/lat_lon.h (working copy) @@ -15,7 +15,8 @@ struct LatLon { LatLon(double latitude, double longitude) : lat(latitude), lon(longitude) { CHECK_IN_INTERVAL(-360, latitude, 360); - CHECK_IN_INTERVAL(-360, longitude, 360); } + CHECK_IN_INTERVAL(-360, longitude, 360); + } void Flat(double* x, double* y) { *x = lat * to_cartesian_meters; *y = lon * to_cartesian_meters;

AltStyle によって変換されたページ (->オリジナル) /