Hi all~

I am very confused by the earth to body frame conversion code when I compare it with the frame conversion matrix that I found on the pixhawk website. Could someone please help me out... I cannot believe how much time I have wasted on this... Many thanks!

What are the exact definitions of "earth frame" and "body frame"?

earth frame = inertial frame?

body frame = body-NED frame? Or body-fixed frame?

The conversion code is here:

https://github.com/diydrones/ardupilot/blob/ArduCopter-3.2.1/libraries/AC_AttitudeControl/AC_AttitudeControl.cpp

Line 425

// earth-frame <-> body-frame conversion functions
//
// frame_conversion_ef_to_bf - converts earth frame vector to body frame vector
void AC_AttitudeControl::frame_conversion_ef_to_bf(const Vector3f& ef_vector, Vector3f& bf_vector)
{
    // convert earth frame rates to body frame rates
    bf_vector.x = ef_vector.x - _ahrs.sin_pitch() * ef_vector.z;
    bf_vector.y = _ahrs.cos_roll()  * ef_vector.y + _ahrs.sin_roll() * _ahrs.cos_pitch() * ef_vector.z;
    bf_vector.z = -_ahrs.sin_roll() * ef_vector.y + _ahrs.cos_pitch() * _ahrs.cos_roll() * ef_vector.z;
}

The frame conversion matrix that I am referring to is here:

http://www.pixhawk.org/dev/know-how/frames_of_reference

Based on this matrix, I was expecting something like (take the x-axis as an example):

bf_vector.x = _ahrs.cos_pitch() * ef_vector.x - _ahrs.sin_pitch() * ef_vector.z;

Thanks for reading the post~~

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Activity

DIY Robocars via Twitter
yesterday
DIY Robocars via Twitter
yesterday
DIY Drones via Twitter
Thursday
DIY Robocars via Twitter
RT @Heavy02011: @diyrobocars : A Home-brew computer club* for Connected Autonomous Driving on Jan 23rd, 2021 https://www.meetup.com/Connected-Autonomous-Driving/events/275728684/ #Meetu…
Thursday
DIY Robocars via Twitter
Thursday
David Hori liked Isabella Domi's profile
Wednesday
DIY Robocars via Twitter
RT @Heavy02011: ⁦@diyrobocars⁩ Autonomous Driving Assembly at #rC3. join us at https://rc3.world/rc3/assembly/diyrobocars-f1tenth/ ⁦@f1tenth⁩ ⁦@DAVGtech⁩ ⁦@DWalmroth⁩…
Monday
DIY Robocars via Twitter
RT @chr1sa: New car designs coming for our next @DIYRobocars @donkey_car virtual race on the 23rd. Choose any one you want at race time Le…
Monday
DIY Robocars via Twitter
RT @RoboticMasters: Thanks to @EllerbachMaxime and the Sydney Uni Capstone Students the @donkey_car @diyrobocars simulator is getting a ma…
Monday
DIY Robocars via Twitter
Jan 6
DIY Robocars via Twitter
Dec 28, 2020
DIY Robocars via Twitter
An interesting line-following simulator to use with with your robocars: https://github.com/ron-grant/LFS
Dec 23, 2020
DIY Robocars via Twitter
Dec 23, 2020
DIY Robocars via Twitter
An improved version of the @IntelAIResearch OpenBot: https://diyrobocars.com/2020/12/14/an-improved-version-of-the-intel-openbot/
Dec 14, 2020
DIY Drones via Twitter
An improved version of the Intel OpenBot https://ift.tt/2KkHT8Q
Dec 14, 2020
DIY Robocars via Twitter
Dec 10, 2020
More…