I'm new to arduino and have no prior coding background. so forgive me for being a n00b/dumb ass etc.
I'm using the Pololu minimu v3 9dof -> https://www.pololu.com/product/2468
It comes with the minIMU-9 program as seen in the resources section on the Pololu website.
What i want to do is use the IMU for station keeping/hover mode for a model ROV i'm building.
To do this i want to take the accelerometer data for the x axis from the IMU. Then integrate this data twice so that i can get position. If i'm correct the first integration will give me velocity and the second integration will give me position.
Next i want to store the x-axis position value when a button is pressed; as this will be my desired position. Then by continuously comparing the position data to the position that I have stored I should be able to get the error between these two positions (could also be called the displacement?). I then want to print this error in the serial monitor.
After doing this for the x-axis i will repeat it for the z-axis.
later I want to use this error to control bilge pumps so I can have the rov maintain its position.
not sure i made that more confusing than it needed to be or not so this might be easier to follow...
integrate accel_x to find velocity_x integrate velocity_x to find position_x
store position_x when button (high) stored position = desired_x
desired_x - position_x = error_x
If anyone can help at all it would be greatly appreciated!