Commit 7a5dee4f authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾

Update points A and B

parent 29e7a5d7
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
IS_LEADER = me.id === LEADER_ID, IS_LEADER = me.id === LEADER_ID,
PARACHUTE_ALTITUDE = 100, PARACHUTE_ALTITUDE = 100,
POINT_A = { POINT_A = {
latitude: 45.6447727, latitude: 45.650833,
longitude: 14.2635345, longitude: 14.259722,
altitude: 608 altitude: 606
}, },
POINT_B = { POINT_B = {
latitude: 45.6447678, latitude: 45.644167,
longitude: 14.2635388, longitude: 14.263611,
altitude: 608 altitude: 607
}, },
ROUND_NB = 1; ROUND_NB = 1;
...@@ -90,10 +90,13 @@ ...@@ -90,10 +90,13 @@
me.start_altitude me.start_altitude
); );
if (me.init_alt_reached && IS_LEADER) { if (me.init_alt_reached && IS_LEADER) {
me.setTargetCoordinates( exitOnFail(
POINT_A.latitude, me.setTargetCoordinates(
POINT_A.longitude, POINT_B.latitude,
POINT_A.altitude + FLIGH_ALTITUDE POINT_B.longitude,
POINT_B.altitude + FLIGH_ALTITUDE
),
"Failed to set point B coordinates"
); );
me.going_to_point_a = true; me.going_to_point_a = true;
me.sendMsg(JSON.stringify({going_to_point_a: me.going_to_point_a})); me.sendMsg(JSON.stringify({going_to_point_a: me.going_to_point_a}));
...@@ -145,20 +148,26 @@ ...@@ -145,20 +148,26 @@
); );
} else { } else {
if (me.going_to_point_a) { if (me.going_to_point_a) {
me.setTargetCoordinates( exitOnFail(
POINT_B.latitude, me.setTargetCoordinates(
POINT_B.longitude, POINT_B.latitude,
POINT_B.altitude + FLIGH_ALTITUDE POINT_B.longitude,
POINT_B.altitude + FLIGH_ALTITUDE
),
"Failed to set point B coordinates"
); );
me.going_to_point_a = false; me.going_to_point_a = false;
me.sendMsg(JSON.stringify({going_to_point_a: me.going_to_point_a})); me.sendMsg(JSON.stringify({going_to_point_a: me.going_to_point_a}));
} else { } else {
me.round_count += 1; me.round_count += 1;
if (me.round_count < ROUND_NB) { if (me.round_count < ROUND_NB) {
me.setTargetCoordinates( exitOnFail(
POINT_A.latitude, me.setTargetCoordinates(
POINT_A.longitude, POINT_A.latitude,
POINT_A.altitude + FLIGH_ALTITUDE POINT_A.longitude,
POINT_A.altitude + FLIGH_ALTITUDE
),
"Failed to set point A coordinates"
); );
me.going_to_point_a = true; me.going_to_point_a = true;
me.sendMsg(JSON.stringify({going_to_point_a: me.going_to_point_a})); me.sendMsg(JSON.stringify({going_to_point_a: me.going_to_point_a}));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment