I have an IMU attached to each of the segments of a robotic arm, which gives me accelerometer and gyroscope data. My goal is to first of all improve the quality of the sensor readings and subsequently get the angles of each of the joints.

I'm new in robotics, but as far as I can see, I need a sensor fusion algorithm (e.g., complementary filter or Kalman filter) to improve the quality of the sensor readings. Subsequently, how can I calculate the angles between each of the joints using this data?

Can this be done in one go (i.e., can you use the output of the complementary filter to get the angles)? Are there reference implementations in Python available?


I don't understand which type of sensor fusion you like to do. You said you are using IMU and generally it gives you the orientation and accelerations.

If you have the quaternion $\textbf{q}=(w,x,y,z)$ then your axis of rotation is vector $\textbf{v}=(x,y,z)$ and joint displacement (angle) is given by


  • $\begingroup$ Basically, I get the raw accelerometer, gravity and gyroscope data. From these raw data values, I want to calculate the angles of the joints. I thus don't get the joint angles from the actuators. $\endgroup$ – MaVe Mar 7 '19 at 8:52
  • $\begingroup$ Are you getting Eular angles or Quaternions from your IMU? $\endgroup$ – Franky Mar 7 '19 at 9:25
  • $\begingroup$ No, only the raw data. $\endgroup$ – MaVe Mar 7 '19 at 9:54
  • $\begingroup$ You should read the User Manual from the manufacturer of IMU and understand how you can translate this data into useful information like Eular angles or quaternions. $\endgroup$ – Franky Mar 7 '19 at 10:17
  • $\begingroup$ I'm looking for a more generic solution/algorithm, which e.g., can be parametrised with manufacturer-specific settings. Would this be available? $\endgroup$ – MaVe Mar 7 '19 at 11:15

There has been a lot of research done in joint angle estimation using IMUs and it works as the principle technology behind segways, self-balancing robots and humanoid robots as well.

The theoretical concept is that gyroscope gives you the orientation of the sensor and using it in conjunction with the pre-determined mounting orientation of the sensor, you can find the orientation of the link itself. An accelerometer basically computes acceleration and its double integration can give you the linear motion. Additional resource to understand IMUs is the this lecture from the Virtual Reality course EE267 at Stanford.

Improving and cleaning up the sensor data is very important for the IMU due to drifting and biasing reasons and Kalman Filtering and its variants are definitely the most used technologies to resolve this. Theoretical concepts are well explained in this presentation on Inertial Navigation and Kalman Filtering by Navlab while TKJ Electronics has a highly-starred Kalman Filtering implemented on IMUs codebase on Github.

However, I am not sure by what you mean by doing it in one go.

PS: You shoudl refer to this paper IMU-Based Joint Angle Measurement for Gait Analysis for and end-to-end discussion on your concerned task.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.