Generating Off-centered IMU readings

조회 수: 6 (최근 30일)
Deep Shah
Deep Shah 2020년 5월 12일
댓글: Deep Shah 2020년 5월 21일
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.

채택된 답변

Harsha Priya Daggubati
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!
  댓글 수: 1
Deep Shah
Deep Shah 2020년 5월 21일
I was using the previous version of Matlab which is 2019b hence was not able to use the code as it is not available as an example in that version. The code works fine in 2020a.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Manage Products에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by