I am planning to use IMU for joint angle measurement of hand(shoulder ,elbow and wrist joint), I am confused about reference frames of accelerometer and gyroscope. According to my understanding accelerometer will measure angle between global reference frame and reference frame fixed on IMU , How to fix the global reference frame? I can only think of one axis along the direction in which gravitational force acts (vertically downwards), other two axis can have any direction in a plane perpendicular to gravitational force. Also my understanding about gyroscope is it will measure orientation with respect to its previous position using reference frame fixed on imu. To fuse it with accelerometer the angle value has to be calculated with respect to global reference frame. How can it be done?
Both the accelerometer and the gyro provide delta measurements. If you need an absolute reference, you need to provide it by another means. Even gravity is not a reliable reference because you can't tell what component of your acceleration is due to gravity and what is due to motion.
The accelerometers are not very good for angle measurements on their own. They measure linear acceleration, not rotation or angle. You can get a crude orientation out of them by assuming everything is static and therefore the acceleration vector is due entirely to gravity. The challenge is that the accel can't tell the difference between gravity and motion-- if you move the device, the acceleration will be the sum of gravity and motion leading to an ambiguous result.
A magnetometer can give an absolute reference to the earth's magnetic field, but it is sloppy and easily distorted.
The IMU probably has a reference frame labeled on the device that will give you a clue as to the internal arrangement of sensors, but that is still subject to manufacturing tolerances and is probably not labeled with care.
A common solution is to calibrate the device periodically using a technique known as a ZUPT (zero velocity update). Place the device in a known orientation, don't move it, let the filters settle out, and call that your global frame. From then, calculate your deltas from that pose. Errors will grow quickly, so you'll need to repeat this procedure periodically.
The ZUPT will cancel out accumulated measurement errors due to drift and bias, but if you want to coordinate measurements from multiple sensors (3 accelerometers, 3 gyros, for example) then you need to do an alignment calibration. You don't know how well aligned the various sensors are-- how orthogonal are the x,y and z accels and pitch, roll and yaw gyros to each other (they can't be perfect). Also, how coaxial is the yaw gyro with the z accelerometer, etc. This will require making controlled movements of the sensor set to check alignment. Generally this only needs to be done infrequently, and possibly at the factory. Your IMU may have the calibration parameters stored in it.
Every sensor is independent, so the system needs to have the various devices referenced to each other. That is what I referred to as an alignment calibration. That gives you a (non-orthogonal) coordinate system relative to some origin on the IMU itself. Then there are errors that will build over run time that need to be canceled, which the ZUPT will help with. As far as tying to a global reference frame external to the IMU, that needs to be done by some other form of measurement. Possibly by ZUPTing in a known reference pose, or by some external measurement system that can reference your local to global frames.