15. Artificial Intelligence

• What is Intelligence?: Nobody knows, but there are lots of ideas.

• So if we don’t know what intelligence is, how can we write programs that are intelligent ?: AI researchers guess at how parts of the brain work, then try to reproduce the effect in a program.

• A Myth is that artificial programs use intelligence to guide themselves, but they are not as stupid as traditional programs.

• Most AI methods take ONE aspect of human thinking, and then model it, such as,

Logical Reasoning



• There are many older, and newer AI topics of interest,

Expert Systems

Planning Systems

Search Techniques

Fuzzy Logic

Neural Networks

Genetic Algorithms

Symbol Manipulation


• Each of the AI techniques is distinct in which applications they are useful for, and how they are applied.

• In manufacturing there are many problems which are difficult to solve using computers, such as trying to get a computer to ‘listen for a particular PING when doing inspection’. But, AI can help solve some of these problems.

• AI is not magic, you must still understand the problem before an AI system will help you solve it.

• The List below says a few words about some popular AI topics, and how they relate to applications,

Expert Systems: These systems use exact rules with true or false conditions, and results. “If the engine stops, the car is out of gas”

Fuzzy Logic: This method still uses rules which do not need true or false conditions. “When I want the engine to go slower, I give it less gas” where slower, and less are somewhat arbitrary values.

Neural Networks: This methods is equivalent to learning by example. “I don’t know why, I just know to go faster, I push the accelerator that much”.

• For the three methods above, how well the problem can be described determines which is too be used. In effect, if the problem is very logical, use expert systems, if you can still make rules, but nothing is true or false use fuzzy logic. Finally, if you can’t define rules for solving a problem, but can do it by intuition, use neural networks.

15.1 Expert Systems

• To implement an expert system, a knowledge engineer will talk to ‘experts’ about how they solve a problem. The Knowledge engineer will then try to develop a set of rules for solving the problem. After the rules are done, they are entered into Expert System Software ($0: $20,000). Expert system software will then ask questions (or check sensors, or look at data files) to compare rules to conditions, and see the results.

• The rules are in the form shown on the other page

• There are two ways to search rules,

Forward Chaining: Consider what you know now, then check rules to see if all conditions are satisfied. The Results of the rule give you a new conclusion. The rules are all checked again using the Results from the previous rule. This is often used for choosing an action.

Backward Chaining: This method will backtrack from a set of consequents to find which conditions caused them. This method is often used for determining how something was done.

15.2 Fuzzy Logic

• Rules are created which make sense to humans, for example when driving a car some acceleration rules may be,



• Each or the rule conditions, and results, can be represented with a 1 dimension matrix,

LOUD_NOISE = { 0.0 0.1 0.5 1.0 }

QUIET_NOISE = {1.0 0.5 0.1 0.0 }

FAST_SPEED = { 0.0 0.2 0.7 1.0 }

SLOW_SPEED = { 1.0 0.5 0.2 0.0 }

SAME_SPEED = { 1.0 1.0 1.0 1.0 }

The sets are considered normalized from minimum to maximum. For example is the NOISE sets were from 20dB to 100dB, then a noise level of 80dB would result in a value of 0.5, or a 50% membership. This way you can say if the noise is ‘absolutely loud’, giving a value of 1.0, or ‘a bit loud’ giving a value of 0.5.

• The matrices are combined using the rules to get a result matrix

• Because the conditions (like LOUD_NOISE) are defined with a sort of weight, or memebership rules are easier to make up.

• Fuzzy logic controllers have been very successful at solving control problems.

15.2.1 NEURAL NETWORKS - Neural Network Calculation of Inverse Kinematics

• Objectives: To give insight into the neural network solution of the inverse kinematics problem. - Inverse Kinematics

• Forward kinematics for a 3-link manipulator


• Inverse Kinematics for a three link manipulator


• Inverse Kinematics techniques

explicit, with exact solution (as for the 3 link manipulator)

iterative, for use when an infinite number of solutions exist.

• Problems that occur when doing inverse kinematics with these methods are,

both methods require a computer capable of mathematical calculations

the methods do not adapt to compensate for damage, calibration errors, wear, etc.

solutions may be slow, especially for iterative solutions

solutions are valid only for a specific robot

• advantages of using these methods are,

both solutions will yield exact answers

properties of both of these methods are well known

15.2.2 Feed Forward Neural Networks

• A feed forward neural network was used with a sigmoidal activation function

• the back propagation learning technique was used.

• disadvantage of these network is

unpredictable errors occur in the solution

discontinuous problem spaces cause problems for the networks

training may be very slow

these networks are not well understood

neuro-computers are not commonly available

• advantages

the architecture is fault tolerant

faster calculations

can be adjusted for changes in the robot configuration

the controllers are not specific to a single robot

15.2.3 The Neural Network Setup

• The figure below shows how the neural network was configured to solve the problem


• The first neural network estimates the proper inverse kinematics. This will contain a small error, therefore a second net is used to estimate the errors. Additional correction networks can be added after this.


• The networks were generally connected with

10, 20 or 40 neurons in the hidden layer

a bias input was connected to each neuron

the layers were all fully connected

there were runs with one, and two hidden layers

15.2.4 The Training Set

• The problem is reduced using either left or right arm configurations, the solution is also constrained to elbow up or elbow down.

• Discontinuities were avoided by not training the neural network in the region above the origin. The elbow straight configuration is also a minor singularity problem.

• Training points were evenly distributed throughout the robot workspace

• Only a quarter of the robot workspace was used because of the robot symmetry.

• The general protocol for training was,

apply the desired position to the input, and train for the desired joint angles.

When accuracy was high enough, the first correction net was trained by comparing the actual errors, and the desired values. Additional correction networks were also trained in some cases.

the error was measured by using an RMS measure of the differences


• A list of results are provided below,


• The results in the table were obtained for a variety of network configurations

• A visual picture of the network configurations is shown below, and on subsequent pages. These are based on a set of test points that lie in a plane of the workspace.

********** Add figure of network point locations, and test conditions

• As seen in the experimental results, there are distortions that occur near the origin, and the edges of the workspace, as would be expected with the singularities found there.

• The errors also increased near the training boundaries

********* Add in more of the results figures

15.2.5 Results

• The mathematical singularities caused by Cartesian coordinates, and the +/- 180 degrees singularity could be eliminated by selecting another set of coordinates for space and the arm.

• The best results were about 1 degree RMS.