⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 invkine_codepad.html

📁 模糊控制工具箱,很好用的,有相应的说明文件,希望对大家有用!
💻 HTML
📖 第 1 页 / 共 3 页
字号:
            trained ANFIS networks as a reference, much like a lookup table, to determine what the angles of the arms must be, given a            desired location for the tip of the arm. Knowing the desired angles and the current angles of the joints, the system will            apply force appropriately on the joints of the arms to move them towards the desired location.         </p>         <p>The GUI demo <tt>invkine</tt> demonstrates how the two trained ANFIS networks have been used to trace an ellipse in the input space.         </p><pre class="codeinput">invkine</pre><img vspace="5" hspace="5" src="invkine_codepad_02.png"> <p>The two ANFIS networks used in the demo have been pre-trained and are deployed into a larger system that controls the tip            of the two-joint robot arm to trace an ellipse in the input space.         </p>         <p>The ellipse to be traced can be moved around. Move the ellipse to a slightly different location and observe how the system            responds by moving the tip of the robotic arm from its current location to the closest point on the new location of the ellipse.            Also observe that the system responds smoothly as long as the ellipse to be traced lies within the 'x' marked spots which            represent the data grid that was used to train the networks. Once the ellipse is moved outside the range of data it was trained            with, the ANFIS networks respond unpredictably. This emphasizes the importance of having relevant and representative data            for training. Data must be generated based on the expected range of operation to avoid such unpredictability and instability            issues.         </p>         <h2>Conclusion<a name="22"></a></h2>         <p>This demo illustrated using ANFIS to solve an inverse kinematics problem. Fuzzy logic has also found numerous other applications            in other areas of technology like non-linear control, automatic control, signal processing, system identification, pattern            recognition, time series prediction, data mining, financial applications etc.,         </p>         <p>Explore other demos and the documentation for more insight into fuzzy logic and its applications.</p>         <h2>Glossary<a name="23"></a></h2>         <p><b>ANFIS</b> - Adaptive Neuro-Fuzzy Inference System. a technique for automatically tuning Sugeno-type inference systems based on training            data.         </p>         <p><b>membership functions</b> - a function that specifies the degree to which a given input belongs to a set or is related to a concept.         </p>         <p><b>input space</b> - it is a term used to define the range of all possible values         </p>         <p><b>FIS</b> - Fuzzy Inference System. The overall name for a system that uses fuzzy reasoning to map an input space to an output space.         </p>         <p><b>epochs</b> - 1 epoch of training represents one complete presentation of all the samples/datapoints/rows of the training dataset to            the FIS. The inputs of each sample are presented and the FIS outputs are computed which are compared with the desired outputs            to compute the error between the two. The parameters of the membership functions are then tuned to reduce the error between            the desired output and the actual FIS output.         </p>         <p class="footer">Copyright 1994-2005 The MathWorks, Inc.<br>            Published with MATLAB&reg; 7.1<br></p>      </div>      <!--##### SOURCE BEGIN #####%% Modeling Inverse Kinematics in a Robotic Arm% This demo illustrates using a fuzzy system to model the inverse% kinematics in a two-joint robotic arm.%% Copyright 1994-2005 The MathWorks, Inc.%%%% What is Inverse Kinematics?% Kinematics is the science of motion. In a two-joint robotic arm, given% the angles of the joints, the kinematics equations give the location of% the tip of the arm. Inverse kinematics refers to the reverse process.% Given a desired location for the tip of the robotic arm, what should the% angles of the joints be so as to locate the tip of the arm at the desired% location. There is usually more than one solution and can at times be a% difficult problem to solve.%% This is a typical problem in robotics that needs to be solved to control% a robotic arm to perform tasks it is designated to do. In a% 2-dimensional input space, with a two-joint robotic arm and given the% desired co-ordinate, the problem reduces to finding the two angles% involved. The first angle is between the first arm and the ground (or% whatever it is attached to). The second angle is between the first arm% and the second arm.%% <<invkine_angles.png>>%%% *Figure 1:* Illustration showing the two-joint robotic arm with the two% angles, |theta1| and |theta2|%%% Why use Fuzzy logic?% For simple structures like the two-joint robotic arm, it is possible to% mathematically deduce the angles at the joints given the desired location% of the tip of the arm. However with more complex structures (eg: n-joint% robotic arms operating in a 3-dimensional input space) deducing a% mathematical solution for the inverse kinematics may prove challenging.%% Using fuzzy logic, we can construct a Fuzzy Inference System that deduces% the inverse kinematics if the forward kinematics of the problem is% known, hence sidestepping the need to develop an analytical solution.% Also, the fuzzy solution is easily understandable and does not require% special background knowledge to comprehend and evaluate it.%% In the following section, a broad outline for developing such a% solution is described, and later, the detailed steps are elaborated.%%% Overview of Fuzzy Solution%% Since the forward kinematics formulae for the two-joint robotic arm are% known, x and y co-ordinates of the tip of the arm are deduced for the% entire range of angles of rotation of the two joints. The co-ordinates% and the angles are saved to be used as training data to train ANFIS% (Adaptive Neuro-Fuzzy Inference System) network. %% During training the ANFIS network learns to map the co-ordinates |(x,y)|% to the angles |(theta1, theta2)|. The trained ANFIS network is then used% as a part of a larger control system to control the robotic arm. Knowing% the desired location of the robotic arm, the control system uses the% trained ANFIS network to deduce the angular positions of the joints and% applies force to the joints of the robotic arm accordingly to move it to% the desired location. %%% What is ANFIS?% ANFIS stands for Adaptive Neuro-Fuzzy Inference System. It is a hybrid% neuro-fuzzy technique that brings learning capabilities of neural% networks to fuzzy inference systems. The learning algorithm tunes the% membership functions of a% <matlab:helpview([docroot,'/toolbox/fuzzy/fuzzy.map'],'sugeno_type_fis') Sugeno-type Fuzzy Inference System> % using the training input-output data. %% In this case, the input-output data refers to the "coordinates-angles"% dataset. The coordinates act as input to the ANFIS and the angles act as% the output. The learning algorithm "teaches" the ANFIS to map the% co-ordinates to the angles through a process called training. At the end% of training, the trained ANFIS network would have learned the% input-output map and be ready to be deployed into the larger control% system solution.%%% Data Generation% Let |theta1| be the angle between the first arm and the ground. Let% |theta2| be the angle between the second arm and the first arm (Refer to% Figure 1 for illustration). Let the length of the first arm be |l1| and% that of the second arm be |l2|. %% Let us assume that the first joint has limited freedom to rotate and it% can rotate between 0 and 90 degrees. Similarly, assume that the second% joint has limited freedom to rotate and can rotate between 0 and 180% degrees. (This assumption takes away the need to handle some special% cases which will confuse the discourse). Hence, |0<=theta1<=pi/2| and% |0<=theta2<=pi|.%% <<invkine_all_angles.png>>%%% *Figure 2:* Illustration showing all possible |theta1| and |theta2|% values.%% Now, for every combination of |theta1| and |theta2| values the x and y% coordinates are deduced using forward kinematics formulae.%%% The following code snippet shows how data is generated for all% combination of |theta1| and |theta2| values and saved into a matrix to be% used as training data. The reason for saving the data in two matrices is% explained in the following section.l1 = 10; % length of first arml2 = 7; % length of second armtheta1 = 0:0.1:pi/2; % all possible theta1 valuestheta2 = 0:0.1:pi; % all possible theta2 values[THETA1, THETA2] = meshgrid(theta1, theta2); % generate a grid of theta1 and theta2 valuesX = l1 * cos(THETA1) + l2 * cos(THETA1 + THETA2); % compute x coordinatesY = l1 * sin(THETA1) + l2 * sin(THETA1 + THETA2); % compute y coordinatesdata1 = [X(:) Y(:) THETA1(:)]; % create x-y-theta1 datasetdata2 = [X(:) Y(:) THETA2(:)]; % create x-y-theta2 dataset%%% <matlab:edit('traininv') Click here for unvectorized code>%%% The following plot shows all the X-Y data points generated by cycling% through different combinations of |theta1| and |theta2| and deducing x% and y co-ordinates for each. The plot can be generated by using the% code-snippet shown below. The plot is illustrated further for easier% understanding.%%    plot(X(:), Y(:), 'r.'); %    axis equal;%    xlabel('X')%    ylabel('Y')%    title('X-Y co-ordinates generated for all theta1 and theta2 combinations using forward kinematics formulae')%% <<invkine_grid2.png>>%%%% *Figure 3:* X-Y co-ordinates generated for all |theta1| and |theta2|% combinations using forward kinematics formulae%%% Building ANFIS networks% One approach to building an ANFIS solution for this problem, is to build% two ANFIS networks, one to predict |theta1| and the other to predict% |theta2|.%% In order for the ANFIS networks to be able to predict the angles they have% to be trained with sample input-output data. The first ANFIS network will% be trained with X and Y coordinates as input and corresponding |theta1|% values as output. The matrix |data1| contains the |x-y-theta1| dataset% required to train the first ANFIS network. Therefore |data2| will be used

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -