CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

interesting question about pid control

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
planix



Joined: 20 May 2006
Posts: 5

View user's profile Send private message

interesting question about pid control
PostPosted: Sun Aug 06, 2006 6:09 am     Reply with quote

I have been there for a long time and i have learned a lot of things with this forum. firstly thanks all for every thing you post.

Here comes my question.

I'm trying to improme my line following robot i have been using 6 line sensors (3 left from the orgin and 3 right) and 2 motors( left and right) with 2 sensors(actually they are small dc motors connected via belts to drive motors.Smile and i have been reading adc from them. )

I have studied pid algors. and but all of those examples and codes are read from only 1 sensor.

the big question is how can i control the robots drive motors with 6 sensors and 2 motor speed sensors using pid or pi or something like that?

thanks again for every thing.



Ttelmah
Guest







PostPosted: Sun Aug 06, 2006 9:35 am     Reply with quote

At 'heart', this is the question of 'how do I do multiple things on a single processor'. The 'key' normally for most embedded applications, is a 'state machine', where you loop round some process 'flow', and each time round the loop, at some critical point you branch to do different things. Now without knowing the timings involved for your PID, and for the sensors, it is hard togive a real answer, but instead I'll try to draw a 'structure' layout, of what has to happen:
Code:


loop:    Wait here to synchronise to the PWM
           Read the selected ADC
           Select the next ADC
           (now you read, before you select, to avoid having to wait for the
           ADC conversion, which will carry on while you go round the loop).
           If ADC read, was for 'position', update the required movement
           fed to the corresponding PID algorithm.
           If instead ADC read, was for a servo, update it's PID coefficients,
           and calculate new required PWM values.
           Go back to 'loop'.


Now the 'state' in this version, is the read ADC channel, which you change each time round the loop, so you read the six position sensors, and then the two servo sensors in turn. In each loop you only perform one set of arithmetic, corresponding to which sensor was read (you will need to be careful, and use fast (int) arithmetic, to keep the loop time short).

Best Wishes
planix



Joined: 20 May 2006
Posts: 5

View user's profile Send private message

PostPosted: Sun Aug 06, 2006 10:14 am     Reply with quote

thank you for your answer this outline will really help me

thankx again.
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

Re: interesting question about pid control
PostPosted: Sun Aug 06, 2006 6:02 pm     Reply with quote

planix wrote:
...with 2 sensors(actually they are small dc motors connected via belts to drive motors.Smile and i have been reading adc from them. )


Planix,

Can you shed some more light on these sensors? Do you somehow use the DC motors as RVDT? Do you use them as shaft position feedback (instead of an encoder)?

Thanks!
~K
planix



Joined: 20 May 2006
Posts: 5

View user's profile Send private message

PostPosted: Sat Aug 12, 2006 1:55 am     Reply with quote

two of these dc motors connected to other driver motors via shaft/drive belt. as you know dc motors generate voltage if you turn them and the 2 small motors are turned by driver motors i mean the motors which moves robot.

the light sensors are fairchild' s qrd1114

i have worked after i asked my question and i am nearly solve my problem 6 light sensors are lowerd down to 1 with some kind of alg. i will post my full code and isis simulations when i finish my project ;)
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Sat Aug 12, 2006 6:43 pm     Reply with quote

This looks to me like three PID loops. Each motor would have a loop, with an input of the desired ground speed, feedback from the motor sensor, and a PWM output to the motor. Then the third PID loop would have the six light sensors as feedback and the difference of motor ground speeds as output.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group