[Top][All Lists]

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

Re: [Paparazzi-devel] Cannon Launch Detection

From: David Bryant
Subject: Re: [Paparazzi-devel] Cannon Launch Detection
Date: Tue, 05 May 2009 13:38:59 +0930
User-agent: Thunderbird (X11/20090318)

Thanks Pascal,

That's extremely helpful. I've got a module running, following the outline that you provided. I'm reading from the ADCs and want to be sure I understand how they work correctly.

From what I can tell, you declare a buffer (struct adc_buf) and register it for samples to be accumulated in it (adc_buf_channel). Then in each update it would seem you can either:

* Use the average value accumulated: buf.sum / buf.av_nb_sample

* Or look at the samples directly buf.values[0..buf.av_nb_sample - 1]

Is this correct?

What causes this structure to get reset?

What is the member buf.head about?

Obviously I'm having a guess about all this. Am I on the right track?

I will endeavor to contribute to the wiki and submit anything useful that I create back to the project.

Are modules automatically written for paparazzi automatically licensed under GPL?


Pascal Brisset wrote:
Hi David,

the modules mechanism should (almost) provide the features you require. You will have to write: - a module description, a file in conf/modules/ : In your case, it will contain only a call to your init function, a call to your periodic task and the declaration of .c and .h files:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="cld">
   <file name="cld.h"/>
 <init fun="cld_init()"/>
 <periodic fun="cld_check()" period="1./60" autorun="TRUE"/>
   <file name="cld.c"/>
   <flag name="ADC_CLD" "ADC_7"/>

- your .c and .h files in the sw/airborne/modules/cld/ folder:

---8<--- .h ---------
#include "std.h"
bool cld_launch_detected;

---8<--- .c ---------
#include "cld.h"
void cld_init(void) {
 ... initialisation code for your adc ...
 cld_launch_detected = false;
void cld_check(void) {
 if (... check condition...) {
    cld_launch_detected = false;
    cld_cld_status = MODULES_STOP; // stop calling me

- your flight plan, for example using an exception in the Holding Point block (in basic.xml):

   <block name="Holding point">
     <exception cond="cld_launch_detected"  deroute="Takeoff"/>

- and finally in your airframe file:

   <load name="cld.xml"/>
# in the makefile section:

In the current implementation, 60Hz is the maximum frequency for a periodic task in a module. If you really need more ... let us know :-)

Hope this is enough

And feel free to update the wiki :-)


reply via email to

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