Tài liệu báo cáo trình bày chi tiết từng bước thiết kế Solidwork, tính toán động học robot, khởi tạo lâp trình giao diện điều khiển Matlab cho robot 3 bậc tự do.
INTRODUCTION
OVERVIEW
SolidWorks is what we call as “parametric” solid modelling using for 3-D design modelling. Parametric means that the dimension have relationship with one another and able to changed when design process and automatically changes the solid part.
The following is an overview of 4 DOF Arm Robot that the team has designed:
Figure 1.1: 3-D design model of robot in SolidWorks
Figure 1.2: Schematic of 4 DOF Arm Robot
ROBOT BASE DESIGN
The following is a model of the base that the team designed with the following shaft placement method:
- The Z axis is directed along the motor's axis up.
- The X axis is oriented from the inside out.
- Y-axis according to the rule of the right hand we get.
DESIGN LINK 1
The following is the link model 1 that the team designed with the following axis method:
- The Z axis is oriented in the direction of the motor's axis from the inside out.
- Truc X direction along the robot link length from left to right.
- The Y-axis according to the original rule, the right hand should face up.
DESIGN LINK 2
The following is the link 2 model that the team designed with the following axis method:
- The Z axis is oriented in the direction of the motor's axis from the inside out.
- Truc X direction along the robot link length from left to right.
- The Y-axis according to the original rule, the right hand should face up.
DESIGN LINK 3
The following is the link 3 model that the team designed with the following axis placement method:
- The Z axis is oriented in the direction of the motor's axis from the inside out.
- Truc X direction along the robot link length from left to right.
- The Y-axis according to the original rule, the right hand should face up.
DESIGN LINK 4
The following is the link 3 model that the team designed with the following axis placement method:
- Z axis keeps the same direction according to the front 3 link
- Truc X direction along the robot link length from left to right.
- The Y-axis according to the original rule, the right hand should face up.
Figure 1.7: Robot Link 4 Model and executive structure
CONNECTING SOLIDWORKS AND MATLAB SIMULINK
- Step 1: Download the Simscape file to link Solidworks with Matlab according to the appropriate Matlab version.
Figure 1.9: File Simscape after download
- Step 2: Run the installation code in Command Windows
Type install_addon('smlink.r2022a.win64.zip') to install simscape library.
- Step 3: Link Solidworks with Matlab
First, go to Add_Ins to open the Simscape dialog box
Figure 1.10: Select Add-Ins to add the Simscape library
Then tick simscape Multibody Link and select OK
Figure 1.11: Choose Simscape Multibody Link
Next will export the Solidworks file to Matlab
Figure 1.12: Export file Solidworks to Matlab
Figure 1.13: Simscape Multibody Link model
CALCULATION OF QUALITY ROBOT ARM KINEMATICS
FORWARD KINEMATICS
Forward kinematics is the use of robot kinematics equations to calculate and control the actuator, and to be able to find the velocities and accelerations of the actuator and joints In particular, forward kinematics is also the basis for deducing robot dynamics.
Figure 2.1: Set the coordinate system for the robot
Base on figure 2.1 above, we have Denavit Hartenberg Parameters table:
Summary of the shaft placement process:
1 Identify the matching axes and imagine (or draw) infinite lines along them Since steps
2 to 5 below, consider two of these neighborhood lines (at the axis and + 1).
2 Determine the common perpendicular between them, or intersection At the intersection or at the point where the common perpendicular meets the th axis, assign the link frame origin.
3 Assign the pointer axis along the th joint axis.
4 Assign the pointer axis along the common perpendicular, or, if the axes intersect, the intersection as the normal to the plane containing the two axes.
5 Assign the axis to complete a right coordinate system.
6 Assign (0} to match (1} when the first matching variable is 0 For (N}, choose an origin and direction freely, but generally cause a lot of binding parameters) becomes zero.22Equation Section (Next)
After calculation, we get the forward kinematics We have a general transformation matrix from the system i -1 to i
1 1 1 1 1 cos( ) sin( ) 0 sin( ) cos( ) cos( ) cos( ) sin( ) sin( ) sin( )sin( ) cos( )sin( ) cos( ) cos( )
323\* MERGEFORMAT (.) Homogeneous conversion matrix from system 0 to system 1:
Homogeneous conversion matrix from system 1 to system 2:
Homogeneous conversion matrix from system 2 to system 3:
Homogeneous conversion matrix from system 3 to system 4:
Homogeneous conversion matrix from system 4 to system 5:
828\* MERGEFORMAT (.) Homogeneous conversion matrix from system 0 to system 5:
MERGEFORMAT (.) The position of the endpoint relative to the system 0:
INVERSE KINEMATICAL CALCULATION
Inverse kinematics is the use of kinematics equations to determine the motion of the robot to reach the desired position Inverse Kinematics Algebraically:
(.) Square both sides of the system of equations, we get:
Add both sides to get:
From angle 3 finded we calculate angle 2 follow expression (2.14):
Replace s2 to c2 ta we have:
MERGEFORMAT (.) Replace c2 to s2 we have:
Geometric method inverse kinematics
DESIGN GUIDE
GUIDE INTRODUCTION
When you press the Start button, the program will switch to the console below:
Here is the of introduction interface: function varargout = START(varargin)
% START MATLAB code for START.fig
% START, by itself, creates a new START or raises the existing
% H = START returns the handle to a new START or the handle to
% START('CALLBACK',hObject,eventData,handles, ) calls the local
% function named CALLBACK in START.M with the given input arguments.
% START('Property','Value', ) creates a new START or raises the
% existing singleton* Starting from the left, property value pairs are
% applied to the GUI before START_OpeningFcn gets called An
% unrecognized property name or invalid value makes property application
% stop All inputs are passed to START_OpeningFcn via varargin.
% *See GUI Options on GUIDE's Tools menu Choose "GUI allows only one
% See also: GUIDE, GUIDATA, GUIHANDLE
% Edit the above text to modify the response to help START
% Last Modified by GUIDE v2.5 05-Jan-2023 07:28:42
% Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename,
'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end
% End initialization code - DO NOT EDIT
% - Executes just before START is made visible. function START_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to START (see VARARGIN)
% Choose default command line output for START handles.output = hObject;
% Update handles structure guidata(hObject, handles);
% UIWAIT makes START wait for user response (see UIRESUME)
% uiwait(handles.figure1); clc axes(handles.axes1); imshow('C:\Users\acer\Desktop\anh.png');
% - Outputs from this function are returned to the command line. function varargout = START_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure varargout{1} = handles.output;
% - Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA) close; run interface_control.m
CONTROL INTERFACE
- Forward Kinematic: calculate forward kinematics.
- Px: display the x-coordinate position of the robot endpoint.
- Py: display the y coordinate position of the robot endpoint.
- Pz: display the z coordinate position of the robot endpoint.
- Stop button: stop the program.
- Reset button: reset the initial value for the robot.
Here is the code of control interface:
The code of sliders: function slider6_Callback(hObject, eventdata, handles)
% hObject handle to slider6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
ModelName = 'Assem_matlab'; global var; t1=get(handles.slider6,'value'); %lay gia tri tu cac slider set(handles.edit1,'string',num2str(t1)); %hien thi cac gia tri tu slider ra edit t2=get(handles.slider2,'value'); set(handles.edit2,'string',num2str(t2)); t3=get(handles.slider3,'value'); set(handles.edit3,'string',num2str(t3)); t4=get(handles.slider4,'value'); set(handles.edit4,'string',num2str(t4)); set_param([ModelName '/Slider Gain'],'Gain',num2str(t1)) %truyen cac thong so cua cac thanh slider trong guide vao khoi slider gain set_param([ModelName '/Slider Gain1'],'Gain',num2str(t2)) set_param([ModelName '/Slider Gain2'],'Gain',num2str(t3)) set_param([ModelName '/Slider Gain3'],'Gain',num2str(t4)) d15; l1E; l20; l30; l4f.21;
Px =l3*cos(t2 + t3)*cos(t1) - l1 + l2*cos(t1)*cos(t2) + l4*cos(t2 + t3 + t4)*cos(t1);
Py =sin(t1)*(l3*cos(t2 + t3) + l2*cos(t2) + l4*cos(t2 + t3 + t4));
Pz + l3*sin(t2 + t3) + l2*sin(t2) + l4*sin(t2 + t3 + t4); set(handles.edit6,'string',num2str(Px)); set(handles.edit7,'string',num2str(Py)); set(handles.edit8,'string',num2str(Pz));
The code of Run button: function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%open the simulink model open_system(ModelName); set_param(ModelName,'BlockReduction','off'); set_param(ModelName,'StopTime','inf'); set_param(ModelName,'SimulationMode','normal'); set_param(ModelName,'StartFcn','1'); set_param(ModelName,'SimulationCommand','start');
The code of Close button: function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
ModelName = 'Assem_matlab'; close; open_system(ModelName); set_param(ModelName,'BlockReduction','off'); set_param(ModelName,'StopTime','1'); set_param(ModelName,'SimulationMode','normal'); set_param(ModelName,'StartFcn','1'); set_param(ModelName,'SimulationCommand','stop');
The code of Default button: function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
ModelName = 'Assem_matlab'; global var; t=0; set(handles.edit1,'string',num2str(t)); %hien thi cac gia tri tu slider ra edit set(handles.slider6,'value',t); set(handles.edit2,'string',num2str(t)); set(handles.slider2,'value',t); set(handles.edit3,'string',num2str(t)); set(handles.slider3,'value',t); set(handles.edit4,'string',num2str(t)); set(handles.slider4,'value',t); t1 = get(handles.slider6,'value'); set(handles.edit1,'string',num2str(t1)); t2 = get(handles.slider2,'value'); set(handles.edit2,'string',num2str(t2)); t3 = get(handles.slider3,'value'); set(handles.edit3,'string',num2str(t3)); t4 = get(handles.slider4,'value'); set(handles.edit4,'string',num2str(t4)); set_param([ModelName '/Slider Gain'],'Gain',num2str(t1)); %truyen cac thong so cua cac thanh slider trong guide vao khoi slider gain set_param([ModelName '/Slider Gain1'],'Gain',num2str(t2)); set_param([ModelName '/Slider Gain2'],'Gain',num2str(t3)); set_param([ModelName '/Slider Gain3'],'Gain',num2str(t4)); d15; l1E; l20; l30; l4f.21;
Px =l3*cos(t2 + t3)*cos(t1) - l1 + l2*cos(t1)*cos(t2) + l4*cos(t2 + t3 + t4)*cos(t1);
Py =sin(t1)*(l3*cos(t2 + t3) + l2*cos(t2) + l4*cos(t2 + t3 + t4));
Pz + l3*sin(t2 + t3) + l2*sin(t2) + l4*sin(t2 + t3 + t4); set(handles.edit6,'string',num2str(Px)); set(handles.edit7,'string',num2str(Py)); set(handles.edit8,'string',num2str(Pz));
The code of Solve button: function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
ModelName = 'Assem_matlab'; global var;
Px_new=get(handles.edit9,'string');
Px_new=str2num(Px_new);
Py_new=get(handles.edit10,'string');
Py_new=str2num(Py_new);
Pz_new=get(handles.edit11,'string');
Pz_new=str2num(Pz_new); t234_new=get(handles.edit17,'string'); t234_new=str2num(t234_new);
% calculate t1 s1=Py_new; c1=l1+Px_new; t1=atan2d(s1,c1);
% calculate t3 nx=l1*cosd(t1)+Px_new*cosd(t1)+Py_new*sind(t1)-l4*cosd(t234); ny=Pz_new-d1-l4*sind(t234); c3=(nx^2+ny^2-l3^2-l2^2)/(2*l2*l3); s3=sqrt(1 - c3^2); t3=atan2d(s3,c3);
% calculate t2 c2=(nx*(l3*cosd(t3)+l2)+l3*sind(t3)*ny)/((l3*cosd(t3)+l2)^2+(l3*sind(t3))^2); s2=(ny*(l3*cosd(t3)+l2)-l3*sind(t3)*nx)/((l3*cosd(t3)+l2)^2+(l3*sind(t3))^2); t2=atan2d(s2,c2);
% calculate t4 t4=t234-t2-t3; set_param([ModelName '/Slider Gain'],'Gain',num2str(t1)); set_param([ModelName '/Slider Gain1'],'Gain',num2str(t2)); set_param([ModelName '/Slider Gain2'],'Gain',num2str(t3)); set_param([ModelName '/Slider Gain3'],'Gain',num2str(t4)); set(handles.edit12,'string',num2str(t1)); set(handles.edit13,'string',num2str(t2)); set(handles.edit14,'string',num2str(t3)); set(handles.edit15,'string',num2str(t4));
The code of edit text: function edit1_Callback(hObject, eventdata, handles)
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
ModelName = 'Assem_matlab'; global var; t1_new=get(handles.edit1,'string'); t1_new=str2num(t1_new); set(handles.slider6,'value',t1_new); t1=t1_new; t2 = get(handles.slider2,'value'); set(handles.edit2,'string',num2str(t2)); t3 = get(handles.slider3,'value'); set(handles.edit3,'string',num2str(t3)); t4 = get(handles.slider4,'value'); set(handles.edit4,'string',num2str(t4)); d15; l1E; l20; l30; l4f.21;
Px =l3*cos(t2 + t3)*cos(t1) - l1 + l2*cos(t1)*cos(t2) + l4*cos(t2 + t3 + t4)*cos(t1);
Py =sin(t1)*(l3*cos(t2 + t3) + l2*cos(t2) + l4*cos(t2 + t3 + t4));
Pz + l3*sin(t2 + t3) + l2*sin(t2) + l4*sin(t2 + t3 + t4); set(handles.edit6,'string',num2str(Px)); set(handles.edit7,'string',num2str(Py)); set(handles.edit8,'string',num2str(Pz)); set_param([ModelName '/Slider Gain'],'Gain',num2str(t1_new));
CONCLUSION AND DEVELOPMENT
CONCLUSION
After completing this topic, the group has
- Design a four-step robot arm.
- Draw the coordinate system diagram and make the DH table.
- Calculate the forward and reverse kinematics for the robot arm.
- Design the introduction and control interface on Matlab.
- Successfully run forward and reverse kinematics simulation on Matlab.
DEVELOPMENT
Inheriting the advantages and improving the limitations, the team made a number of proposals and development directions to optimize the system:
- Design more robots with 5.6 steps to investigate the kinematics of robots with more steps.
- Optimize the interface further and add many other functions such as reading G-Code, applying more image processing to the robot.
- Remote monitoring and control via HMI, internet and IoT application to industrial robots.
- Design any additional controller to monitor and minimize system error.