paparazzi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paparazzi-commits] [4315] Digital Camera PUSH/PULL button option, Energ


From: Christophe De Wagter
Subject: [paparazzi-commits] [4315] Digital Camera PUSH/PULL button option, Energy Msg correction
Date: Fri, 06 Nov 2009 08:42:42 +0000

Revision: 4315
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=4315
Author:   dewagter
Date:     2009-11-06 08:42:42 +0000 (Fri, 06 Nov 2009)
Log Message:
-----------
Digital Camera PUSH/PULL button option, Energy Msg correction

Modified Paths:
--------------
    paparazzi3/trunk/conf/messages.xml
    paparazzi3/trunk/sw/airborne/ap_downlink.h
    paparazzi3/trunk/sw/airborne/dc.c
    paparazzi3/trunk/sw/airborne/dc.h

Modified: paparazzi3/trunk/conf/messages.xml
===================================================================
--- paparazzi3/trunk/conf/messages.xml  2009-11-06 08:16:20 UTC (rev 4314)
+++ paparazzi3/trunk/conf/messages.xml  2009-11-06 08:42:42 UTC (rev 4315)
@@ -291,7 +291,30 @@
       <field name="w4"  type="uint16"/>
   </message>
 
+  <message name="BARO_BMP85_CALIB" id="38">
+      <field name="a1"  type="int16"/>
+      <field name="a2"  type="int16"/>
+      <field name="a3"  type="int16"/>
+      <field name="a4"  type="uint16"/>
+      <field name="a5"  type="uint16"/>
+      <field name="a6"  type="uint16"/>
+      <field name="b1"  type="int16"/>
+      <field name="b2"  type="int16"/>
+      <field name="mb"  type="int16"/>
+      <field name="mc"  type="int16"/>
+      <field name="md"  type="int16"/>
+  </message>
 
+  <message name="BARO_BMP85" id="39">
+      <field name="UT"  type="int32"/>
+      <field name="UP"  type="int32"/>
+      <field name="P"  type="uint32"/>
+      <field name="T"  type="float"/>
+      <field name="MSL"  type="float"/>
+  </message>
+
+
+
  <message name="WP_MOVED_LLA" id="47">
     <field name="wp_id" type="uint8"/>
     <field name="lat" type="int32" unit="degres"></field>
@@ -412,13 +435,16 @@
 
 
   <message name="DC_SHOT" id="110">
+     <field name="photo_nr" type="int16" unit=""></field>
      <field name="utm_east"  type="int32" unit="cm"></field>
      <field name="utm_north" type="int32" unit="cm"></field>
+     <field name="z" type="float" unit="m"/>
      <field name="utm_zone"  type="uint8"></field>
+     <field name="phi" type="int16" unit="decideg"></field>
+     <field name="theta" type="int16" unit="decideg"></field>   
      <field name="course" type="int16" unit="decideg"></field>
-     <field name="z" type="float" unit="m"/>
-     <field name="phi" type="int16" unit="deg"></field>
-     <field name="theta" type="int16" unit="deg"></field>       
+     <field name="speed"  type="uint16" unit="cm/s"></field>
+     <field name="itow"  type="uint32" unit="ms"></field>
   </message>
 
   <message name="TEST_BOARD_RESULTS" ID="111">

Modified: paparazzi3/trunk/sw/airborne/ap_downlink.h
===================================================================
--- paparazzi3/trunk/sw/airborne/ap_downlink.h  2009-11-06 08:16:20 UTC (rev 
4314)
+++ paparazzi3/trunk/sw/airborne/ap_downlink.h  2009-11-06 08:42:42 UTC (rev 
4315)
@@ -176,7 +176,7 @@
 #define PERIODIC_SEND_AIRSPEED(_chan) {}
 #endif
 
-#define PERIODIC_SEND_ENERGY(_chan) Downlink({ int16_t e = energy; 
DOWNLINK_SEND_ENERGY( &vsup, &curs, &e); })
+#define PERIODIC_SEND_ENERGY(_chan) Downlink({ int16_t e = energy; float vsup 
= ((float)vsupply) / 10.0f; float curs = ((float) current)/1000.0f;  
DOWNLINK_SEND_ENERGY(_chan, &vsup, &curs, &e); })
 
 
 #include "fw_h_ctl_a.h"

Modified: paparazzi3/trunk/sw/airborne/dc.c
===================================================================
--- paparazzi3/trunk/sw/airborne/dc.c   2009-11-06 08:16:20 UTC (rev 4314)
+++ paparazzi3/trunk/sw/airborne/dc.c   2009-11-06 08:42:42 UTC (rev 4315)
@@ -4,3 +4,6 @@
 uint8_t dc_periodic_shutter;
 uint8_t dc_shutter_timer;
 uint8_t dc_utm_threshold;
+uint16_t dc_photo_nr = 0;
+
+uint8_t dc_shoot = 0;

Modified: paparazzi3/trunk/sw/airborne/dc.h
===================================================================
--- paparazzi3/trunk/sw/airborne/dc.h   2009-11-06 08:16:20 UTC (rev 4314)
+++ paparazzi3/trunk/sw/airborne/dc.h   2009-11-06 08:42:42 UTC (rev 4315)
@@ -67,24 +67,38 @@
 extern uint8_t dc_utm_threshold;
 /* In m. If non zero, automatic shots when greater than utm_north % 100 */
 
+/* Picture Number starting from zero */
+extern uint16_t dc_photo_nr;
+extern uint8_t dc_shoot;
 
+#ifndef DC_PUSH
+#define DC_PUSH LED_ON
+#endif
 
+#ifndef DC_RELEASE
+#define DC_RELEASE LED_OFF
+#endif
+
 #define SHUTTER_DELAY 2  /* 4Hz -> 0.5s */
 
 static inline uint8_t dc_shutter( void ) {
   dc_timer = SHUTTER_DELAY; 
-  LED_OFF(DC_SHUTTER_LED);
+  DC_PUSH(DC_SHUTTER_LED);
 
-  int16_t phi = DegOfRad(estimator_phi);
-  int16_t theta = DegOfRad(estimator_theta);
-  DOWNLINK_SEND_DC_SHOT(DefaultChannel, &gps_utm_east, &gps_utm_north, 
&gps_utm_zone, &gps_course, &estimator_z, &phi, &theta);
+  int16_t phi = DegOfRad(estimator_phi*10.0f);
+  int16_t theta = DegOfRad(estimator_theta*10.0f);
+  DOWNLINK_SEND_DC_SHOT(DefaultChannel, &dc_photo_nr, &gps_utm_east, 
&gps_utm_north, &estimator_z, &gps_utm_zone, &phi, &theta,  &gps_course, 
&gps_gspeed, &gps_itow);
 
+  dc_photo_nr++;
+
   return 0;
 }
 
 static inline uint8_t dc_zoom( void ) {
   dc_timer = SHUTTER_DELAY; 
-  LED_OFF(DC_ZOOM_LED);
+#ifdef DC_ZOOM_LED
+  DC_PUSH(DC_ZOOM_LED);
+#endif
   return 0;
 }
 
@@ -95,13 +109,41 @@
 
 #define dc_init() { /* initialized as leds */ dc_periodic_shutter = 0; } /* 
Output */
 
+static inline void dc_shoot_on_gps( void ) {
+  static uint8_t gps_msg_counter = 0;
+
+  if (dc_shoot > 0)
+  {
+
+    if (gps_msg_counter == 0)
+    {
+      DC_PUSH(DC_SHUTTER_LED);
+      int16_t phi = DegOfRad(estimator_phi*10.0f);
+      int16_t theta = DegOfRad(estimator_theta*10.0f);
+      float gps_z = ((float)gps_alt) / 100.0f;
+      DOWNLINK_SEND_DC_SHOT(DefaultChannel, &dc_photo_nr, &gps_utm_east, 
&gps_utm_north, &gps_z, &gps_utm_zone, &phi, &theta,  &gps_course, &gps_gspeed, 
&gps_itow);
+      dc_photo_nr++;
+    }
+    else if (gps_msg_counter == 1)
+    {
+      DC_RELEASE(DC_SHUTTER_LED);
+    }
+  
+    gps_msg_counter++;
+    if (gps_msg_counter >= 4)
+      gps_msg_counter = 0;
+  }
+}      
+
 /* 4Hz */
 static inline void dc_periodic( void ) {
   if (dc_timer) {
     dc_timer--;
   } else {
-    LED_ON(DC_SHUTTER_LED);
-    LED_ON(DC_ZOOM_LED);
+    DC_RELEASE(DC_SHUTTER_LED);
+#ifdef DC_ZOOM_LED
+    DC_RELEASE(DC_ZOOM_LED);
+#endif
   }
 
   if (dc_periodic_shutter) {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]