Thread: Using Sensors
View Single Post
  #7   Spotlight this post!  
Unread 13-12-2003, 07:59
mtrawls's Avatar
mtrawls mtrawls is offline
I am JVN! (John von Neumann)
#0122 (NASA Knights)
Team Role: Programmer
 
Join Date: Mar 2003
Location: Hampton, VA
Posts: 295
mtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to behold
Send a message via AIM to mtrawls
Re: Using Sensors

Quote:
Originally Posted by thoughtful
Hmm about the gyro thingm i am very fascinated by that can u tell me or show be an basic program which incorporates something like that, or give me a link to start me off. It will be really helpful
Well, I wasn't going to show you a basic program ... but rather the P-basic variety

The team laptop with the code from last year, however, is undergoing repairs. I'll explain the concept to you though, if that helps. The 'gyro' is really a yaw rate sensor, meaning that it tells you your angular speed (omega). To get your angular position (theta), you have to integrate the speed (since, from physics, theta = Int (omega) dt, where omega is a function of time).

So, what you do, is every cycle through the code, add the value of omega to the current value of theta (initialize it to zero). This should approximate your angular position, and you can come up with some empirical numbers to convert the nasty numbers they give you to nice radian or degree measurements if you like. But be careful for a couple of things; namely, you don't want to turn faster than the gyro can keep up with you, and two, your angle is measured with respect to where you started from (the theta=0 point), so be very sure that you put your robot down in a similar position if your autonomous code depends upon the angle you are to something on the field.

This should, at least, get you started. Obviously, there are some things to fine tune the code, depending on its application, and, possibly, on your robot.