Artificial intelligence in robotics
Where AI sits in a robot: deep learning for perception, reinforcement learning for control, and what it takes to run these models on real hardware.
A robot without AI repeats what it was told. A robot with AI can look at a scene it has never seen, decide what to do and get better with practice. This post shows where AI fits inside a robot, which methods are used for which job, and what changes when the model has to run on the robot itself.
Where AI sits in a robot
Most robots follow the same chain, from raw sensor data to motor commands:
$$ \underbrace{\text{Sensors}}_{\text{camera, LiDAR}} \;\rightarrow\; \underbrace{\text{Perception}}_{\text{what is around me?}} \;\rightarrow\; \underbrace{\text{Planning}}_{\text{what should I do?}} \;\rightarrow\; \underbrace{\text{Control}}_{\text{how do I move?}} \;\rightarrow\; \text{Motors} $$
AI can help at every step, but today it makes the biggest difference in perception. Planning and control still rely heavily on classical, well-understood algorithms, with learning added where the classical models struggle.
Perception: deep learning lets robots see
Deep neural networks turn camera images into information a robot can use:
| Task | Question it answers | Typical models |
|---|---|---|
| Object detection | What objects are here, and where? | YOLO, Faster R-CNN |
| Segmentation | Which pixels belong to which object? | Mask R-CNN, YOLO-seg |
| Pose estimation | Where are a person's joints? | MediaPipe, OpenPose |
| Action recognition | What is the person doing? | CNN + LSTM or attention |
| Depth estimation | How far away is each pixel? | Monocular depth networks |
Two kinds of network do most of this work:
- Convolutional neural networks (CNNs) slide small filters over the image to find edges, then shapes, then whole objects.
- Recurrent networks (LSTMs) and attention (Transformers) handle sequences, so a robot can understand motion over several frames instead of one still image.
Other sensors add what cameras miss: LiDAR gives precise 3D distances, ultrasonic sensors detect nearby obstacles cheaply, and thermal cameras find people in the dark.
Decision making: learning by trial and error
In reinforcement learning (RL) the robot is not told the right answer. It tries an action, receives a reward, and slowly learns which actions pay off. The classic algorithm, Q-learning, keeps a score \(Q(s,a)\) for taking action \(a\) in state \(s\) and updates it after every step:
$$ Q(s,a) \;\leftarrow\; Q(s,a) + \alpha \Big[\, r + \gamma \max_{a'} Q(s',a') - Q(s,a) \,\Big] $$
- \(r\) is the reward just received and \(s'\) the new state.
- \(\alpha\) is the learning rate: how fast old beliefs change.
- \(\gamma\) is the discount factor: how much future rewards count.
Deep Q-Networks (DQN) replace the table with a neural network, so the method works with camera images. Actor-critic methods (PPO, SAC) learn a policy (the actor) together with a value estimate (the critic) and handle continuous motor commands, which is why they are popular for walking and grasping.
Because trial and error on a real robot is slow and can break things, most RL training happens in simulation (Gazebo, Isaac Sim, MuJoCo) and is then transferred to the real robot.
Planning and control: classical methods, sometimes with learning
Path planning. A* finds the shortest path on a grid by always expanding the cell with the lowest estimated total cost:
$$ f(n) = \underbrace{g(n)}_{\text{cost so far}} + \underbrace{h(n)}_{\text{estimate to goal}} $$
For robot arms and cluttered spaces, sampling-based planners such as RRT explore the space with random samples instead of a grid.
Motion control. Most motors are still driven by a PID controller, which turns the error \(e(t)\) between target and measurement into a command:
$$ u(t) = K_p\, e(t) + K_i \int_0^t e(\tau)\, d\tau + K_d\, \frac{de(t)}{dt} $$
AI adds to these methods: fuzzy control handles vague rules ("if it is a bit too warm, open the vent a little"), adaptive control tunes the gains while the robot runs, and learned models predict effects that are hard to write down, such as friction or how people will move.
Running AI on a real robot
A model that works on a desktop GPU is not yet a robot skill. On the robot it must be:
- Fast: a camera delivers 30 frames per second, so each frame has about 33 ms for perception, planning and control together.
- Small: embedded boards such as NVIDIA Jetson have limited memory and power.
- Reliable: a wrong detection can make the robot hit something.
Common tricks are lighter architectures (ResNet-18 instead of ResNet-152), quantisation (8-bit numbers instead of 32-bit), runtimes such as TensorRT or ONNX Runtime, and running only the heavy model when something changes in the scene.
Challenges
- Technical: limited computing power and battery, models that fail on situations unlike their training data, and understanding natural language and gestures.
- Ethical: privacy of camera data, safety around people, bias in training data, and who is responsible when an autonomous robot makes a mistake.
Tools to get started
| Need | Tools |
|---|---|
| Robot software framework | ROS 2 |
| Machine learning | PyTorch, TensorFlow |
| Computer vision | OpenCV |
| Simulation | Gazebo, Isaac Sim |
| Languages | Python for AI, C++ for fast control |
A practical learning path: learn Python and some C++, refresh linear algebra and probability, train a small image classifier, then build a small robot (Arduino or Raspberry Pi) and connect the two through ROS 2.
AI in robotics is no longer only research. It is already sorting parcels, inspecting products and helping in hospitals, and each of those systems is built from the pieces above.