[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Paparazzi-devel] Cannon Launch Detection
From: |
Pascal Brisset |
Subject: |
Re: [Paparazzi-devel] Cannon Launch Detection |
Date: |
Mon, 04 May 2009 21:45:53 +0200 |
User-agent: |
Thunderbird 2.0.0.21 (X11/20090409) |
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">
<header>
<file name="cld.h"/>
</header>
<init fun="cld_init()"/>
<periodic fun="cld_check()" period="1./60" autorun="TRUE"/>
<makefile>
<file name="cld.c"/>
<flag name="ADC_CLD" "ADC_7"/>
</makefile>
</module>
- 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"/>
...
</block>
- and finally in your airframe file:
<modules>
<load name="cld.xml"/>
</modules>
...
# in the makefile section:
ap.CFLAGS += -DUSE_MODULES
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 :-)
--Pascal
David Bryant wrote:
Hi,
I'm attempting to extend paparazzi to detect rapid acceleration launch
from a cannon. The cannon is activated by a separate system. The
aircraft is accelerated at approximately 24 g-force along a 3 metre
barrel length.
I need to detect the launch within paparazzi immediately and am
investigating an approach based on sampling the output from a ADXL321
accelerometer on an ADC paparazzi input.
I was hoping to be able to create a function that was periodically
invoked at say 200Hz and polled the accelerometer ADC input. The
routine would process the data until some criteria had been met that
indicated a launch. On detecting a launch the routine would do
something (invoke a function?) that would allow cause flightplan to
progress to the next stage. After this the routine would no longer
need to be called.
I am currently going down the path of using the conf/modules mechanism
to define my function and its periodicity, and writing the function.
Could someone please provide some general advice and any tips in
regard to my approach or an alternative approach? I am having trouble
finding any precedence or examples of this kind of thing. Can you draw
my attention to a example that I should be looking at?
Thanks,
Dave
_______________________________________________
Paparazzi-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/paparazzi-devel