Go to Post There are always rules we don't agree with, just like in life. Our character is defined by how we respond. - Mr MOE [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 23-01-2008, 20:51
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Issues with our code

Quote:
Originally Posted by Ryan O View Post
Thank you. It is in an analog port, and we are using the WPILib function GetGyroangle(port), whcih is supposed to give us a heading through integration. Have you had any problems with that?
We use those functions all the time. Can you use some print statements or the easyC online window to verify that the gyro is working properly?
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #17   Spotlight this post!  
Unread 24-01-2008, 21:48
Ryan O's Avatar
Ryan O Ryan O is offline
FRC Eclipse Plug-in Developer
no team (FRC Eclipse)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Plaistow
Posts: 111
Ryan O is an unknown quantity at this point
Send a message via AIM to Ryan O
Re: Issues with our code

Our code currently uses the following to output in an infinite loop in operator control:

printf("Gyro Heading: %d",heading);

Where heading is an int assigned:

heading = GetGyroAngle(GYRO_PORT);
__________________
CRUD Name: Windows
Rookie Year: 2005
Alumni to Team: 350
  #18   Spotlight this post!  
Unread 25-01-2008, 07:47
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: Issues with our code

Did you call initialize gyro and start gyro?
__________________
FIRST Team 501 PowerKnights - Mentor
FIRST Team 40 Checkmate - Mentor Alum
FIRST Team 146 Blue Lightning - Alumni
  #19   Spotlight this post!  
Unread 26-01-2008, 12:16
Ryan O's Avatar
Ryan O Ryan O is offline
FRC Eclipse Plug-in Developer
no team (FRC Eclipse)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Plaistow
Posts: 111
Ryan O is an unknown quantity at this point
Send a message via AIM to Ryan O
Re: Issues with our code

Here is the code so far:

Our file, ConstantsandControl.h:

#ifndef Constants_Control
#define Constants_Control

//Constants
#define AUTO_FIELD 1
#define INFINITE 1

//Ports
#define GYRO_PORT 1

//Controls

#endif


The run file, main.c:

//Define robot type(FRC vs. VEX) (Done only once)
#ifndef _FRC_BOARD
#define _FRC_BOARD
#endif

//Include features
#include "BuiltIns.h"
#include "Constants_Control.h"

//Setup competition mode, called first
void IO_Initialization(void)
{
//Set to automatic competition mode handling
SetCompetitionMode(AUTO_FIELD);
}

//Initialize: run at robot startup regradless of mode
void Initialize(void)
{
//Initailize Sensors
SetGyroType(1,80);
InitGyro(GYRO_PORT);
}

//Note: will switch between auto and operator automatically,
//even if the code is currently in an infinite loop

//Autonomous: run at field control enable
void Autonomous(void)
{
int heading;
StartGyro(GYRO_PORT);

while(INFINITE)
{
heading = GetGyroAngle(GYRO_PORT);
//Print
printf("Gyro Angle: %d\r",heading);
}
}

//OperatorControl: Teleoperated period
void OperatorControl(void)
{
int heading;
StartGyro(GYRO_PORT);

while(INFINITE)
{
heading = GetGyroAngle(GYRO_PORT);
//Print
printf("Gyro Angle: %d\r",heading);

if(heading < 0)
{
heading = heading * -1;
}

SetPWM(1,heading);
}
}

//Main: Satifies call requiremen only, unused
void main(void)
{
}


Thats the code.

The only warning we get on compile are qualifier mismatch in assignment, and we get two of them on the line that assigns GetGyroAngle to heading.


EDIT: That Setpwm thing was our way of testing if the printf was the problem. We just hooked a servo up to it ans tested to see if it moved t all when we moved the gyro.
__________________
CRUD Name: Windows
Rookie Year: 2005
Alumni to Team: 350

Last edited by Ryan O : 26-01-2008 at 12:19. Reason: Additional information
  #20   Spotlight this post!  
Unread 26-01-2008, 16:02
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Issues with our code

I was able to test the code quickly on a Vex controller (changed _FRC_ROBOT) and it works as it should. It printed gyro angles for both autonomous and operator control and the motor started going once it hit operator control.

You mentioned that you're getting an warning about a type qualifier mismatch on the GetGyroAngle calls. I'm not sure why you're getting that and I don't see it here.

I'll see if I can put something together with an FRC controller, but I might not be able to do that for a while.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #21   Spotlight this post!  
Unread 26-01-2008, 22:43
Ryan O's Avatar
Ryan O Ryan O is offline
FRC Eclipse Plug-in Developer
no team (FRC Eclipse)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Plaistow
Posts: 111
Ryan O is an unknown quantity at this point
Send a message via AIM to Ryan O
Re: Issues with our code

Is it possible I accessed something VEX specific? The output we get sometimes cuts itself off (Gyro AngGyro Angle: 0). It usually does all zeros, but the second time we tried it it just started incrementing and wouldn't stop. Also, I know that this year it is a different gyro. Is there something different in it that doesn't like WPILib? The papers for it said everythingis the same except the resolution, whch is down to 80 deg/sec from 150 deg/sec. I tried using the SetGyroType function, inputing 80, seeing as the WPILib papers said that the input number is the resolution.

Thanks for all the help!
__________________
CRUD Name: Windows
Rookie Year: 2005
Alumni to Team: 350
  #22   Spotlight this post!  
Unread 28-01-2008, 21:52
Ryan O's Avatar
Ryan O Ryan O is offline
FRC Eclipse Plug-in Developer
no team (FRC Eclipse)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Plaistow
Posts: 111
Ryan O is an unknown quantity at this point
Send a message via AIM to Ryan O
Re: Issues with our code

I will be making a thread on this in programming, but we believe we have found the problem. THIS IS VERY IMPORTANT FOR GYRO USERS THIS YEAR!

While trying to help me figure out what was going on, one of our team members made the very interesting observation that there were many more paths leading to what we believed to be the temperature read port (with a T over teh white wire instead of an R) than to the port we thought was the Rotational Acceleration port. he then remarked that thee have been times when a board has been mislabeled. So, for the heck of it, and for lack of anythign else to try, we plugged the T port into the port we were using for the R port, with the code above. Low and behold, it started behaving like we thought the R port should have. It got larger to right, smaller to left, and held a value when it wasn't moving. Also, the numbers were roughly tenths of a degree counts from the starting point (90 degrees was about 900 counts).

So, we think that at least a few if not all of the new gyros this year (They are different from last year) could have been labeled wrong or with different conventions than last year (t doesn't stand for temp anymore, but Twist?) Either way, if you are experiencing problems similar to those we had described previously, give it a shot, it won't hurt the board if the controller doesn't know what to do with the signal it sends.
__________________
CRUD Name: Windows
Rookie Year: 2005
Alumni to Team: 350
  #23   Spotlight this post!  
Unread 28-01-2008, 22:07
lukevanoort lukevanoort is offline
in between teams
AKA: Luke Van Oort
no team
 
Join Date: Oct 2005
Rookie Year: 2005
Location: Waterloo, ON, Canada
Posts: 1,873
lukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond repute
Send a message via AIM to lukevanoort
Re: Issues with our code

They aren't mislabeled, they are just confusingly labeled, which is effectively the same thing. IIRC, the "T" stands for "Twist" and the "R" stands for "Relative Temperature." Personally, I think A for rotation (standing for angular velocity) and T for temperature would make the most sense, and cause the least confusion.
__________________
Team 1219: 2009 - Mentor
Team 587: 2005 - Animator, 2006-2008 - Team Captain
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
EasyC master code issues Joe G. Programming 2 14-12-2007 11:28
Code Flashing Issues bluenp Programming 4 07-11-2007 23:43
need help with our default code coolguybigt Programming 14 19-02-2007 10:17
Issues with encoder code jgannon Programming 7 26-03-2006 15:12
Issues with MPLAB 7.30 gnirts Programming 4 25-01-2006 22:57


All times are GMT -5. The time now is 00:50.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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