Computer science | Sensing and acting

Robotics: build systems that sense and act

Learn how robots combine sensors, computation, control, and actuators to interact with the physical world—and why uncertainty and safety shape every design.

COMPUTER SCIENCEROBOTICS GUIDEBeginner to intermediate
A robot observes the world and respondsSensors measure the environment, a controller estimates state and chooses an action, and actuators move the robot, changing the environment. EnvironmentSensorsControllerActuators actions change the world; new measurements close the loop
Figure 1. Robots operate in a feedback loop: actions change the environment, which produces new sensor measurements.

What makes a robot

A robot is a physical system that senses its environment, computes or follows a plan, and acts through mechanisms. Robots range from factory arms and mobile vehicles to assistive devices and scientific instruments.

A robot combines mechanical design, electronics, software, and control. Its environment matters: wheel slip, friction, lighting, sensor noise, and unexpected obstacles make physical behavior less predictable than a simulation. A useful robot must handle uncertainty as well as perform its intended task.

These parts form a loop, not a one-time sequence. The robot observes, acts, observes again, and adjusts based on the result.

Sensors and measurements

A sensor converts a physical quantity into data. Encoders measure wheel rotation; cameras capture light; inertial measurement units report acceleration and angular velocity; distance sensors estimate range. A sensor does not provide perfect truth: it has noise, bias, limited range, resolution, and update frequency.

A measurement can be delayed, missing, or affected by the environment. A camera may struggle in poor lighting; a wheel encoder cannot directly tell whether the wheel is slipping. Sensor models describe what a measurement means and the uncertainty around it.

Sensor fusion

Sensor fusion combines measurements from different sources. An inertial sensor responds quickly to motion but accumulates drift; a GPS measurement may be more stable over time but arrives less frequently and can be unavailable indoors. Combining them can provide a better estimate than relying on either alone.

Fusion requires timing and coordinate alignment. If measurements refer to different moments or frames, a mathematically correct combination can still be wrong. Systems record timestamps, calibrate sensors, and account for uncertainty when combining data.

Sampling and aliasing

Digital sensors sample physical signals at intervals. If a signal changes faster than the sampling rate can capture, aliasing can make it appear as a slower or different signal. Filtering and appropriate sampling rates help, but sensor bandwidth and processing delay create trade-offs.

Actuators and mechanisms

An actuator turns a control signal into physical action. Electric motors rotate wheels or joints; servos position a mechanism; pneumatic actuators use compressed air; grippers apply force to objects. Actuators have limits such as maximum speed, torque, range, and response time.

Mechanical design determines how actuator motion affects the robot. A motor connected through gears can trade speed for torque. Backlash, flexibility, friction, and load affect how accurately a commanded position is reached.

Commands should respect mechanical and electrical limits. A controller that requests movement beyond a joint's range can damage the robot or surrounding objects. Limit switches, current monitoring, mechanical stops, and software constraints provide complementary safeguards.

Coordinates, pose, and kinematics

A robot needs to describe positions relative to a coordinate frame. A pose usually includes position and orientation. A mobile robot may track its pose in a map frame; a camera measures objects in a camera frame; an arm reasons about end-effector pose relative to its base.

Coordinate transformations convert points between frames. If a camera is mounted on a robot arm, the system needs to know the camera's position and orientation relative to the arm. Calibration estimates these relationships. Small calibration errors can create large position errors at the end of a long arm.

Forward and inverse kinematics

Forward kinematics computes the position of a robot's end point from joint angles. Inverse kinematics finds joint angles that place the end point at a requested target. Inverse kinematics may have multiple solutions, no solution, or solutions that violate joint limits.

A robot's reachable workspace is the set of positions it can attain. Obstacles and joint constraints reduce the usable workspace. Planning should check the full path, not only whether the destination is reachable.

Feedback and control

A controller compares the desired behavior with measured behavior and chooses an action to reduce the error. Open-loop control sends commands without measuring the result; it is simple but cannot compensate for disturbances. Closed-loop control uses feedback to adjust commands as conditions change.

A simple proportional controller sets its output in proportion to the current error. If a wheel is moving too slowly, the controller increases motor effort. Strong feedback can respond quickly, but excessive gain can cause overshoot or oscillation.

PID control

A PID controller combines proportional, integral, and derivative terms. The proportional term reacts to present error; the integral term accumulates past error; the derivative term responds to the rate of change. Tuning balances response speed, stability, overshoot, and measurement noise.

Integral windup occurs when the integral term grows while the actuator is saturated, causing a large overshoot when it becomes available again. Anti-windup methods limit or adjust the accumulated value. Derivative estimates can amplify noisy sensor readings, so filtering may be needed.

Control loops run at a chosen frequency. Slow updates can miss fast changes; excessively fast updates waste computation or amplify noise. The control rate should match the dynamics of the robot and the timing characteristics of its sensors and actuators.

Planning and navigation

A mobile robot needs to plan a path from its current pose to a goal while avoiding obstacles and respecting motion constraints. A grid map can label cells as free, occupied, or unknown. Graph search can find a route across known free cells, but a geometric path may still be impossible for the robot to follow smoothly.

Global planning uses a map to choose an overall route; local planning responds to nearby obstacles and current motion. Localization estimates where the robot is within the map. Mapping builds or updates the map. These tasks interact: a wrong pose can make a correct map appear inconsistent.

Uncertainty and localization

Wheel odometry estimates movement from encoder readings, but small errors accumulate. Landmarks or GPS can help correct drift. A probabilistic filter represents multiple possible states and updates their likelihood as measurements arrive.

Simultaneous localization and mapping (SLAM) addresses the coupled problem of constructing a map while estimating the robot's location within it. The robot's map and pose estimates inform each other. SLAM is challenging because errors can accumulate across long trajectories and repeated environments can be ambiguous.

In unknown environments, a robot may need to explore while avoiding unsafe areas. A planner should account for uncertainty, stopping distance, sensor range, and how costly a collision would be—not just the shortest geometric distance.

Robot software architecture

Robotics software is often organized into components: sensor drivers publish measurements, estimation components update the robot state, planning components choose goals, and control components send actuator commands. Message-based interfaces let components evolve independently but introduce timing, queue, and version concerns.

Real-time tasks may have deadlines. A missed deadline can be more serious than a slow response in ordinary software—for example, a safety stop must take effect quickly. Real-time does not always mean “as fast as possible”; it means providing predictable timing behavior under stated conditions.

Simulation allows teams to test algorithms before using physical hardware. However, a simulator may simplify friction, sensor noise, latency, or collisions. A system that succeeds in simulation may fail on a real robot because the model does not capture reality well enough.

Worked example: a line-following robot

  1. Downward-facing sensors estimate the line's position relative to the robot.
  2. The controller computes the line-position error.
  3. A steering controller adjusts left and right wheel speeds.
  4. The robot moves, changing the next sensor readings.
  5. If readings become unreliable, the robot slows or stops rather than continuing blindly.

Calibration matters: sensor values depend on surface color, height, and lighting. A robust design defines what to do when the line disappears, when a sensor fails, or when the motors cannot reach the requested speed.

Testing, safety, and human impact

Physical systems can injure people or damage property. Define safe operating areas, speed and force limits, emergency stops, and safe behavior when sensors or communication fail. Independent hardware safeguards can complement software checks.

Test in stages: unit-test calculations, simulate dynamics and failure conditions, use a constrained test environment, and expand gradually with supervision. Test sensor disconnection, stale data, actuator saturation, obstacles, and loss of power. Record what assumptions the test environment makes.

Robots that operate near people should communicate their intentions and respect human control. Consider privacy when cameras or microphones collect data, and ensure the robot can be stopped or safely recovered. A successful demonstration does not establish safety in every environment.

A compact glossary

Actuator
A component that creates physical movement or force.
Pose
A position and orientation expressed in a coordinate frame.
Feedback control
Control that uses measurements of the system's response to adjust actions.
Odometry
An estimate of movement derived from sensors such as wheel encoders.
Kinematics
The study of motion and geometric relationships without directly modeling forces.
SLAM
Simultaneous localization and mapping: estimating a pose while building a map.

References and further reading

  1. John J. Craig. Introduction to Robotics: Mechanics and Control, 4th edition. Pearson, 2017. Publisher information.
  2. Peter Corke. Robotics, Vision and Control, 3rd edition. Springer, 2023. Author resources.
  3. Robot Operating System (ROS). ROS 2 Documentation. Documentation.
  4. Modern Robotics. Kevin M. Lynch and Frank C. Park. Free textbook and course.

Try it yourself

  1. Design a sensor-controller-actuator loop for a thermostat or a small mobile robot.
  2. Why does wheel odometry drift over time?
  3. Describe one advantage and one limitation of testing a robot only in simulation.
  4. Give an example of a control system that should fail safely when its sensor data becomes stale.
  5. Sketch coordinate frames for a robot arm, its camera, and an object it needs to reach.

Remember: robots combine computation with physical uncertainty; safe, useful behavior depends on feedback, calibration, and careful testing.

Keep exploring

Try another topic

A fresh topic suggestion is ready for you.

Explore a topic
0% read