Robot motion control using a negative feedback system. Ways to move

Annotation: The management problem is very relevant in modern science and technology. Let there be a system (control object) that we must maintain in a given state. To do this, we have a controller that (1) collects information about the current state of the system at time t and (2) calculates the control signal U(t). This signal is supplied to the control object, returning it to the specified state. This scheme is called a system with negative feedback, since when deviating from equilibrium, the regulator tends to return the system to its normal state. In this topic we will look at two types of regulators: a simpler relay and a more stable proportional one. Goal: learn to build a control system for an autonomous robot based on the simplest relay and proportional controllers, consider one of the tasks of competitive robotics and explore the possibilities of using a speed sensor.

Relay regulator

Example 9.1. Robot movement along the wall.

Let there be a robot equipped with an ultrasound sensor and a not very smooth wall (with small protrusions and depressions). It is required to write a program to control the movement of a robot along a wall at a given distance.

The position of the ultrasound sensor should be considered in advance. As mentioned above (see page 38), this sensor is slow. Therefore, it should be placed slightly in front of the robot body. In addition, it should be moved as far as possible from the wall (see Fig. 9.1), because at short distances (5 - 7 cm) the ultrasonic sensor readings become too inaccurate. Next we will see that the direction of the sensor should also be adjusted.

The robot’s movement algorithm, written in verbal form, can be something like this (Fig. 9.2):

  1. move straight;
  2. if the distance to the wall is greater than the specified one, then turn towards the wall;
  3. if the distance to the wall is less than the specified one, then turn away from the wall;
  4. repeat steps 2 - 3 endlessly (or until some event occurs).

One of the most obvious solutions to this problem is a relay regulator.

A relay in electrical engineering is a contactor with automatic return to the initial state(although there are many other varieties). In other words, when a signal (for example, current) exceeds a certain limit value, the relay closes. As soon as the current decreases, the relay opens. In our case, the definition of relay in relation to the controller only means that we describe the behavior of the system only for two cases: the signal value (1) is less than the specified value and (2) is greater than the specified value.

For definiteness, we take 20 cm as the given distance. We get next program(Fig. 9.3):

As can be seen from the program text, after turning on both motors, an endless loop starts, in which the above described verbal algorithm. A noticeable feature of this approach is the "yaw" motion: the robot always turns with the same intensity, no matter how far or close it happens to be in relation to the wall. Therefore, the trajectory will always be zigzag, since during turns the robot will always "jump" around the average value of 20 cm. Since the ultrasonic sensor is "slow", a small delay (0.1 s) is used in the cycle so that the sensor readings can keep up processed by the NXT block. The amount of delay actually determines the time during which the robot will move in the same direction. In other words, by increasing the delay time we will get larger “teeth” of the trajectory. As noted earlier, it makes no sense to make a delay less than 0.06 s, because in this case the ultrasound sensor simply will not have time to take measurements.

When using a relay controller, the robot may frequently move away from the distance. One reason is that with the ultrasound sensor placement we have chosen, the robot will not be able to distinguish between positions that are symmetrical with respect to normal position. That is, the two positions shown in Fig. 9.4 will be identical, and the distance to the wall in both cases will be more than 20 cm. In accordance with the second step of the algorithm, the robot must turn towards the wall (to the left). And if this is true for the second position, then for the first it is wrong: the robot will go even further off the track.

This problem can be solved by placing the sensor not perpendicular to the direction of movement (i.e. strictly to the left), but at an angle of 45° to the direction of movement (Fig. 9.5).

This way we can avoid the case shown in Fig. 9.4. Indeed, when steering to the left, the distance to the wall will be (at small angles of rotation< 45°) уменьшаться, а при поворотах вправо, наоборот, увеличиваться. Однако не стоит рассчитывать, что наш робот сможет проехать вдоль стены любой формы. Даже простой поворот на 90° может вызвать у него неожиданные трудности. Таким образом, наиболее значимым достоинством релейного регулятора в нашем случае является простота его алгоритма. В следующем разделе мы рассмотрим более интересный алгоритм управления.

Task 9.1. Program the robot to move along the wall with different provisions ultrasound sensor. In which case is the movement more stable?

Task 9.2. Compare this solution with Example 4.1 on p. 48. Implement a relay algorithm for moving along a wall without using branching.

Task 9.3. Implement a relay algorithm for moving along a line using branching.

P-regulator

The difficulties of using a relay controller, which were discussed in paragraph 9.1, require a search for a more acceptable solution to the control problem. One option is a proportional controller (or P controller). In this case, the control action on the robot motors is not constant, as in a relay controller, but varies in proportion to the deviation from the specified distance to the wall. In other words, the greater the deviation, the more actively the motors must work to align the robot’s trajectory. Ideally, the robot should drive straight if the sensor registers a given distance. With a slight deviation, a slight steering follows. If the deviation is greater, then the steering is greater. The P-regulator algorithm is classic in the theory of automatic control systems.

Example 9.2. Control of movement along the wall based on a P-controller.

For a P-regulator, the control action U(t) on the robot motors at time t is calculated by the formula:

(9.1)

Obviously, the graph for calculating the control action U depending on the error E will be a straight line (see Fig. 9.6):

It is very easy to determine the coefficient from the graph. Let's choose an arbitrary point on the graph. In our case, this is point A(1; 2) . Then

The error can be either positive (if we are closer to the wall than necessary) or negative (if we have moved further from the wall than necessary). Thus, the control action U(t) can also be either positive or negative.

Let us have a P-controller for a robot moving along a wall. Then the power of the motors PowerB(t) and PowerC(t) at time t is calculated using the formulas:

(9.2)
(9.3)
  • Nm is the normal power of the motors: the power with which both engines should spin if the course deviation is zero. In our program we can put Nm = 50;
  • U(t) is the control action on the motors, calculated using formula (9.1).

The signs in front of U(t) for your robot may change to the opposite depending on which motor is on the left and which on the right.

Let's consider the meaning of the proportionality coefficient. As you can see, the rotation is made due to the fact that the control action is subtracted from the power of one motor, while it is added to the other. Thus, the coefficient can strengthen or weaken the effect of the regulator on the motors: if it is greater than one, then it is strengthened, and if it is less, it is weakened. A large one will make the robot very sensitive to errors, which will lead to sudden jerks to correct the trajectory. A small one will make the robot’s movements smoother, but on sharp turns the robot can lose the wall and go off the trajectory. The specific values ​​of the coefficient that are most suitable in each specific case will depend on design features robot, movement speed (normal power), route complexity, sensors used. The values ​​of PowerB(t) and PowerC(t) must be in the range . Therefore, with large errors (and, accordingly, large control signals), the power of the motors will be limited so that it does not fall outside the specified range. In this case, the proportional controller will not work correctly because it will not be able to compensate for large errors. Thus, one of the features of the P-regulator is that it works adequately only with small errors. In order to take this into account in our problem, we need to have a wall without sharp turns and move at low speed.

We implement the P-regulator algorithm according to the given formulas using nested procedures (My blocks) in the NXT-G language.

The block for calculating the deviation (error) from a given distance, which we will call Error, has the following parameters:

  • input - current distance sensor reading X(t);
  • weekend - error E(t)) .

The Error block in NXT-G language looks like this:


Rice. 9.7.

We use it in a subroutine to calculate the control action U(t) . It has the following parameters.

Wheeled and tracked robots

The most common robots of this class are four-wheeled and tracked robots. Robots are also being created with a different number of wheels - two or one. These kinds of solutions make it possible to simplify the design of the robot, as well as give the robot the ability to work in spaces where a four-wheeled design is ineffective.


Segway at the Robot Museum in Nagoya.

Two-wheeled robots, as a rule, to determine the angle of inclination of the robot body and generate the corresponding control voltage(in order to ensure maintaining balance and performing the necessary movements) they use certain gyroscopic devices. The task of maintaining the balance of a two-wheeled robot is related to the dynamics of an inverse pendulum. On this moment, many similar “balancing” devices have been developed. Such devices include the Segway, which can be used as a robot component; for example, the Segway is used as a transport platform in the Robonaut robot developed by NASA.

Single-wheeled robots are in many ways a development of ideas associated with two-wheeled robots. To move in 2D space, a ball driven by several drives can be used as a single wheel. Several designs of such robots already exist. Examples include the spherical robot developed at Carnegie Mellon University, the spherical robot "BallIP", developed at Tohoku Gakuin University (eng. TohokuGakuinUniversity), or the Rezero ball robot, developed at the Swiss Higher Technical School. These types of robots have some advantages associated with their elongated shape, which may allow them to integrate better into human environments than is possible for some other types of robots.

There are a number of prototypes of spherical robots. Some of them use rotation of the internal mass to organize movement. Robots of this type are called in English. sphericalorbrobots, English orbbot and English ball bot.

To move on uneven surfaces, grass and rocky terrain, six-wheeled robots are being developed, which have more traction compared to four-wheeled ones. The tracks provide even greater traction. Many modern combat robots, as well as robots designed to move on rough surfaces are developed as tracked ones. At the same time, it is difficult to use such robots indoors, on smooth surfaces and carpets. Examples of such robots include the English robot developed by NASA. UrbanRobot(“Urbie”), the Warrior and PackBot robots developed by iRobot.

Walking robots


Android robot ASIMO, manufactured by Honda.

The first publications devoted to theoretical and practical issues of creating walking robots, date back to the 1970s - 1980s of the 20th century.

Moving a robot using its “legs” is a complex dynamic problem. A number of robots have already been created that move on two legs, but these robots cannot yet achieve such stable movement as is inherent in humans. Many mechanisms have also been created that move on more than two limbs. Attention to such structures is due to the fact that they are easier to design. Hybrid options are also offered (such as the robots from the movie “I, Robot”, capable of moving on two limbs while walking and on four limbs while running).

Robots that use two legs tend to move well on the floor, and some designs can navigate stairs. Traveling over rough terrain is challenging task for robots of this type. There are a number of technologies that allow walking robots to move:

  • ZMP technology: ZMP ( English) (English) ZeroMomentPoint"zero moment point") is an algorithm used in robots like Honda's ASIMO. On-board computer controls the robot in such a way that the sum of all external forces acting on the robot is directed towards the surface on which the robot moves. Thanks to this, no torque is created that could cause the robot to fall. This type of movement is not typical for humans, as can be seen by comparing the manner of movement of the ASIMO robot and a person.
  • Jumping Robots: In the 1980s by Professor Mark Reibert. MarcRaibert from English « LegLaboratory" The Massachusetts Institute of Technology has developed a robot that can maintain balance by jumping using only one leg. The robot's movements resemble those of a human on a pogo stick trainer. The algorithm was subsequently extended to mechanisms using two and four legs. Such robots have demonstrated running abilities and the ability to perform somersaults. Robots moving on four limbs demonstrated running, trotting, gaiting, and skipping.
  • Adaptive algorithms for maintaining balance. They are mainly based on calculating the deviations of the instantaneous position of the robot’s center of mass from a statically stable position or some predetermined given trajectory his movements. In particular, similar technology uses the Big Dog walking robot carrier. When moving, this robot maintains a constant deviation of the current position of the center of mass from the point static stability, which entails the need for a peculiar positioning of the legs (“knees in” or “push”), and also creates problems with stopping the car in one place and practicing transitional walking modes. An adaptive algorithm for maintaining stability can also be based on maintaining a constant direction of the velocity vector of the system’s center of mass, however, such techniques are effective only at sufficiently high speeds. Of greatest interest to modern robotics presents the development of combined methods for maintaining stability, combining the calculation of the kinematic characteristics of the system with highly effective methods of probabilistic and heuristic analysis.

Other Moving Methods

  • Flying robots. Most modern aircraft are flying robots controlled by pilots. The autopilot is able to control the flight at all stages - including takeoff and landing. Flying robots also include unmanned aircrafts(UAVs; cruise missiles are an important subclass of them). Such devices are, as a rule, light in weight (due to the absence of a pilot) and can carry out dangerous missions; some UAVs are capable of firing at the operator's command. UAVs are also being developed that can fire automatically. In addition to the method of movement used by airplanes, flying robots also use other methods of movement - for example, similar to those used by penguins, stingrays, and jellyfish; Festo's Air Penguin, Air Ray and Air Jelly robots use this method of movement, or use the flight methods inherent in insects, such as RoboBee.

Two snake-like crawling robots. The left one is equipped with 64 drives, the right one - ten.

  • Crawling robots. There are a number of developments of robots that move like snakes, worms, and slugs. It is assumed that this method of movement may give them the ability to move in narrow spaces; in particular, it is planned to use such robots to search for people under the rubble of collapsed buildings. Also, snake-like robots have been developed that can move in water; An example of such a design would be japanese robot ACM-R5.
  • Robots moving around vertical surfaces. When designing such robots, various approaches are used. The first approach is to design robots that move like a person climbing a wall covered with ledges. An example of such a design is the Capuchin robot developed at Stanford University. Another approach is to design robots that move like geckos. Examples of such robots are Wallbot and Stickybot
  • Floating robots. There are many developments of robots that move in water imitating the movements of fish. According to some estimates, the efficiency of such propulsion can be 80% greater than the efficiency of propulsion using a propeller. In addition, such structures produce less noise and are also characterized by increased maneuverability. This is the reason for the high interest of researchers in robots that move like fish. Examples of such robots are the Robotic Fish robot developed at the University of Essex and the Tuna robot developed by the Institute of Field Robotics (English) to study and model the mode of movement characteristic of tuna. There are also developments of floating robots of other designs. Examples are robots from Festo: Aqua Ray, which imitates the movements of a stingray, and Aqua Jelly, which imitates the movements of a jellyfish.

1. Robot design for moving along a wall
You need to attach a distance sensor to the base cart and connect it to 1 port.
The distance sensor is slightly moved forward:

The orientation of the sensor can be varied:


2. Movement along the wall on the P-regulator
Let's solve this problem. The robot must move along the wall at a given distance L. Let's assume that the left wheel of the robot is controlled by motor B, the right wheel by motor C, and the distance sensor connected to port 1 is fixed slightly in front of the cart body (this is important!) and is aimed at the wall on the right along progress of movement.


Distance to wall in currently The time shown by the sensor will be denoted by S1. It is measured in centimeters.
The motors move at an average speed of 50% of the maximum, but when they deviate from a given course, a control action u is applied to them (on motor B 50+u, to motor C 50-u):
u=k*(S1-L), where k is a certain amplification factor that determines the effect of the regulator on the system.
Thus, when S1=L the robot does not change course and drives straight. In case of deviation, its course is adjusted. For a medium sized NXT robot, the k factor can range from 1 to 10 depending on many factors. Choose it yourself.

IN in this case The P-regulator will work effectively only at small deflection angles. In addition, the movement will almost always occur along a wave-like trajectory. The introduction of new principles that take into account the robot’s deviation from the course will make the regulation more accurate.

3. Proportional-differential controller

In some cases, the P-regulator can bring the system out of a stable state.

For example, if the robot is directed away from a wall, but is closer than a given distance to it, the motors will receive a command to turn even further away from the wall, as a result of which contact with it may be lost (the distance sensor receives a reflected signal almost only from a perpendicular surface).

To protect against similar situations Let's add a differential component to the controller, which will monitor the direction of movement of the robot.

u=k1*(S -L)+k2*(s1-Sold), where Sold is the distance at the previous step.

It is necessary to select suitable values ​​of the coefficients k1 and k2. Typically, the selection begins with a proportional coefficient (k1) with a zero differential coefficient (k2=0). When some stability at small deviations is achieved, a differential component is added.

4. Robot design with distance sensor located at an angle

The robot described above can go around walls only with small deviations from a straight line. Let's consider an option in which serious turns, even right angles, will occur along the path of movement. Modifications will need to be made to both the design and the program.

Firstly, the robot will have to look not only to the right, but also forward. Installing a second rangefinder is quite expensive. However, you can take advantage of the fact that ultrasonic sensor has an expanding scope.

This is similar to a person's angular vision: he can see something out of the corner of his eye. It is worth taking advantage of this property and placing the distance sensor not perpendicular to the course of movement, but at an acute angle. This way you can kill two birds with one stone. Firstly, the robot will see obstacles in front, and secondly, it will more stably adhere to a course along the wall, constantly being on the verge of visibility. Thus, without adding new devices, more efficient use rangefinder capabilities.

Important note. When starting the robot, it will need to be directed with the sensor strictly at the wall so that the reading process initial value went through without any problems.
The sensor mount is located on the left side: 15.01.2012, 18:51

Until now, in articles about algorithms used when moving along a line, a method was considered when the light sensor seemed to monitor its left or right border: as soon as the robot moves onto white part fields - the regulator returned the robot to the border, the sensor will begin to move deeper into the black line - the regulator straightened it back.
Despite the fact that the picture above is shown for a relay regulator, the general principle of movement of a proportional (P-regulator) will be the same. As already stated, average speed such a movement is not very high and several attempts were made to increase it by slightly complicating the algorithm: in one case “soft” braking was used, in another, in addition to turns, forward movement was introduced.
In order to allow the robot to move forward in some areas, a narrow area was allocated in the range of values ​​​​produced by the light sensor, which could conventionally be called “the sensor is on the border of the line.”
U this approach there is a small drawback - if the robot “follows” the left border of the line, then on right turns it does not immediately detect the curvature of the trajectory and, as a result, spends more time searching for the line and turning. Moreover, we can say with confidence that the sharper the turn, the longer this search takes place.
The following figure shows that if the sensor were not on the left side of the border, but on the right, then it would have already detected the curvature of the trajectory and would begin to make turning maneuvers.

Therefore, it is a good idea to equip the robot with two sensors at once, which are located along different sides from the line and, accordingly, would help the robot to react more quickly to changes in direction of movement.
Now we need to determine how this design change will affect the program. For simplicity, we should again start with the simplest relay controller and therefore, first of all, we are interested in the possible positions of the sensors relative to the line:

In fact, one more acceptable condition can be identified - on complex routes it will be the intersection of an intersection or some kind of thickening on the path.
Other positions of the sensors will not be considered, because they are either derivatives of those shown above, or these are the positions of the robot when it has left the line and will no longer be able to return itself to it using information from the sensors. As a result, all of the above provisions can be reduced to the following classification:
  • the left sensor, like the right one, is above a light surface
  • left sensor over a light surface, right sensor over a dark one
  • left sensor over dark surface, right sensor over light surface
  • both sensors are located above a dark surface
If at a certain point in time the program on the robot detects one of these positions, it will have to react accordingly:
    If both sensors are above a white surface, then this is a normal situation in which the line is between the sensors, so the robot should go straight. If the left sensor is still above a light surface, and the right sensor is already above a dark one, then the robot has driven its right side to the line, which means he needs to turn right so that the line is again between the sensors. If the left sensor is above a dark surface, and the right one is still above a light one, then to align the robot needs to turn left. If both sensors are above a dark surface, then general case, the robot continues to move straight again.

The diagram above immediately shows how exactly the behavior of the motors should change in the program. Now, writing a program should not be difficult. You should start by choosing which sensor will be polled first. It doesn't have of great importance, so let it be left. It is necessary to determine whether it is above a light or dark surface:
This action does not yet allow you to say in which direction the robot should go. But it will divide the states listed above into two groups: (I, II) for the upper branch and (III, IV) for the lower. Each group now has two states, so you need to choose one of them. If you look closely at the first two states I and II, they differ in the position of the right sensor - in one case it is above a light surface, in the other - above a dark one. This is what will determine the choice of what action to take:
Now you can insert blocks that define the behavior of the motors according to the tables above: the upper branch of the nested condition defines the combination “both sensors on light”, the top - “left on light, right on dark”:
The lower branch of the main condition is responsible for another group of conditions III and IV. The two states also differ from each other in the level of light that the right sensor detects. This means that it will determine the choice of each of them:
The resulting two branches are filled with movement blocks. The upper branch is responsible for the “left on dark, right on light” state, and the lower branch is responsible for “both sensors on dark”.
It should be noted that this design only determines how to turn on the motors depending on the readings of the sensors in a certain place in the field; naturally, after a moment, the program must check whether the readings have changed in order to adjust the behavior of the motors accordingly, and after a moment again, again, etc. .d. Therefore, it should be placed in a loop that will provide this repeated check:

So pretty simple program will provide a fairly high speed of movement of the robot along the line without flying beyond its limits, if configured correctly maximum speed when moving in states I and IV, and also set the best way braking in states II and III - the steeper the turns on the highway, the “harder” the braking should be - the speed should be reduced faster, and vice versa - with smooth turns it is quite possible to apply braking by turning off the power or even by reducing the speed altogether.

A few separate words should also be said regarding the placement of sensors on the robot. Obviously, the same recommendations for the location of these two sensors relative to the wheels will apply as for one sensor, only the vertex of the triangle is taken as the middle of the segment connecting the two sensors. The distance between the sensors itself should also be selected from the characteristics of the track: the closer the sensors are located to each other, the more often the robot will level out (perform relatively slow turns), but if the sensors are spaced wide enough, then there is a risk of flying off the track, so you will have to more “hard” turns and reduce speed on straight sections.