Author Topic: Webbotavrclib-1.21 Re: Sensors/Encoder  (Read 2083 times)

0 Members and 1 Guest are viewing this topic.

Offline InvictaTopic starter

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 1
Webbotavrclib-1.21 Re: Sensors/Encoder
« on: June 21, 2010, 05:39:36 PM »
Webbotlib

Cry 'God for Harry, England and St George'. (It's an English thing)

In the section for Sensors/Encoder you state that: "Assuming that the wheel is just rotating continuously then the counter will eventually overflow back to 0 and the frequency of this will depend on how many stripes the encoder has and on how fast the motor is rotating". Your getround is to re-zero the counter before it overflows, this is ok, but what if the counter is at zero and the robot starts moving backwards! Will not the counter need to be able to store -ve numbers?

   uint16_t ticks = quad1.encoder.value; (unsigned integer will not show -ve numbers)

Also, unable to find in Webbotavrclib-1.21 value range for the counter, or do I deduce positive integer values from 0 to 65535 from the uint16_t?

or have I missed something ;)

Keep Webbotavrclib rolling it is a fantastic resource.


Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Webbotavrclib-1.21 Re: Sensors/Encoder
« Reply #1 on: June 21, 2010, 08:24:07 PM »
The value used to store the encoder tick count is actually defined to be of type ENCODER_TYPE which is defined elsewhere as an int16_t so it can already store -ve numbers (ie -32,768 to +32,767)

The documentation shows this correctly in some places ie:-
Code: [Select]
// get the value from the last read
ENCODER_TYPE ticks = quadrature.encoder.value;

However the comments for the MAKE routines incorrectly show:-
Code: [Select]
uint16_t ticks = quad1.encoder.value;
So I'll fix the docs - thanks for bringing it my attention.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline woody

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
Re: Webbotavrclib-1.21 Re: Sensors/Encoder
« Reply #2 on: December 20, 2010, 03:08:02 PM »
Hello,

Im new to using microcontrollers. I have some light background on using pic-micros & some C-language basics.
I am working on a simple system "ATmega32 - Quad Encoder - LCD".. and im using the new webbot library 1.27...
I was hoping i found find somekind of sample codes for using the library.. for educational use.. as this would really help me alot to see how such a simple system is implemented... so i can further build on.....
Note: Ive been through the pdf document thouroughly.. I just believe that learning by examples is one of the efficient ways for a beginner in programming microcontrollers..

Thanks alot!! :)

Offline woody

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
Re: Webbotavrclib-1.21 Re: Sensors/Encoder
« Reply #3 on: December 20, 2010, 03:11:45 PM »
Maybe i can provide my source code.. for anybody who is familiar with using the webbot library / encoder & LCD interfacing to tell me if im going in the right direction or not....

Thank Youuuuu ;) :)

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Webbotavrclib-1.21 Re: Sensors/Encoder
« Reply #4 on: December 20, 2010, 07:51:44 PM »
@woody
Hard for me, and others I guess, to give help since you don't say how far you've got. As for an 'example' with ATmega32 + encoder + LCD then please think about the endless possibilities given the enormous combinations supported by WebbotLib.
Suggest you try downloading Project Designer from my website (http://webbot.org.uk) as it gives a drag'n'drop visual GUI and then start a new thread with your specific issues.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

 


data_list