Page 1 of 1

Angular Deviation from the Vertical Axis

Posted: 24 Jul 2020, 13:11
by Essembly
Good day. I am working on Self-balancing robot project which is a simple rectangular body on two wheels. I have to develop a way to calculate angular deviation (theta) of the robot from vertical axis as well as the rate of change of this deviation (dtheta/dt). Here is a pic: https://imgur.com/ID1Auun

While I was working only in 1 axis, this job was easily fulfilled with getObjectOrientation function as I just read the asbolute value of beta angle. But now I want the robot to balance in any orientation (around Z), and hence if we turn him 90deg, his beta anlge will read 0 while his alpha angle will give us the actual angle devition.

I simply want an algorithm that gives the angle deviation of the robot with respect to the vertical (Z axis) where the angle is negative if the wheels are further than his body's COG and the angle is positive when the wheels are behind his body's COG. My experiements with the accelerometer showed very noize results so I would rather prefer a solution that doesn't require it. Thank you in advance!

Re: Angular Deviation from the Vertical Axis

Posted: 24 Jul 2020, 16:20
by Essembly
RESOLVED: Let me know if anyone wants to see my code.

Re: Angular Deviation from the Vertical Axis

Posted: 22 Nov 2021, 15:55
by shreyas7738
Hey I am working on similar project and would like to know how you solved the problem.