You know that mathematics are everywhere, and especially in robotics.

But, if you just want to program robots, is it really important? Could you succeed without it?

So, should you learn mathematics to program robots? The answer is: yes and no. Quite useful, right? Because it’s not as simple as that.

Keep reading so you’ll understand if and when you need to learn some mathematics, depending on what you want to achieve.

Table of Contents

## When you start a new project: use libraries

You can use tons of libraries that will allow you not to do the maths yourself.

Let’s imagine that you have to compute the inverse kinematic of a robot. Well, this involves a lot of mathematics. Soon you’ll read stuff about the Denavit-Hartenberg parameters, and your motivation will start to fade.

How could you possibly use that in your code, without spending a huge amount of time understanding the maths? Time, of course, that you won’t spend on developing your robot software.

Well, this is a problem you can solve (at least temporary). **Instead of trying to do the maths yourself, what if you could find a library that can do the maths for you?** That’s the good question to ask, especially if you want to progress fast on your prototype or small project.

For this specific example, you can quickly find the KDL from Orocos: Kinematics and Dynamics Library. This is a C++ library you can use directly in your code. Provided that you learn how to use it, you won’t have to use Denavit-Hartenberg or any other advanced mathematical knowledge.

And, if you continue looking, you’ll soon find the Moveit library from ROS. This library allows you to specify your robot parameters (distances between joints, types of joints, etc) in a single XML representation called URDF: Unified Robot Description Format. Then Moveit will use the URDF to compute inverse kinematics.

Not only that, it will also do complete path and motion planning for you! So you get even more stuff than what you’ve asked.

Searching for libraries instead of learning the required mathematics is a great solution if you want to develop faster, especially for a small project or prototype. In fact, I’d advise you to use libraries even if you have the mathematical knowledge. This will save you some time in the short term anyway.

## Where do you need mathematics

Even if you can use libraries that hide the mathematical knowledge, mathematics are still everywhere in robotics.

**And if you want to really get serious in programming robots, you’ll eventually have to learn some maths, and know how to translate the maths into code.**

Sometimes, a library will not do exactly what you want. Or, the license of the library will be a problem for your project. Or simply, the library is just an overkill for your application, because the mathematical problem you have is maybe not so hard to solve.

Here is a non-exhaustive list of where you’ll find mathematics in robotics:

**Kinematics**: includes forward and inverse kinematics. This is especially useful for robotic arms.**Velocity and acceleration**: if your robot is moving (which is probably the case), you’ll need to know how to compute a velocity from a position data, and how to compute an acceleration (and vice versa). To go even further, I could add the computation of the jerk, which represents the variation in acceleration and can be very important for smooth movements.**Path planning**: which path should the robot take to reach the destination? How to optimize this path?**Motion planning**: given a path, which velocity and acceleration should you apply to each joint of the robot at any time? And how do you ensure the max velocity constraints can be respected?**Angles**: you’ll need to know how to switch from degrees to radians, how to switch from Euler angles to a quaternion, etc.**PID control**: PIDs are often used to control motors and some actuators. This control system is full of maths.**Interpolation**: given a set of points, you’ll often have to interpolate between them, using a polynomial expression for example.**Machine learning**: well I won’t go into much details here, but as you can guess, this is also full of mathematics.**Image processing**: here you’ll need at least solid geometry basics.**Logical reasoning**: if you study logic in mathematics, this will help you a lot in programming, whether you program robots or not.- …

If you think this list is long, well, I’m sorry to say this is maybe less than 10% of all the maths you’ll come across when programming robots! And if you ask someone else with a different background than me, he/she will probably come up with a totally different list.

## What robotics programmer do you want to be?

As you saw in this post, mathematics is everywhere in robotics. You’ll certainly have to learn some maths basics, but the overall required knowledge really depends on what you want to do.

If you want to **develop web applications for robots**, and not the robot itself, well in this case much of the mathematical knowledge listed before doesn’t apply to you.

If you want to **develop low-level code, at the firmware level** on micro-controllers, PID control and system control in general will be a must-have for you.

And if you want to **develop the core software of a robot** – the decision algorithms to move the robot, how the robot moves its joints, etc – well in this case, you can’t escape mathematics. Of course you can (and should) start with some libraries to go easy and fast, but one day or another you’ll have to learn some maths.

So, before diving head first into robotics programming, make sure that you either have some knowledge in mathematics, or that you’re at least interested in maths.

**And, as you’ll see, it all seems very complicated until you finally understand and think: well that’s finally not so hard!**