01
def
flask.route('/')
1
0
if ai.ready():
1
SELECT
0
render(app)
1
0
import pandas
0
1
df.fillna(0)
1
0
SELECT *
FROM clients
0
1
0
plt.show()
1
0
0
1
1
0
sql.connect()
1
AI
0
1
0
module.exports
1
0
return result
1
0
0
1
0
async def run():
1
0
1
1
0
for i in range(n):
0
1
0
1
0
1
PLC.run()
1
0
1
0
1
0
def predict(x):
1
0
1
vba.exe
0
0
1
1
try(x)
0
1
0
1
0
web.deploy()
1
0
1
0
0
1
CAD.export()
1
0
1
1
0
0
1
MATLAB
0
1
0
1
0
1
0
1
0
MATLAB

2-DOF Planar Robotic Arm

A MATLAB simulation of a two-link planar robotic arm (2-DOF) that calculates where the tip of the arm ends up for a given pair of joint angles, and maps every point the arm can reach. Forward kinematics: with link lengths of 1.0 and 0.8 units, a first joint angle of 45° and a second joint angle of 30° relative to the first link, the script uses trigonometry to calculate the position of the elbow joint and of the end effector: x = L1·cos θ1 + L2·cos(θ1 + θ2) and y = L1·sin θ1 + L2·sin(θ1 + θ2). The result, an end effector at about (0.91, 1.48), is plotted as the arm itself, with the base, the joint and the end effector labelled. Reachable workspace: the script then sweeps both joints from −180° to 180° in 5° steps, which is 5,329 joint combinations, and plots where the end effector lands each time. The result is a ring. The arm can reach any point between an outer radius of 1.8 (both links fully stretched, L1 + L2) and an inner radius of 0.2 (links folded back, |L1 − L2|), with a dead zone around the base that it can never reach. The final figure overlays the arm on its workspace and is exported as a 300 dpi image. Why it matters: the workspace shows, before anything is built, whether an arm geometry can reach the points a task needs, and how the link lengths change that. This is the first step in designing pick-and-place arms, robotic welding and painting arms, camera and antenna positioners, and two-axis CNC and plotter mechanisms. The same forward-kinematics equations are the starting point for adding inverse kinematics and motion control.

2-DOF Planar Robotic Arm screenshot
2-DOF Planar Robotic Arm screenshot
2-DOF Planar Robotic Arm screenshot

Source Code

% Robot parameters
L1 = 1.0;  L2 = 0.8;
theta1 = 45;  theta2 = 30;

% Forward kinematics
x1 = L1 * cosd(theta1);
y1 = L1 * sind(theta1);
x2 = x1 + L2 * cosd(theta1 + theta2);
y2 = y1 + L2 * sind(theta1 + theta2);

% Reachable workspace: sweep both joints
for t1 = -180:5:180
    for t2 = -180:5:180
        x = L1 * cosd(t1) + L2 * cosd(t1 + t2);
        y = L1 * sind(t1) + L2 * sind(t1 + t2);
        workspace_x(end+1) = x;
        workspace_y(end+1) = y;
    end
end

scatter(workspace_x, workspace_y, 8, '.');

Full source code is available to licensed clients. Contact us