Welcome to Module Four of Level Three! In Module One, you learned about kinematics and dynamics. In Module Two, you learned about probabilistic robotics. In Module Three, you learned about motion planning. Now you will learn about robot learning.
Robot learning is the study of how robots can learn from experience. Instead of being programmed for every situation, a robot can learn by trying, failing, and improving. It is like how you learn to ride a bicycle. You do not read a manual. You try, you fall, you try again, and eventually you succeed.
Think about how you learned to walk. When you were a baby, you did not know how. You tried. You fell. You tried again. Slowly, you learned. Robots can learn the same way.
Robot learning is one of the most exciting areas of robotics. It is used in self-driving cars, robot arms, drones, and even robots that play games. In this module, you will learn about reinforcement learning, Markov Decision Processes, Q-Learning, deep reinforcement learning, and imitation learning.
Do not worry if these words sound hard. We will explain everything step by step, using simple examples and stories.
Let us begin!
By the end of this module, you will be able to:
Once upon a time, in the city of Port Harcourt, Nigeria, there lived a boy named Tunde. Tunde had built a small robot named Kemi. Kemi had two legs, motors, sensors, and a small computer brain.
Tunde wanted Kemi to walk. But walking is hard. You have to balance. You have to move your legs. You have to avoid falling. Tunde did not know how to program all of this.
He tried writing a program. The program said: "Move left leg forward. Move right leg forward. Repeat." But Kemi fell over. She could not balance.
Tunde tried again. He added more instructions. But Kemi still fell. The program was too simple. Walking is too complex to program step by step.
Tunde went to his teacher. "Madam, I cannot program Kemi to walk. It is too hard."
His teacher smiled. "Tunde, you do not need to program every step. You need to let Kemi learn."
"What do you mean?" Tunde asked.
"Use reinforcement learning," his teacher said. "Give Kemi a reward when she walks. Give her a penalty when she falls. She will learn to walk by trying."
Tunde was fascinated. He learned about reinforcement learning. He learned about rewards and penalties. He learned about Markov Decision Processes. He learned about Q-Learning.
He wrote a new program. The program did not tell Kemi exactly what to do. Instead, it gave Kemi a reward when she moved forward. It gave her a penalty when she fell.
At first, Kemi fell a lot. She did not know what to do. But slowly, she learned. She learned to balance. She learned to move her legs. She learned to walk.
After many tries, Kemi took her first steps. She walked across the room. She did not fall. Tunde cheered.
"Kemi, you learned to walk!" he shouted.
Kemi kept walking. She was no longer programmed. She had learned.
That is what you will learn in this module. You will learn how robots learn from experience. You will learn about reinforcement learning, Q-Learning, deep reinforcement learning, and imitation learning.
Let us begin!
Robot learning is the process of a robot improving its behaviour through experience. Instead of being programmed for every situation, the robot learns from its actions and their results.
Some tasks are too complex to program step by step. Walking, grasping, and driving are examples. Robot learning allows robots to figure out these tasks on their own.
Think about learning to ride a bicycle. Nobody can tell you exactly how to balance. You have to try. You fall. You try again. Slowly, you learn. Robots learn the same way.
A self-driving car learns to drive by practising in simulation.
A student learns to solve math problems by practising.
You learn to cook by trying recipes and improving.
A trader learns which goods sell best by trying different products.
Robot Learning Try --> Fail --> Learn --> Try Again --> Succeed The robot improves with each attempt.
Robot learning is the process of a robot improving its behaviour through experience.
Programming means telling the robot exactly what to do. Learning means the robot figures out what to do by itself.
Programming is good for simple tasks. Learning is good for complex tasks. Knowing the difference helps you choose the right approach.
| Aspect | Programming | Learning |
|---|---|---|
| Who decides? | Human programmer | Robot itself |
| Best for | Simple, clear tasks | Complex, unclear tasks |
| Example | Blink a light | Walk on two legs |
| Flexibility | Low | High |
Programming is like following a recipe. Learning is like experimenting in the kitchen.
A calculator is programmed. A chess computer learns.
Memorising times tables is programming. Solving new problems is learning.
Following a recipe is programming. Inventing a new dish is learning.
Following a bus route is programming. Finding a shortcut is learning.
Programming vs Learning Programming: Human --> Instructions --> Robot Learning: Robot --> Try --> Feedback --> Improve
Programming means telling the robot exactly what to do. Learning means the robot figures out what to do by itself.
Reinforcement learning is a type of learning where the robot learns by receiving rewards and penalties for its actions.
Reinforcement learning is powerful. It allows robots to learn complex tasks without being told exactly what to do.
Think of training a dog. When the dog sits, you give it a treat. When it does something wrong, you say "No." The dog learns to sit because it wants the treat. Robots learn the same way.
| Term | Meaning |
|---|---|
| Agent | The robot or learner |
| Environment | The world the robot interacts with |
| Action | What the robot does |
| Reward | Positive feedback for good action |
| Penalty | Negative feedback for bad action |
| State | The current situation |
A robot learns to walk by getting a reward for moving forward and a penalty for falling.
You learn to study by getting good grades (reward) and avoiding bad grades (penalty).
You learn to cook by getting compliments (reward) and avoiding burnt food (penalty).
A trader learns which goods to sell by making profit (reward) and avoiding losses (penalty).
Reinforcement Learning
Agent (Robot)
|
| Action
V
Environment
|
| Reward/Penalty
V
Agent learns
|
| Repeat
V
Reinforcement learning is a type of learning where the robot learns by receiving rewards and penalties for its actions.
A Markov Decision Process (MDP) is a mathematical framework for reinforcement learning. It describes the states, actions, and rewards in a learning problem.
MDPs help us model learning problems. They tell us what the robot can do, what it knows, and what it wants.
Imagine a board game. You have a position (state). You can move (action). You get points (reward). The rules of the game are the MDP.
A chess game is an MDP. States are board positions. Actions are moves. Rewards are winning or losing.
Studying for an exam is an MDP. States are knowledge levels. Actions are study choices. Rewards are grades.
Cooking is an MDP. States are cooking stages. Actions are cooking steps. Rewards are taste.
A trader's day is an MDP. States are stock levels. Actions are buying and selling. Rewards are profit.
Markov Decision Process
State 1 --> Action --> State 2
|
V
Reward
State 2 --> Action --> State 3
|
V
Reward
A Markov Decision Process is a mathematical framework for reinforcement learning. It describes the states, actions, and rewards in a learning problem.
Rewards are positive feedback. Penalties are negative feedback. Both help the robot learn.
Rewards and penalties tell the robot what is good and what is bad. Without them, the robot cannot learn.
Think of a video game. When you collect a coin, you get points (reward). When you hit an enemy, you lose points (penalty). The game teaches you what to do.
A robot gets a reward for reaching a goal and a penalty for hitting a wall.
You get a reward for correct answers and a penalty for wrong ones.
You get a reward for cleaning your room and a penalty for not doing chores.
A trader gets a reward for profit and a penalty for loss.
Rewards and Penalties Action: Move forward Result: Reached goal Reward: +10 Action: Hit wall Result: Robot stuck Penalty: -5 Robot learns to move forward, not hit walls.
Rewards are positive feedback. Penalties are negative feedback. Both help the robot learn.
Q-Learning is a reinforcement learning algorithm. It learns the value of taking an action in a state. This value is called the Q-value.
Q-Learning is simple and effective. It is used in many robot learning applications.
Imagine you are in a maze. You want to find the exit. You try different paths. You remember which paths lead to the exit. Q-Learning helps you remember.
A robot learns the best path to a goal using Q-Learning.
You learn the best way to study using Q-Learning principles.
You learn the best way to organise your room.
A trader learns the best market to sell in.
Q-Learning State: At start Actions: Left, Right, Forward Q-values: Left: 0.5 Right: 0.2 Forward: 0.8 <-- Best Choose Forward.
Q-Learning is a reinforcement learning algorithm that learns the value of taking an action in a state.
SARSA is another reinforcement learning algorithm. It stands for State-Action-Reward-State-Action. It learns by looking at the action the robot actually takes.
SARSA is safer than Q-Learning. It considers the robot's actual behaviour, not just the best possible behaviour.
Imagine you are following a path. Q-Learning asks: "What is the best path?" SARSA asks: "What is the best path given what I actually do?"
A robot learns to walk carefully using SARSA.
You learn to study consistently using SARSA.
You learn to save money carefully.
A trader learns to manage stock carefully.
SARSA State --> Action --> Reward --> State --> Action S --> A --> R --> S' --> A' Update based on actual next action.
SARSA is a reinforcement learning algorithm that learns by looking at the action the robot actually takes.
Deep reinforcement learning combines reinforcement learning with deep neural networks. It allows robots to learn from complex inputs like images.
Deep reinforcement learning is powerful. It can handle complex tasks like driving and playing games.
Imagine you are learning to play a video game. You see the screen (images). You decide what to do. Deep reinforcement learning works the same way.
A self-driving car uses deep reinforcement learning to drive.
A robot learns to play chess using deep reinforcement learning.
A robot vacuum learns to clean efficiently.
A drone learns to deliver packages in a city.
Deep Reinforcement Learning
Images --> Neural Network --> Actions
|
V
Rewards
|
V
Learning
Deep reinforcement learning combines reinforcement learning with deep neural networks. It allows robots to learn from complex inputs like images.
Imitation learning is a type of learning where the robot learns by watching a human or another robot. It copies the behaviour it sees.
Imitation learning is fast. The robot does not have to try everything from scratch. It can learn from an expert.
Think about how you learned to write. You watched your teacher write. You copied. That is imitation learning.
A robot learns to cook by watching a chef.
You learn to solve math problems by watching your teacher.
You learn to cook by watching your mother.
An apprentice learns a trade by watching a master.
Imitation Learning Human demonstrates --> Robot observes --> Robot copies The robot learns by watching.
Imitation learning is a type of learning where the robot learns by watching a human or another robot.
Sim-to-real transfer means training a robot in simulation, then using what it learned in the real world.
Training in the real world is slow and expensive. Training in simulation is fast and cheap. Sim-to-real transfer saves time and money.
Think of learning to drive in a video game. Then you drive a real car. That is sim-to-real transfer.
A drone learns to fly in simulation, then flies in the real world.
You practise a sport in a video game, then play the real sport.
You practise cooking in a game, then cook real food.
A pilot trains on a flight simulator, then flies a real plane.
Sim-to-Real Transfer Simulation --> Learn --> Real World Train in simulation, apply in reality.
Sim-to-real transfer means training a robot in simulation, then using what it learned in the real world.
Transfer learning means using what you learned in one task to help with another task.
Transfer learning saves time. The robot does not have to start from scratch for every new task.
If you know how to ride a bicycle, you can learn to ride a motorcycle faster. That is transfer learning.
A robot that learned to pick up balls can learn to pick up cups faster.
If you know algebra, you can learn calculus faster.
If you know how to cook rice, you can learn to cook beans faster.
If you know how to sew dresses, you can learn to sew shirts faster.
Transfer Learning
Task 1: Learn to pick balls
|
V
Task 2: Learn to pick cups (faster!)
Knowledge transfers from Task 1 to Task 2.
Transfer learning means using what you learned in one task to help with another task.
Active learning means the robot chooses which examples to learn from. It asks for help when it is unsure.
Active learning is efficient. The robot focuses on the examples that matter most.
Imagine you are studying for a test. Instead of reading the whole book, you focus on the parts you do not understand. That is active learning.
A robot asks a human for help when it encounters a new object.
You ask your teacher for help when you are stuck.
You ask your mother for help when you are cooking a new dish.
A trader asks customers what they want.
Active Learning Robot is unsure --> Asks for help --> Learns The robot chooses what to learn.
Active learning means the robot chooses which examples to learn from. It asks for help when it is unsure.
Real robots use learning to improve their behaviour.
| Robot | Learning Method | Purpose |
|---|---|---|
| Self-Driving Car | Deep reinforcement learning | Drive safely |
| Robot Arm | Imitation learning | Pick and place |
| Robot Vacuum | Reinforcement learning | Clean efficiently |
| Drone | Sim-to-real transfer | Fly and deliver |
| Game-Playing Robot | Deep reinforcement learning | Play games |
A robot arm learns to pick up objects by watching a human.
A school robot learns to navigate a maze using reinforcement learning.
A robot vacuum learns the layout of your house.
A delivery robot in Lagos learns to avoid traffic.
Real Robot: Self-Driving Car
+-------------------+
| Sensors |
| (see world) |
+-------------------+
|
V
+-------------------+
| Deep RL |
| (learns to |
| drive) |
+-------------------+
|
V
+-------------------+
| Control |
+-------------------+
|
V
+-------------------+
| Car moves |
+-------------------+
Real robots use learning to improve their behaviour. Different methods are used for different tasks.
Debugging robot learning systems means finding and fixing problems in learning algorithms.
Learning systems can fail. The robot might not learn. It might learn the wrong thing. Debugging helps you fix these problems.
| Problem | Cause | Solution |
|---|---|---|
| Robot does not learn | Rewards too small | Increase rewards |
| Robot learns wrong behaviour | Reward function wrong | Fix reward function |
| Robot forgets old skills | Catastrophic forgetting | Use transfer learning |
| Learning is too slow | Too many states | Simplify state space |
| Robot overfits | Too little training data | Add more data |
If a robot does not learn to walk, check the reward function.
If a student does not improve, check the study method.
If a recipe does not work, check the ingredients.
If a trader is not making profit, check the goods and prices.
Debugging Robot Learning
[ Robot not learning ]
|
V
[ Check rewards ]
|
V
[ Check state space ]
|
V
[ Check algorithm ]
|
V
[ Fix problem ]
|
V
[ Test again ]
Debugging robot learning systems means finding and fixing problems in learning algorithms. Common problems include no learning, wrong behaviour, and slow learning.
The future of robot learning is very exciting. Robots will become smarter and more capable.
Better learning means better robots. They will work in more complex environments. They will help people in more ways.
Researchers are already teaching robots to learn from YouTube videos.
Students today are learning robot learning for future jobs.
Robot vacuums are becoming smarter every year.
Nigerian universities are researching robot learning for agriculture and healthcare.
Future of Robot Learning
Today: Simple learning
|
V
Soon: Learning from videos
|
V
Future: Continuous learning
|
V
Future: Creative robots
The future of robot learning is exciting. Robots will become smarter and more capable.
| Word | Simple Definition |
|---|---|
| Robot Learning | Improving behaviour through experience. |
| Reinforcement Learning | Learning from rewards and penalties. |
| Agent | The robot or learner. |
| Environment | The world the robot interacts with. |
| Action | What the robot does. |
| Reward | Positive feedback. |
| Penalty | Negative feedback. |
| State | The current situation. |
| Markov Decision Process | A framework for reinforcement learning. |
| Q-Learning | Learning the value of actions. |
| SARSA | Learning from actual actions. |
| Deep Reinforcement Learning | Reinforcement learning with neural networks. |
| Imitation Learning | Learning by watching others. |
| Sim-to-Real Transfer | Training in simulation, applying in reality. |
| Transfer Learning | Using knowledge from one task for another. |
| Active Learning | Choosing what to learn. |
| Concept | Real-Life Example |
|---|---|
| Robot Learning | Self-driving car learns to drive. |
| Programming vs Learning | Calculator is programmed, chess computer learns. |
| Reinforcement Learning | Training a dog with treats. |
| Markov Decision Process | A chess game. |
| Rewards and Penalties | Video game points. |
| Q-Learning | Robot learns best path in a maze. |
| SARSA | Robot learns to walk carefully. |
| Deep Reinforcement Learning | Self-driving car uses images. |
| Imitation Learning | Robot learns to cook by watching a chef. |
| Sim-to-Real Transfer | Drone learns in simulation, flies in reality. |
| Transfer Learning | Knowing bicycle helps learn motorcycle. |
| Active Learning | Robot asks for help when unsure. |
| Concept | Nigerian Example |
|---|---|
| Robot Learning | A trader learns which goods sell best. |
| Programming vs Learning | Following a bus route vs finding a shortcut. |
| Reinforcement Learning | A trader learns from profit and loss. |
| Markov Decision Process | A trader's day: states, actions, rewards. |
| Rewards and Penalties | Profit is reward, loss is penalty. |
| Q-Learning | Trader learns best market to sell in. |
| SARSA | Trader learns to manage stock carefully. |
| Deep Reinforcement Learning | A drone learns to deliver packages. |
| Imitation Learning | Apprentice learns trade by watching master. |
| Sim-to-Real Transfer | Pilot trains on simulator, flies real plane. |
| Transfer Learning | Sewing dresses helps learn to sew shirts. |
| Active Learning | Trader asks customers what they want. |
| Concept | Everyday Example |
|---|---|
| Robot Learning | Learning to cook by trying recipes. |
| Programming vs Learning | Memorising times tables vs solving new problems. |
| Reinforcement Learning | Getting compliments for good cooking. |
| Markov Decision Process | Studying for an exam. |
| Rewards and Penalties | Rewards for cleaning, penalties for not. |
| Q-Learning | Learning the best way to study. |
| SARSA | Learning to save money carefully. |
| Deep Reinforcement Learning | Robot vacuum learns to clean. |
| Imitation Learning | Learning to cook by watching your mother. |
| Sim-to-Real Transfer | Practising cooking in a game, then cooking real food. |
| Transfer Learning | Knowing how to cook rice helps cook beans. |
| Active Learning | Asking for help when cooking a new dish. |
| Mistake | Why It Is Wrong | How to Fix It |
|---|---|---|
| Rewards too small | Robot does not learn. | Increase rewards. |
| Wrong reward function | Robot learns wrong behaviour. | Fix reward function. |
| Too many states | Learning is too slow. | Simplify state space. |
| Too little data | Robot overfits. | Add more data. |
| Ignoring sim-to-real gap | Robot fails in real world. | Add noise to simulation. |
| Not debugging | Problems continue. | Find and fix problems. |
+-------------------+
| Agent |
| (Robot) |
+-------------------+
|
| Action
V
+-------------------+
| Environment |
+-------------------+
|
| Reward / New State
V
+-------------------+
| Agent updates |
| its knowledge |
+-------------------+
|
| Repeat
V
( Start )
|
V
+----------------+
| Initialize |
| Q-table |
+----------------+
|
V
+----------------+
| Observe state |
+----------------+
|
V
+----------------+
| Choose action |
+----------------+
|
V
+----------------+
| Observe reward |
| and new state |
+----------------+
|
V
+----------------+
| Update Q-value |
+----------------+
|
V
+----------------+
| Goal reached? |
+----------------+
/ \
YES NO
/ \
V V
+---------+ +-----------+
| Done | | Repeat |
+---------+ +-----------+
| Method | How It Learns | Best For |
|---|---|---|
| Reinforcement Learning | Rewards and penalties | Complex tasks |
| Q-Learning | Action values | Navigation |
| SARSA | Actual actions | Safe learning |
| Deep RL | Neural networks | Images, complex inputs |
| Imitation Learning | Watching experts | Fast learning |
| Sim-to-Real | Simulation then reality | Expensive tasks |
| Transfer Learning | Reusing knowledge | Similar tasks |
| Active Learning | Choosing examples | Efficient learning |
Step 1: Define task
|
V
Step 2: Choose learning method
|
V
Step 3: Set up rewards
|
V
Step 4: Train in simulation
|
V
Step 5: Test in reality
|
V
Step 6: Debug
|
V
Step 7: Improve
|
V
Step 8: Deploy
Robot learning is the process of a robot improving its behaviour through experience.
Programming means telling the robot exactly what to do. Learning means the robot figures out what to do by itself.
Reinforcement learning is a type of learning where the robot learns by receiving rewards and penalties.
A Markov Decision Process is a mathematical framework for reinforcement learning.
Rewards are positive feedback. Penalties are negative feedback. Both help the robot learn.
Q-Learning is a reinforcement learning algorithm that learns the value of taking an action in a state.
SARSA is a reinforcement learning algorithm that learns by looking at the action the robot actually takes.
Deep reinforcement learning combines reinforcement learning with deep neural networks.
Imitation learning is a type of learning where the robot learns by watching a human or another robot.
Sim-to-real transfer means training a robot in simulation, then using what it learned in the real world.
Transfer learning means using what you learned in one task to help with another task.
Active learning means the robot chooses which examples to learn from. It asks for help when it is unsure.
Real robots use learning to improve their behaviour.
Debugging robot learning systems means finding and fixing problems in learning algorithms.
The future of robot learning is exciting. Robots will become smarter and more capable.
In this module, you learned about robot learning. You learned that robot learning is the process of a robot improving its behaviour through experience.
You learned the difference between programming and learning. You learned about reinforcement learning — learning from rewards and penalties. You learned about Markov Decision Processes. You learned about Q-Learning and SARSA.
You learned about deep reinforcement learning — using neural networks. You learned about imitation learning — learning by watching. You learned about sim-to-real transfer, transfer learning, and active learning.
You learned about real robots and their learning methods. You learned about debugging robot learning systems. You learned about the future of robot learning.
Most importantly, you learned that robot learning is what allows robots to handle complex tasks that cannot be programmed step by step.
In the next module, you will learn about Manipulation and Grasping. You will learn how robots pick up and move objects. You will learn about contact modeling, grasping, and dexterous manipulation.
But for now, take a moment to celebrate what you have learned. You have taken another big step in your journey to becoming a robotics expert. Well done!
Match the term on the left with its definition on the right.
| Term | Definition |
|---|---|
| 1. Robot Learning | A. Learning from rewards and penalties |
| 2. Reinforcement Learning | B. Improving behaviour through experience |
| 3. Q-Learning | C. Learning by watching others |
| 4. SARSA | D. Training in simulation, applying in reality |
| 5. Imitation Learning | E. Learning the value of actions |
| 6. Sim-to-Real Transfer | F. Learning from actual actions |
| 7. Transfer Learning | G. Choosing what to learn |
| 8. Active Learning | H. Using knowledge from one task for another |
Answers: 1-B, 2-A, 3-E, 4-F, 5-C, 6-D, 7-H, 8-G
Title: Design a Reward System
Instructions:
Example:
Task: Robot cleans a room Rewards: +10 for picking up an object +5 for moving to a new area -5 for hitting furniture -10 for falling over Goal: Maximize total reward.
Title: Learning Scavenger Hunt
Instructions:
Example:
| Thing | What It Learns | How It Learns |
|---|---|---|
| You | New skills | Practice |
| Robot vacuum | House layout | SLAM |
| Phone | Your habits | Data analysis |
| Game AI | Player behaviour | Reinforcement learning |
| Weather app | Weather patterns | Data analysis |
Title: Build a Simple Q-Learning Agent
Goal: Create a program that learns to solve a simple maze using Q-Learning.
Steps:
Deliverables:
Title: Implement Reinforcement Learning in Simulation
Instructions:
Grading Criteria:
| Criteria | Points |
|---|---|
| Learning algorithm works | 30 |
| Robot learns the task | 25 |
| Reward function is well designed | 15 |
| Report is clear | 15 |
| Visualization is clear | 15 |
| Total | 100 |
In Module Five, you will learn about Manipulation and Grasping. You will learn how robots pick up and move objects.
You will learn about:
To prepare for Module Five:
Get ready for an exciting journey into the world of robot manipulation!
Congratulations! You have completed Module Four of Fundamentals of Robotics Level Three. You have learned about robot learning.
You learned that robot learning is the process of a robot improving its behaviour through experience. You learned the difference between programming and learning. You learned about reinforcement learning, Markov Decision Processes, rewards, and penalties.
You learned about Q-Learning and SARSA. You learned about deep reinforcement learning. You learned about imitation learning, sim-to-real transfer, transfer learning, and active learning.
You learned about real robots and their learning methods. You learned about debugging robot learning systems. You learned about the future of robot learning.
You also learned many examples from Nigeria, from your home, from school, and from everyday life. You learned through stories, illustrations, and activities.
Now you are ready for Module Five: Manipulation and Grasping. In Module Five, you will learn how robots pick up and move objects. You will learn about contact modeling, grasping, dexterous manipulation, and force control.
But before you move on, take a moment to review this module. Make sure you understand the key ideas. Practise designing reward functions. Draw diagrams. Test your understanding. The more you practise, the better you will become.
You are doing great. Keep learning. Keep exploring. Keep building. The world of robotics is waiting for you!
End of Module Four
Next: Module Five — Manipulation and Grasping