I'm making a robot that uses two DC motors to move, and has two distance sensors on its right side. I want to make a PID controller to control the angle of the robot (using a wall as reference) and also its distance to the wall.

I made a PID controller that can minimize the difference between both sensors' measurements, making the robot go always parallel to the wall. I also made a controller for controlling the distance one sensor measures, for the robot to go always at the same distance to the wall.

What I want to do is combine those two controllers into one. I know there's something called MISO PID controller (multiple inputs single output) but I don't know how to use it or even design it. I thought of adding those two variables (the difference and one sensor's measurement) and using that as the controller's input. Is that right? How can I achieve this?

PS: I also thought of adding the difference between each sensor's measurement and the distance I want, or using those two differences as the variables of my MISO controller.

  • $\begingroup$ I have a question regarding your PID-Wall-Follower. I have already developed a simple version without PID controller that measures the distance in a 45 degree angle and by using the arcos, a correction angle is avaialble to set the robot parallel to the wall. However, I have now found a PID controller that could help me to ensure the parallel distance to the wall. My question now is if you can share your code regarding the wall-follower? Even if I only have one sensor for measuring the distance to the wall, I guess it would help me. Thanks a lot $\endgroup$ – burki0611 Dec 1 '20 at 18:00

The principle is called linguistic multivariable fuzzy pid control. The idea is to create a domain specific language and create with that a domain specific controller. The existing sensor variables and existing motor primitives for starting and stopping the servo motors are taken as a base for constructing a higher level behavior system on top. Rodney Brooks described this principle first. In terms of programming it means, to add new methods in the controller class. For example, “stayaway-fromwall”, “move-onthe-line”, “rotate-until” and so on. The motion primitives are forming together with the sensor variables a domain specific language and the controller is formulated in that language.

I know, it sounds very theoretically. A practical example can be tested out in the famous “Karel the robot” game. The user has the task to define new subfunction and combines them into a program. This gets started in the Karel simulator. Programming a real robot in a maze works similar.

  • $\begingroup$ This doesn't address OP's question at all. The Karel game doesn't show or explain how to combine PID controllers. Also, I find zero results online when I search "linguistic multivariable fuzzy pid control" or "linguistic multivariable" pid. Can you please provide links to the methods you mention and/or an example of how it works? $\endgroup$ – Chuck Jan 2 '19 at 16:49
  • $\begingroup$ @Chuck Which kind of of academic search engine do you have? Google Scholar shows over 1000 hits for “wall following fuzzy controller multivariable”, Additionally, the “Flakey the robot” project by SRI gave a good introduction into linguistic grounded robot control. $\endgroup$ – Manuel Rodriguez Jan 2 '19 at 18:39
  • $\begingroup$ You said The principle is called linguistic multivariable fuzzy pid control, so I searched that phrase and found nothing. Without quotes turns up results,but then I can't seem to find a paper that has something to covers linguistic and multivariable and fuzzy pid. You mention "Flakey the robot" as a good example, but the wikipedia entry has 6 sentences on it, none of which mention PID. The SRI page has even less information. $\endgroup$ – Chuck Jan 2 '19 at 18:58
  • $\begingroup$ My point is that you state "the principle is called ____" and then I personally can't find anything that features that phrase. The project you mention in the answer doesn't seem to relate, at least that I can find, to multivariable PID control at all, and again, none of this seems to address the question which is, in essence, "How do I combine two PID controllers?" If your answer is "fuzzy PID control," then please cite a source that shows how fuzzy PID combines multiple PID controllers and/or write a small example here. $\endgroup$ – Chuck Jan 2 '19 at 19:04

A (possible) way that I could think of is to use a (resource-aware) switching PID controller in your feedback loop. The operation is as follows:

[1] The controller is of the class single-input-single-output.

[2] The input to the controller is the (desired) error i.e., the error measued between the reference position and the location of the wall-1/wall-2 that is being measued along the motion. I omit the discussion on the control output which is redundant.

[3] The fun part starts here: In short the controller will act as a switching PID controller which switches between its two error inputs. Thereby, reducing the error when certain limit exceeds. This limit can be in terms of performance, for instance, how the ideall the robot should maneuver parallel to the wall.

[4] This switching action can be based on algorithims like roll-out policy. Thereby, switching between the inputs whenever it is necessary. Of course, this depends upon your performance specificationsn and your processor's capabilities. Nevertheless, you can dig into topics such as resource aware controller design per se to look more in detail about this.

Disclaimer: Following this procedure might have impact on the stability, hence always verify the stability argument before going forward with these techniques.

  • $\begingroup$ The domain of a wall following robot is too complex for pid switching control. PID switching has it's roots in a mathematical description which can't be provided in case of robot control. So called “roll-out policies” are an optimization technique. If no model is available, the optimization will fail. $\endgroup$ – Manuel Rodriguez Jan 7 '19 at 9:26
  • $\begingroup$ @Manuel Rodriguez could you elaborate on being too complex and can't be provided for robot control. Also, roll-out policies can also be tweaked to behave based on measured data. $\endgroup$ – Raaja_is_at_topanswers.xyz Jan 7 '19 at 9:33
  • $\begingroup$ Sure, according to the problem description the systems contains of 2 actuators, 2 sensors and a wall which is the reference line to follow. Is it a toy problem in the form of f(x)=y? No, it's an np-hard problem which contains of a non-linear complex statespace which gets divided by project's requirements. It's very likely that the robot is in a maze like environment and has to win a game against other robots. $\endgroup$ – Manuel Rodriguez Jan 7 '19 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.