Converting sensor frames using Aerospace Toolbox
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I'm having trouble wrapping my head around writing quarternion transforms in Matlab to convert between body frames and navigation frames. Does anyone know of some Matlab tutorials, videos, or example code that might help me? I've already looked at the Matlab Help "About Aerospace Coordinate Systems", "Coordinate Systems", "Orientation, Position, and Coordinate Systems", and other provided by Matlab Help, but they are insuffient for me. Specifically, I'm trying to use the Aerospace blockset and toolbox with the Sensor Fusion and Tracking Toolbox, and convert between body-fixed, inertial frame, and navigation frames of the 6DOF (Quaternion) block and imuSensor. Currently I'm doing the following, which I figured out by trial and error.
function [acc, gyro, mag] = fcn(acc_be, angVel, ori)
% Notes
% the input is from the 6DOF (Quaternion) block
% the output is from the imuSensor Model
accBody = [0 0 0]';
gyroBody = [0 0 0]';
magBody = [0 0 0]';
persistent IMU
if isempty(IMU)
IMU = imuSensor('accel-gyro-mag');
IMU.SampleRate = 200;
end
ori_Q = quaternion(ori');
quatRotator = quaternion([0 ,180,180],'eulerd','ZYX','frame');
[aBody, gBody, mBody] = IMU(acc',angVel',ori_Q);
aBody = rotateframe(quatRotator,aBody);
aBody(3) = -aBody(3);
accBody = aBody';
gyroBody = gBody';
magBody = mBody';
end
Thanks
0 Commenti
Risposte (1)
James Tursa
il 6 Apr 2020
This discussion on MATLAB quaternion convention might help you:
0 Commenti
Vedere anche
Categorie
Scopri di più su Guidance, Navigation, and Control (GNC) in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!