Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Kevin Watson's Kick-off Demo Code! (http://www.chiefdelphi.com/forums/showthread.php?t=32441)

Mr. Lim 10-01-2005 10:17

Kevin Watson's Kick-off Demo Code!
 
Kevin's done a great job again this year! The IR and encoder code he supplied last year was outstanding, and I had a chance to quickly flip through his code providing gyro, PID, and navigation scripting. See http://kevin.org/frc/ the first link.

This year is going to be a LOT of fun! Thanks Kevin!

A few quick questions/comments for anyone who's looked at the code:

1) I think you'll need to source two encoders (not in the kit) to work with this code. The gear tooth sensors included in the kit may not cut it, unless you buy two more, and are clever about aligning them to simulate a quadrature output.

2) There is no camera code in here. So for teams looking to use the some combination of camera navigation, navigation scripting, and position sensing via encoders and gyro, you'll need to fuse the two together. So don't get too excited about things being TOO easy.

3) Will the included gyro code work with the accelerometer provided in the kit? Plug and play I hope? I didn't pick up on what kind of gyro Kevin Watson used for the demo robot.

Good luck to everyone!

-SlimBoJones...

Squall 10-01-2005 19:39

Re: Kevin Watson's Kick-off Demo Code!
 
I'm trying to find out what Gyro he used, or if it isn't the acelerometer

My team is gonna buy two Encoders, we just have to adjust the code so that it can work with our Encoders and we need to find out what's the gyro we need

Squall 11-01-2005 10:29

Re: Kevin Watson's Kick-off Demo Code!
 
Hey, I've email kevin with this question and he answered :

"The software should work with quite a few gyros. We
used one made by Silicon Sensing Systems, but you
should be able to use the popular Analog Devices
ADXLS150 or ADXLS300 gyros too by modifying
the GYRO_RATE_SCALE_FACTOR and
GYRO_ANGLE_SCALE_FACTOR #defines in
gyro.h. We used two Grayhill 61K128 encoders on
the gearbox output shaft."

I think that this info can be of use to a lot of teams, and this way we don't have to botter Kevin so much asking the same question.

russell 11-01-2005 10:51

Re: Kevin Watson's Kick-off Demo Code!
 
Is there not a gyro included in the kit?

Squall 11-01-2005 11:02

Re: Kevin Watson's Kick-off Demo Code!
 
No, the sensor that's included in the kit is the accelerometer, it's similar but it's not the same thing.

The accelerometer gives you the instant acceleration, and the gyro gives you the angular velocity.

CJO 11-01-2005 15:32

Kevin Watson's Scripting code and the Camera System
 
P.S. I have re-posted this as a new thread here.


I have not had a chance to e-mail Mr. Watson yet, however, trying to integrate the Camera control system into the scripting code is becoming a real nightmare. The difficulty is in the serial port driver. The problem as I see it is thus:

1) There are really three different serial port drivers, they are:
a) usr_SerialDrv.c
b) serial_ports.c
c) PicSerialDrv.c
"a" is the defaut FRC driver, no need to worry about it just delete it. "b" is Mr. Watson's serial port driver, allowing LCD screens and printf functions from the FRC controller. "c" is the serial port driver which comes with the camera. "b" and "c" really do most of the same things, put are not intrinsically compatible. My immediate solution is to call some parts of "b" from within "c," thereby leaving the camera driver intact and just adding certain functionality from the seril ports driver. Problem is, in even limited testing on the controller it has been doing some really weird things.

2) What the is the "Dynamic Debug Tool?" This phrase was included in the camera software. In the PicSerialDrv.c file there was this comment:
Quote:

This file contains an unsupported serial device driver for the 18F8520 micro. It was designed to be used with the Dynamic Debug Tool (DDT). The DDT is now apart of the IFI Loader (ver 1.8 or later) under the 'Options' menu. The DDT can be used to directly read and modify memory locations and registers of the user processor dynamically.
The camera quick start guide specifies the the PicSerialDrv.c as a required file. Furthermore, the PicSerialDrv.c specifies that :
Quote:

You can put your own callback routine inside CheckUartInts. This will allow you to parse data from another device in real time.
So, in fact, this is where I called Mr. Watsons code. The problem is, that the two drivers seem to be trying to do different things with the ports.

3) While trying to use interrupts (a switch attached to one of the digital ports) and the camera software at the same time, the controller keeps resetting itself, for no reason which I can identify.

4) Building on #3, the camera has what is esentially a state machine servicer (for lack of a better term) built into it; that is, calling camera_track_update() will tell you whether or not the camera has been successful in updating and tracking to a new position. To my mind, this should be handled almost like an interrupt, that is, when it returns 1, the camera track code is executed, but in the code provided, it sits in user_routines_fast in the sutonomous section, and simply says:
Quote:

if(camera_track_update()==1)
tracking = 1;
trakcing code
else
tracking = 0;
So, if I understand it correctly, what it is really doing is sitting in the autonomous space and waiting for an update. Is this really the best way to do this?

5) Finally, the camera needs to be calibrated before use. This is done by hooking a PC up to the camera and running a JAVA script program to get exposure values. You then have to send these values to the camera in "User_Initialization()" by including the line
Quote:

camera_init ( yellow exposure, green exposure, red exposure )
The drawback to this is that it requires re-compiling and loading the code. Is there a way to set it so that you could use onboard switches to change the state of the exposure values without having to re-load the code? My only thouught so far was to have a pair of pushbuttons attached to the operator interface, and after pressing some button combination, the display byte gets set to the currently selected value and then the two buttons increment it up and down.

Kris Verdeyen 11-01-2005 16:13

Re: Kevin Watson's Kick-off Demo Code!
 
The CRS03-02 gyro "puck" costs $299 from newark: http://www.newark.com/NewarkWebComme...&Ntk=gensearch

That's over the $200 / part limit.

If someone knows of a distributor that sells the chip itself for less, please post it.

vtrehan 11-01-2005 16:29

Re: Kevin Watson's Kick-off Demo Code!
 
Quote:

Originally Posted by Kris Verdeyen
The CRS03-02 gyro "puck" costs $299 from newark: http://www.newark.com/NewarkWebComme...&Ntk=gensearch

That's over the $200 / part limit.
If someone knows of a distributor that sells the chip itself for less, please post it.

You can use the ADXRS300 from Analog devices, it costs arround $50 and can be used with Mr.Watsons code. Heres the link, http://www.analog.com/en/prod/0%2C28...S300%2C00.html

stephenthe1 11-01-2005 16:46

Re: Kevin Watson's Kick-off Demo Code!
 
will this code work for last years controller? (the whole scripting thing). also, what are the parameters for? do they have a definition somewhere else in a .h file? also, what is the default setup of the robot (motors, etc.) that these commands will work with? or is this what the parameters are for. either way, we'll need a description of the robot layout.

CJO 11-01-2005 17:08

Re: Kevin Watson's Kick-off Demo Code!
 
Also check out this guy . . .
http://www.drrobot.com/products_item...Number=DTA5102

Squall 12-01-2005 11:09

Re: Kevin Watson's Kick-off Demo Code!
 
Has anyone been able to substitute the gyro ?

I've been looking for info on how to do that, Kevin told me that I should change that two variables that I previously posted, but I can't understand them, and I can't find that info on my Gyro Datasheet

Does anyone have an Ideia ?

Mark McLeod 12-01-2005 11:27

Re: Kevin Watson's Kick-off Demo Code!
 
Quote:

Originally Posted by Squall
I've been looking for info on how to do that, Kevin told me that I should change that two variables that I previously posted, but I can't understand them, and I can't find that info on my Gyro Datasheet

Post the model gyro you are using and we might be able to help with those parameters.

Anthony Kesich 12-01-2005 11:46

Re: Kevin Watson's Kick-off Demo Code!
 
Any teams that competed in the 2003 competition should already have a gyro. Its that ugly black rectangle they gave us. The spec sheets were not to hard to find (I'll post a link when I get it again) and it wasn't too hard to make a pwm adapter. Using it should save teams a lot of money.

-Tony K

Squall 12-01-2005 13:35

Re: Kevin Watson's Kick-off Demo Code!
 
Quote:

Originally Posted by Mark McLeod
Post the model gyro you are using and we might be able to help with those parameters.

Hi, We're using this one :

ADXRS150 from analog devices

It's datasheet can be found here :

http://www.analog.com/UploadedFiles/...ADXRS150_B.pdf

We kind of understand the values that we have in the datasheet, but we really couldn't find one that could match the ones needed to alter in Kevin's code.


Thanks for your attention

Kevin Watson 12-01-2005 16:10

Re: Kevin Watson's Kick-off Demo Code!
 
Quote:

Originally Posted by Squall
Has anyone been able to substitute the gyro ?

I've been looking for info on how to do that, Kevin told me that I should change that two variables that I previously posted, but I can't understand them, and I can't find that info on my Gyro Datasheet

Does anyone have an Ideia ?

Sorry, I haven't been around much. The hillside directly behind my house collapsed last Sunday and I've been dealing with the mess.

Anyway, the two variables are GYRO_RATE_SCALE_FACTOR and GYRO_ANGLE_SCALE_FACTOR. GYRO_RATE_SCALE_FACTOR should be set to a value equal to the gyros sensitivity in units of angular rate per volt divided by the ADCs bits per volt. Set GYRO_ANGLE_SCALE_FACTOR to GYRO_RATE_SCALE_FACTOR divided by the update rate, which is 50Hz.

So, for example, to use the Analog Devices' ADXRS150 evaluation board, which has a sensitivity of 12.5mV/degree/sec, take the inverse of that sensitivity (80 degrees/sec/volt) and divide by the number of ADC bits per volt (1024/5), which equals (80 x 5)/1024 = 400/1024 = 100/256. The GYRO_ANGLE_SCALE_FACTOR is then just (100/256)/50 = 2/256 = 1/128.

In the coming days I'll be working on cleaning up not only my house, but the code too <grin>.

-Kevin


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

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