 ### Network # Calculating an single output from two inputs...maths help!

#### cps13

Feb 25, 2013
54
Hi,

I have an application where I am using two devices:

1) Absolute Encoder
2) Inclinometer

What I am doing is measuring the angle of a device in a single plane. My device is a pivoting arm which can move left/right and up/down. However, due to the mechanical setup, when the arm moves left to right, this also moves the arm up/down.

I'm not interested in my angle left/right other than using it as a measurement point. The only angle I am interested in, is from 0deg (vertical) to 90deg (horizontal). I know all of my input (calibration) values.

I can using my sensors calculate my angle accurately left/right and up/down. However, I a formula to compensate for one angle affecting the other. For example:

When my arm is pointing straight (left to right) the encoder reads 0.00 degrees, then if I push my arm down so it was at an angle of 40 degrees, my inclinometer would read 36.67degrees. If I now move my arm 40 degrees to the right (or left) then my inclinometer value would change to 39.09degrees, even though the vertical angle is actually still the same, this is because the arm is a fixed length and moves its location in free space, but the actual angle is the same.

I need to calculate a single output, from two varying inputs which are not always constant. I hope this makes sense.

thanks,

#### Nanren888

Nov 8, 2015
622
I have to say that I find the description confusing. Would love to help, but I just can't quite get what you are asking.

measuring the angle of a device in a single plane.
I presume this is the aim, for soem reason.
.
What I am doing is measuring the angle of a device in a single plane.
Where is that plane compared to your left-right & up-down?
A figure or two, perhaps?
.
When my arm is pointing straight (left to right) the encoder reads 0.00 degrees, then if I push my arm down so it was at an angle of 40 degrees, my inclinometer would read 36.67degrees.
So, nothing to do with the hprizontal rotation? Your inclinometer reads wioth a small error? Is that the message?
.
If I now move my arm 40 degrees to the right
So, when you say "arm", this is the whole assembly?
.
It now reads a lower incline? NOt obvious how this affects the inclinometer?
or was
measuring the angle of a device in a single plane.
The actual case somehow & not the aim?
NOt sure how I would measure incline in one plane on a rotating platform.
.
I guess if this is alreay in one plane, that is somehow the inclinometer does not rotate with the platform, then it's not going to work when they get near orthogonal. at right angles.
.
The maths of cylindrical rotation, cut by a plane, are not too bad. You have some trig I presume? Maybe google cylindrical coordinates.
Clarify situation, maybe explain where you have got to so far, or see if you get another reponse from some smarter than I am.

#### cps13

Feb 25, 2013
54
Ok, it is quite hard for me to explain but I will try a bit more. Fundamentally my device operates in two planes, X and Z. Where X is left to right and Z is up and down. It pivots in both the X and Z planes from a single point, imagine holding the end of a pen in your fingers, with your fingers as a fixed pivot point, you will be able to move the pen up/down and left/right and every combination of angles of up/down and left right. My device can move in this way, but, I am only interested in calculating the up/down angles.

The way it functions is the arm sits onto of something, then when the item underneath the arm moves up, down, left, right, the arm is supposed to read the angle of the item underneath it.

I have an inclinometer which measures up/down and an encoder which measures left/right - the encoder is only there to provide a reference measurement to try and improve accuracy.

1) Yes, only need to measure my Z plane.
2) X and X planes as above.
3) There is a slight offset to my inclinometer
4) Mechanically, due to where the inclinometer is mounted, when it moves left/right this affects the vertical position of the arm too. Because the arm is a fixed length and constricted to the pivot point.

I have put my data below. There are two sets, one for the inclinometer and one for the encoder. Column A shows the vertical angle of the arm, and rows 13 and 27 show the horizontal. For example, when the arm pointing to the floor it is zero degrees in Z, when the arm is at -80 in the X, it is 80 degrees to the left of centre.

Hopefully this will highlight however the valve of both the inclinometer and encoder change in relation to the position of the arm.

What I need to do, from this data, is find a way to accurately calculate my Z angle value after the impact of X is considered. Essentially work out the offset error caused by X. Using the column in white as my "correct" value for my inclinometer and row 17 as my "correct" for my encoder.

Thanks

My data... Last edited by a moderator:

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
13,475
imagine holding the end of a pen in your fingers, with your fingers as a fixed pivot point, you will be able to move the pen up/down and left/right and every combination of angles of up/down and left right.
As far as I understand this he up/down angle doesn't change when you rotate the arm in the X plane. You wouldn't have to take the rotation within the x plane into account. Either my understanding is wrong or your description.
If you can't describe the movement of the arm analytically as a set of rotations, you could approximate by using tables as above and interpolate between values.

#### cps13

Feb 25, 2013
54
As far as I understand this he up/down angle doesn't change when you rotate the arm in the X plane. You wouldn't have to take the rotation within the x plane into account. Either my understanding is wrong or your description.
If you can't describe the movement of the arm analytically as a set of rotations, you could approximate by using tables as above and interpolate between values.

No, the X values do change. Both the X and Z values will change when the arm only moves in one plane. Therefore:

If the arm moves only in the X plane, this will alter the X and Z values.
If the arm moves only in the Z plane, this will alter the X and Z values.

Example:

The arm is at 20 degrees in X and 20 degrees in Z
The X value is 22.06
The Z value is 29.30

The arm moves to 30 degrees in X and remains 20 degrees in Z
The X value is now 28.46
The Z value is now 30.75

I can interpolate all of the values for either the X or Z axis individually, i'm just not sure how to correct for error in one. My thinking so far is:

1) Use my Z axis (inclinometer) as my reference axis, as this is the more consistent of the two.
2) Apply a correction factor to the Z axis measurement based upon the current output of the X axis (encoder).

I'm just not sure mathematically how to figure out this correction factor.

Thanks

Replies
4
Views
345
Replies
1
Views
742
Replies
7
Views
1K
Replies
3
Views
4K
Replies
23
Views
2K