AI with Robotics: A Complete Module-Wise Guide
What is Artificial Intelligence?
The tasks involved are those that normally need human intelligence: reasoning, problem solving, understanding language, perceiving images and making decisions. A simple way to picture AI is as a pipeline: a problem is described, knowledge about it is stored, a search or reasoning process runs over that knowledge, and the result is a solution or an action. Every topic in the later modules fits somewhere along this pipeline.
Approaches to AI
There are four classical ways of looking at what it means to be intelligent.
| Approach | Meaning | Example |
|---|---|---|
| Thinking humanly | Model how the human mind works (cognitive modelling) | General Problem Solver |
| Acting humanly | Behave indistinguishably from a human (Turing Test) | Conversational chatbots |
| Thinking rationally | Use logic and the laws of thought | Theorem provers |
| Acting rationally | Choose the action expected to best achieve the goal | Self-driving cars, robot vacuum cleaners |
Most modern systems follow the last approach, because it does not require copying human thought, only achieving good outcomes.
Applications of AI
| Application | What AI does |
|---|---|
| Natural Language Processing | Understands and generates human language, including translation |
| Theorem proving | Uses logical reasoning to establish whether a statement is true |
| Games | Searches possible moves and chooses the best one |
| Vision and speech | Interprets images and spoken signals |
| Expert systems | Uses stored domain knowledge and rules, as in medical diagnosis |
| Robotics | Combines sensing, planning and physical action |
Techniques of AI
- Abstraction: focus on the essential features of a problem and ignore unnecessary detail.
- Search: explore possible states and actions to find a path to a goal.
- Knowledge: represent facts, rules and relationships so a machine can reason with them.
Without knowledge, search has nothing to guide it, and without abstraction, the search space becomes too large to explore.
State Space Search
Most AI problems have no direct formula, so a solution has to be found by exploring possibilities. State space search gives a standard way to describe such problems.
A state is one configuration of the problem. The initial state is where we start and the goal state is where we want to end. Operators are actions that change one state into another.
Uninformed Search: BFS and DFS
Uninformed strategies explore the space without any knowledge about where the goal lies.
| Feature | Breadth-First Search | Depth-First Search |
|---|---|---|
| Order | Level by level | Deepest branch first, then backtrack |
| Data structure | Queue (FIFO) | Stack (LIFO) |
| Memory | High | Low |
| Optimality | Optimal when every step costs the same | Not guaranteed |
BFS has time complexity , where b is the branching factor and d is the depth of the shallowest goal. It stores every node at the current level, which is why it needs so much memory. DFS can wander down a very deep branch but is cheap on memory.
Heuristic Search
A heuristic function estimates the cost from node n to the goal. Instead of exploring blindly, a heuristic lets the search favour promising states.
- Best-First Search: keeps a priority queue and expands the node with the smallest heuristic value. Fast, but greedy and not always optimal.
- Hill Climbing: evaluates neighbours and moves to a better one, repeating until none is better. It can stop at a local maximum, a plateau (flat region with no direction to move) or a ridge (a narrow rising path that single moves cannot follow). Remedies: random restart, a big jump, or looking several moves ahead.
- Branch and Bound: keeps a bound on the cost of the best complete solution found so far and prunes any branch that already exceeds it.
The famous A* algorithm combines the cost already paid with the estimated remaining cost:
Here g is the path cost from the start to node n and h is the heuristic estimate. If h never overestimates the true cost, it is called admissible and A* returns an optimal path. Straight-line distance on a map and the number of misplaced tiles in the 8-puzzle are typical heuristics.
Production Systems
A production system is a rule-based framework with three parts: a working memory holding the current facts, production rules of the form IF condition THEN action, and a control strategy that decides which matching rule fires.
A system is monotonic if applying a rule never blocks a previously applicable rule, as in theorem proving. It is non-monotonic if applying a rule may block others, as in chess or robot navigation, where mistakes may require backtracking.
Constraint Satisfaction, Problem Reduction and Means-End Analysis
| Technique | Core idea |
|---|---|
| Constraint Satisfaction (CSP) | Variables, domains and constraints; assign every variable a value so that all constraints hold. In map colouring, neighbouring regions need different colours. |
| Problem reduction | Convert a complex goal into simpler subgoals using an AND/OR graph. An AND node needs all subgoals solved; an OR node needs only one. |
| Means-End Analysis | Compare current and goal states, find the difference, choose an operator that reduces it, apply it and repeat. |
AO* and LA* Algorithms
The AO* algorithm performs heuristic search on AND/OR graphs. Where A* searches an OR graph and returns a single path, AO* returns a solution sub-graph. It repeatedly selects the most promising partial solution graph, expands a node and propagates the revised cost estimates backward to the parents. The LA* algorithm is treated in this course as an A*-style heuristic search: evaluate promising states using the heuristic, expand them, update the estimates and continue towards the goal.
Why Representation Matters
- Representational adequacy: can represent every kind of knowledge required.
- Inferential adequacy: can derive new knowledge from old.
- Inferential efficiency: reasoning is fast.
- Acquisitional efficiency: new knowledge is easy to add.
- Must cope with incomplete and uncertain information.
A robot, for instance, stores information about obstacles, locations and objects so that it can navigate safely.
First-Order Predicate Calculus
First-Order Predicate Calculus (FOPC) is a formal language for describing objects, their properties and the relationships between them. Its building blocks are constants (such as Robot1), variables (x, y), predicates (such as Human(x)), functions and quantifiers. The universal quantifier means "for all" and the existential quantifier means "there exists".
The first sentence says that all humans are mortal. The second says that some robots can move.
Horn Clauses
A Horn clause is a logical clause with at most one positive literal. Horn clauses come in three kinds: a fact, which is always true; a rule, which is conditional; and a goal or query, which is to be proved. The general form is:
It reads: if all conditions on the right are true, then the conclusion on the left is true. In Prolog the same idea is written Mortal(x) :- Human(x). Horn clauses are the basis of logic programming and many expert systems.
Resolution
Resolution is an inference rule that proves a statement by contradiction.
For example, from and , resolving on gives . Deriving the empty clause means the negated goal contradicts the knowledge base, so the original statement must be true.
Frames, Semantic Nets and Partitioned Nets
| Technique | Description | Example |
|---|---|---|
| Frame | Slots and slot values, with defaults and inheritance from other frames | Robot frame: mobile robot, four wheels, camera, autonomous |
| Semantic network | Graph of nodes (concepts) and labelled links such as IS-A, HAS-A and PART-OF | Animal, Dog, Tail |
| Partitioned semantic network | Divides the graph into spaces to represent quantified and nested statements | "Every robot has a sensor" |
A dog node linked to an animal node by IS-A inherits whatever is true of animals and can add its own links.
Forward versus Backward Reasoning
| Basis | Forward reasoning | Backward reasoning |
|---|---|---|
| Driven by | Data (known facts) | Goal (desired conclusion) |
| Direction | Facts to conclusions | Goal back to supporting facts |
| Suited to | Monitoring | Diagnosis |
Procedural versus Declarative Knowledge
Procedural knowledge describes how to do something through steps and algorithms, such as an obstacle avoidance routine. Declarative knowledge describes what is true through facts and relationships, such as "a robot has four wheels". Procedural knowledge focuses on execution, while declarative knowledge focuses on information and lives naturally in logic and knowledge bases.
Natural Language Processing
Natural languages are ambiguous, irregular and context-dependent, which is what makes the problem hard. Language can be analysed at several levels: morphological (structure of words), lexical (words and their categories), syntactic (how words form sentences), semantic (literal meaning), discourse (links between sentences) and pragmatic (meaning in context).
Syntactic Processing and Semantic Analysis
| Aspect | Syntactic processing | Semantic analysis |
|---|---|---|
| Main concern | Grammatical structure | Meaning and interpretation |
| Typical output | Parse tree, noun and verb phrases | Roles, relations, meaning representation |
| Typical tasks | Part-of-speech tagging, phrase structure | Word-sense disambiguation, role labelling, entity recognition |
Syntax matters because it separates "the person follows the robot" from "the robot follows the person", which use the same words but mean very different things. A sentence can also be syntactically ambiguous: "I saw the person with a telescope" has two structures, depending on who holds the telescope. Semantics then resolves such cases. A sentence like "colourless green ideas sleep furiously" is grammatical but semantically odd, which shows the two are related but distinct.
Parsing Techniques
Parsing builds a parse tree for a sentence from its tokens, using a grammar.
| Feature | Top-down parsing | Bottom-up parsing |
|---|---|---|
| Starting point | Start symbol S | Input words |
| Direction | Root to leaves | Leaves to root |
| Typical issue | May predict structures the input does not support | May build partial structures that never form a sentence |
Related methods include recursive-descent parsing (top-down), shift-reduce parsing (bottom-up), chart parsing, which stores partial results to avoid recomputation, and dependency parsing, which finds head-dependent relations between words.
Transition Nets
A transition network is a graph of states joined by labelled arcs. A path from the initial state to a final state represents a valid sequence of words or categories.
This simple noun phrase network accepts both "the robot" and "robot". Transition networks are visual and modular, but a simple finite-state network cannot represent deeply nested structures.
Context-Free and Transformational Grammars
A context-free grammar (CFG) has non-terminals such as S, NP and VP, terminals (the actual words), production rules and a start symbol. Every rule has a single non-terminal on its left side.
S → NP VP
NP → Det N | N
VP → V NP
Det → the | a
N → robot | machine
V → moves | detects
The sentence "the robot detects a machine" is derived as:
CFGs describe phrase structure clearly and can express recursion, though a basic CFG does not capture agreement, meaning or long-distance dependencies.
Transformational grammar, associated with Noam Chomsky, relates sentence structures through transformations. A deep structure captures the underlying grammatical relations, and transformation rules convert it to the surface structure we actually see.
Schank's Conceptual Dependency
Conceptual Dependency (CD), proposed by Roger Schank, represents the meaning of sentences in a language-independent form, so that sentences with the same meaning get similar representations regardless of wording.
| Primitive | Meaning |
|---|---|
| ATRANS | Transfer of possession |
| PTRANS | Physical transfer of an object or person |
| PROPEL | Applying physical force to an object |
| MOVE and GRASP | Moving a body part; taking hold of an object |
| INGEST and EXPEL | Taking something into or out of the body |
| MTRANS and MBUILD | Transferring information; constructing a new thought |
Augmented Transition Networks
An Augmented Transition Network (ATN) extends a transition network with tests, registers, actions and recursive calls. Tests check conditions such as subject-verb agreement. Registers store partial results, such as the subject noun phrase. Actions update registers when an arc is followed, and recursive calls let one network invoke another to handle embedded clauses. For "the robot detects a person", an ATN recognises a noun phrase, stores it in the subject register, then recognises the verb phrase and object, checking agreement along the way. A basic transition network only matches sequences, while an ATN can enforce richer grammatical conditions.
Scripts
A script, introduced by Schank and Abelson, is a structured representation of a familiar sequence of events in a stereotyped situation. It has entry conditions, roles, props, scenes and results.
In the restaurant script, the roles are customer, server, cook and cashier, and the props are a menu, table, food and bill. If a story says "Mina entered the restaurant, ordered soup and left a tip", a system holding this script can infer that she was served and ate. These inferences are defaults rather than guaranteed facts, and scripts fail when events follow an unusual order.
Sentence Generation, Grammar-Free Analysers and Translation
Sentence generation, or Natural Language Generation, is the reverse of analysis: it starts from meaning and produces text. The stages are content determination, sentence planning, lexicalisation, syntactic realisation, morphological realisation and surface realisation.
Grammar-free analysers extract useful information without relying on a complete hand-written grammar, using keyword patterns, dictionaries, statistics, machine learning or templates. For the command "please move the box near the door", a template can fill the slots action, object and location. This works well in narrow domains but is sensitive to unfamiliar wording.
Machine translation converts text from a source language to a target language while preserving meaning and fluency.
| Approach | Idea |
|---|---|
| Rule-based (RBMT) | Hand-crafted linguistic rules and dictionaries |
| Example-based (EBMT) | Analogy with previously translated examples |
| Statistical (SMT) | Translation probabilities learned from bilingual text |
| Neural (NMT) | Encoder-decoder or Transformer models trained on parallel text |
Translation is difficult because of lexical ambiguity, differing word order, idioms, agreement and context. Quality is judged by adequacy and fluency, and automatically by metrics such as BLEU.
The Concept of Learning
The major forms are supervised learning (labelled examples), unsupervised learning (finding structure in unlabelled data), reinforcement learning (learning from rewards and penalties) and semi-supervised learning (a small labelled set plus a larger unlabelled one). A robot that gradually learns routes with fewer collisions is a simple example.
Genetic Algorithms
A genetic algorithm (GA) is a population-based search technique inspired by natural evolution. A candidate solution is encoded as a chromosome made of genes, and a fitness function scores each chromosome.
GAs do not need gradient information and cope with complex search spaces, although they may need many fitness evaluations and do not guarantee the global optimum. In robotics they are used for path planning, controller tuning and task scheduling.
Automation of Learning
Automation of learning means building workflows that carry out the stages of learning with limited manual effort.
Model parameters, such as network weights, are learned from data, while hyperparameters, such as the learning rate or number of layers, are chosen by the designer or by automated search. AutoML tools automate parts of this process, but human oversight is still needed to define objectives and validate results.
Neural Networks
An artificial neural network is a set of interconnected neurons. Each neuron computes a weighted sum of its inputs, adds a bias and applies an activation function:
Here the w values are weights, b is the bias and is the activation function, for example sigmoid, tanh, ReLU or softmax. A network has an input layer, one or more hidden layers and an output layer.
Parameters are updated by gradient descent:
where is the learning rate and L is the loss. A learning rate that is too large makes training unstable, and one that is too small makes it slow. Convolutional networks suit images, recurrent networks and LSTMs suit sequences, and autoencoders suit feature learning and anomaly detection.
Learning by Induction
Inductive learning derives a general rule from specific examples, in contrast to deduction, which derives specific conclusions from general rules.
Forms of induction include concept learning, decision-tree learning and rule learning. The key risks are overfitting, where the model memorises training data, and underfitting, where it is too simple to capture the pattern.
Expert Systems and Knowledge Acquisition
An expert system solves problems in a specialised domain using stored knowledge and reasoning procedures. It is justified because it preserves scarce expertise, applies rules consistently, is always available and fast, and supports less experienced users.
Knowledge acquisition is the process of collecting, organising and encoding expert knowledge. Techniques include interviews, observation, think-aloud protocols, questionnaires and case analysis.
- The central difficulty is the knowledge acquisition bottleneck: experts often cannot put tacit knowledge into words, may disagree, and the process is slow.
- Rules take the form IF condition THEN conclusion, and the inference engine uses forward or backward chaining.
Case Studies: R1/XCON and MYCIN
| Feature | R1 / XCON | MYCIN |
|---|---|---|
| Domain | Computer system configuration (DEC VAX orders) | Diagnosis of bacterial blood infections (Stanford, 1970s) |
| Representation | Production rules | Production rules with certainty factors |
| Contribution | Showed commercial value of expert systems in a narrow domain | Made uncertainty explicit and could explain its advice |
MYCIN was a research system and not a substitute for clinical judgement.
PROLOG and LISP
PROLOG, short for programming in logic, is a declarative language based on first-order logic. A program is a set of facts and rules, and execution answers queries using unification and backtracking.
parent(ram, shyam).
parent(shyam, amit).
grandparent(X, Z) :- parent(X, Y), parent(Y, Z).
?- grandparent(ram, amit). % true
The rule says X is a grandparent of Z if X is a parent of some Y who is a parent of Z. Unification matches terms by finding substitutions, for example binding X = shyam in parent(ram, X). Backtracking returns to an earlier choice point to look for further solutions.
LISP, short for list processing, is a functional, symbolic language in which data and programs are both lists written in prefix notation. Important list functions are car (first element), cdr (the rest) and cons (add an element to the front).
(defun factorial (n)
(if (<= n 1)
1
(* n (factorial (- n 1)))))
(factorial 5) ; result: 120
PROLOG is strongest at logical relations and inference, while LISP is strongest at symbolic manipulation and recursive processing.
Handling Uncertainty
Real systems work with noisy sensors, missing facts and vague concepts, so four complementary methods are used.
| Method | What it represents | Robot example |
|---|---|---|
| Probabilistic reasoning | Likelihood of events, updated with evidence | How likely a detected obstacle is real |
| Non-monotonic reasoning | Default conclusions withdrawn on new facts | A corridor assumed clear is now blocked |
| Certainty factors | Degree of belief in rule-based conclusions | MYCIN-style diagnostic evidence |
| Fuzzy logic | Degrees of membership for vague concepts | Speed based on how near an obstacle is |
Probabilistic reasoning updates beliefs using Bayes' theorem:
Step 1: $P(S) = 0.90 \times 0.20 + 0.10 \times 0.80 = 0.26$.
Step 2: $P(O \mid S) = \dfrac{0.90 \times 0.20}{0.26} \approx 0.6923$.
So the obstacle is really present with about 69% probability, not 90%, because false alarms and the low prior both matter.
Non-monotonic reasoning allows conclusions to be withdrawn when new information arrives. We assume that Tweety, a bird, can fly. When we learn Tweety is a penguin, the conclusion is retracted.
Certainty factors measure belief on a scale from -1 to +1. A positive value supports a hypothesis, a negative value opposes it, and zero means no net evidence. A certainty factor is not the same as a probability. Two independent positive pieces of evidence combine as:
For CF1 = 0.6 and CF2 = 0.5, the combined value is .
Fuzzy logic handles vagueness through degrees of membership between 0 and 1, rather than strict true or false. A distance may belong to the set "near" to degree 0.7.
A typical rule is IF distance is NEAR THEN speed is SLOW. Defuzzification, for example by the centroid method, converts the combined fuzzy result back into a single motor speed. Fuzzy membership describes how much something belongs to a category, whereas probability describes how likely an event is.
Overview of Robotics
| Component | Function | Example |
|---|---|---|
| Manipulator | Links and joints that position the robot | Robot arm, mobile chassis |
| End-effector | Interacts directly with objects | Gripper, welding torch, suction cup |
| Actuators | Convert energy into controlled movement | Electric motor, hydraulic cylinder |
| Sensors | Measure robot state and surroundings | Encoder, camera, proximity sensor |
| Controller | Processes sensor data and issues commands | Microcontroller, PLC |
Robots are classified as industrial, mobile, collaborative, humanoid, service and autonomous. Common arm configurations are Cartesian, cylindrical, spherical, articulated, SCARA and parallel or delta.
- Degrees of freedom (DOF): the number of independent variables needed to describe a robot's configuration. A rigid body moving freely in 3D space has six: three translations and three rotations (roll, pitch and yaw).
- Revolute joints rotate about an axis; prismatic joints translate along an axis.
Robot Kinematics and Position Analysis
Kinematics studies motion, including position, velocity and acceleration, without considering the forces that cause it. Position analysis finds where a link or end-effector is, relative to a chosen reference frame.
Forward kinematics computes the end-effector position from known joint values. For a two-link planar arm with link lengths L1 and L2 and joint angles and :
$x = 4\cos 0^\circ + 3\cos 90^\circ = 4$ and $y = 4\sin 0^\circ + 3\sin 90^\circ = 3$.
The end-effector sits at (4, 3).
Inverse kinematics does the opposite: given a desired position, it finds the joint values that achieve it. For the same arm:
A target may have no solution if it lies outside the reachable workspace, or more than one solution, such as elbow-up and elbow-down configurations.
To describe the pose of one frame relative to another, robotics uses a homogeneous transformation matrix, a 4 by 4 matrix that combines a 3 by 3 rotation with a translation vector. Transformations along the chain of links are multiplied in order, and the order matters because matrix multiplication is not commutative.
| D-H parameter | Meaning |
|---|---|
| Joint angle | Rotation about the previous Z-axis; the variable of a revolute joint |
| Link offset | Translation along the previous Z-axis; the variable of a prismatic joint |
| Link length | Distance between adjacent Z-axes, measured along X |
| Link twist | Angle between adjacent Z-axes, measured about X |
The Denavit–Hartenberg (D-H) convention uses these four parameters to assign frames to links systematically.
Robot Dynamic Analysis and Forces
Dynamics relates forces and torques to the resulting motion, taking mass and inertia into account. It supports motor selection, controller design and safe motion planning. The basic laws are:
where m is mass, a is linear acceleration, I is the moment of inertia and is angular acceleration. For a whole manipulator, the standard dynamic model is:
In this equation q is the vector of joint positions, M is the inertia matrix, C represents Coriolis and centrifugal effects, G is gravity, F is friction and $\tau` is the vector of actuator torques. It shows that the torque needed at one joint depends on the configuration and motion of the other links as well.
(a) Torque: for `I` = 0.5 kg·m² and $\alpha$ = 4 rad/s², the ideal torque is $\tau = 0.5 \times 4 = 2$ N·m. A safety margin must be added in practice.
(b) Load: a robot holds a 5 kg object 0.4 m from a joint. The weight is $W = 5 \times 9.81 = 49.05$ N, so the torque is $\tau = 49.05 \times 0.4 = 19.62$ N·m.
Force analysis considers gravitational, inertial, friction, contact and external loads. A force applied at a distance from a joint creates a moment . Position control follows a path, while force control regulates the contact force using force and torque sensors, which is essential for polishing, insertion and delicate grasping.
Robot Programming Systems and Languages
A robot programming system provides the tools to specify, run, monitor and modify robot tasks. It includes a controller, a programming device such as a teach pendant, a robot language, a motion control system, sensors and input-output, and simulation tools.
- Teach pendant: the operator jogs the robot and records points.
- Lead-through: the operator physically guides the arm along a path.
- Text-based and graphical: instructions written in a language or assembled from visual blocks.
- Offline programming: created and tested in simulation without occupying the physical robot.
A good robot programming language should support motion specification, coordinate frames (base, tool and workpiece), real-time execution, sensor and input-output handling, program flow control, error handling, safety, readability, portability and simulation or debugging support.
The Three Levels of Robot Programming
Higher levels are easier for the programmer but demand more intelligence from the system. Lower levels give finer control but depend heavily on the hardware.
Programming Languages and Their Specific Problems
| Language | Associated with |
|---|---|
| RAPID | ABB industrial robots |
| KRL | KUKA robots |
| KAREL | Certain FANUC systems |
| VAL / VAL3 | Particular industrial robot systems |
| URScript | Universal Robots |
| Python / C++ | General-purpose languages used with robotics libraries for perception, planning and AI |
A program for one manufacturer's controller is generally not portable to another. Robot programming also differs from ordinary programming because errors cause physical movement.
- Frame and calibration errors: an incorrect frame definition sends the robot to the wrong place.
- Motion planning and collision avoidance: a mathematically valid path may collide with obstacles or violate joint limits.
- Singularities: configurations where small tool movements demand very large joint velocities.
- Timing and synchronisation with conveyors, sensors and grippers.
- Sensor uncertainty: sensor results must be checked and exceptions handled.
- Safety: must rely on safety-rated hardware, speed and force limits and emergency stops, not application code alone.
- Debugging and portability: testing should move from simulation to low-speed trials to full operation.
Bringing It Together: The Pick-and-Place Robot
A pick-and-place robot ties the whole module together. Its manipulator, gripper, sensors and controller form the system. Forward kinematics predicts the gripper pose, and inverse kinematics calculates the joint values for the pick and place positions. Dynamic analysis decides the motor torque needed for the payload, and force sensing keeps the grip firm without damaging the part.
The task is written in a robot language at task or motion level, and the controller converts it to joint commands, while calibration, collision avoidance and safety are handled throughout.
CONTINUE LEARNING:
-
Build the programming foundation with Python Fundamentals: A Complete Guide for Beginners.
-
See neural-network concepts turn into a deployed application in AdSpectra: A Full-Stack Machine Learning Sales Prediction App.
-
Understand how knowledge-based systems store and retrieve structured information through What is DBMS?.
-
For a broader path from Python and AI fundamentals to web and software development, follow the Full-Stack Developer Roadmap 2026.



