Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Encoder+PID = How make robot going straight (http://www.chiefdelphi.com/forums/showthread.php?t=133510)

roialex 25-01-2015 20:47

Encoder+PID = How make robot going straight
 
1 Attachment(s)
Hi,

My team and I tried to make robot going straight by using pid en the rate of our encoder on our motor (1 each side). Unfortunately it finish by not working at all. Here is our code that we tried but the robot was just spinning without any control you just needed to make the robot enable and it was spinning alone. We took the rate of our encoder divide it by 3700 wich is a theoretical value that represent the maximum rate that our motor were able to go. This should now gave us a value between 0 and 1. We took this value and make it the process variable in our PID. We too also the variable fromm our joystick wich range between -1 and 1 and make it our setpoint in the PID. We took the output of the pid and set it to the motor. Brief it doesn't works maybe we are not doing it right. Our goal is just to make our robot going straight how to do it ? Do you have any advice on how make you robot going straght with encoder or how improve our code ?

Thanks in advance,

Alex Rousseau
Student programmer
VObotik team 5444

Chris_Elston 25-01-2015 20:52

Re: Encoder+PID = How make robot going straight
 
1 Attachment(s)
We find it soooo much easier to make a robot go straight with a GYRO verses encoders. So if your application or goal is to go straight maybe try with a gyro if you have one?

Here is some pseudo code in excel with a simple "P" loop that works for autonomous mode.

Alan Anderson 25-01-2015 22:48

Re: Encoder+PID = How make robot going straight
 
If your goal is to make the robot go straight, and you're using Arcade drive, then it is probably easiest to put the closed-loop control on the turn input rather than on the individual motor outputs. You can either use a gyro as Chris suggests, or use the difference of the left and right encoders to tell you how much the robot thinks it has turned.


All times are GMT -5. The time now is 08:58.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi