*Tracking a directed line or circle* for a robot is a useful capacity in a number of applications. This technology is one of MotionLab's most valuable motion-control technology. With this algorithm, Swan can track a path consisting of multiple lines and circles by switching from one line/circle to the next line/circle. The roundness of switching (transient) motions is controlled by a parameter called *smoothness*. With a larger smoothness, the transition curve becomes larger and smoother.

(1) The first line-tracking example is the *regular polygon* function. Given a positive integer *n*, the function generates *n*+1 lines, where the first and the last one are the same. Swan tracks a path consisting of the *n*+1 lines to make a regular *n*-gon and stops at the end.. By giving *n* = 4, Swan makes a counterclockwise (ccw) *square*. Watch the video, **Square**. Here, another grandson of the founder, Andrew, is harassing Swan. See the trajectory. The *user program* of this* *regular polygon function is shown HERE.

In this line-tracking function, Swan tracks a specific line at every moment. When the time comes, Swan *switches* the current line being tracked into the next one. The timing of this switch between lines is crucial; if the switching takes place too early or too late, the resulting turning motion is not ideal, as this demo and trajectory illustrate. In this trajectory diagram, each *switching point* from one line to the next is explicitly displayed by an *arrowhead.* The best switching time is computed by the line-tracking algorithm using the *smoothness*.

(2) The next example is a *pentagon*. In this case, we give *n* = -5 instead of +5. Then the user program makes a clockwise pentagon instead of a counterclockwise pentagon. Watch the video, **Pentagon**. In this pentagon execution, Swan turns -72º at each vertex. See the trajectory.

(3) By changing the regular-polygon user program a little, we can make a *star* shape with five points. Watch the video, **Star**. See the trajectory. In this motion, Swan turns -144º at each vertex.

We also possess a *circle-tracking algorithm, *in which Swan tracks a given oriented circle, counterclockwise (ccw) or clockwise (cw), with a given smoothness.

(4) The first circle-tracking example is called the *CircleTrain*. The number *n *(>1) of circles is given first. The circles are aligned on one line, detached from each other. The first circle is ccw and the second cw, and so forth. Swan starts from a point on the first circle, and tracks all of them in a row, and comes back to the first one. The robot stops at the starting point. Watch the video, **Circle Train**. Seethe trajectory. In this example *n* = 3. See *the user program* of this function HERE.

(5) The next circle-tracking example is called the *CircleRing*, in which eight small circles detached from each other are placed on a big circle. Swan tracks the small circles sequentially and stops when it comes back to the starting point. Watch the video, **Circle Ring**. See the trajectory. In this case, eight circles are positioned on a bigger circle with alternate orientations, ccw and cw. Although this motion looks similar to the prior *closed serpentine*, it is very different.

(6) A path can be defined by a mixed sequence of lines and circles. The *Hamburger* function is an example. Players for this function are a circle C and an oriented diameter L of the circle; L divides C into a pair, of a ccw half circle CU and a cw half circle CL. Swan tracks L, CU, L, CL, and L in this order and stops at the circle center. Watch the video, **Hamburger**. See the trajectory.

We can define a path with any number of directed lines and oriented circles in a user program. Therefore, we can program an unlimited number of distinct motions in this category.