paparazzi-devel
[Top][All Lists]
Advanced

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

Re: [Paparazzi-devel] Waypoints?


From: Gautier Hattenberger
Subject: Re: [Paparazzi-devel] Waypoints?
Date: Fri, 01 Aug 2008 12:42:05 +0200
User-agent: Thunderbird 2.0.0.16 (X11/20080724)

Hi Daniel,

I confirm you should not have more than 255 waypoints (waypoint 0 is a dummy waypoint) in your flight plan. It may works in simulation, but obviously not on airborne code.

Gautier

Serge LE HUITOUZE a écrit :
Hi,

Since Pascal is on holidays, I'll take my turn ;-)


Mitchel Humpherys wrote:
I just built with 200 and 400 waypoints without a problem.
Check out xemacs macros.
From what I can tell in the code the waypoints are implemented
with the ocaml List data structure so I imagine they're only
limited by memory, [...]

That's why you noticed (see below) that the simulation,
which runs in OCaml, runs fine!

Simulations are great, they have their limitations though,
especially in resource-constrined environment like an
UAV ;-)


[...] but when I built with 400 waypoints I got this warning:
common_nav.c:67: warning: comparison is always true due
 to limited range of data type

A quick glance at the piece of C code supposed to run on the AC:

* unit_t nav_update_waypoints_alt( void ) {
*   uint8_t i;
*   for(i = 0; i < NB_WAYPOINT; i++) {
*     waypoints[i].a += ground_alt - previous_ground_alt;
*   }
*   return 0;
* }

Obviously, this is not going to work correctly if you have more
waypoints than can fit in an 8 bits byte!
But the C compiler can only issue a warning here...

But you'd better NOT try to run this code on the AC!!!


I'm surprised you don't get a compiler error on another piece
of code also related to these waypoints: the "DlSettings" stuff.
OCaml file "gen_settings.ml" generates, with the help of an XML
config file a switch statement (via a C macro) that is used to
change a setting on the AC. The argument to the switch is also
"uint8_t", so this is obviously going to go awry if you have
more than 256 different settings...

I've not tried, so I'm not sure whether a switch statement like
the following would trigger a warning or an error:
* uint8_t x = ...;
* switch (x) {
* case   2: foo(); break;
* case   3: bar(); break;
* ...
* case 258: baz(); break; /* This is 2 mod 256 ! */
*
* }

I'd tend to think that this should trigger an error.
But then, I'd have expected that you would have signaled this error
rather than the above warning...


My understanding is that each waypoint is settable, hence part of
the settings, hence consuming a value in the "DlSettings" switch.
Thus having more than 256 waypoints should result in an incorrect
C code.

Well, if the embedded code uses the "DlSettings" macro, that is.


--Serge



_______________________________________________
Paparazzi-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/paparazzi-devel




reply via email to

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