-1

I have been measuring the change in orientation of a 3D shape (a 3-space sensor) with different starting positions for a controlled end position. I am using Euler angles, (P)itch, (R)oll and (Y)aw.

My measure of orientation change Is: Orientation change OC = |dP| + |dR| + |dY|

The 3 starting positions differ only in sensor roll in degrees:

1). 0

2). 45

3). 90

With each starting position the sensor is tared then elevated to 30 degrees along the roll axis.

The problem is that for 1). & 3). as expected I get OC = 30, representing only pitch and only yaw error of 30 degrees respectively. However for 2). OC is significantly >30 being a sum of non-zero pitch, roll and yaw.

Is this as expected? Assuming it is, is there a better measure of OC which is not sensitive to starting position?

Ant
  • 69
  • 1
  • 11
  • Please describe the underlying problem in more detail (what method generates the error?). It seems your positional error is actually an orientation error. Taking the difference in Euler angles might work for small differences, but it is not expressive in general. Try a quaternion distance or similar instead. – Nico Schertler Nov 19 '19 at 16:30
  • Hi Nico, I've edited the question hopefully to describe the problem better. The underlying problem is that for the same rotation angle about an axis through the midpoint of the sensor, I get different OC* values depending on the starting position of the sensor. I need a better formula for OC which remains constant. – Ant Nov 19 '19 at 17:00
  • I was suggesting a quaternion distance: Compute the unit quaternion for both orientations and take their dot product. – Nico Schertler Nov 19 '19 at 17:18
  • But if I tare the sensor in the start position, I only have the quaternion for the final position, of the form (a,b,c,d). Presumably if I'm using quaternions the tare is unnecessary anyway - it was done to avoid as gimbal lock. – Ant Nov 19 '19 at 18:03
  • Since you haven't described at all what you are actually doing, there is no way to make any further suggestions. Your question was how to measure a change in orientation. The answer is to take a quaternion distance or similar. If you already have a difference rotation represented as a single quaternion, then just take its `w` component (or `arc cos(w)` if you want an angle). – Nico Schertler Nov 19 '19 at 22:09
  • You are correct, the w component now gives me a consistent measure independent of starting position. Thank you! Not sure how I can mark your answer as correct? – Ant Nov 20 '19 at 11:13
  • I believe the angle is 2 x arccos(w) from experiment and further reading – Ant Nov 20 '19 at 22:46
  • Yes, this is the angle of the rotation. – Nico Schertler Nov 20 '19 at 23:51

1 Answers1

0

The answer supplied by Nico in the comments:

Was to use a quaternion distance, this was the dot product of the initial and final quaternions which my sensor supplied as unit quaternions where x2 + y2 + z2 + w2 = 1

The dot product was given by: dot = xi.xf + yi.yf + zi.zf + wi.wf

Furthermore I used the relative angle theta (radians) between these quaternions given by: Theta = 2cos-1(dot)

The sensors gave greatly improved results using theta, which only improved more when they had a gradient descent calibration applied.

Ant
  • 69
  • 1
  • 11