Robots and automation
UAT 308 Automation and Robotics Technology
Lesson
By the end of this module you will be able to
- Describe the parts of a mobile robot, namely sensors, actuators, controller and communication
- Use homogeneous transformation matrices to chain robot, sensor and map frames
- Compute the effect of a wheel radius error on differential-drive odometry
- Explain the map, odom and base_link frames used in ROS practice
- Describe a factory robot cell and size the handshake and safety I/O between its PLC and robot controller
Why this matters
UAT 202 gave an overview of automation, PLCs and feedback control. This is a practical course that builds robot systems working with drones. The case used throughout is a solar farm with an unmanned ground vehicle (UGV) that drives along panel rows, finds hotspots on panels with a thermal camera, and carries a drone to launch for high-angle surveys. The first module starts with what every robot must get right before anything else: knowing what is where, in which frame.
Parts of a mobile robot
The textbook by Siegwart et al. divides a mobile robot’s work into perception (sensors), localisation, planning and motion control (actuators). The solar-farm UGV has wheel encoders, an IMU, GNSS, a thermal camera and a LiDAR, and is driven by two DC motors. Its controller is an on-board computer running ROS 2 that talks to the control centre over a wireless network. Each sensor’s data is in its own frame, so it must be transformed into a common frame before being combined.
Review: vectors, matrices and 2D rotation
The frame transformations in this module use vectors and matrices. This section reviews only what is needed. Read it and run the review examples before class (week 1 of the weekly plan), so it is not counted in the module’s class time.
A vector has both size and direction, written as components along axes, such as velocity . Its magnitude is and its direction, measured clockwise from north, is , which gives the correct angle in every quadrant, unlike , which cannot tell opposite directions apart. Vectors are added component by component.
Review example A A crosswind bends the track
Air velocity m/s (heading north) plus wind m/s gives ground velocity m/s, with magnitude m/s and direction from north.
A matrix is a table of numbers. Matrix multiplication pairs each row of the first with each column of the second, multiplying and adding, and in general cannot be reordered ().
2D rotation turns a vector by angle with the matrix
Review example B Rotating a point by 90°
The point rotated by becomes . The homogeneous transform in the next section combines this rotation with a translation in one matrix.
Homogeneous transforms and the frame tree
The position and orientation of one frame relative to another is written as a 3×3 matrix in 2D (4×4 in 3D) that combines rotation and translation. Frames are chained by multiplying matrices in order from the larger frame to the smaller one. REP 103 specifies SI units and body axes with x forward, y left and z up. The ROS tf library (Foote, 2013) stores frame relationships as a tree and computes the transforms automatically.
Example 1 Where on the map is the panel hotspot?
The UGV is at (12, 5) m on the map, heading 30°. The thermal camera is mounted on the right side, offset (0.20, −0.25) m from the centre and facing right (−90°). The camera sees a hotspot at (4.0, 0.5) m in the camera frame (simulated data).
import numpy as np
def se2(x, y, deg):
t = np.radians(deg)
return np.array([[np.cos(t), -np.sin(t), x],
[np.sin(t), np.cos(t), y],
[0, 0, 1]])
T_map_base = se2(12.0, 5.0, 30) # robot on the map, heading 30°
T_base_cam = se2(0.20, -0.25, -90) # camera on the right side, facing right
p_cam = np.array([4.0, 0.5, 1]) # hotspot seen by the camera
p_map = T_map_base @ T_base_cam @ p_cam
print(f"hotspot on map: ({p_map[0]:.2f}, {p_map[1]:.2f}) m")
wrong = T_base_cam @ T_map_base @ p_cam
print(f"wrong multiplication order: ({wrong[0]:.2f}, {wrong[1]:.2f}) m")
goal = np.linalg.inv(T_map_base) @ np.array([20.0, 9.0, 1])
print(f"goal in robot frame: x = {goal[0]:.2f} m, y = {goal[1]:.2f} m")
hotspot on map: (14.73, 1.67) m
wrong multiplication order: (7.63, -15.46) m
goal in robot frame: x = 8.93 m, y = -0.54 m
The multiplication must run from map to robot to camera. With the order swapped, the result is off by many metres, enough to send a technician to the wrong panel. Finding the goal in the robot frame uses the inverse matrix; a negative y means the goal is to the robot’s right.
map, odom and base_link
REP 105 defines three main frames for mobile robots. base_link is attached to the robot. odom is a frame in which the position changes continuously without jumps but drifts with distance, which suits short-term control. map is a frame in which the position does not drift over the long term but may jump when localisation corrects it, for example when GNSS arrives or the robot matches the map. Separating frames this way keeps the wheel controller from jerking when the map position is corrected.
Odometry and systematic error
Odometry estimates position from wheel revolutions. A differential-drive robot turns when its two wheels travel different distances, . If the wheel radius used by the software differs from the real one, the error accumulates in the same direction every time. Borenstein and Feng (1996) identify two main causes, unequal wheel diameters and uncertainty in the wheel separation, and propose the UMBmark test, in which the robot drives a square path both clockwise and counter-clockwise to separate these two causes.
Example 2 A right wheel just 0.1% larger
The wheel separation is 0.50 m. The software uses a radius of 0.100 m, but uneven wear has left the right wheel at 0.1001 m. The UGV is commanded to drive straight along a 50 m panel row (simulated data).
import numpy as np
b = 0.50 # wheel separation m
r_nom = 0.100 # wheel radius used by software m
r_right = 0.1001 # actual right wheel 0.1% larger
dist = 50.0 # distance software believes is straight m
rev = dist / (2 * np.pi * r_nom) # same revolutions on both wheels
d_left = rev * 2 * np.pi * r_nom
d_right = rev * 2 * np.pi * r_right
dtheta = (d_right - d_left) / b
R = b * (d_right + d_left) / (2 * (d_right - d_left))
lateral = R * (1 - np.cos(dtheta))
print(f"actual heading change {np.degrees(dtheta):.2f} deg")
print(f"actual turn radius {R:.0f} m")
print(f"sideways offset at the end {lateral:.2f} m")
actual heading change 5.73 deg
actual turn radius 500 m
sideways offset at the end 2.50 m
A difference of only 0.1 millimetre makes the robot drift about 2.5 m from the panel line within one row, enough to hit the next row. Odometry is therefore only good over short distances; wheel radius and separation must be calibrated regularly, with GNSS or map matching to correct it.
Robots in industrial automation: cells and PLC interfacing
Mobile robots in the field are only part of the picture. In factories and depots, robots work inside robot cells, and Groover describes how they are used for material handling, machine loading and unloading, welding, assembly and inspection. ISO 10218-2 (2025) sets the safety requirements for industrial robot applications and robot cells, where a cell means the robot together with its end effector, fixtures, guarding, safety devices and the other machines it works with.
The solar farm has such a cell at its depot: a fixed arm swaps the UGV’s battery when the vehicle docks. The cell has three layers of control:
- The robot controller runs the robot’s own program (motion, taught points, the gripper)
- The cell PLC coordinates everything around the robot: the dock clamp, the conveyor, stack lights and interlocks, using the logic taught in UAT 202
- The safety system (a safety PLC or safety relay) handles the emergency stop, gate switches and light curtains. Safety signals are wired as two independent channels and must not depend on the ordinary PLC program
The PLC and robot controller talk through a handshake, a fixed exchange of signals over digital I/O or a fieldbus. A typical cycle: the PLC checks robot ready, sets a job number and raises start job; the robot answers busy, does the job, then raises job done; the PLC sees it and drops start job, and the robot drops done. Each signal waits for its answer, so neither side acts on a stale signal. Above the cell, OPC UA for Robotics (OPC 40010-1) defines a standard information model so that higher-level systems can read a robot’s status, axes and condition in the same way from any maker.
Example 3 Sizing the I/O between the PLC and the robot
The signals come from the handshake above plus the dock and the safety devices. Safety signals count two points each. The team keeps 20% spare, uses 16-point standard modules and 8-point safety modules (assumed values).
import math
# signal: (direction seen from the PLC, safety?) -- safety signals are wired dual-channel
signals = {
"robot ready": ("in", False), "robot busy": ("in", False), "job done": ("in", False),
"robot fault": ("in", False), "UGV docked": ("in", False), "battery latched": ("in", False),
"start job": ("out", False), "job number bit 0": ("out", False), "job number bit 1": ("out", False),
"reset fault": ("out", False), "dock clamp": ("out", False), "stack light": ("out", False),
"e-stop": ("in", True), "gate closed": ("in", True), "light curtain clear": ("in", True),
"robot safe stop": ("out", True),
}
SPARE, STD_POINTS, SAFE_POINTS = 1.2, 16, 8 # 20% spare; points per module (assumed)
count = {"std in": 0, "std out": 0, "safety in": 0, "safety out": 0}
for direction, safety in signals.values():
kind = ("safety " if safety else "std ") + direction
count[kind] += 2 if safety else 1
for kind, n in count.items():
per = SAFE_POINTS if kind.startswith("safety") else STD_POINTS
print(f"{kind:<10} {n:2d} points -> {math.ceil(n * SPARE / per)} module(s) of {per}")
std in 6 points -> 1 module(s) of 16
std out 6 points -> 1 module(s) of 16
safety in 6 points -> 1 module(s) of 8
safety out 2 points -> 1 module(s) of 8
Sixteen signals become 20 wired points in four modules, and the safety signals go to separate safety modules rather than the ordinary inputs. Two job-number bits allow four robot programs, such as swap battery, return the old battery, park and fetch a spare. If the cell later needs more programs, one spare output gives a third bit and eight programs, which is why the spare points matter.
Module lab
Lab: coordinate frames and odometry calibration
Done in the course lab hours as Worksheet 1 (weeks 1 to 3 of the weekly plan); not counted in the module class time.
- Measure the mounting positions of the LiDAR and camera on the training robot and write them as transforms relative to base_link
- Place a cone at a known position, measure it with the LiDAR, convert it to map coordinates with Example 1, and compare with a tape measure
- Drive the robot straight for 10 m five times, measure the actual sideways drift, and back-estimate the wheel radius difference with Example 2
- Run the square-path test clockwise and counter-clockwise, recording the end position relative to the start
- Summarise the corrected wheel radius and separation, with results before and after correction
Common mistakes
Watch out
- Multiplying matrices in the wrong order or inverting in the wrong direction
- Mixing degrees and radians in rotation calculations
- Measuring sensor mounting positions roughly and assuming it does not matter
- Trusting odometry over long distances with no position correction
- Feeding the map frame straight into the wheel controller, so the robot jerks when its position is corrected
- Wiring the emergency stop or gate switch to ordinary PLC inputs instead of a dual-channel safety circuit
Summary
- A mobile robot combines perception, localisation, planning and control
- Homogeneous transforms combine rotation and translation, and frames chain by multiplying in order
- REP 105 separates map, odom and base_link by continuity and drift
- Odometry accumulates systematic error and needs calibration and other sources to correct it
- In a factory robot cell, the robot controller, cell PLC and safety system each have their own job; the PLC and robot coordinate through a handshake, and safety signals are dual-channel on separate safety modules
Check your understanding
- Following REP 103, which way does a robot’s y axis point?
- Which frame is continuous but drifts, and which does not drift but may jump?
- The right wheel travels 10.02 m and the left 10.00 m, with a wheel separation of 0.5 m. How many radians does the robot turn?
- In the PLC–robot handshake, why does the PLC drop start job only after it sees job done?
- Why does the UMBmark test drive both clockwise and counter-clockwise?
Answers
- To the left
- odom is continuous but drifts; map does not drift but may jump
- rad
- So that each signal waits for its answer and neither side acts on a stale signal, for example starting the same job twice
- To separate the effect of unequal wheels from that of an uncertain wheel separation
Key formulas
| Homogeneous transform in 2D | |
| Chaining frames | |
| Heading change from wheel distances |
Key references
- Siegwart, R., Nourbakhsh, I. R., & Scaramuzza, D. (2011). Introduction to autonomous mobile robots (2nd ed.). MIT Press. link
- ROS Enhancement Proposals. REP 105: Coordinate frames for mobile platforms. link
- Foote, T., & Purvis, M. (2010). REP 103: Standard units of measure and coordinate conventions. ROS Enhancement Proposals. link
- Foote, T. (2013). tf: The transform library. In 2013 IEEE Conference on Technologies for Practical Robot Applications (TePRA) (pp. 1–6). IEEE. link
- Borenstein, J., & Feng, L. (1996). Measurement and correction of systematic odometry errors in mobile robots. IEEE Transactions on Robotics and Automation, 12(6), 869–880. link
- Groover, M. P. (2018). Automation, production systems, and computer-integrated manufacturing (5th ed.). Pearson. link
- International Organization for Standardization. (2025). Robotics – Safety requirements – Part 2: Industrial robot applications and robot cells (ISO 10218-2:2025). link
- International Electrotechnical Commission. (2025). Programmable controllers – Part 3: Programming languages (IEC 61131-3:2025, Ed. 4.0). link
- OPC Foundation & VDMA. (2025). OPC UA for Robotics – Part 1: Vertical integration (OPC 40010-1, Version 1.02). link
Further reading
Study the assigned knowledge units in advance, review media and take the module quiz
Topic 3: Robotics & autonomous systems
ระบบอัตโนมัติอุตสาหกรรมและ PLC
เวกเตอร์ เมทริกซ์ และการแปลงพิกัดสำหรับอากาศยาน
ตรีโกณมิติ มุมออยเลอร์ และกรอบอ้างอิง
In class / field
Lab or field practice from worksheets with a safety checklist
Learning evidence: Checked worksheets and quiz results