Modeling and Code Generation for a Robot Arm - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Applications and Example Worksheets : Science and Engineering : Modeling and Code Generation for a Robot Arm

Modeling and Code Generation for a Robot Arm

Introduction

This application models a robot arm with three degrees of freedom. To model the arm, the worksheet does the following:

 

• 

Analytically derives the Denavit & Hartenberg transformation matrix for each of the three joints

• 

Generates optimized C code for the angle of the third joint, in terms of the position of the end effector

• 

Lets the user specify a parametric path for the tip of the robot to follow

• 

Animates the robot following the parametric path

 

Reference:

Adapted from http://www.maplesoft.com/applications/view.aspx?SID=6850

Transformation Matrix for One Joint

(2.1)

Transformation Matrix of Tip with Respect to Base

Next, use parameters for a robot with a sequence of three arms and compute the transformation matrix for the tip of the robot with respect to its base.

Path for Robot Tip to Follow

This is the required path for the end effector, as a function of time.

Deriving Joint Angles

First Angle

(5.1.1)

Second Angle

(5.2.1)

Third Angle

(5.3.1)

Code Generation

This is the C code for the angle of the third joint as a function of the position of the end effector, and the arm lengths.

t1 = lengthArm3 + lengthTip;
t2 = t1 * lengthArm2;
t3 = x * x;
t4 = y * y;
t6 = z * z;
t8 = 0.2e1 * z * lengthArm1;
t9 = lengthArm1 * lengthArm1;
t10 = lengthArm2 * lengthArm2;
t11 = lengthArm3 * lengthArm3;
t13 = 0.2e1 * lengthArm3 * lengthTip;
t14 = lengthTip * lengthTip;
t15 = t3 + t4 + t6 - t8 + t9 + t10 - t11 - t13 - t14;
t16 = t15 * t15;
t18 = sqrt(t16 * (t3 + t4));
t25 = t1 * t1;
t29 = sqrt(-0.1e1 / t25 / t10 * (0.2e1 * t1 * lengthArm2 - t10 - t11 - t13 - t14 + t3 + t4 + t6 - t8 + t9) * (-0.2e1 * t1 * lengthArm2 - t10 - t11 - t13 - t14 + t3 + t4 + t6 - t8 + t9));
t32 = z - lengthArm1;
t38 = 0.1e1 / (t3 + t4 + t6 - t8 + t9);
t39 = 0.1e1 / lengthArm2;
t47 = atan2(t39 * t38 / t15 * (-t29 * t18 * t2 - t16 * t32), t39 * t38 * (-t29 * t32 * t2 + t18));
t49 = t47 + 0.3141592654e1 / 0.2e1;

Animation

 


Download Help Document