If you use an orientation sensor, like an accelerometer, mount it anywhere that makes sense to you. It will tell you the direction of "down" (defined by gravity) with respect to the sensor mounting position and orientation.
If you take a few moments to post and explain a diagram of the machine, and all the angles that are relevant to the problem, you will get better answers.
Thank you for the suggestions. Attached is the model of prosthetic knee. I am designing something similar to that. I am interested in measuring knee flexion and extension angle precisely.
jremington:
It is very popular to measure that angle, therefore there are a number of techniques, all described on the web, with pictures.
Use your favorite search engine with the phrase "measure knee flexion angle" to find them.
These techniques are generally used to find knee flexion angle of healthy human leg in clinics. However, i am interested in using a sensing scheme in robotic/prosthetic knee joint.
I have searched keyword you suggested, but i could not come up with a solution that i an work on implementation.