04-11-2016 08:06 PM
Hi all,
I am trying to control a differential mobile robot using myrio. I read the encoder signals that are attached to the two motors, and uses a separate PI controller for each wheel. The set point is the deisred velocity for each wheel, and the process variable is the calculated wheel speed from the encoder counter. The robot can move, but there is a problem with the speed control because if I need the robot to move in a straight line for instance, actually it is alaways has a small deviation. I tried to tune the PI paramters, but in vain. Any ideas?
I am attaching a screen shot of the code. I can also attach the code if any wants to have a look.
04-12-2016 10:25 AM
Hi Cowboy12,
Could you be more descriptive about the small deviation when you move the robot? Is the robot not moving the desired distance or does it seem like the speed is incorrect, and how much is "small" deviation? There could be a number of different things occurring here depending on what exactly you mean.
You also have a lot going on in that code, which I assume is all running in the same loop. It might be worthwhile to strip the code down to the bare minimum required to run the motor, as it could be the loop is running too slow to properly update the output voltages and that's where the discrepancy is coming from. If the PI is not able to run quickly enough, you might not see the output voltages updating quickly enough.