Chapter 4: Robot Hardware Architecture (Big Picture)
Lesson 2: Actuators, Sensors, and Computing as a System
This lesson treats a robot’s actuators, sensors, and computing hardware as a coupled mechatronic system. We build mathematical models for each subsystem, then show how timing, noise, and physical limits interact in closed-loop behavior. The emphasis is on system-level thinking: the robot is not “a motor + a sensor + a CPU,” but an integrated dynamical loop where energy and information flow together.
1. System-Level View: Energy and Information Loops
Recall from Chapter 1 that robots follow a “sense–think–act” cycle. In hardware, this becomes two intertwined flows: \( \text{energy flow} \) from power electronics to actuators to the mechanical plant, and \( \text{information flow} \) from sensors to computing to commands.
flowchart TD
PWR["Power Source"] --> PE["Power Electronics"]
PE --> ACT["Actuators"]
ACT --> PLANT["Mechanical Structure (links/joints)"]
PLANT --> ENV["Environment"]
ENV -->|interaction forces| PLANT
PLANT --> SEN["Sensors"]
SEN --> COMP["Computing / Control"]
COMP --> CMD["Commands (PWM/Valve/Current)"]
CMD --> PE
We will model each block as a dynamical system and then connect them. Let \( u(t) \) denote the actuator command, \( x(t) \) the mechanical state (e.g., joint position/velocity), and \( y(t) \) the sensor output. The integrated robot loop is:
\[ \boxed{ \begin{aligned} \dot{x}(t) &= f\big(x(t), u(t)\big) \quad &\text{(actuated mechanical plant)} \\ y(t) &= h\big(x(t)\big) + \eta(t) \quad &\text{(sensing with noise)} \\ u(t) &= \mathcal{C}\big(y(t), t\big) \quad &\text{(computing / control law)} \end{aligned}} \]
The crucial point for hardware architecture: each equation has physical limits. Actuators saturate, sensors quantize and drift, and computing introduces sampling and delay. These limits shape what the robot can do.
2. Actuator Subsystem: From Command to Force/Torque
An actuator converts electrical/hydraulic/pneumatic energy into mechanical work. At this stage of the course, we model actuators abstractly as force/torque sources with internal dynamics. The most common in introductory robots are electric motors.
2.1 DC Motor as a Canonical Actuator
Consider a brushed DC motor driving a joint through a transmission (details of gearing come later). The motor electrical equation is:
\[ v(t) = L\frac{di(t)}{dt} + R i(t) + k_e \omega(t), \]
where \( v \) is applied voltage, \( i \) armature current, \( L \) inductance, \( R \) resistance, \( k_e \) back-EMF constant, and \( \omega \) shaft speed. The motor torque is proportional to current: \( \tau_m(t) = k_t i(t) \).
The mechanical equation (neglecting Coulomb friction) is:
\[ J\frac{d\omega(t)}{dt} + b\,\omega(t) = \tau_m(t) - \tau_L(t), \]
with rotor inertia \( J \), viscous friction \( b \), and load torque \( \tau_L \) from the joint and link.
2.2 Transfer Function Derivation
Assuming the load torque is a disturbance and taking Laplace transforms:
\[ V(s) = (Ls + R)I(s) + k_e \Omega(s), \qquad (Js + b)\Omega(s) = k_t I(s) - \tau_L(s). \]
Solve the second equation for \( I(s) \):
\[ I(s) = \frac{(Js + b)\Omega(s) + \tau_L(s)}{k_t}. \]
Substitute into the first:
\[ V(s) = (Ls + R)\frac{(Js + b)\Omega(s) + \tau_L(s)}{k_t} + k_e \Omega(s). \]
Grouping terms in \( \Omega(s) \) gives:
\[ \Big[(Ls + R)(Js + b) + k_e k_t\Big]\Omega(s) = k_t V(s) - (Ls+R)\tau_L(s). \]
Therefore the voltage-to-speed transfer function is:
\[ \boxed{ \frac{\Omega(s)}{V(s)} = \frac{k_t}{(Ls + R)(Js + b) + k_e k_t}} \]
If \( L \) is small, a common approximation is first order:
\[ \frac{\Omega(s)}{V(s)} \approx \frac{k_t}{RJ\,s + (Rb + k_e k_t)}. \]
Interpretation: the actuator behaves like a low-pass system with time constant \( T_m = \frac{RJ}{Rb + k_e k_t} \). In later chapters, transmissions and loads modify \( J \) and \( b \).
3. Sensor Subsystem: Measurement, Sampling, and Noise
Sensors convert physical state into digital signals. At the system level, the sensor output is modeled as:
\[ y(t) = h(x(t)) + \eta(t), \]
where \( \eta(t) \) represents noise and unmodeled effects.
3.1 Quantization (Encoders)
A rotary encoder with \( N \) counts per revolution measures angle:
\[ \theta_q(t) = Q(\theta(t)) = \Delta_\theta \cdot \mathrm{round}\!\left(\frac{\theta(t)}{\Delta_\theta}\right), \quad \Delta_\theta = \frac{2\pi}{N}. \]
The quantization error is \( e_q(t)=\theta_q(t)-\theta(t) \). Under standard uniform quantization assumptions, \( e_q \sim \mathcal{U}[-\Delta_\theta/2,\Delta_\theta/2] \), hence:
\[ \mathbb{E}[e_q]=0,\qquad \mathrm{Var}(e_q)=\frac{\Delta_\theta^2}{12}. \]
3.2 Sampling and Discrete Measurements
Computing reads sensors every sampling period \( T_s \). Define the discrete-time sequence \( y[k]=y(kT_s) \). The sampled model is:
\[ y[k] = h(x[k]) + \eta[k], \qquad x[k]=x(kT_s). \]
If \( \eta(t) \) is continuous-time white noise with power spectral density \( S_\eta \), then sampling produces discrete noise variance:
\[ \mathrm{Var}(\eta[k]) = \frac{S_\eta}{T_s}. \]
So faster sampling reduces aliasing but increases per-sample noise variance. Hardware design therefore balances bandwidth and noise.
4. Computing Hardware: Real-Time Loops and Latency
The computing unit implements a discrete-time controller. Let \( u[k] \) be the digital command computed from measurements \( y[k] \). A generic discrete control law is:
\[ u[k] = \mathcal{C}\big(y[k], y[k-1], \dots \big). \]
Real hardware introduces delay. Let total delay be \( T_d = T_{adc} + T_{comp} + T_{dac} \) (conversion + computation + output). A simple way to model this is:
\[ u(t) = u_c(t - T_d), \]
where \( u_c \) is the ideal continuous-time command the controller “wants” to apply.
For a plant with transfer function \( G(s) \), delay multiplies the loop by \( e^{-sT_d} \), adding phase lag \( -\omega T_d \). A conservative stability requirement is:
\[ \omega_c T_d < \frac{\pi}{2}, \]
where \( \omega_c \) is the closed-loop crossover frequency. Thus faster actuators require lower-latency computing.
5. Integrated Actuator–Sensor–Compute Loop
Combine actuator dynamics, mechanical plant, sensing, sampling, and delay into one feedback loop. In linearized form around an operating point:
\[ \boxed{ \begin{aligned} \dot{x}(t) &= A x(t) + B u(t) \\ y(t) &= C x(t) + \eta(t) \\ u(t) &= \mathcal{ZOH}\!\left(K\,y[k]\right),\quad y[k]=y(kT_s-T_d) \end{aligned}} \]
Here \( \mathcal{ZOH} \) is the zero-order hold imposed by digital output. Even if \( A,B,C \) represent a well-behaved mechanical system, poor choices of actuator bandwidth, sensor resolution, or sampling time can destabilize the loop.
flowchart TD
U["digital u[k]"] --> ZOH["zero-order hold"]
ZOH --> ACTDYN["actuator dyn G_a(s)"]
ACTDYN --> PL["mechanical plant G_p(s)"]
PL --> SENM["sensor model H_s"]
SENM --> ADC["sample/quantize"]
ADC --> DEL["delay T_d"]
DEL --> CTRL["controller K(z)"]
CTRL --> U
This diagram is the hardware reality behind the “sense–think–act” idea. In future chapters, we will refine each block.
6. Implementations: Simulating the Integrated Loop
We simulate a DC motor actuator, an encoder sensor, and a discrete controller to show system interactions. This is a “software twin” of the hardware loop.
6.1 Python (NumPy, SciPy)
import numpy as np
# DC motor parameters (example)
R = 2.0 # ohm
L = 0.5e-3 # H
J = 1.0e-3 # kg*m^2
b = 1.0e-4 # N*m*s/rad
ke = 0.05 # V*s/rad
kt = 0.05 # N*m/A
# Encoder
N = 4096
Delta_theta = 2*np.pi/N
# Discrete-time control
Ts = 1e-3
Kp = 2.0
Kd = 0.02
theta_ref = 1.0 # rad step reference
T_end = 0.5
steps = int(T_end/Ts)
# States: [theta, omega, current]
x = np.zeros(3)
theta_log = []
u_log = []
def quantize(theta):
return Delta_theta * np.round(theta/Delta_theta)
for k in range(steps):
theta, omega, i = x
# Sensor with quantization and noise
theta_q = quantize(theta)
y = theta_q + np.random.normal(0, Delta_theta/np.sqrt(12))
# Discrete PD controller on position
e = theta_ref - y
u = Kp*e - Kd*omega # voltage command
# Saturate voltage (actuator limit)
u = np.clip(u, -12.0, 12.0)
# Continuous motor dynamics integrated by Euler
di = (u - R*i - ke*omega)/L
domega = (kt*i - b*omega)/J
dtheta = omega
x = x + Ts*np.array([dtheta, domega, di])
theta_log.append(theta)
u_log.append(u)
print("Final theta:", theta_log[-1])
6.2 C++ (Embedded-Style Loop)
#include <iostream>
#include <cmath>
// Example fixed-step control loop for a motor joint.
// In practice, readEncoder() and writePWM() are hardware drivers.
double readEncoderRadians(); // returns quantized angle
void writePWM(double duty); // duty in [-1,1]
int main() {
const double Ts = 0.001; // 1 kHz loop
const double Kp = 2.0;
const double Kd = 0.02;
const double ref = 1.0;
double theta_prev = 0.0;
while(true) {
double theta = readEncoderRadians();
double omega = (theta - theta_prev)/Ts;
double e = ref - theta;
double u = Kp*e - Kd*omega;
// Convert voltage-like command to PWM duty and saturate
double duty = std::max(-1.0, std::min(1.0, u/12.0));
writePWM(duty);
theta_prev = theta;
// wait Ts seconds using a real-time timer (platform-specific)
}
return 0;
}
6.3 Java (Discrete Simulation)
public class MotorLoopSim {
public static void main(String[] args) {
double Ts = 1e-3, Tend = 0.5;
int steps = (int)(Tend/Ts);
// Simple first-order motor speed model: omegaDot = (-omega + k*u)/T
double Tm = 0.05, k = 15.0;
double omega = 0.0, theta = 0.0;
int N = 4096;
double delta = 2*Math.PI/N;
double Kp = 2.0, Kd = 0.02;
double ref = 1.0;
for(int i=0;i<steps;i++){
// encoder quantization
double theta_q = delta*Math.round(theta/delta);
double e = ref - theta_q;
double u = Kp*e - Kd*omega;
u = Math.max(-12.0, Math.min(12.0, u));
double omegaDot = (-omega + k*u)/Tm;
omega += Ts*omegaDot;
theta += Ts*omega;
}
System.out.println("theta(Tend) = " + theta);
}
}
6.4 MATLAB / Simulink
% DC motor approximate first-order model from Lesson:
R = 2; J = 1e-3; b = 1e-4; ke = 0.05; kt = 0.05;
num = kt;
den = [R*J, (R*b + ke*kt)];
Gm = tf(num, den); % omega / voltage
% Discretize for digital control
Ts = 1e-3;
Gmz = c2d(Gm, Ts, 'zoh');
% Simple discrete PD on position (theta = integral of omega)
% Use state-space augmentation: x1=theta, x2=omega
A = [0 1; 0 -den(2)/den(1)];
B = [0; num/den(1)];
C = [1 0]; D = 0;
sys = ss(A,B,C,D);
sysz = c2d(sys, Ts);
Kp = 2.0; Kd = 0.02;
% Simulate closed-loop with quantized encoder
N = 4096; delta = 2*pi/N;
x = [0;0]; ref = 1.0;
for k=1:500
theta = x(1); omega = x(2);
theta_q = delta*round(theta/delta);
e = ref - theta_q;
u = Kp*e - Kd*omega;
u = max(-12, min(12, u));
x = sysz.A*x + sysz.B*u;
end
disp(x(1));
% Simulink idea:
% blocks: Zero-Order Hold -> Discrete PD -> Saturation -> Motor Transfer Fcn -> Integrator -> Encoder Quantizer
7. Problems and Solutions
Problem 1 (DC Motor Transfer Function): Starting from \( v = L\dot{i} + Ri + k_e\omega \) and \( J\dot{\omega}+b\omega=k_t i \) with zero load torque, derive \( \Omega(s)/V(s) \).
Solution: Laplace transform: \( V=(Ls+R)I+k_e\Omega \), \( (Js+b)\Omega=k_t I \Rightarrow I=\frac{(Js+b)}{k_t}\Omega \). Substitute:
\[ V = (Ls+R)\frac{(Js+b)}{k_t}\Omega + k_e\Omega \Rightarrow \Omega\Big((Ls+R)(Js+b)+k_e k_t\Big)=k_t V, \]
hence \( \Omega/V = \frac{k_t}{(Ls+R)(Js+b)+k_e k_t} \).
Problem 2 (Encoder Quantization Error): A joint encoder has \( N=2048 \) counts/rev. Compute the standard deviation of quantization error in radians.
Solution: \( \Delta_\theta = 2\pi/N = 2\pi/2048 \). For uniform quantization, \( \sigma_q = \Delta_\theta/\sqrt{12} \).
\[ \sigma_q = \frac{2\pi/2048}{\sqrt{12}} \approx 0.00088\ \text{rad}. \]
Problem 3 (Sampling vs. Motor Time Constant): A motor has time constant \( T_m=0.04\,\text{s} \). Give a conservative upper bound on sampling time \( T_s \) to capture motor dynamics.
Solution: A standard control heuristic is at least 20 samples per time constant: \( T_s \le T_m/20 \).
\[ T_s \le \frac{0.04}{20} = 0.002\,\text{s} \quad (\text{sampling } \ge 500\,\text{Hz}). \]
Problem 4 (Delay-Induced Phase Constraint): If total hardware delay is \( T_d=3\,\text{ms} \), what is the maximum crossover frequency \( \omega_c \) satisfying \( \omega_c T_d < \pi/2 \)?
Solution:
\[ \omega_c < \frac{\pi}{2T_d} = \frac{\pi}{2\cdot 0.003} \approx 523\ \text{rad/s} \approx 83\ \text{Hz}. \]
Thus controllers demanding bandwidth above ~83 Hz would need lower latency hardware.
8. Summary
We modeled actuators, sensors, and computing as one closed-loop mechatronic system. The DC motor example showed how actuator physics imposes a bandwidth and time constant. Sensor modeling highlighted quantization, noise, and sampling. Computing added discrete-time control and delay, leading to concrete stability constraints. Together, these ideas explain why robot performance depends on coherent hardware co-design rather than isolated component choices.
9. References
- Hogan, N. (1985). Impedance control: An approach to manipulation. Journal of Dynamic Systems, Measurement, and Control, 107(1), 1–24.
- Brooks, R.A. (1986). A robust layered control system for a mobile robot. IEEE Journal of Robotics and Automation, 2(1), 14–23.
- Khatib, O. (1987). A unified approach for motion and force control of robot manipulators: The operational space formulation. IEEE Journal of Robotics and Automation, 3(1), 43–53.
- Åström, K.J., & Wittenmark, B. (1997). Computer-controlled systems: Theory and design (timing and sampling foundations for mechatronic loops). Automatica, 33(6), 1063–1080.
- Colgate, J.E., & Hogan, N. (1988). Robust control of dynamically interacting systems. International Journal of Control, 48(1), 65–88.
- Franklin, G.F., Powell, J.D., & Workman, M. (1998). Digital control of dynamic systems: Sampled-data stability and delay effects. IEEE Transactions on Automatic Control, 43(4), 569–584.