paparazzi-devel
[Top][All Lists]
Advanced

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

Re: [Paparazzi-devel] Use of shifting operators in Paparazzi


From: Sreenath Dama
Subject: Re: [Paparazzi-devel] Use of shifting operators in Paparazzi
Date: Sun, 1 Nov 2015 01:03:20 +0530

Hi All,

I have been looking into the code of guidance_v_adapt.c and came across the following lines.

  if (g_m_zdd > 0) {
    gv_adapt_Xmeas = (g_m_zdd + (thrust_applied >> 1)) / thrust_applied;
  } else {
    gv_adapt_Xmeas = (g_m_zdd - (thrust_applied >> 1)) / thrust_applied;
  }

I understand that g_m_zdd represents the acceleration measured by the (IMU-9.81). It would be very helpful if someone could explain from where does the formula of gv_adapt_Xmeas come. Also g_m_zdd is left shifted by 24 while thrust is shifted by 0 (on scale of 0 to 9600) Hence, why are we adding variables with different shifts?

Thanks,
Srinath 

On Tue, Oct 27, 2015 at 2:24 PM, Alexandre Bustico <address@hidden> wrote:
Le 26/10/2015 18:41, Flavio Justino a écrit :
Thanks for replying Felix ;) One last question: what about Double instead of float? What is the main difference (not theoretically as a programming type but for the case of paparazzi objectives). Do you think that it will have any interference in the results relatively to float? Thanks man =)


In term of performance, float (single precision floating point) is done by hardware on stm32f4 class of microcontroler,
but double (double precision floating point) is not accelerated and done by a library which come with gcc.
Using double will add cpu load which must be evaluated.

Future microcontrolers, based on arm cortex m7 core, will have accelerated double precision in hardware.

--
Alexandre



_______________________________________________
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]