Chapter 9: Coordinate Systems

In the late 1970s, a team at Yamanashi University in Japan led by Hiroshi Makino set out to build an arm for factory assembly work. They began not with the machine but with the job. Watch a person fitting a component into a circuit board and you see the same motion repeated: swing the hand across to the right place above the board, then push straight down. Sideways to find the spot, downward to seat the part.

So the arm they designed moved in exactly those two ways. Two joints rotated in a flat horizontal plane, sweeping the tool anywhere over the workbench. A third slide carried the tool straight up and down. The result was the SCARA arm — the Selective Compliance Assembly Robot Arm — and it is still bolted beside assembly lines today, of the kind shown in Fig. 9.0-1.

Notice what that design decided. To tell this arm where to go, you do not naturally say “go to x and y and z”. You say: turn to this angle, reach out this far, drop this height. An angle, a distance and a height. The machine’s shape and the numbers used to command it were chosen together.

That pairing is the subject of this chapter. Before a robot can move to a place, someone must first agree on how a place is written down.

Photograph

Fig. 9.0-1 – a SCARA robot arm mounted on an assembly bench, photographed from the side and slightly above so the whole structure reads clearly: the fixed base, the two arm links that swing in a horizontal plane, the vertical shaft carrying the tool at the far end, and the flat work surface below it. Sourcing note: a stock or manufacturer-licensed photograph of a real installed SCARA arm in a working or laboratory setting; renderings, computer-generated images, and close-ups that hide the base or the vertical shaft are unusable.

NoteCuriosity Corner

Q1. If a robot is told that a box is at “2 metres and 3 metres”, why is that instruction still useless on its own? Q2. A scanning sensor sweeps a room and reports what it finds as a distance and an angle, not as a pair of side-to-side measurements. Why is that the natural way for it to speak? Q3. A cleaning robot is at one corner of a hall and must reach a charging point at another. How does it work out the shortest straight-line distance without driving it first? Q4. A robot calculates the angle to a target and sets off in exactly the opposite direction, even though the arithmetic was done correctly. What went wrong? Q5. The SCARA designers described their arm with an angle, a distance and a height. Why did they not use a third angle instead of a height?

This chapter will answer all five of these questions.

9.1 Locating a Point in Space

Ask a friend where the scissors are and you might hear “on the second shelf, behind the glue bottle”. That answer works because your friend can see the shelf, knows what a glue bottle looks like, and trusts you to work out the rest.

A robot has none of that. It cannot picture a shelf, and it has no sense of “behind”. What it can do is hold numbers, compare them, and turn them into motion. So before a robot can be sent anywhere, a place has to be turned into numbers.

This chapter is about how that is done, and about the three ways of doing it that the subject uses again and again: Cartesian, polar, and cylindrical.

9.1.1 Why a Robot Needs Numbers for Position

Everything inside a robot is arithmetic. A sensor produces a number, the controller compares that number with another, and the result decides how far a motor turns. Nothing in that chain can act on a phrase.

Suppose a warehouse robot is told to fetch a carton from the third rack. The instruction is perfectly clear to a person, and useless to the machine. Somewhere it must become something the controller can subtract, such as “the carton is 6.4 m ahead and 2.1 m to the left”.

Once a place is written as numbers, three useful things become possible at once. The place can be stored in memory, so the robot can return to it later. It can be compared with the robot’s present place, so the robot can tell how far it still has to travel. And it can be sent over a communication link to another machine, arriving unchanged.

Position, and how it differs from distance

Be careful with the word distance. A distance is a single number and it tells you how far, never which way. A position must fix a place completely, and in a plane that always takes two numbers, not one.

Q. An ultrasonic sensor on a robot reports that something is 1.2 m away. Is that a position?

A. No. It is one number, so it fixes only how far the object is, not where. Together with the direction the sensor was pointing it becomes a position — and that is exactly the pair of numbers the polar system uses.

9.1.2 What a Coordinate System Is

To turn places into numbers, you first need something to measure from and something to measure along. Fix a starting point, fix one or more directions, and agree on a unit of length. Every place in the region can then be labelled by how far it lies from the starting point along those directions.

That agreed arrangement is a coordinate system. The fixed starting point is called the origin, each fixed direction is an axis, and the numbers that label a place are its coordinates. Fig. 9.1-1 shows the idea at its simplest.

Diagram

Fig. 9.1-1 – two perpendicular reference axes drawn as arrowed lines meeting at a point labelled O (origin); the horizontal axis labelled X-axis and the vertical axis labelled Y-axis; a single dot marked P placed in the upper right region; a dashed line dropped vertically from P to the X-axis and a dashed line drawn horizontally from P to the Y-axis, the two intercepts labelled x and y respectively; a scale mark on each axis showing the unit of length

NoteDefinition

A coordinate system is an agreed arrangement of an origin, one or more reference axes and a unit of measurement, by which the position of any point in a region is expressed as a set of numbers called its coordinates.

The word system is doing real work in that definition. The numbers are not properties of the point itself; they are the answer the point gives to a particular set of questions. Change the questions and the numbers change, although the point has not moved at all.

A well-chosen coordinate system has one further property that matters a great deal in robotics: within it, one point gives one set of numbers, and one set of numbers gives one point. Without that, a robot commanded to a position could end up at either of two places.

9.1.3 A Coordinate Means Nothing Without Its Frame

You already know that a frame in robotics is a coordinate system attached to something — to the workshop floor, to a robot’s chassis, to a single link of an arm. A fixed frame stays put; a moving frame travels with the part it is attached to.

This is the point at which frames and coordinates meet, and it is worth being blunt about it. A set of coordinates is meaningless until you say which frame it is measured in.

Take a workshop with a fixed frame whose origin sits at the corner of the doorway, with the x-axis running along one wall and the y-axis along the other. A carton rests at \(x = 4.0\) m, \(y = 1.5\) m in that frame.

A mobile robot stands at \(x = 4.0\) m, \(y = 0.5\) m in the same frame, facing along the x-axis. The robot also carries its own moving frame, with its origin at the robot’s centre, its x-axis pointing straight ahead and its y-axis pointing to its left.

In the robot’s own frame, that same carton is at \(x = 0.0\) m, \(y = 1.0\) m. Fig. 9.1-2 shows both descriptions of the one carton.

Diagram

Fig. 9.1-2 – a plan view of a rectangular workshop; a fixed frame drawn at the doorway corner with axes labelled x0 and y0 and origin labelled O0; a small robot symbol drawn inside the room facing along x0, carrying its own frame with axes labelled x1 (pointing forward) and y1 (pointing to the robot’s left) and origin labelled O1 at the robot’s centre; a carton drawn to the robot’s left; two dashed measurement lines to the carton from O0 labelled 4.0 m and 1.5 m, and two from O1 labelled 0.0 m and 1.0 m; a caption line inside the figure reading “one carton, two sets of coordinates”

Neither description is wrong, and neither is more true than the other. The carton has not moved. What changed is the frame the question was asked in.

This is why a robot’s software keeps saying which frame a number belongs to, and why a large part of practical robotics is converting a measurement taken in one frame into the frame where the decision has to be made. A camera reports what it sees in the camera’s frame; the gripper must be commanded in the arm’s frame.

Q1. If a robot is told that a box is at “2 metres and 3 metres”, why is that instruction still useless on its own?

A. Because coordinates only have meaning inside a stated frame. Two metres and three metres from the corner of the workshop is a completely different place from two metres and three metres from the robot’s own centre, and a third place again if the axes are turned the other way. The pair of numbers has to arrive with the name of the frame it was measured in, and with its unit, before the robot can act on it.

Put a small object anywhere on a bench. Two of you now choose different corners of the bench as the origin, taking the axes along the two bench edges, and each measures the object’s position in centimetres. Compare your two answers, then say what would have to be agreed before one of you could send that position to the other.

9.1.4 What Coordinate Systems Let a Robot Do

A coordinate system is not book-keeping. It is the reason several ordinary robot behaviours are possible at all.

  1. Stating a location exactly. A place written as numbers carries no ambiguity, and can be repeated to the same precision every time the robot is switched on.

  2. Measuring distances and angles. Once two places are numbers, the gap between them can be calculated rather than guessed, which is how a robot knows whether it is nearly there.

  3. Planning a path. A route is a list of positions in order. Planning is arithmetic on that list, and the robot’s motion is the machine following it.

  4. Transforming between frames. A reading taken in a sensor’s frame can be converted into the frame of the floor, or the arm, or the map, so that separate parts of one machine agree about where things are.

  5. Describing a workspace. The workspace is the whole region a robot can reach. Written in coordinates, it becomes a set of limits the controller can test against before it commands a move.

  6. Programming and simulation. A robot can be tried out on a screen before it is built, because in software a position is nothing more than its numbers.

The last point deserves a moment. When a robotic arm is simulated, no metal moves and no motor turns. What the computer holds is a set of coordinates being updated step by step, and everything visible on the screen is drawn from them.

The choice that is still to be made

Nothing so far has said which numbers to use. A place in a plane needs two of them, but the pair could be two distances measured along two axes, or one distance and one angle. Both describe the same plane completely.

That choice is not a matter of taste. It decides how much arithmetic the robot has to do, how naturally a sensor’s raw output fits, and how closely the description matches the way the machine actually moves. The next three sections take the three choices the syllabus sets out — Cartesian, polar, and cylindrical — one at a time.

9.2 The Cartesian Coordinate System

Draw two lines on the workshop floor at right angles to each other, and you have already built the most widely used coordinate system in robotics. Almost every machine drawing, every simulation and every map a robot carries is written this way.

Its idea is simple. Measure along one direction, then measure along a second direction at right angles to the first, and the two measurements together fix the place.

9.2.1 Axes, Origin and the Ordered Pair

The Cartesian coordinate system — also called the rectangular or rectilinear system — uses two perpendicular axes meeting at the origin. The horizontal one is the X-axis, the vertical one is the Y-axis, and the origin is written as (0, 0).

A point is then labelled by two numbers: how far it lies along the X-axis, and how far along the Y-axis. Written together in that fixed order, inside brackets, they form an ordered pair \((x, y)\).

The word ordered is not decoration. The point (3, 5) and the point (5, 3) are two different places, so the first number is always the distance along the X-axis and the second is always the distance along the Y-axis. Swap them and the robot goes somewhere else.

NoteDefinition

The Cartesian coordinate system is a coordinate system in which the position of a point is given by its perpendicular distances from two mutually perpendicular axes meeting at the origin, written as an ordered pair (x, y) with respect to a stated frame.

Here is what that looks like in a real setting. A mobile robot on a workshop floor is at \(x = 2.0\) m, \(y = 3.0\) m in the workshop’s fixed frame. It is standing 2.0 m along the wall the X-axis runs beside, and 3.0 m out from that wall.

Notice how independent the two numbers are. Change \(x\) and the robot has moved along one wall only; change \(y\) and it has moved away from that wall only. Neither measurement disturbs the other, and this independence is the system’s main strength.

9.2.2 The Four Quadrants and the Sign of a Coordinate

The two axes cut the plane into four regions, and each region is called a quadrant. They are numbered I to IV, starting from the region where both coordinates are positive and going anticlockwise, as Fig. 9.2-1 shows.

Diagram

Fig. 9.2-1 – Cartesian axes drawn as two arrowed perpendicular lines crossing at O; the four regions labelled with Roman numerals I, II, III and IV, with I at the upper right and the numbering running anticlockwise; one sample point plotted in each quadrant and labelled with its coordinates: (3, 2), (−3, 2), (−3, −2) and (3, −2); the sign pair for each quadrant written small inside the region, as (+, +), (−, +), (−, −) and (+, −)

A coordinate is negative simply because the point lies on the other side of an axis from the positive direction. There is nothing unusual about a negative position; it means “behind the origin” or “below it”, depending on the axis.

Table 9.1 – sign of each coordinate in the four quadrants of the Cartesian plane | Quadrant | Sign of x | Sign of y | Condition | |—|—|—|—| | I | positive | positive | \(x > 0\), \(y > 0\) | | II | negative | positive | \(x < 0\), \(y > 0\) | | III | negative | negative | \(x < 0\), \(y < 0\) | | IV | positive | negative | \(x > 0\), \(y < 0\) |

Reading Table 9.1 across, you can see that only the pair of signs distinguishes the four regions; the sizes of the numbers play no part in it. This is why a robot’s software can decide which quadrant a target lies in by testing two signs, long before it does any arithmetic on the distances.

Two cases sit outside the table. A point on an axis has one coordinate equal to zero and belongs to no quadrant, and the origin itself has both coordinates zero.

Signs matter in practice because they usually carry a physical meaning. If a robot’s own frame has its x-axis pointing forward and its y-axis pointing to its left, then a target at \(y = -0.6\) m is 0.6 m to the robot’s right, and a target at \(x = -1.4\) m is behind it.

9.2.3 Extending the Description to Three Dimensions

A mobile robot on a level floor needs only two numbers, because it cannot leave the floor. A robotic arm that lifts a component off a bench needs three, because height is now part of the answer.

The system extends in the obvious way. A third axis, the Z-axis, is drawn perpendicular to both the others through the same origin, and a point becomes an ordered triple \((x, y, z)\), as in Fig. 9.2-2.

Diagram

Fig. 9.2-2 – three-dimensional Cartesian axes drawn in perspective from a common origin O, labelled X-axis, Y-axis and Z-axis with the Z-axis vertical; a point P plotted away from all three axes; dashed construction lines dropped from P vertically down to the horizontal plane and then along to each of the X and Y axes, with the three intercepts labelled x, y and z; a small right-hand symbol in the corner indicating the right-handed convention

Almost all robotics work uses a right-handed arrangement of the three axes. Point the fingers of your right hand along the X-axis and curl them towards the Y-axis; your thumb then points along the positive Z-axis. Fixing this convention once means that a rotation described as positive means the same thing on every machine in the workshop.

The independence carries over unchanged. Moving a gripper 40 mm upward changes only \(z\), and leaves \(x\) and \(y\) exactly as they were.

9.2.4 Distance Between Two Points

A robot at one place, a target at another: how far apart are they? In Cartesian coordinates the answer needs no measurement at all, only the two pairs of numbers.

Join the two points and complete the right-angled triangle, as in Fig. 9.2-3. One side is the difference in \(x\), the other is the difference in \(y\), and the straight-line gap between the points is the hypotenuse. Pythagoras’ theorem finishes the job.

Diagram

Fig. 9.2-3 – Cartesian axes with two points plotted and labelled A(x1, y1) and B(x2, y2); a straight line joining A to B labelled d; a horizontal dashed line from A and a vertical dashed line from B meeting at a right angle to complete the triangle, the horizontal side labelled (x2 − x1) and the vertical side labelled (y2 − y1); the right angle marked with a small square

This straight-line separation is called the Euclidean distance between the two points.

the Euclidean distance formula Statement: For two points \(A(x_1, y_1)\) and \(B(x_2, y_2)\) in a plane, the straight-line distance between them is \(d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}\). In words: square the gap along each axis, add the squares, and take the square root of the total. Why it holds: the gaps along the two axes are the perpendicular sides of a right-angled triangle whose hypotenuse is the line joining the points, so Pythagoras’ theorem applies directly. Used for: finding how far a robot still has to travel, deciding whether a target lies inside the reach of an arm, and comparing candidate routes before any motor turns. Watch out: it is the length of the straight line only. If a wall, a bench or a joint limit stands in the way, the distance the robot actually travels will be greater.

Because each difference is squared, the order of subtraction cannot change the answer. Taking \(x_1 - x_2\) instead of \(x_2 - x_1\) flips the sign, and squaring removes it again.

In three dimensions the same reasoning gives one more term:

\[d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}\]

straight-line distance a floor robot must cover

Given: A cleaning robot in a school workshop is at \(A(1.2\ \text{m},\ 0.8\ \text{m})\) in the workshop frame. Its charging dock is at \(B(4.4\ \text{m},\ 4.6\ \text{m})\) in the same frame.

Find: the shortest straight-line distance from the robot to the dock.

Method: both points are given in the same frame and in the same unit, so the Euclidean distance formula applies directly.

\[x_2 - x_1 = 4.4\ \text{m} - 1.2\ \text{m} = 3.2\ \text{m}\]

\[y_2 - y_1 = 4.6\ \text{m} - 0.8\ \text{m} = 3.8\ \text{m}\]

\[d = \sqrt{(3.2\ \text{m})^2 + (3.8\ \text{m})^2} = \sqrt{10.24\ \text{m}^2 + 14.44\ \text{m}^2} = \sqrt{24.68\ \text{m}^2}\]

\[d = 4.97\ \text{m}\]

The dock is 4.97 m away in a straight line.

Check: The robot has to cross 3.2 m one way and 3.8 m the other, so the direct distance must be more than either of them and less than their sum of 7.0 m. A value of 4.97 m sits sensibly between the two.

taking the square root term by term What students do: They compute \(\sqrt{(x_2-x_1)^2} + \sqrt{(y_2-y_1)^2}\), so the example above becomes \(3.2\ \text{m} + 3.8\ \text{m} = 7.0\ \text{m}\). What happens: The answer is always too large, and it is the distance the robot would cover by driving along one axis and then the other, not the direct line. A controller using it would believe the target was further away than it is and would begin slowing down too late. The fix: Add the squares first and take one square root at the end. The square root of a sum is not the sum of the square roots.

deciding whether a target is within reach

Given: A small robotic arm is mounted with its base at the origin of the bench frame. Its maximum reach in the plane of the bench is 0.40 m. A component to be picked up lies at \((0.32\ \text{m},\ -0.18\ \text{m})\) in that frame.

Find: whether the arm can reach the component.

Method: the reach limit is a straight-line distance from the base, so find the Euclidean distance from the origin \((0, 0)\) to the component and compare it with 0.40 m.

\[d = \sqrt{(0.32\ \text{m} - 0)^2 + (-0.18\ \text{m} - 0)^2}\]

\[d = \sqrt{0.1024\ \text{m}^2 + 0.0324\ \text{m}^2} = \sqrt{0.1348\ \text{m}^2}\]

\[d = 0.367\ \text{m}\]

The component is 0.367 m from the base, which is less than the 0.40 m reach, so the arm can reach it.

Check: The negative sign on \(y\) only places the component on the far side of the x-axis; squaring removes it, as it must, because a distance cannot depend on which side of an axis a point lies. The result is a little larger than 0.32 m, which is right, since the component is not straight out along the X-axis.

Q3. A cleaning robot is at one corner of a hall and must reach a charging point at another. How does it work out the shortest straight-line distance without driving it first?

A. It uses the two positions it already holds as numbers. If both are written in the same frame, the differences along the two axes are the sides of a right-angled triangle, and the Euclidean distance formula gives the hypotenuse — the straight-line gap — in a single calculation. The robot never has to travel the route to know its length. What the formula cannot tell it is whether anything stands in the way, so the distance it finally drives may well be longer.

9.2.5 What Cartesian Description Does Well, and Where It Struggles

Cartesian coordinates suit motion that runs along straight lines. A gantry machine that carries a tool on one rail across another is a perfect match: one motor changes \(x\), a second changes \(y\), a third changes \(z\), and each command touches one motor only.

They also suit maps. A warehouse floor, a field, a printed circuit board and a workshop bench are all naturally described as flat surfaces with two straight measuring directions, so grids and Cartesian coordinates fit them without strain.

The difficulty appears when motion is naturally circular. Fig. 9.2-4 shows an arm swinging about its base at a steady rate, with the tool tracing an arc.

Diagram

Fig. 9.2-4 – a single arm link pivoted at the origin O of a set of Cartesian axes, drawn in three positions as it swings anticlockwise, with the tool tip marked in each position; a dashed arc through the three tip positions showing the circular path; dashed lines from two of the tip positions to the X and Y axes showing that both x and y change together; the constant length of the link from O to the tip labelled r

The arm is doing one simple thing: turning. Yet in Cartesian terms both \(x\) and \(y\) are changing at every instant, and neither changes at a steady rate. Describing that plain rotation as a pair of x and y values is far more work than the motion deserves.

The distance from the pivot, meanwhile, never changes at all. A description built around that unchanging distance and the angle turned would capture the motion in one moving number instead of two, and that is precisely the description the next section introduces.

9.3 The Polar Coordinate System

Stand in the middle of a dark room with a torch. You sweep the beam around until it lands on the doorway, and then you judge how far off the door is. You have just described a position without using a single grid line.

What you used instead was a direction and a distance. That pairing is the whole of the polar system, and it is how a great many robot sensors naturally describe the world.

9.3.1 The Pole, the Reference Direction and the Ordered Pair

The polar coordinate system fixes a single reference point and a single reference direction. The point is called the pole, and the fixed direction drawn out from it is the polar axis, which in robotics is almost always taken along the positive X-axis of the matching Cartesian frame.

A point is then written as the ordered pair \((r, \theta)\), where \(r\) is the radial distance — the straight-line distance from the pole to the point — and \(\theta\) is the angular displacement, the angle turned from the polar axis to the line joining the pole to the point. Fig. 9.3-1 shows both quantities on one diagram.

Diagram

Fig. 9.3-1 – a point O labelled “pole” with a horizontal arrowed line running right from it labelled “polar axis”; a point P placed up and to the right; a straight line from O to P labelled r; a curved arrow from the polar axis round to OP labelled theta with an anticlockwise arrowhead; a faint dashed circle of radius r centred on O passing through P; a note on the circle reading “every point on this circle has the same r”

NoteDefinition

The polar coordinate system is a coordinate system in which the position of a point in a plane is given by its radial distance r from a fixed point called the pole, together with the angular displacement θ of the line joining them, measured from a fixed reference direction called the polar axis.

Look again at that dashed circle in Fig. 9.3-1. Every point on it has the same \(r\) and differs only in \(\theta\), which is exactly the situation of a robot arm swinging about its base with the link length unchanged.

There is one honest awkwardness to record. The same point can be written with more than one pair of numbers, because turning a full circle brings you back to where you started: \((2.0\ \text{m},\ 30^\circ)\) and \((2.0\ \text{m},\ 390^\circ)\) are the same place. At the pole itself, \(r = 0\) and the angle has no meaning at all.

Robot software avoids the trouble by agreeing on a range for the angle and keeping every value inside it, usually \(0^\circ\) to \(360^\circ\), or \(-180^\circ\) to \(+180^\circ\) where left and right of straight ahead are to be distinguished.

9.3.2 Measuring the Angle: Degrees, Radians and Sign

An angle can be written in two units, and robotics uses both. The degree is familiar from geometry, with a full turn divided into 360 parts. The radian is the unit used inside almost all calculation, and a full turn is \(2\pi\) radians.

The two are related by a fixed ratio, since half a turn is both \(180^\circ\) and \(\pi\) radians:

\[\theta_{\text{rad}} = \theta_{\text{deg}} \times \frac{\pi}{180}\]

So a right angle of \(90^\circ\) is \(\pi/2 = 1.571\) rad, and one radian is about \(57.3^\circ\). Neither unit is more correct; what matters is knowing which one a given number is in.

The sign of the angle follows a convention that is worth fixing in your mind now. Turning anticlockwise from the polar axis is positive, and turning clockwise is negative. An obstacle reported at \(\theta = -30^\circ\) therefore lies \(30^\circ\) to the clockwise side of straight ahead.

9.3.3 Why Range-and-Angle Sensors Report in Polar Form

Consider what a distance sensor actually does. It sends out a pulse of sound or light in the direction it is pointing, waits for the reflection, and works out how far away the reflecting surface is. The answer it produces is one number: a range.

The sensor has no way of producing an x and a y. It does not know where it is in a room, and it cannot see sideways. All it knows is how far, in the direction I am facing — a radial distance along a known direction, which is a polar description and nothing else.

A scanning sensor makes this obvious. A light detection and ranging (LIDAR) unit spins a beam around and takes a range measurement every fraction of a degree. Its raw output is a long list of pairs: an angle and the range found at that angle. Fig. 9.3-2 shows what that list looks like when drawn.

Diagram

Fig. 9.3-2 – a small robot symbol at the centre of a room outline, with a LIDAR unit marked on top of it; many straight rays drawn outward from the robot at regular angular spacing, each ray stopping where it meets a wall or an obstacle; a dot marked at the end of each ray; three of the rays picked out and labelled with a range and an angle, such as “2.8 m at 0°”, “1.6 m at 45°” and “3.1 m at 300°”; the anticlockwise direction of the sweep shown by a curved arrow

The same is true of an ultrasonic sensor mounted on a small motor that turns it from side to side. Each reading is a range, and the position of the motor supplies the angle.

This is the practical reason polar coordinates matter. Convert too early and you throw away the form the data arrived in; work in polar form and some decisions become almost free. To find the nearest obstacle in a LIDAR scan, a robot simply looks for the smallest \(r\) in the list, with no arithmetic at all.

Q2. A scanning sensor sweeps a room and reports what it finds as a distance and an angle, not as a pair of side-to-side measurements. Why is that the natural way for it to speak?

A. Because that is all the sensor can physically measure. It sends a pulse in one direction and times the echo, so it learns how far away a surface is along that one line. The direction comes from where the beam was pointing at that instant. A range and an angle is therefore the raw form of the measurement, and turning it into a pair of x and y values is an extra step done afterwards, by calculation.

9.3.4 Converting Between Cartesian and Polar Coordinates

A robot rarely stays in one description. The sensor speaks polar, the map is Cartesian, and the two must be made to agree. Rewriting a position from one coordinate system into another is called a coordinate transformation.

For polar and Cartesian, the transformation is nothing more than a right-angled triangle. Drop a perpendicular from the point to the X-axis, as in Fig. 9.3-3, and \(r\) becomes the hypotenuse while \(x\) and \(y\) become the two other sides.

Diagram

Fig. 9.3-3 – a point P in the first quadrant of a set of Cartesian axes; the line OP drawn and labelled r; the angle at O between the X-axis and OP labelled theta; a vertical dashed line from P down to the X-axis, the foot of it marked, the horizontal side labelled x and the vertical side labelled y; the right angle at the foot marked with a small square

From that triangle, \(\cos\theta = x/r\) and \(\sin\theta = y/r\), which rearrange into the pair of equations used for going from polar to Cartesian. Going the other way uses Pythagoras’ theorem for \(r\) and the tangent ratio for \(\theta\).

conversion between Cartesian and polar coordinates Statement: For a point in a plane, \(x = r\cos\theta\) and \(y = r\sin\theta\); conversely \(r = \sqrt{x^2 + y^2}\) and \(\theta = \tan^{-1}(y/x)\). In words: an \(r\) and an angle can be resolved into two perpendicular distances, and two perpendicular distances can be combined back into a length and a direction. Why it holds: the point, its foot on the X-axis and the origin form a right-angled triangle whose hypotenuse is \(r\), so the sine, cosine and tangent ratios and Pythagoras’ theorem all apply to it directly. Used for: placing a sensor reading onto a map, commanding a rotating joint towards a point given in x and y, and letting the parts of one robot exchange positions without confusion. Watch out: the arctangent alone does not fix the direction. It cannot tell a point from the point diametrically opposite it, so the signs of \(x\) and \(y\) must always be checked as well.

putting an obstacle from a map onto a scanning sensor

Given: An obstacle is recorded on a robot’s map at \((2.4\ \text{m},\ 1.0\ \text{m})\) in the robot’s own frame, whose origin is at the sensor and whose X-axis points straight ahead.

Find: the radial distance and angular displacement the scanning sensor should report for it.

Method: this is a Cartesian-to-polar transformation, so use \(r = \sqrt{x^2 + y^2}\) and \(\theta = \tan^{-1}(y/x)\). Both \(x\) and \(y\) are positive, so the point lies in the first quadrant and the arctangent needs no correction.

\[r = \sqrt{(2.4\ \text{m})^2 + (1.0\ \text{m})^2} = \sqrt{5.76\ \text{m}^2 + 1.00\ \text{m}^2} = \sqrt{6.76\ \text{m}^2} = 2.6\ \text{m}\]

\[\theta = \tan^{-1}\left(\frac{1.0\ \text{m}}{2.4\ \text{m}}\right) = \tan^{-1}(0.4167) = 22.62^\circ\]

The obstacle is at \((2.6\ \text{m},\ 22.62^\circ)\) in polar form.

Check: Converting back, \(x = 2.6 \times \cos 22.62^\circ = 2.6 \times 0.9231 = 2.40\) m and \(y = 2.6 \times \sin 22.62^\circ = 2.6 \times 0.3846 = 1.00\) m, which returns the original pair exactly. The radial distance is also larger than either side, as a hypotenuse must be.

turning a sensor reading into map coordinates

Given: A robot’s scanning sensor reports a wall at a range of 0.85 m and an angle of \(150^\circ\), measured anticlockwise from straight ahead.

Find: the position of that point in the robot’s Cartesian frame, in which the X-axis points forward and the Y-axis points to the robot’s left.

Method: this is a polar-to-Cartesian transformation, so use \(x = r\cos\theta\) and \(y = r\sin\theta\) with the angle exactly as reported.

\[x = 0.85\ \text{m} \times \cos 150^\circ = 0.85\ \text{m} \times (-0.8660) = -0.736\ \text{m}\]

\[y = 0.85\ \text{m} \times \sin 150^\circ = 0.85\ \text{m} \times 0.5000 = 0.425\ \text{m}\]

The wall point is at \((-0.736\ \text{m},\ 0.425\ \text{m})\) in the robot’s frame.

Check: An angle of \(150^\circ\) is past the quarter turn, so the point should lie behind the robot and to its left. The negative \(x\) and positive \(y\) say exactly that, which places it in the second quadrant, as expected.

9.3.5 Getting the Quadrant Right

The conversion from Cartesian to polar has a trap in it, and a robot that falls into it drives the wrong way.

The arctangent function returns an angle only between \(-90^\circ\) and \(+90^\circ\). That covers the first and fourth quadrants, and nothing else. If the true angle lies in the second or third quadrant, the calculator cannot report it, because it was never given enough information to.

Look at why. The arctangent is fed the single ratio \(y/x\), and a ratio hides the signs it came from. Fig. 9.3-4 shows two points on exactly opposite sides of the origin, both giving the ratio \(-1\).

Diagram

Fig. 9.3-4 – Cartesian axes with two points plotted: P at (−0.6, 0.6) in the second quadrant and Q at (0.6, −0.6) in the fourth quadrant; a single straight dashed line drawn through the origin passing through both points; the angle from the positive X-axis anticlockwise to OP marked 135° and the angle from the positive X-axis clockwise to OQ marked −45°; a label beside each point reading “y/x = −1”; a note reading “one ratio, two opposite directions”

The remedy is simple and mechanical: after taking the arctangent, look at the signs of \(x\) and \(y\) and correct the answer. Table 9.2 sets out every case.

Table 9.2 – correcting the arctangent according to the signs of the Cartesian coordinates | Signs of the coordinates | Where the point lies | Angle to use | |—|—|—| | \(x > 0\), \(y \ge 0\) | quadrant I | \(\tan^{-1}(y/x)\), unchanged | | \(x < 0\), any \(y\) | quadrant II or III | \(\tan^{-1}(y/x) + 180^\circ\) | | \(x > 0\), \(y < 0\) | quadrant IV | \(\tan^{-1}(y/x)\), which is negative; add \(360^\circ\) if a positive angle is wanted | | \(x = 0\), \(y > 0\) | on the positive Y-axis | \(90^\circ\) | | \(x = 0\), \(y < 0\) | on the negative Y-axis | \(270^\circ\), or \(-90^\circ\) | | \(x = 0\), \(y = 0\) | at the pole | undefined; the angle has no meaning |

The last row of Table 9.2 is not a technicality. Dividing by \(x = 0\) would fail outright, so a robot’s software has to test for the pole before it attempts the conversion at all.

Most programming languages provide a two-argument arctangent, written atan2(), which is given \(y\) and \(x\) separately instead of their ratio. Because it can see both signs, it returns the correct angle in all four quadrants without any correction.

converting a point that lies behind the robot

Given: A robot’s map shows a doorway at \((-0.6\ \text{m},\ 0.6\ \text{m})\) in the robot’s frame, where the X-axis points forward and the Y-axis points to the left.

Find: the radial distance and the correct angular displacement of the doorway.

Method: use \(r = \sqrt{x^2 + y^2}\) for the distance, then take the arctangent and correct it using the signs of the coordinates as set out in Table 9.2.

\[r = \sqrt{(-0.6\ \text{m})^2 + (0.6\ \text{m})^2} = \sqrt{0.36\ \text{m}^2 + 0.36\ \text{m}^2} = \sqrt{0.72\ \text{m}^2} = 0.849\ \text{m}\]

\[\tan^{-1}\left(\frac{0.6\ \text{m}}{-0.6\ \text{m}}\right) = \tan^{-1}(-1) = -45^\circ\]

Here \(x\) is negative, so the point lies in the second quadrant and \(180^\circ\) must be added:

\[\theta = -45^\circ + 180^\circ = 135^\circ\]

The doorway is at \((0.849\ \text{m},\ 135^\circ)\).

Check: Converting back, \(x = 0.849 \times \cos 135^\circ = 0.849 \times (-0.7071) = -0.600\) m and \(y = 0.849 \times \sin 135^\circ = 0.849 \times 0.7071 = 0.600\) m, which matches the map. Had the uncorrected \(-45^\circ\) been used, the same conversion would have given \((+0.600\ \text{m},\ -0.600\ \text{m})\) — a point behind and to the right instead of ahead and to the left.

Q4. A robot calculates the angle to a target and sets off in exactly the opposite direction, even though the arithmetic was done correctly. What went wrong?

A. The arctangent was trusted without checking the signs. It is given only the ratio \(y/x\), and a point and the point directly opposite it produce the same ratio, so it cannot tell them apart. It always answers between \(-90^\circ\) and \(+90^\circ\), which means a target in the second or third quadrant comes back as a direction \(180^\circ\) away from the true one. Adding \(180^\circ\) whenever \(x\) is negative, or using a two-argument arctangent that is shown both signs, prevents it.

9.4 The Cylindrical Coordinate System

The polar system describes a flat surface completely, and for a robot that stays on the floor that is enough. A machine that also lifts needs one more number.

The simplest thing to add is height. Keep the radial distance, keep the angle, and record how far above the reference plane the point sits. That is the whole of the cylindrical system, and it fits a surprising number of real machines.

9.4.1 Adding Height to the Polar Description

The cylindrical coordinate system extends the polar description into three dimensions by adding a vertical measurement. A point is written as the ordered triple \((r, \theta, z)\).

Each of the three has a precise meaning, and Fig. 9.4-1 shows all of them together:

  • \(r\) is the radial distance of the point from the Z-axis, measured in the horizontal plane.
  • \(\theta\) is the angle from the reference direction, measured in that same horizontal plane, exactly as in the polar system.
  • \(z\) is the height of the point above the reference plane.

Diagram

Fig. 9.4-1 – three-dimensional axes drawn in perspective with the Z-axis vertical, labelled X-axis, Y-axis and Z-axis, meeting at origin O; a faint upright cylinder drawn around the Z-axis; a point P marked on the curved surface of the cylinder; a vertical dashed line dropped from P to the horizontal plane, its foot marked Q; the line OQ drawn and labelled r; the angle at O between the X-axis and OQ labelled theta with a curved anticlockwise arrow; the vertical dashed line PQ labelled z; the right angle at Q marked with a small square

NoteDefinition

The cylindrical coordinate system is a coordinate system in which the position of a point is given by its radial distance r from the Z-axis measured in a horizontal plane, its angular displacement θ from a fixed reference direction in that plane, and its height z above a stated reference plane.

The name comes from the shape the description sweeps out. Hold \(r\) fixed and let \(\theta\) and \(z\) vary, and every point you can reach lies on the curved surface of a cylinder — the surface drawn faintly in Fig. 9.4-1.

One detail in that definition deserves care, because it is the single thing students most often get wrong here.

treating r as the distance from the origin What students do: They read \(r\) as the straight-line distance from the origin O to the point, as it was in the polar system, and use it in that sense when the point is above the plane. What happens: Every answer involving height comes out short. For a point at \(r = 0.5\) m and \(z = 1.2\) m, the true distance from the origin is \(\sqrt{0.5^2 + 1.2^2} = 1.3\) m, not 0.5 m, so a reach check made this way would accept a target the arm cannot get to. The fix: In cylindrical coordinates \(r\) is measured from the Z-axis, in the horizontal plane, so it is the distance to the point’s shadow on that plane. The two agree only when \(z = 0\). Where the distance from the origin is genuinely wanted, compute \(\sqrt{r^2 + z^2}\).

9.4.2 Robots That Move Naturally in Cylindrical Coordinates

A coordinate system earns its place when the numbers in it correspond, one for one, with things the machine can actually do. Cylindrical coordinates earn theirs on any robot built from a rotating base and a vertical slide.

Picture such a machine. Its base turns about a vertical axis, which changes \(\theta\) alone. An arm extends and retracts horizontally, which changes \(r\) alone. A carriage runs up and down a column, which changes \(z\) alone. Three motions, three numbers, and no arithmetic needed to connect them.

The SCARA arm works on the same principle, with the reach produced by two joints turning in a horizontal plane rather than by a sliding arm. Its horizontal motion is rotation and extension; its vertical motion is a straight line.

Fig. 9.4-2 shows why the region such a machine can reach is called a cylindrical work envelope, and why it has a hole down the middle.

Diagram

Fig. 9.4-2 – a robot with a fixed vertical column and a horizontal arm that extends radially, drawn in perspective; a curved arrow at the base showing rotation about the vertical axis, a straight double-headed arrow along the arm showing extension, and a straight double-headed vertical arrow on the column showing lift; a hollow cylinder drawn faintly around the machine to show the reachable region, with its outer radius labelled “maximum reach” and its inner radius labelled “minimum reach”, and its height labelled “lift travel”

The hole is real, not a drawing convention. The arm cannot retract past a certain length, so there is a column of space close to the machine that it can turn around but never reach into.

Three kinds of work suit this arrangement particularly well. Vertical stacking, where parts are set down one above another at the same \(r\) and \(\theta\). Shelf picking, where the tool swings to a shelf and then rises to the right level. And drilling along a central axis, where the tool must come straight down onto a fixed point.

Q5. The SCARA designers described their arm with an angle, a distance and a height. Why did they not use a third angle instead of a height?

A. Because the arm’s third motion is a straight vertical slide, and a height is what a straight slide changes. Each of the three numbers then matches one motion of the machine exactly, so commanding a move needs no conversion at all. A third angle would describe a turn in space, which that arm cannot make; the controller would have to work out what combination of its real motions produced it, every single time. The description was chosen to fit the machine, and the assembly task itself is naturally vertical — the part is carried across, then pushed straight down.

9.4.3 Converting Between Cartesian and Cylindrical Coordinates

The conversion holds no surprises, because two-thirds of it has already been done. The \(r\) and \(\theta\) parts are the polar transformation applied in the horizontal plane, and the height is simply carried across untouched.

From Cartesian to cylindrical:

\[r = \sqrt{x^2 + y^2}, \qquad \theta = \tan^{-1}\left(\frac{y}{x}\right), \qquad z = z\]

And from cylindrical back to Cartesian:

\[x = r\cos\theta, \qquad y = r\sin\theta, \qquad z = z\]

The quadrant rule of Table 9.2 applies here in full, and for the same reason: the arctangent is still being handed a single ratio, and it still cannot see the signs that produced it.

That \(z = z\) is worth a sentence rather than a shrug. It says the vertical measurement is untouched by the conversion, which is exactly why this system is easy to work with. Whatever happens to the horizontal description, height stays height.

recording a shelf position in the robot’s own terms

Given: A component on a shelf is at \((0.45\ \text{m},\ -0.26\ \text{m},\ 0.80\ \text{m})\) in the Cartesian frame of a workcell, whose origin is at the foot of the robot’s column and whose Z-axis runs up that column.

Find: the cylindrical coordinates the robot’s controller should store for that shelf position.

Method: apply the polar transformation to \(x\) and \(y\) to obtain \(r\) and \(\theta\), correct the arctangent using the signs of the coordinates, and carry \(z\) across unchanged.

\[r = \sqrt{(0.45\ \text{m})^2 + (-0.26\ \text{m})^2} = \sqrt{0.2025\ \text{m}^2 + 0.0676\ \text{m}^2} = \sqrt{0.2701\ \text{m}^2} = 0.520\ \text{m}\]

\[\theta = \tan^{-1}\left(\frac{-0.26\ \text{m}}{0.45\ \text{m}}\right) = \tan^{-1}(-0.5778) = -30.0^\circ\]

Here \(x\) is positive and \(y\) is negative, so the point is in the fourth quadrant and the arctangent needs no correction. The height is carried across:

\[z = 0.80\ \text{m}\]

The shelf position is \((0.520\ \text{m},\ -30.0^\circ,\ 0.80\ \text{m})\), which may also be written with the angle as \(330.0^\circ\).

Check: A negative angle of this size means the arm swings a little to the clockwise side of the reference direction, which agrees with the negative \(y\) in the original data. The radial distance of 0.520 m is larger than either horizontal coordinate on its own, as a hypotenuse must be, and well under the height of 0.80 m the arm must also climb.

working out where a commanded move will end

Given: A workcell arm is commanded to the cylindrical position \((0.60\ \text{m},\ 120^\circ,\ 0.35\ \text{m})\) in the frame described above.

Find: where the tool will be in Cartesian coordinates, so that the position can be checked against the workcell map.

Method: apply \(x = r\cos\theta\) and \(y = r\sin\theta\) in the horizontal plane, and carry \(z\) across unchanged.

\[x = 0.60\ \text{m} \times \cos 120^\circ = 0.60\ \text{m} \times (-0.5000) = -0.300\ \text{m}\]

\[y = 0.60\ \text{m} \times \sin 120^\circ = 0.60\ \text{m} \times 0.8660 = 0.520\ \text{m}\]

\[z = 0.35\ \text{m}\]

The tool will arrive at \((-0.300\ \text{m},\ 0.520\ \text{m},\ 0.35\ \text{m})\) in the workcell frame.

Check: An angle of \(120^\circ\) is past the quarter turn, so \(x\) should have gone negative while \(y\) stayed positive, and it has. Squaring and adding the two horizontal values returns \(\sqrt{0.09 + 0.2704} = 0.60\) m, the radial distance that was commanded, so nothing has been lost in the conversion.

Notice what the second worked example is really for. The arm was told to move in the terms its own joints understand, and the conversion was done afterwards, only so that a person or a shared map could check the result. That is the ordinary working pattern: each part of a system speaks the description that suits it, and transformations keep them in agreement.

9.5 Choosing and Using a Coordinate System

Three descriptions of position have now been set out, and every one of them can describe every point. Nothing forces a robot to prefer one over another.

What separates them is the amount of work each leaves behind. The right choice makes a robot’s arithmetic short and its commands obvious; the wrong one makes the same task correct but laborious, and gives errors more places to hide.

9.5.1 Matching the Coordinate System to the Motion

The guiding rule is simple to state. Choose the description in which one number corresponds to one thing the machine actually does.

A gantry robot moves along rails at right angles, so each of its motors owns one Cartesian coordinate. A rotating machine turns and reaches, so its motors own \(\theta\) and \(r\). Add a vertical slide and the third number is \(z\). In each case the coordinates and the joints line up, and a commanded position needs no translation at all.

Table 9.3 draws the three systems together at the point where the choice is actually made.

Table 9.3 – Cartesian, polar and cylindrical coordinate systems compared | Feature | Cartesian | Polar | Cylindrical | |—|—|—|—| | Coordinates used | \((x, y)\), or \((x, y, z)\) in space | \((r, \theta)\) | \((r, \theta, z)\) | | Space described | Plane, or three-dimensional space | Plane only | Three-dimensional space | | Measured from | Origin, along two or three perpendicular axes | Pole, along a line at an angle to the polar axis | Z-axis horizontally, and the reference plane vertically | | Motion it describes naturally | Straight lines parallel to an axis | Turning about a centre, and reaching outwards | Turning, reaching, and lifting | | Machines and sensors that suit it | Gantry robots, three-dimensional printers, grid maps of a floor | Ultrasonic and IR range sensors, LIDAR scans, rotating turrets | Cylindrical configuration robots, SCARA arms, rack picking and palletising | | Awkward case | A smooth arc, which changes both coordinates continuously | Motion along a straight line that misses the pole | Motion that ignores the vertical axis altogether | | Uniqueness of the description | One point, one set of numbers | Repeats every \(360°\), and \(\theta\) is undefined at the pole | Same repetition in \(\theta\) as the polar system |

Read the last row before the others. A Cartesian pair is unambiguous; the other two are only unambiguous once a convention has been fixed on the range of \(\theta\). That is one reason a robot’s stored map is almost always Cartesian even when everything reaching it arrives in polar form.

The maps and the sensors therefore sit in different systems by design, not by accident. Each is in the description that suits it, and conversion is the bridge between them.

9.5.2 From a Sensor Reading to a Motion Command

Follow one obstacle reading through a small mobile robot and the whole chapter appears in a single loop, drawn in Fig. 9.5-1.

Diagram

Fig. 9.5-1 – flow: sensor measures range and bearing (polar, sensor frame) → conversion to Cartesian in the robot’s own frame → shift into the room frame using the robot’s known position → decision made against the stored map → target position converted back to a turn angle and a distance → motors driven → robot has moved, so a new reading is taken, with the last arrow returning to the first block to close the loop

Each block in that loop changes the description without changing the place. The obstacle does not move when its coordinates are rewritten; only the frame and the system the numbers belong to change.

converting a range-and-bearing reading into a map position Input: One sensor reading as a radial distance \(r\) and a bearing \(\theta\) in the robot’s own frame; the robot’s own position \((x_R, y_R)\) in the room frame; the assumption that the robot’s axes are aligned with the room’s axes. Output: The obstacle’s position \((x_W, y_W)\) in the room frame. Method:

1. Confirm the unit of r and convert it to metres if the sensor reports otherwise.
2. Confirm whether theta is in degrees or radians, and convert to the unit the
   trigonometric function expects.
3. Compute the obstacle position in the robot frame:
       x_local = r * cos(theta)
       y_local = r * sin(theta)
4. Shift into the room frame by adding the robot's own position:
       x_W = x_R + x_local
       y_W = y_R + y_local
5. Verify by recomputing sqrt(x_local^2 + y_local^2) and confirming it equals r.
6. Store the result together with the name of the frame it is measured in.

Why it works: The sensor’s reading is a polar pair about the robot’s own centre, so step 3 converts it into the robot’s Cartesian frame. Because the two frames’ axes point the same way, moving from the robot frame to the room frame needs only the addition of the robot’s position. Watch out: If the robot is not facing along the room’s x-axis, the addition in step 4 is not enough on its own — the reading must first be rotated by the robot’s heading. And a reading of zero range usually means the sensor failed rather than that an obstacle is touching it, so that case is tested for and discarded.

placing a detected obstacle on the room map

Given: A robot stands at \((4.00, 2.50)\) m in the room frame, facing along the room’s x-axis. Its ultrasonic sensor reports an obstacle at \(r = 1.80\) m and \(\theta = -40°\), measured in the robot’s own frame where the X-axis points forward and the Y-axis to the robot’s left.

Find: The obstacle’s coordinates in the room frame.

Method: Convert the polar reading into the robot’s Cartesian frame with \(x = r\cos\theta\) and \(y = r\sin\theta\), then add the robot’s own position, since the two frames’ axes are aligned.

\[x_{local} = 1.80 \times \cos(-40°) = 1.80 \times 0.7660 = 1.379 \text{ m}\]

\[y_{local} = 1.80 \times \sin(-40°) = 1.80 \times (-0.6428) = -1.157 \text{ m}\]

\[x_W = 4.00 + 1.379 = 5.38 \text{ m}\]

\[y_W = 2.50 + (-1.157) = 1.34 \text{ m}\]

The obstacle is at \((5.38, 1.34)\) m in the room frame.

Check: The bearing is negative, so the obstacle lies to the robot’s right and its y-coordinate should fall below the robot’s own, which it does. Recomputing \(\sqrt{1.379^2 + 1.157^2}\) gives 1.80 m, the range the sensor reported.

Fig. 9.5-2 shows the same situation as the robot’s designer would draw it, with both frames marked.

Diagram

Fig. 9.5-2 – plan view of a rectangular room; the room frame drawn at the lower left corner with axes labelled x and y and origin O; a robot symbol drawn at (4.00, 2.50) m facing along the room’s x-axis, carrying its own frame with forward and left axes marked; a solid line from the robot to a small obstacle, labelled r = 1.80 m, with the angle between the robot’s forward direction and that line marked by a clockwise curved arrow labelled −40 degrees; dashed lines from the obstacle to both room axes labelled 5.38 m and 1.34 m

9.5.3 Units, Angles and Consistency

A coordinate is a number and a unit, and the unit is not optional. Most of the mistakes that reach the workshop floor in this subject are not errors of method at all.

Three habits prevent nearly all of them.

The first is to keep one unit of length throughout a calculation. A datasheet that quotes a sensor’s range in centimetres and a map that holds metres will happily combine into an answer a hundred times too large, and nothing in the arithmetic will object. Convert at the moment the reading is taken, not later.

The second is to know at every step whether an angle is in degrees or radians. Write the unit beside the number in your working, and remember that trigonometric functions in software expect radians.

The third is to record the frame with the number. A position stored without its frame is a fact nobody can use six months later, and on a machine with several frames it is a fact that will eventually be used wrongly.

There is a fourth habit, quieter than the others: state a result only as precisely as the measurement deserves. A tape measure read to the nearest millimetre does not justify a position quoted to five decimal places, and an angle written as \(67.38°\) claims a precision most hobby sensors cannot deliver.

In September 1999 the Mars Climate Orbiter was lost as it arrived at Mars. The investigation found that one piece of ground software had supplied thruster impulse figures in pound-force seconds while the spacecraft’s navigation software expected newton-seconds. Every calculation was performed correctly, and the mismatch of units alone was enough to put the spacecraft on the wrong path.

Mark a corner of the laboratory floor as the pole and a wall edge as the polar axis. Using a measuring tape and a protractor, record the polar coordinates of three objects, convert each to Cartesian coordinates, and then measure the two Cartesian distances directly to check your answers. Note the largest difference you find, and say whether it comes from the measurement or from the conversion.

9.6 Summary

  1. A robot can act only on numbers, so a place must be written as numbers before it can be commanded, stored, compared or sent to another machine.
  2. A position fixes a place completely and takes two numbers in a plane; a distance is a single number and tells only how far, never in which direction.
  3. A coordinate system is an agreed arrangement of an origin, one or more reference axes and a unit of measurement, in which the position of a point is expressed as a set of numbers called its coordinates.
  4. Coordinates are not properties of a point. They are the answer that point gives to one particular set of questions, so the same point yields different numbers in different frames.
  5. A set of coordinates is meaningless until the frame it is measured in is stated. A carton at \((4.0, 1.5)\) m in a workshop frame may be at \((0.0, 1.0)\) m in a robot’s own moving frame, and neither description is more correct than the other.
  6. Coordinate systems make six things possible: stating a location exactly, measuring distances and angles, planning a path as an ordered list of positions, transforming a reading from one frame into another, describing the workspace a robot can reach, and simulating or programming motion before any hardware moves.
  7. The three systems this chapter uses for robot positioning and movement are Cartesian, polar, and cylindrical.
  8. The Cartesian coordinate system, also called the rectangular or rectilinear system, locates a point by an ordered pair \((x, y)\) measured along two perpendicular axes meeting at the origin. The order is fixed: the X measurement is always written first.
  9. The two axes divide the plane into four quadrants, numbered I to IV anticlockwise from the upper right, and the sign of each coordinate says which side of an axis the point lies on. On a robot’s own frame a negative x means behind and a negative y means to its right, so a lost sign is a wrong direction.
  10. In three dimensions a third perpendicular axis is added and a point becomes the ordered triple \((x, y, z)\). The direction of the positive Z-axis is fixed by the right-hand rule, and software and hardware must agree on it or every commanded lift becomes a plunge.
  11. The Euclidean distance between two points in one Cartesian frame is \(d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}\), extended in space by a third squared term. It gives the shortest possible distance, not the distance the robot will actually cover if something stands in the way.
  12. Cartesian description suits machines whose motors each drive one axis, and grid maps of floors and boards, because the axes are independent. It becomes awkward for arcs and rotation, where both coordinates must change together throughout the movement.
  13. The polar coordinate system locates a point in a plane by the ordered pair \((r, \theta)\), where \(r\) is the radial distance from a fixed point called the pole and \(\theta\) is the angular displacement measured from a fixed reference direction, the polar axis.
  14. A polar description repeats every \(360°\) and leaves \(\theta\) undefined at the pole, so a convention is fixed and kept: \(r\) is not negative and \(\theta\) lies between \(0°\) and \(360°\).
  15. Angles are measured in degrees or in radians, with \(\pi\) rad \(= 180°\), and are positive when measured anticlockwise from the polar axis. Trigonometric functions in software expect radians, so an angle held in degrees must be converted before it is used.
  16. Range-and-angle sensors report in polar form because that is what they physically measure. An ultrasonic sensor times an echo along the direction it points, and LIDAR sweeps a laser beam to record one range against one bearing, so a whole scan is a list of polar pairs sharing the sensor as their pole.
  17. Cartesian and polar descriptions are joined by one right-angled triangle: \(r = \sqrt{x^2 + y^2}\) and \(\theta = \tan^{-1}(y/x)\) in one direction, and \(x = r\cos\theta\) and \(y = r\sin\theta\) in the other.
  18. The inverse tangent alone returns an angle only between \(-90°\) and \(+90°\), because the ratio \(y/x\) cannot distinguish a point from the one diametrically opposite it. The signs of \(x\) and \(y\) fix the quadrant, and the quadrant fixes the correction: add \(180°\) when \(x\) is negative, add \(360°\) when \(x\) is positive and \(y\) negative, and treat \(x = 0\) as a separate case rather than dividing.
  19. The cylindrical coordinate system extends the polar description into space as the ordered triple \((r, \theta, z)\), where \(r\) is the perpendicular distance from the Z-axis, \(\theta\) is the angle in the horizontal plane and \(z\) is the height above the reference plane.
  20. In this system \(r\) is a horizontal reach, not a diagonal. The straight-line distance from the origin to the point is \(\sqrt{r^2 + z^2}\).
  21. Conversion between cylindrical and Cartesian coordinates is the polar conversion with the height carried across unchanged, and the same quadrant rule applies to \(\theta\).
  22. Cylindrical description suits robots with a rotating base and vertical movement, whose work envelope is a hollow cylinder; SCARA arms, which settle their horizontal position and then descend; and tasks organised about a vertical line, such as vertical stacking, shelf picking and drilling along a central axis.
  23. The system is chosen so that one number corresponds to one thing the machine actually does. Where the sensor’s description and the map’s description differ, conversion is the bridge, and a stored map is usually kept Cartesian because that description is unique.
  24. A coordinate is a number together with its unit and its frame. Keeping one unit of length throughout a calculation, knowing at every step whether an angle is in degrees or radians, recording the frame alongside the number, and quoting a result only as precisely as the measurement allows prevent most of the errors that reach the workshop floor.

9.7 Key Terms

  1. Angular displacement — the angle turned from the polar axis to the line joining the pole to a point; the second coordinate of a polar pair.
  2. Axis — a fixed reference direction along which a coordinate is measured.
  3. Cartesian coordinate system — a system that locates a point by its perpendicular distances along two or three mutually perpendicular axes meeting at the origin; also called the rectangular or rectilinear system.
  4. Coordinate system — an agreed arrangement of an origin, reference axes and a unit of measurement, in which the position of any point is expressed as a set of numbers.
  5. Coordinates — the set of numbers that gives the position of a point within a stated coordinate system and frame.
  6. Cylindrical coordinate system — a system that locates a point in space by the triple \((r, \theta, z)\): the horizontal distance from the Z-axis, the angle in the horizontal plane, and the height above the reference plane.
  7. Degree — a unit of angle equal to one three-hundred-and-sixtieth of a full turn.
  8. Euclidean distance — the straight-line distance between two points, found by squaring the difference in each coordinate, adding the results and taking the square root.
  9. LIDAR — light detection and ranging; a sensor that measures distance with a laser beam and sweeps that beam to produce a scan of range-and-bearing readings.
  10. Ordered pair — two coordinates written in a fixed sequence, such as \((x, y)\), in which the position of each number decides its meaning.
  11. Origin — the fixed point from which all coordinates in a system are measured.
  12. Polar axis — the fixed reference direction from which the angle of a polar coordinate is measured, normally taken along the positive X-axis.
  13. Polar coordinate system — a system that locates a point in a plane by its radial distance from the pole and its angular displacement from the polar axis.
  14. Pole — the central reference point of a polar coordinate system, corresponding to the origin of a Cartesian system.
  15. Position — a description that fixes a place completely, requiring two numbers in a plane and three in space, as distinct from a distance, which is a single number.
  16. Quadrant — one of the four regions into which the two Cartesian axes divide a plane, numbered I to IV anticlockwise from the upper right.
  17. Radial distance — the distance from the pole to a point in the polar system, or from the Z-axis to a point in the cylindrical system.
  18. Radian — a unit of angle in which one full turn is \(2\pi\) radians, so that \(\pi\) rad \(= 180°\); the unit expected by trigonometric functions in software.
  19. SCARA — Selective Compliance Assembly Robot Arm; an arm whose joints rotate in a horizontal plane while a separate joint slides vertically.
  20. Workspace — the whole region a robot is able to reach, described as a set of limits in coordinates.

9.8 Objective Questions

  1. A point is recorded at \((-4.0, -7.0)\) m in a workshop frame. In which quadrant does it lie?
  1. Quadrant I
  2. Quadrant II
  3. Quadrant III
  4. Quadrant IV
  1. In the cylindrical coordinate system, the coordinate \(r\) is measured:
  1. from the origin in a straight line to the point
  2. horizontally from the Z-axis to the point
  3. vertically from the reference plane to the point
  4. along the polar axis to the point
  1. Fill in the blanks.
  1. \(\pi\) radians is equal to ________ degrees.
  2. The fixed reference direction from which the angle of a polar coordinate is measured is called the ________.
  3. The straight-line distance between two points in one Cartesian frame is called the ________ distance.
  1. State whether each of the following is true or false.
  1. The ordered pairs \((3, 5)\) and \((5, 3)\) describe the same point.
  2. A LIDAR measures a range and a bearing rather than two perpendicular distances.
  3. The Euclidean distance between a robot and its dock is always the length of the path the robot drives.
  4. When a cylindrical triple is converted to Cartesian coordinates, the height passes across unchanged.
  1. Two statements are given below, one labelled Assertion (A) and the other labelled Reason (R). Choose the correct option. Assertion (A): A robot’s software stores the name of the frame alongside every recorded position. Reason (R): The same physical point has different coordinates when measured in different frames.
  1. Both A and R are true, and R is the correct explanation of A.
  2. Both A and R are true, but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.
  1. Match each item in Column A with the statement in Column B that fits it best.
Column A Column B
a. A single LIDAR scan i. one motor drives one Cartesian axis
b. A gantry robot ii. its work envelope is a hollow cylinder
c. A cylindrical configuration robot iii. a list of polar pairs sharing one pole
d. A point lying on the Y-axis iv. its x-coordinate is zero
  1. Give the full form of each of the following.
  1. LIDAR
  2. SCARA

9.9 Check Your Concepts

  1. Define a coordinate system. Explain why fixing a position in a plane needs two numbers, while stating a distance needs only one.

  2. Name the three coordinate systems used for robot positioning and movement, and state one situation in which each is the natural choice.

  3. Differentiate between the polar and the cylindrical coordinate systems, naming one machine or sensor suited to each.

  4. Give reasons: an ultrasonic sensor cannot report the Cartesian coordinates of an obstacle directly, however accurate it is.

  5. With the help of a labelled sketch, explain how the Euclidean distance formula follows from a right-angled triangle drawn between two points. State one situation in which the distance it gives is not the distance a mobile robot will actually travel.

  6. A mobile robot stands at the origin of its own frame, with the X-axis pointing forward and the Y-axis to its left. Its scanner detects one object at \((8.0, 6.0)\) m and a second at \((-8.0, 6.0)\) m.

  1. Find the radial distance and the angle of each object, giving the angles in the range \(0°\) to \(360°\).
  2. Explain why the value returned by the inverse tangent must be corrected for one of the two objects but not for the other.
  3. State what the robot would do if the correction were omitted.

9.10 Diagram, Circuit & Output Reading

  1. A robot’s log holds the three stored positions shown in Table 9.4.

Table 9.4 – three stored positions from a robot’s log, with the note recorded against each | Entry | Stored value | Note recorded with the entry | |—|—|—| | 1 | (2.5, 1.0) | room frame; lengths in metres | | 2 | (250, 100) | room frame; unit not recorded | | 3 | (1.8, 40) | sensor frame; length in metres, angle in degrees |

For each entry, state whether it can be placed on the room map as it stands, and give the reason. Name the single item of information that entry 2 is missing, and state what must be done to entry 3 before it can be used.

  1. A cylindrical configuration robot has a base that rotates about a vertical column, an arm that extends and retracts horizontally, and a slide that raises and lowers the arm on the column.
  1. Draw the work envelope of this robot and name its shape.
  2. Label the three coordinates \(r\), \(\theta\) and \(z\) on your drawing.
  3. State which coordinate each of the three motions changes, and which two it leaves unchanged.
  1. A student converts the point \((-3.0, 4.0)\) m into polar form and writes the answer as \(r = 5.0\) m, \(\theta = -53.13°\). The value of \(r\) is correct. Identify the error in the angle, explain what caused it, and give the corrected value in the range \(0°\) to \(360°\).

  2. A LIDAR mounted at the centre of a robot reports two obstacles, one at \((3.00 \text{ m}, 90°)\) and one at \((3.00 \text{ m}, 270°)\), in a frame whose X-axis points forward and whose Y-axis points to the robot’s left.

  1. State where each obstacle lies relative to the robot.
  2. Find the Cartesian coordinates of both obstacles.
  3. Using your answers, explain why software converting from Cartesian to polar form must test for the case \(x = 0\) instead of computing \(\tan^{-1}(y/x)\).

9.11 Case-Based Questions

  1. A warehouse installs a picking robot whose column stands at the origin of the aisle frame, with the reference direction along the aisle and the reference plane at floor level. The robot turns about the column, reaches horizontally into the racks, and raises its gripper on a vertical slide. Three cartons are to be collected, as listed in Table 9.5.

Table 9.5 – bay angle, reach and shelf height for the three cartons to be collected | Carton | Bay angle | Reach into the rack | Shelf height | |—|—|—|—| | P | \(40°\) | 1.10 m | 1.30 m | | Q | \(150°\) | 0.85 m | 0.60 m | | R | \(250°\) | 1.20 m | 1.85 m |

  1. Write the cylindrical coordinates of each carton as an ordered triple.
  2. Convert the position of carton R into Cartesian coordinates in the aisle frame, showing your working with units.
  3. The supervisor asks why the control software stores these positions as cylindrical triples rather than as Cartesian triples. Give two reasons, referring to the way this particular machine moves.
  1. In a school workshop, a small mobile robot carries an ultrasonic sensor mounted on a servo so that the sensor can be turned to face in different directions. The robot’s own frame has its X-axis pointing forward and its Y-axis pointing to its left. During one sweep the readings in Table 9.6 are recorded.

Table 9.6 – ultrasonic readings taken during one sweep, with each angle measured from the robot’s forward direction | Reading | Angle | Range | |—|—|—| | 1 | \(0°\) | 2.50 m | | 2 | \(60°\) | 1.40 m | | 3 | \(-45°\) | 1.90 m |

  1. Convert readings 2 and 3 into Cartesian coordinates in the robot’s own frame, showing your working with units.
  2. State which obstacle is nearest the robot, and how the table alone tells you this without any conversion.
  3. The robot is at \((3.20, 1.50)\) m in the workshop frame and is facing along that frame’s x-axis. Find the workshop-frame coordinates of the obstacle in reading 2, and state the assumption about the robot’s heading that your method depends on.