Author |
Message |
LittleToY
Rookie
Joined: Sat Jan 21, 2012 6:10 pm Posts: 3
|
 how can i use 2 light sensors as pid control
how can i use 2 light sensors with pid control cause I've read through the link http://www.inpharmix.com/jps/PID_Controller_For_Lego_Mindstorms_Robots.html it works with nxt-G with only one sensor but i would like to know how can i use robotc to do like this with 2 sensor like this link http://www.youtube.com/watch?v=nQ6wsAL6w9Ythanks for your advices
|
Sat Jan 21, 2012 6:15 pm |
|
 |
DiMastero
Expert
Joined: Wed Jun 30, 2010 7:15 am Posts: 181
|
 Re: how can i use 2 light sensors as pid control
PID doesn't really need a second light sensor, and I doubt it would improve your results a lot. What I would do is use one sensor for the line following and use the other one for something else (detecting colored dots on the line, maybe?)
_________________leonoverweel.com
|
Sat Jan 21, 2012 7:28 pm |
|
 |
LittleToY
Rookie
Joined: Sat Jan 21, 2012 6:10 pm Posts: 3
|
 Re: how can i use 2 light sensors as pid control
if 2 sensors do not work for pid could guide me to do for more sensors such as 4 sensors and i think only one sensors less smooth than more sensors but i do not know how to build some code to control nxt
|
Sat Jan 21, 2012 9:15 pm |
|
 |
DiMastero
Expert
Joined: Wed Jun 30, 2010 7:15 am Posts: 181
|
 Re: how can i use 2 light sensors as pid control
The smoothness of a PID controller really depends on how it's tuned. Here's some code that I wrote for my line follower, but it only uses one sensor. The result is very smooth though. It has some stuff you don't need, but you can change it to fit your needs. I wrote this using the tutorial page you also talked about in your first post.
_________________leonoverweel.com
|
Sat Jan 21, 2012 10:06 pm |
|
 |
MHTS
Guru
Joined: Sun Nov 15, 2009 5:46 am Posts: 1523
|
 Re: how can i use 2 light sensors as pid control
In theory, if you have more light sensors, you will be able to move faster and smoother without losing the line. If you have just one light sensors and you go too fast and overshoot a curve a lot, you may not find the line again, whereas if you have 7 light sensors spanning a wider width, you will know you are about to lose the line so you can slow way down to make the turn. There are may threads in forums that talk about this subject. You may want to search for them.
|
Sun Jan 22, 2012 12:38 am |
|
 |
mightor
Site Admin
Joined: Wed Mar 05, 2008 8:14 am Posts: 3654 Location: Rotterdam, The Netherlands
|
 Re: how can i use 2 light sensors as pid control
_________________| Professional Conduit of Reasonableness| (Title bestowed upon on the 8th day of November, 2013) | My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
Sun Jan 22, 2012 3:07 am |
|
 |
LittleToY
Rookie
Joined: Sat Jan 21, 2012 6:10 pm Posts: 3
|
 Re: how can i use 2 light sensors as pid control
i read some related topic but still do not understand how to config code that work with pid if i want to use 2 light according to video link above could anyone guide me how to config code with robotc
thanks for your suggestion
|
Mon Jan 23, 2012 5:45 am |
|
 |
MHTS
Guru
Joined: Sun Nov 15, 2009 5:46 am Posts: 1523
|
 Re: how can i use 2 light sensors as pid control
The following thread explains how to use 3 light sensors to do PID line following. Although the thread is in Vex/Cortex forum but it should be equally applicable to NXT Mindstorms. viewtopic.php?f=11&t=3988
|
Mon Jan 23, 2012 2:38 pm |
|
|