Generation of artificial IMU data from simple waypoint trajectory
42 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I would like to generate some synthetic IMU (accelerometer and gyroscope only) data given a sampled 3D trajectory using the imuSensor system object from MATLAB's navigation toolbox.
The IMU sensor object https://www.mathworks.com/help/nav/ref/imusensor-system-object.html requires acceleration (in the local navigation coordinate system, e.g., NED) and angular velocity (also in the local navigation coordinate system). I only have waypoints (positions in 3D) and assume that regarding orientation, there is no auto-roll or auto-pitch, but just "auto-yaw" meaning that the nose points always in the direction of movement.
I started with a simple trajectory, a circle in the plane: (cos(t), sin(t), 0) and sampled it (e.g., with 10 Hz one full revolution) to obtain "waypoints". See figure below:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1091480/image.png)
Using the waypointsTrajectory object https://www.mathworks.com/help/fusion/ref/waypointtrajectory-system-object.html, I obtain via [position,orientation,velocity,acceleration,angularVelocity] = trajectory(), the acceleration and angularVelocity (in the local navigation coordinate system), which are required by the IMU sensor object to output accel and gyro readings in the sensor body coordinate system. As stated above, I use no auto-pitch, no auto-roll, only the auto-yaw, a setting which is implicitly used by the waypointTrajectory object.
The resulting accel data (in the sensor body coordinate system) confuse me though. See below:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1091485/image.png)
On the body z-axis, as expected we measure gravitational acceleration, but on the x and y we have a sinusoidal acceleration. If my device is moving with "auto-yaw" along a circle (I verified that speed is constant) shouldn't I just see a constant acceleration on the x or y axis (namely the centripetal acceleration)?
Thanks!
0 Commenti
Risposta accettata
Brian Fanous
il 11 Ago 2022
The last line of your code:
[accelReadings, gyroReadings] = imu(acceleration, angularVelocity, orientation');
has a sublte but very important bug. Just like for complex numbers in MATLAB, when you use the ' operator on a quaternion array you are taking the conjugate transpose. So
orientation'
is actually conjugating all the quaternions in the array and transposing the array. You should just use the transpose operator here:
orientation.'
which does not conjugate. Try that and you'll see the sinusoidal artifact in the accelerometer signal disappear.
0 Commenti
Più risposte (1)
Brian Fanous
il 9 Ago 2022
Can you explain your setup a bit more? Are the plots shown in your post the outputs of the imuSensor or the outputs of the waypointTrajectory? Can you post the code you used?
5 Commenti
Greg Dionne
il 25 Ago 2022
When you use the Orientation property, waypointTrajectory decouples the orientation from the path. It instead takes the orientation from the supplied values. It will assume an initial and final angular velocity of zero which can be confirmed in your first plot.
Hope that helps
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!