I want to make a robot arm with a gripper that can go to any x y z coordinates near it. the robot itself will be simple just servo motors and Arduino but I don't know how to make reach the desired coordinates, any ideas?
There are multiple way to do so. It depends on how much effort you want to put in. In any case, you'll have to do some math and define your frames.
As @lucab said you can calculate those set of equations.
Then compute the inverse kinematics .
This will let you find the set of angles your joints need to have in order for the end of your arm to reach the desired position.
Another popular approach with robotic arms is to use the Denavit-Hartenberg convention. This convention allows you to define your arm joints with another set of parameters.
Then you can use these parameters to build your arm model thanks to Peter Corke Toolbox. This toolbox allows you to do:
- forward kinematics: which mean you it will calculate for you the position of the end of the arm for a desired set of angles
- inverse kinematics: calculate the set of angles needed to get to a position.
If you need more details, feel free to ask.
Determining your x, y, and z depends greatly on how many Degrees of Freedom (DoF) the robotic arm has (which in most cases is just the amount of joints or servos there are not counting the end effector)
You may want to dive into the world of forward and inverse kinematics. In a nutshell:
forward kinematics is generally used when you have your joint angles and want to find your x, y, and z.
Inverse kinematics is used when you know what your x, y, and z is but you want to find your joint angles.
Forward kinematic equations are almost always easier to solve for than inverse kinematic equations since they usually guarantee closed form solutions whereas inverse kinematics makes no such guarantee.
The more accurate your sensors are in measuring angular displacement, the more accurate your end effector will be to the x, y, and z you choose. The process will be something like this:
Select position (x, y, z) --> plug position into inv kin equ to get thetas --> command motors to thetas
Although it may seem like you have no interest in forward kinematics, its actually very helpful in solving the inverse kinematic equations.
Start with forward kinematics, obtain what your x, y, and z equations are as a function of generic thetas (x(θ1, θ2, θ3, ...), y(θ1, θ2, θ3, ...), z(θ1, θ2, θ3, ...)), and perform inverse kinematics by turning the x, y, and z equations, which are functions of thetas, to theta equations as a function of generic x, y, and z (θ1(x, y, z), θ2(x, y, z), θ3(x, y, z), ...).
Where your thetas are your joint angles with respect to your previous link axis.
If still having issues understanding forward or inverse kinematics after researching (many textbooks seem to make it more complicated than it actually is), let me know and I can derive a couple examples.
In order to do forward kinematics, it helps to know transformation matrices. Here is a video I put together awhile ago. Not the best video, but I plan on redoing them and making a series about this type of stuff when I get the free time.
Once you understand transformation matrices, its a matter of giving your robot several coordinate systems in unique places. Could be at each joint, or could be using the denavit-hartenberg (DH) technique to reduce the amount of parameters needed to describe the relation between coordinate systems to 4 parameters.
After the coordinate systems are in place, you'll need to multiply various rotation and translation operators with one another to get from a base coordinate system to your end effector coordinate system. Or in other words, you need to find the combination of rotations and translations to get your base coordinate system overlaid on top of your end effector coordinate system.
Once the combination of Rots and Trans operators are found, multiply them all together to get your transformation matrix of your end effector with respect to your base. It'll be a 4x4 matrix; just pick off the 3x1 vector in the top right and you'll have your x, y, and z equations that will tell you your end effector position given your thetas.
Now the difficult part:
You want to derive what your thetas should be to get to a position of your choosing, not the other way around. So use those 3 equations you picked off of the transformation matrix to to help you solve for thetas given an x, y, and z.
Unfortunately determining the thetas from these equations can be somewhat tricky, and sometimes, depending on how crazy your robot configuration is, there is no solvable answer using this approach.
If you have a three or four DoF robot (not including the end effector), and not doing anything too crazy, you should be able to solve for it using some high level algebra.
In order to help you further with the inverse kinematics, you will either need to provide the forward kinematic equations, or show what configuration you plan on having the servos in; but hopefully this was enough to push you in the right direction.
What you need is a set of equations that gives you the joint parameters of your robot as a function of the desired end-effector position. For this, you need to compute the inverse kinematics of your robot. Depending on how complex your robotic arm is, deriving those equations might be tricky and multiple solutions (or poses) can be possible. This page explains how to use the inverse Jacobian Matrix method to derive the inverse kinematics.