diff --git a/.gitignore b/.gitignore
index 74824166ba..22b80c9dc3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -116,6 +116,7 @@
# /sw/ground_segment/misc
/sw/ground_segment/misc/davis2ivy
+/sw/ground_segment/misc/kestrel2ivy
# /sw/airborne/arch/lpc21/test/bootloader
diff --git a/conf/radios/T7chp.xml b/conf/radios/T7chp.xml
index 8637844425..3b52880368 100644
--- a/conf/radios/T7chp.xml
+++ b/conf/radios/T7chp.xml
@@ -10,4 +10,3 @@
-
diff --git a/conf/radios/T9cap.xml b/conf/radios/T9cap.xml
index 2bda5a2e4c..a2c976242e 100644
--- a/conf/radios/T9cap.xml
+++ b/conf/radios/T9cap.xml
@@ -11,4 +11,3 @@
-
diff --git a/conf/radios/aron.xml b/conf/radios/aron.xml
index 1dba7a58a8..e3b1dc93b6 100644
--- a/conf/radios/aron.xml
+++ b/conf/radios/aron.xml
@@ -10,4 +10,3 @@
-
diff --git a/conf/radios/fc28.xml b/conf/radios/fc28.xml
index 905016645f..ee1877e811 100644
--- a/conf/radios/fc28.xml
+++ b/conf/radios/fc28.xml
@@ -57,4 +57,3 @@
-
diff --git a/conf/radios/generic_tm.xml b/conf/radios/generic_tm.xml
index 0a68957ef2..065774c3f9 100644
--- a/conf/radios/generic_tm.xml
+++ b/conf/radios/generic_tm.xml
@@ -56,4 +56,3 @@
-
diff --git a/conf/radios/mc24.xml b/conf/radios/mc24.xml
index 5688dd616a..c4de73a3b6 100644
--- a/conf/radios/mc24.xml
+++ b/conf/radios/mc24.xml
@@ -56,4 +56,3 @@
-
diff --git a/conf/radios/mc24_j.xml b/conf/radios/mc24_j.xml
index 79a62253b7..06d809ed08 100644
--- a/conf/radios/mc24_j.xml
+++ b/conf/radios/mc24_j.xml
@@ -56,4 +56,3 @@
-
diff --git a/conf/radios/mc3030.xml b/conf/radios/mc3030.xml
index 396d100768..9068c6c616 100644
--- a/conf/radios/mc3030.xml
+++ b/conf/radios/mc3030.xml
@@ -56,4 +56,3 @@
-
diff --git a/conf/radios/x412.xml b/conf/radios/x412.xml
index d06172ba85..57a683b4a8 100644
--- a/conf/radios/x412.xml
+++ b/conf/radios/x412.xml
@@ -53,4 +53,3 @@
-
diff --git a/sw/airborne/modules/ins/ins_xsens.c b/sw/airborne/modules/ins/ins_xsens.c
index c8be89d68c..9b55080239 100644
--- a/sw/airborne/modules/ins/ins_xsens.c
+++ b/sw/airborne/modules/ins/ins_xsens.c
@@ -286,8 +286,13 @@ void handle_ins_msg( void) {
// Send to Estimator (Control)
+#ifdef XSENS_BACKWARDS
+ EstimatorSetAtt((-ins_phi+ins_roll_neutral), (ins_psi + RadOfDeg(180)), (-ins_theta+ins_pitch_neutral));
+ EstimatorSetRate(-ins_p,-ins_q);
+#else
EstimatorSetAtt(ins_phi+ins_roll_neutral, ins_psi, ins_theta+ins_pitch_neutral);
EstimatorSetRate(ins_p,ins_q);
+#endif
// Position
float gps_east = gps.utm_pos.east / 100.;
@@ -311,7 +316,6 @@ void handle_ins_msg( void) {
float fcourse = atan2f((float)ins_vy, (float)ins_vx);
EstimatorSetSpeedPol(fspeed, fcourse, fclimb);
-
// Now also finish filling the gps struct for telemetry purposes
gps.gspeed = fspeed * 100.;
gps.speed_3d = (uint16_t)(sqrt(ins_vx*ins_vx + ins_vy*ins_vy + ins_vz*ins_vz) * 100);
diff --git a/sw/ground_segment/lpc21iap/lpc21iap.c b/sw/ground_segment/lpc21iap/lpc21iap.c
index 9cd73ff3be..2c5ff1c695 100644
--- a/sw/ground_segment/lpc21iap/lpc21iap.c
+++ b/sw/ground_segment/lpc21iap/lpc21iap.c
@@ -24,7 +24,7 @@
#define LPC21IAP_VER_MAJ 1
-#define LPC21IAP_VER_MIN 2
+#define LPC21IAP_VER_MIN 3
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -472,7 +472,7 @@ int main(int argc, char *argv[])
/* number of bytes in the last sector */
splitCnt = end % MAX_SECT;
}
- if (splitCnt != MAX_SECT)
+ if ((splitCnt != MAX_SECT) && (splitCnt > 0))
{
/* keep partly filled pages for later programming */
actBuf = startBuf;
diff --git a/sw/ground_segment/misc/Makefile b/sw/ground_segment/misc/Makefile
index 096dbdfaaa..35ff00d8c9 100644
--- a/sw/ground_segment/misc/Makefile
+++ b/sw/ground_segment/misc/Makefile
@@ -7,10 +7,16 @@ else
endif
-all: davis2ivy
+all: davis2ivy kestrel2ivy
+
+clean:
+ rm *.o davis2ivy kestrel2ivy
davis2ivy: davis2ivy.o
g++ -o davis2ivy davis2ivy.o $(LIBRARYS) -livy
+kestrel2ivy: kestrel2ivy.o
+ g++ -o kestrel2ivy kestrel2ivy.o $(LIBRARYS) -livy
+
%.o : %.c
gcc -c -O2 -Wall -I /opt/local/include/ $<
diff --git a/sw/ground_segment/misc/kestrel2ivy.c b/sw/ground_segment/misc/kestrel2ivy.c
new file mode 100644
index 0000000000..70ca70ead8
--- /dev/null
+++ b/sw/ground_segment/misc/kestrel2ivy.c
@@ -0,0 +1,274 @@
+/*
+ * Paparazzi $Id$
+ *
+ * Copyright (C) 2011 Andreas Gaeb, Max Chtangeev
+ *
+ * This file is part of paparazzi.
+ *
+ * paparazzi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * paparazzi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with paparazzi; see the file COPYING. If not, write to
+ * the Free Software Foundation, 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+/** \file kestrel2ivy.c
+ * \brief Connect a Kestrel 4500 Bluetooth weather station to the Paparazzi system
+ *
+ * The program communicates with a Kestrel 4500 weather station connected
+ * to a serial port via bluethooth. It asks for new data (Kestrel S command) in the
+ * specified intervals, extracts the relevant data (ambient pressure and
+ * temperature, wind speed and direction) and broadcasts this via the Ivy bus.
+ *
+ * At the moment, the Ivy messages should be sent with the ID of the actually
+ * flying aircraft, which integrates them into the log file, as long as the
+ * aircraft sends its alive message.
+ *
+ * Useful links:
+ * - ] [-d ] [-i ] [-s ]\n",
+ argv[0]);
+};
+
+/// Main function
+int main(int argc, char **argv) {
+ // default values for options
+ const char
+ *defaultbus = "127.255.255.255:2010",
+ *bus = defaultbus,
+ *defaultdevice = "/dev/rfcomm0";
+ device = defaultdevice;
+ long delay = 1000;
+
+ // parse options
+ char c;
+ while ((c = getopt (argc, argv, "hab:d:i:s:")) != EOF) {
+ switch (c) {
+ case 'h':
+ print_usage(argc, argv);
+ exit(EXIT_SUCCESS);
+ break;
+ case 'a':
+ want_alive_msg = TRUE;
+ break;
+ case 'b':
+ bus = optarg;
+ break;
+ case 'd':
+ device = optarg;
+ break;
+ case 'i':
+ ac_id = atoi(optarg);
+ break;
+ case 's':
+ delay = atoi(optarg)*1000;
+ break;
+ case '?':
+ if (optopt == 'a' || optopt == 'b' || optopt == 'd' || optopt == 's')
+ fprintf (stderr, "Option -%c requires an argument.\n", optopt);
+ else if (isprint (optopt))
+ fprintf (stderr, "Unknown option `-%c'.\n", optopt);
+ else
+ fprintf (stderr, "Unknown option character `\\x%x'.\n", optopt);
+ print_usage(argc, argv);
+ exit(EXIT_FAILURE);
+ default:
+ abort ();
+ }
+ }
+
+
+ // make Ctrl-C stop the main loop and clean up properly
+ signal(SIGINT, sigint_handler);
+
+ bzero (packet, PACKET_LENGTH);
+ open_port(device);
+
+ // setup Ivy communication
+ IvyInit("kestrel2ivy", "READY", 0, 0, 0, 0);
+ IvyStart(bus);
+
+ // create timer (Ivy)
+ tid = TimerRepeatAfter (0, delay, handle_timer, 0);
+
+ /* main loop */
+#if IVYMINOR_VERSION == 8
+ IvyMainLoop (NULL,NULL);
+#else
+ IvyMainLoop ();
+#endif
+ return 0;
+}
diff --git a/sw/ground_segment/misc/readme.txt b/sw/ground_segment/misc/readme.txt
index 5221c38c9f..22a89af9bc 100644
--- a/sw/ground_segment/misc/readme.txt
+++ b/sw/ground_segment/misc/readme.txt
@@ -1,3 +1,7 @@
davis2ivy:
A wrapper to communicate with a Davis VantagePro/VantagePro2 weather
station and integrate weather data into the telemetry link.
+
+kestrel2ivy:
+ A wrapper to communicate with a Kestrel 4500 bluetooth weather
+ station and integrate weather data into the telemetry link.