Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Jarhead20 opened this issue Jul 1, 2024 · 6 comments
Open

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

Jarhead20 opened this issue Jul 1, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@Jarhead20
Copy link

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
Copy link
Author

2024-07-01.16-36-50.mp4

@Jarhead20
Copy link
Author

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
Copy link
Contributor

Autumn60 commented Jul 1, 2024

@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.

@Autumn60 Autumn60 self-assigned this Jul 1, 2024
@Autumn60 Autumn60 added the bug Something isn't working label Jul 1, 2024
@Jarhead20
Copy link
Author

I forked the repo and have relative motion mostly working, I will finish my SLAM implementation to properly test it and I have also made a wheel encoder sensor. I also added the option to remove gravity and switch between absolute and relative modes. I'll create a pr for each once I have fully tested them.

@Autumn60
Copy link
Contributor

Autumn60 commented Jul 6, 2024

@Jarhead20

The implementation of IMUSensor.cs has been reviewed.
I am ashamed to say that I have little knowledge of IMU sensors and it is difficult to judge whether this is working properly.

May I ask you to check that the behaviour is what you expect?

https://github.com/Autumn60/UnitySensors/tree/fix/imu_relative_calc

@Jarhead20
Copy link
Author

I will be able to check the functionality of the sensor this time next week. In the meantime, you could compare the functionality of your code to what I was testing with. What I wrote seems to act like a real IMU sensor so if your code produces the same output then it should be good. It's a bit messy because it has my work on the encoder in the same branch. master...Jarhead20:UnitySensors:master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants