Converting sensor frames using Aerospace Toolbox
조회 수: 4 (최근 30일)
이전 댓글 표시
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
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Guidance, Navigation, and Control (GNC)에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!