Generating Off-centered IMU readings
조회 수: 6 (최근 30일)
이전 댓글 표시
Fs = 100;
% Waypoints and times of arrival.
waypoints = [1 1 1; 3 1 1; 3 0 0; 0 0 0];
t = [1; 5; 10; 15];
t1=[0;10;20;30]
% Create trajectory and compute pose.
traj = waypointTrajectory(waypoints, t1, "SampleRate", Fs);
[posVeh, orientVeh, velVeh, accVeh, angvelVeh] = lookupPose(traj,t(1):1/Fs:t(end)); %error in this line
imu = imuSensor("accel-gyro-mag", "SampleRate", Fs);
% IMU at driver's seat.
mountedIMU = imuSensor("accel-gyro-mag", "SampleRate", Fs);
% Position and orientation offset of the vehicle and the mounted IMU.
posVeh2IMU = [2.4 0.5 0.4];
orientVeh2IMU = quaternion([0 0 90], "eulerd", "ZYX", "frame");
%trajectoryInfo=waypointInfo(traj)
% Visualization.
helperPlotIMU(posVeh(1,:), orientVeh(1,:), posVeh2IMU, orientVeh2IMU);
[posIMU, orientIMU, velIMU, accIMU, angvelIMU] = transformMotion(posVeh2IMU,orientVeh2IMU,posVeh, orientVeh, velVeh, accVeh, angvelVeh);
% IMU at vehicle origin.
[accel, gyro, mag] = imu(accVeh, angvelVeh, orientVeh);
% IMU at driver's seat.
[accelMounted, gyroMounted, magMounted] = mountedIMU(accIMU, angvelIMU, orientIMU);
I was trying to use the above Matlab example for generating the off centered IMU readings but the error pops up in the 8th line of the code that says "Cannot access method 'lookupPose' in class 'waypointTrajectory'". I have never encountered an error like this in Matlab hence have no idea on how to debug it. Also, I tried giving the values manually for the following arrays (posVeh,orientVeh,velVeh,etc) the code works till line 19 and stops saying that the function 'helperPlotIMU' and 'transformMotion' are unrecognized which shouldn't be the case as I have the necessary Tool boxes installed on my Laptop.
I have changed few things in the array t as the 'Time of Arrival' Input to the waypointTrajectory Function should start from 0 which is not the case in the example on the Mathworks website as it starts from 1.
댓글 수: 0
채택된 답변
Harsha Priya Daggubati
2020년 5월 15일
Hi,
I guess this is a shipped example, you can find the livescript code under examples/shared_positioning folder. You can also try using the following command:
openExample('shared_positioning/GenerateOffcenteredIMUReadingsExample')
Make sure you can run the shipped example without any changes. If this works fine, then your issue might be due to the required helper functions for the example to run are not accessible as you might be copying your code to some other location.
Hope this helps!
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Manage Products에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!