paparazzi-devel
[Top][All Lists]
Advanced

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

Re: [Paparazzi-devel] Float error in Camera Module


From: Felix Ruess
Subject: Re: [Paparazzi-devel] Float error in Camera Module
Date: Tue, 7 Oct 2014 20:48:13 +0200

Hi Nicolas,

ah, right!
It fails because the preprocessor can't handle floats and if you had a unit defined it would always generate a define as float.
This is fixed in master if unit = code_unit.

So as you found out, you should either not specify a unit at all or if using latest master also set code_unit to deg.

Maybe we should just convert that module to use radians as well, but you can't check the float radians with the preprocessor anymore.

Cheers, Felix

On Tue, Oct 7, 2014 at 7:20 PM, Nicolas Quendez <address@hidden> wrote:

Felix,

I use 5.3 Paparazzi version. 
Here the output errors when using the wiki datas : 

In file included from ./inter_mcu.h:43:0,
                 from modules/cam_control/cam.h:31,
                 from modules/cam_control/cam.c:28:
/home/nicolas/paparazzi/var/aircrafts/WED/ap/generated/airframe.h:269:21: error: floating constant in preprocessor _expression_
 #define CAM_PAN_MAX 0.7853981625
                     ^
modules/cam_control/cam.c:51:6: note: in expansion of macro 'CAM_PAN_MAX'
 #if (CAM_PAN_MAX == CAM_PAN_NEUTRAL)
      ^
/home/nicolas/paparazzi/var/aircrafts/WED/ap/generated/airframe.h:270:25: error: floating constant in preprocessor _expression_
 #define CAM_PAN_NEUTRAL 0.
                         ^
modules/cam_control/cam.c:51:21: note: in expansion of macro 'CAM_PAN_NEUTRAL'
 #if (CAM_PAN_MAX == CAM_PAN_NEUTRAL)
                     ^
modules/cam_control/cam.c:52:2: error: #error CAM_PAN_MAX has to be different from CAM_PAN_NEUTRAL
 #error CAM_PAN_MAX has to be different from CAM_PAN_NEUTRAL
  ^
In file included from ./inter_mcu.h:43:0,
                 from modules/cam_control/cam.h:31,
                 from modules/cam_control/cam.c:28:
/home/nicolas/paparazzi/var/aircrafts/WED/ap/generated/airframe.h:270:25: error: floating constant in preprocessor _expression_
 #define CAM_PAN_NEUTRAL 0.
                         ^
modules/cam_control/cam.c:54:6: note: in expansion of macro 'CAM_PAN_NEUTRAL'
 #if (CAM_PAN_NEUTRAL == CAM_PAN_MIN)
      ^
/home/nicolas/paparazzi/var/aircrafts/WED/ap/generated/airframe.h:271:22: error: floating constant in preprocessor _expression_
 #define CAM_PAN_MIN -0.7853981625
                      ^
modules/cam_control/cam.c:54:25: note: in expansion of macro 'CAM_PAN_MIN'
 #if (CAM_PAN_NEUTRAL == CAM_PAN_MIN)
                         ^
modules/cam_control/cam.c:55:2: error: #error CAM_PAN_MIN has to be different from CAM_PAN_NEUTRAL
 #error CAM_PAN_MIN has to be different from CAM_PAN_NEUTRAL
  ^
In file included from ./inter_mcu.h:43:0,
                 from modules/cam_control/cam.h:31,
                 from modules/cam_control/cam.c:28:
/home/nicolas/paparazzi/var/aircrafts/WED/ap/generated/airframe.h:265:22: error: floating constant in preprocessor _expression_
 #define CAM_TILT_MAX 0.523598775
                      ^
modules/cam_control/cam.c:61:7: note: in expansion of macro 'CAM_TILT_MAX'
 #if ((CAM_TILT_MAX) == (CAM_TILT_NEUTRAL))
       ^
/home/nicolas/paparazzi/var/aircrafts/WED/ap/generated/airframe.h:266:26: error: floating constant in preprocessor _expression_
 #define CAM_TILT_NEUTRAL 0.
                          ^
modules/cam_control/cam.c:61:25: note: in expansion of macro 'CAM_TILT_NEUTRAL'
 #if ((CAM_TILT_MAX) == (CAM_TILT_NEUTRAL))
                         ^
modules/cam_control/cam.c:62:2: error: #error CAM_TILT_MAX has to be different from CAM_TILT_NEUTRAL
 #error CAM_TILT_MAX has to be different from CAM_TILT_NEUTRAL
  ^
In file included from ./inter_mcu.h:43:0,
                 from modules/cam_control/cam.h:31,
                 from modules/cam_control/cam.c:28:
/home/nicolas/paparazzi/var/aircrafts/WED/ap/generated/airframe.h:266:26: error: floating constant in preprocessor _expression_
 #define CAM_TILT_NEUTRAL 0.
                          ^
modules/cam_control/cam.c:64:6: note: in expansion of macro 'CAM_TILT_NEUTRAL'
 #if (CAM_TILT_NEUTRAL == CAM_TILT_MIN)
      ^
/home/nicolas/paparazzi/var/aircrafts/WED/ap/generated/airframe.h:267:23: error: floating constant in preprocessor _expression_
 #define CAM_TILT_MIN -0.523598775
                       ^
modules/cam_control/cam.c:64:26: note: in expansion of macro 'CAM_TILT_MIN'
 #if (CAM_TILT_NEUTRAL == CAM_TILT_MIN)
                          ^
modules/cam_control/cam.c:65:2: error: #error CAM_TILT_MIN has to be different from CAM_TILT_NEUTRAL
 #error CAM_TILT_MIN has to be different from CAM_TILT_NEUTRAL
  ^
modules/cam_control/cam.c:132:1: warning: data definition has no type or storage class [enabled by default]
 chute = 0;
 ^
modules/cam_control/cam.c:132:1: warning: type defaults to 'int' in declaration of 'chute' [enabled by default]
modules/cam_control/cam.c: In function 'cam_periodic':
modules/cam_control/cam.c:139:5: warning: switch missing default case [-Wswitch-default]
     switch (cam_mode) {
     ^
make[1]: *** [/home/nicolas/paparazzi/var/aircrafts/WED/ap/modules/cam_control/cam.o] Error 1
make[1]: Leaving directory `/home/nicolas/paparazzi/sw/airborne'
make: *** [ap.compile] Error 2
make: Leaving directory `/home/nicolas/paparazzi'

FAILED 'make -C /home/nicolas/paparazzi -f Makefile.ac AIRCRAFT=WED ap.compile' with code 2



Best regards
Nicolas


Le 7 oct. 2014 à 13:54, Felix Ruess <address@hidden> a écrit :

Hi Nicolas,

can you please post the actual error output and the paparazzi_version you are using?

Cheers, Felix

On Tue, Oct 7, 2014 at 6:38 PM, Nicolas Quendez <address@hidden> wrote:
Hi,

Trying to implement the camera module, I had a « float error » when applying the wiki : 


   <servo name="CAM_PAN"  no="3" min="2000" neutral="1550" max="1000"/>
   <servo name="CAM_TILT" no="6" min="1000" neutral="1550" max="2000"/>
 
   <axis name="CAM_TILT" failsafe_value="0"/>
   <axis name="CAM_PAN"  failsafe_value="0"/>
 
   <set command="CAM_PAN"  value="@YAW"/>
   <set command="CAM_TILT" value="@GAIN1"/>
 
   <set servo="CAM_PAN"  value="@CAM_PAN"/>
   <set servo="CAM_TILT" value="@CAM_TILT"/>
 
 <section name="CAM" prefix="CAM_">
   <define name="TILT_MAX"      value="30"   unit="deg"/>
   <define name="TILT_NEUTRAL"  value="0"    unit="deg"/>
   <define name="TILT_MIN"      value="-30"  unit="deg"/>
   <define name="TILT0"         value="0"    unit="deg"/>
 
   <define name="PAN_MAX"     value="45" unit="deg"/>
   <define name="PAN_NEUTRAL" value="0" unit="deg"/>
   <define name="PAN_MIN"     value="-45"  unit="deg"/>
   <define name="PAN0"          value="0" unit="deg"/>
 </section>
 
  <modules main_freq="60">
    <load name="cam_point.xml">
      <define name="POINT_CAM_PITCH_ROLL"  value="1"/>
      <define name="SHOW_CAM_COORDINATES" value="1"/>
    </load>
  </modules>


After reading some old posts, removing the unit=« deg »  solves the problem, but in my case, adding  code_unit=« deg »  did not. 

So perhaps it could be good to remove the unit=« deg » in the wiki ? 

Best regards
Nicolas


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


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


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



reply via email to

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