Field-Robotics-Japan / UnitySensors

ROS/ROS2 enabled Sensor models (Assets) on Unity
Apache License 2.0
191 stars 28 forks source link

IMU linear acceleration is relative to origin and not sensor #162

Open Jarhead20 opened 2 days ago

Jarhead20 commented 2 days ago

I added an IMU sensor and put it on a 45 degree angle, then the game object was dragged in the editor to generate some data. The below image shows the data captured in RQT and shows both the X and Y linear accelerations changing. The expected behaviour is to have only the X or the Y linear accelerations change as it would be on a physical IMU. The current behaviour shows the acceleration relative to the origin and not the sensor itself. I am using version 2.0.4.

image

Jarhead20 commented 2 days ago

https://github.com/Field-Robotics-Japan/UnitySensors/assets/62244227/3dbf8a3a-148e-47f8-9384-52137f280dc1

Jarhead20 commented 1 day ago

Another related problem is that since the IMU rotation is relative to the orign, when the imu starts, it isn't initialised to 0 degrees. Instead it starts at whatever the angle is in the simulator. I would suggest a button to toggle between relative and absolute rotation.

Autumn60 commented 1 day ago

@Jarhead20 Thanks for the Issue report!! 🙏

You are right. IMU angles and angular velocities do not seem to be relative.

As I am busy this week, I will fix this next week.