Cognitive Robotics Practical Simulation App
This single HTML app converts the lecture ideas into hands-on mini labs. It covers cognition, brain-body-environment interaction, Bayesian reasoning, anticipation, reinforcement learning, sensorimotor coordination, affordances, tool use and cognitive architectures.
Perceive
Sense the world with noisy visual/tactile data, then select information useful for action.
Act
Move the body, reach, push, grasp, use tools and update the world through actions.
Learn
Improve models from experience using data, incremental updates and reinforcement signals.
Anticipate
Predict future states so the robot can act before reaction alone becomes too late.
Adapt
Change internal parameters when the body, task or environment changes.
Why this app?
The lectures describe cognitive robots as autonomous systems that perceive, act, adapt, learn and anticipate. Here those words become visible: you can change noise, delays, learning rates, reward structure, body growth and object properties, then watch the robot behave differently.
What to demonstrate in class
- Reaction versus anticipation in catching.
- Bayesian inference from uncertain evidence.
- How Q-learning gradually improves action selection.
- How affordances emerge through exploration.
- How a cognitive architecture connects modules into flexible behaviour.
Suggested teaching flow
Start with the Cognitive Loop lab, then use Bayesian Network for uncertainty, Anticipation for prediction, Reinforcement Learning for trial-and-error, Sensorimotor Reaching for embodied coordination, Affordance Learning for object-action-effect relations, Tool Use for planning, and Cognitive Architecture to connect everything.
Lab 1 - Cognitive loop: perceive, act, adapt, learn, anticipate
A robot follows a moving target. It receives noisy perception, predicts where the target will be next, acts, and adapts its internal estimate.
Controls
Lab 2 - Bayesian network for uncertain robot perception
Select visual evidence and an action. The network computes likely object type and predicted effect. This simulates how a robot can combine uncertain evidence instead of using one fixed rule.
Evidence
Probability table — what the Bayesian network is calculating
The table below uses the same prior probabilities and evidence likelihoods as the simulation. Posterior probability is the updated belief after combining the selected shape, size and surface evidence. The values change whenever you change an evidence selector or the robot action.
Lab 3 - Anticipation: reaction is not enough
Two robots try to catch a falling ball. The reaction-only robot goes to the measured current location. The anticipatory robot predicts where the ball will be after its control delay.
Controls
Lab 4 - Reinforcement learning: Q-learning grid robot
A robot explores a grid, receives rewards and penalties, and gradually learns a policy. Use episodes to see value estimates and action arrows develop.
Learning parameters
How the reinforcement-learning simulation works
This grid world represents a robot learning a navigation policy through trial and error. The robot starts at the bottom-left, must reach the GOAL, and should avoid the HAZARD cells. There is deliberately no pre-written route: the policy is built from reward feedback.
1. Choose an action
At each state the robot chooses Up, Right, Down or Left. With probability ε it explores a random action; otherwise it selects the action with the highest current Q-value.
2. Receive feedback
Reaching the goal gives +10, entering a hazard gives −8, and every ordinary move gives −0.1. This makes shorter, safer routes more useful.
3. Update Q-values
The simulation applies Q-learning: Q(s,a) is moved toward the received reward plus the discounted value of the best next action. α controls how strongly new experience changes the estimate.
4. Look ahead
γ controls how much future rewards matter. A high γ encourages the robot to value actions that lead toward a useful future state rather than only immediate reward.
5. Learn a policy
The arrow in each ordinary cell shows the currently best-valued action. Early arrows can be uninformative because all Q-values start at zero; after training, useful directions emerge.
6. What the goal demonstrates
The learning goal is not memorising a fixed path. It is demonstrating how repeated interaction and reward can produce an improving action-selection policy.
Lab 5 - Sensorimotor development and gaze-driven reaching
A two-link robot arm learns to reach a target. The movement has a fast ballistic phase and a visually guided correction phase. Change growth and noise to see adaptation.
Controls
Understanding the sensorimotor reaching simulation
This simulation represents an embodied robot arm coordinating visual perception, body geometry and movement. The gaze marker represents visual attention to the target, the two-link arm represents the body, and the green target represents the object the hand should reach.
| Parameter | Range / current meaning | What it changes | What to look for |
|---|---|---|---|
| Body growth / arm length | 0.70×–1.35× | Scales both arm links and changes the reachable workspace. | Changing body size creates a mismatch between the current body and the internal body model. |
| Visual noise | 0–55 px | Adds random error to the target position used by the controller. | Higher noise makes the visual estimate less stable, so corrections become more variable. |
| Adaptation rate | 0.01–0.80 | Controls how quickly the internal arm-scale estimate moves toward the actual body scale. | Higher adaptation lets the internal model adjust faster after body-growth changes. |
| Hand-target error | Live pixels | Distance between the actual hand position and the true target. | Lower error means the arm is successfully coordinating perception and action. |
| Phase | Idle / ballistic / visual correction | Shows which part of the reaching movement is active. | The movement begins with a faster ballistic phase and then uses visual feedback for final correction. |
Ballistic phase
The arm initially moves quickly toward the visually estimated target. This represents a fast, largely pre-planned part of reaching.
Visual correction
After the initial movement, the controller uses the noisy visual estimate repeatedly to refine the joint angles and reduce final positioning error.
Performance
The live error and phase indicators show whether the hand is converging on the target and whether the controller is still moving or has completed the reach.
Lab 6 - Affordance learning by exploration
Choose an object and an action, then let the robot try it. The robot updates an object-action-effect table from experience.
Experiment
Understanding the affordance-learning simulator
What the simulator represents: This simulator models how a robot can discover affordances by interacting with different objects. An affordance is the action possibility that emerges from the relationship between the object, the chosen action, the robot's capabilities and the environment. Instead of assuming the correct outcome is known in advance, the robot builds experience from repeated trials.
How it works
Select an object and an action, such as pushing a ball or grasping a cup. Each trial samples an outcome from the simulator's object-action model. The result is added to the robot's experience table, and the displayed effect probabilities are recalculated from the accumulated trials.
What it represents
The table is a simplified learned model of the relationship object → action → effect. Different objects respond differently to the same action, so the robot must learn which interactions are useful rather than treating every object in the same way.
Key outcome to observe
Watch the effect probabilities become more informative as the number of trials increases. The important outcome is convergence toward a useful prediction of what an action will do. Use Auto explore to see how experience gradually turns uncertain interaction into a more reliable affordance model.
Lab 7 - Tool use and planning with affordances
The robot must achieve a desired effect. It can select direct reach, push, or a tool. Planning uses predicted effects of object-tool-action combinations.
Task
Understanding the tool-use planning simulator
What the simulator represents: This simulator demonstrates how a robot can use learned or predicted affordances to choose actions and tools that are likely to produce a desired effect. The robot starts with a task goal, considers the available tool, and selects a simplified action plan based on the predicted usefulness of the available object-tool-action combination.
How it works
Choose a goal such as bringing an object closer, moving it right, or lifting it. Then choose a long stick, hook, or no tool. When Plan action is pressed, the planner evaluates the available combination and returns an action, a predicted success percentage and a short reason. The canvas then animates the planned effect.
What it represents
This is a simplified model of planning from affordances: the robot is not only asking “what action can I perform?” but “which action, with which tool, is likely to create the effect I need?” Tool use therefore extends the robot's reachable actions beyond direct body interaction.
Key outcome to observe
Change only the available tool while keeping the goal the same. Observe that the selected action and predicted success can change. The key outcome is goal-directed action selection based on predicted effects, rather than choosing an action randomly or using a single fixed behaviour.
Lab 8 - Cognitive architecture: connecting modules
Follow a high-level command through natural language understanding, visual object understanding, affordance perception, action planning and action execution.
Command
Understanding the cognitive-architecture simulator
What the simulator represents: This simulator shows how multiple cognitive modules can be connected into one robot behaviour. A high-level human instruction is progressively transformed into goals and memory, visual object understanding, affordance perception, action planning and finally low-level action execution. It is a teaching model of the flow between cognition, perception and behaviour rather than a complete robotic operating system.
How it works
Select a command and an architecture style, then run the flow. The modules activate sequentially from high level to mid level to low level. At each step, the simulator displays the corresponding interpretation—for example, detecting an object, identifying its affordance, planning the action and executing the movement.
What it represents
The architecture acts as the coordination layer between language, perception, memory, affordance reasoning, planning and motor control. The three styles provide simplified conceptual views: cognitivist emphasises a fixed symbolic flow, emergent emphasises adaptive self-organisation, and hybrid combines symbolic and adaptive modules.
Key outcome to observe
Watch the command move through the complete chain instead of jumping directly from language to motor output. The key outcome is functional integration of modules: a high-level goal becomes an executable sequence of lower-level actions through intermediate representations and decisions.
Revision quiz and viva prompts
Use this section after the simulations to check understanding. Click an answer to see feedback.
Quiz
Viva/practical prompts
- Explain why a robot needs anticipation using the catching lab.
- Describe how a Bayesian network represents relationships between sensory evidence, actions and effects.
- Use the reaching lab to explain open-loop ballistic movement and closed-loop visual correction.
- Explain affordance learning as object-action-effect prediction.
- Compare cognitivist, emergent and hybrid cognitive architectures.
Source mapping inside the app
Week 1 ideas are used in the overview and loop labs; Week 2 ideas drive Bayesian reasoning; Week 3 supports anticipation, learning and RL; Week 5 supports sensorimotor learning and affordances; Week 6 supports the architecture and tool-use/planning labs.
Exam answer checker + full paper practice
Choose the exact past-paper sub-question, type your answer or select an MCQ, then check model answer points. MCQ options shuffle every time the question loads or the file is refreshed.
Past-paper question controls
Question
Progress
What changed
- MCQs now use real radio buttons and can be selected.
- Written/numerical questions now always show an editable answer box.
- Exam checker contains full past-paper sub-questions, not only MCQs.
- Revision quiz has a much larger MCQ bank with shuffled answers.