Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

1.2 State, Actions, and Models

Source

Before a robot can reason about the world, we have to decide what it reasons about. This choice, called the state representation, is one of the most important modeling decisions in robotics. A good state contains just enough information to predict what happens next when the robot acts, and nothing more.

Choosing a state

RobotA sensible stateType
Vessel-washing robotwhich kind of vessel is in the sinkdiscrete (one of a few types)
Mopping robot on a tiled floorwhich tile it is ondiscrete (grid cells)
Cooking armangle of each jointcontinuous (a vector of angles)
Delivery robot in an apartment complexposition (px,py)(p_x, p_y) and heading θ\thetacontinuous
Delivery droneposition, velocity, and orientation in 3Dcontinuous

A discrete state takes one of finitely many values. A continuous state is a vector of real numbers. The same robot can often be modeled either way: a mopping robot’s position is really continuous, but thinking in whole tiles makes planning much simpler.

Two models describe every robot

A motion model says how the state changes when the robot acts, and a measurement model says what the sensors report in a given state:

motion model:xt+1=f(xt,ut)+wt\text{motion model:}\qquad x_{t+1} = f(x_t, u_t) + w_t
measurement model:zt=h(xt)+vt\text{measurement model:}\qquad z_t = h(x_t) + v_t

The terms wtw_t and vtv_t are noise. wtw_t captures the fact that the world does not do exactly what we command (wheels slip, wind blows), and vtv_t captures sensor error. For discrete states we express the same ideas as conditional probabilities, P(xt+1xt,ut)P(x_{t+1} \mid x_t, u_t) and P(ztxt)P(z_t \mid x_t).

A discrete motion model: mopping a wet balcony

A mopping robot cleans a narrow balcony six tiles long, moving one tile at a time from tile 0 toward the wall at tile 5. The floor is wet, so its wheels are unreliable. When it commands “forward one tile”:

  • it moves one tile with probability 0.70,

  • it slips and stays where it is with probability 0.20,

  • it skids forward two tiles with probability 0.10.

At the wall it cannot go further. We collect these probabilities in a transition matrix TT, where entry Tij=P(xt+1=jxt=i)T_{ij} = P(x_{t+1} = j \mid x_t = i). Each row is a probability distribution, so it sums to 1.

[[0.2 0.7 0.1 0.  0.  0. ]
 [0.  0.2 0.7 0.1 0.  0. ]
 [0.  0.  0.2 0.7 0.1 0. ]
 [0.  0.  0.  0.2 0.7 0.1]
 [0.  0.  0.  0.  0.2 0.8]
 [0.  0.  0.  0.  0.  1. ]]
rows sum to 1: True

If the robot starts certain that it is on tile 0 and commands “forward” several times, what should it believe about where it is? The probability of being on tile jj after one more step adds up all the ways of getting there:

P(xt+1=j)=iP(xt=i)  TijP(x_{t+1} = j) = \sum_i P(x_t = i)\;T_{ij}

In matrix form this is a row vector times a matrix, pt+1=ptTp_{t+1} = p_t\,T.

<Figure size 825x352 with 2 Axes>

Figure 1:Belief about the mopping robot’s tile after each “forward” command on a wet floor. Without sensing, the belief spreads over several tiles, and only the wall at tile 5 eventually concentrates it again.

After three commands the robot “should” be on tile 3, but it is actually there with only about 40% probability. Without a sensor that can tell tiles apart, the robot has no way to shrink this uncertainty until it reaches the wall. Mapping and localization in Chapters 5 and 6 are about exactly this problem.

A measurement model: ranging to a gate

A delivery robot measures its distance to an apartment gate with an ultrasonic range sensor. Real sensors of this kind become less precise with distance, so we model the noise standard deviation as growing with range:

z=d+v,vN(0, σ(d)2),σ(d)=0.02+0.03d metresz = d + v, \qquad v \sim \mathcal{N}\big(0,\ \sigma(d)^2\big), \qquad \sigma(d) = 0.02 + 0.03\,d \ \text{metres}

The notation vN(0,σ2)v \sim \mathcal{N}(0, \sigma^2) means “vv is drawn from a Gaussian (bell-curve) distribution with mean 0 and standard deviation σ\sigma”. Section 2.1 explains it in detail. The sensor also reports only whole centimetres, and it cannot see beyond 4 m.

<Figure size 770x396 with 1 Axes>

A measurement model like (4) tells us how far to trust each reading. A reading of 0.5 m can be trusted to within a few centimetres; a reading of 3.5 m could easily be 20 cm off. Beyond 4 m the sensor returns nothing at all, which is itself information: the gate is probably more than 4 m away.

A continuous motion model: the delivery robot drives

Now let the delivery robot drive along a path in the apartment complex. Its state is its position and heading (px,py,θ)(p_x, p_y, \theta). Each second it is commanded to drive forward at speed vv while turning at rate ω\omega, and both are disturbed by noise from uneven paving:

θt+1=θt+(ω+wω)Δtpx,t+1=px,t+(v+wv)cosθtΔtpy,t+1=py,t+(v+wv)sinθtΔt\begin{aligned} \theta_{t+1} &= \theta_t + (\omega + w_\omega)\,\Delta t \\ p_{x,t+1} &= p_{x,t} + (v + w_v)\cos\theta_t\,\Delta t \\ p_{y,t+1} &= p_{y,t} + (v + w_v)\sin\theta_t\,\Delta t \end{aligned}

We cannot predict one exact future, but we can sample many possible futures and look at where they end up.

<Figure size 770x396 with 1 Axes>

The clouds of possible positions grow as the robot drives. They also bend: small errors in heading turn into large sideways errors after a long straight run, so the cloud stretches across the direction of travel rather than along it. This shape is typical of wheeled robots, and it is why a delivery robot needs to keep correcting its estimate with landmarks and GPS.