paparazzi-devel
[Top][All Lists]

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

 From: Devyesh Tandon Subject: Re: [Paparazzi-devel] Use of shifting operators in Paparazzi Date: Sun, 1 Nov 2015 01:50:54 +0530

Hi,
Adding to Srinath, in the file rotorcraft/guidance/guidance_v_ref.c, gv_z_ref (shifted by GV_Z_REF_FRAC), is added to gv_zd_ref (shifted by GV_ZD_REF_FRAC).

void gv_update_ref_from_z_sp(int32_t z_sp)

gv_z_ref  += gv_zd_ref;
gv_zd_ref += gv_zdd_ref;
....
}

Are we assuming the time step to be 10^(GV_Z_REF_FRAC - GV_ZD_REF_FRAC)?

Thanks! :)

On Sun, Nov 1, 2015 at 1:03 AM, Sreenath Dama wrote:
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 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
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel

_______________________________________________
Paparazzi-devel mailing list