Go to Post I was outvoted by conservative teenagers (curse them...). - Rick TYler [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
  #1   Spotlight this post!  
Unread 13-01-2008, 21:14
Richard McClellan's Avatar
Richard McClellan Richard McClellan is offline
Engineering Mentor
FRC #0254 (Cheesy Poofs)
Team Role: Mentor
 
Join Date: May 2004
Rookie Year: 2004
Location: Palo Alto, CA
Posts: 322
Richard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud of
Send a message via AIM to Richard McClellan
Issues with our code

We're moving to WPILib this year and are having a few issues getting our code working with the FRC controller. We tested it out quite a bit on the Vex robots last fall and it worked great, but we tried downloading to last year's FRC bot for the first time today and couldn't get it to work.

The code below compiles and downloads, but does nothing after that. We were trying to get basic drive working first with the Tank2 function (We have one CIM motor on each side, plugged into PWM ports 13 and 15). Then we commented out the Tank2 function to see if we could just get the motors to turn on at all with the SetPWM function, and that didn't work either. Any ideas what we're doing wrong?

We are using MPLab v8.00, the C18 Compiler v2.40, and IFILoader v1.10.

Code:
#include "BuiltIns.h"

void IO_Initialization(void) {
	SetCompetitionMode(1);
}

void Initialize(void) {
	DefineControllerIO(INPUT, INPUT, INPUT, INPUT, INPUT, INPUT, INPUT, INPUT, INPUT,
					   INPUT, INPUT, INPUT, INPUT, INPUT, INPUT, INPUT, INPUT, INPUT);
}

void Autonomous(void) {
	printf("Autonomous\r");
	while(1) {
		printf("In Autonomous\r");
		SetPWM(13, 50);
		SetPWM(15, 50);
	}
}

void OperatorControl(void) {
	printf("OperatorControl\r");
	while(1) {
		printf("In OperatorControl\r");
		SetPWM(13, 50);
		SetPWM(15, 50);
		//Tank2(1, Y_AXIS, 2, Y_AXIS, 13, 15, 0, 1);
	}
}

void main(void){
}
__________________
~ Richard McClellan ~
Former Student on 1477 | Northside Roboteers | 2004-2005
Former Lead Mentor for 2158 | ausTIN CANs | 2007-2010
Current Mentor for 254 | Cheesy Poofs | 2013

Last edited by Richard McClellan : 13-01-2008 at 21:15. Reason: typo
  #2   Spotlight this post!  
Unread 13-01-2008, 21:19
Branden Ghena's Avatar
Branden Ghena Branden Ghena is offline
Previously: tawnos23
FRC #0240 (TEMPEST)
Team Role: College Student
 
Join Date: Nov 2005
Rookie Year: 2004
Location: Houghton, Michigan (MTU)
Posts: 303
Branden Ghena has a spectacular aura aboutBranden Ghena has a spectacular aura aboutBranden Ghena has a spectacular aura about
Re: Issues with our code

Do you have your robot enabled on the operator interface? (done that WAY too many times)

Otherwise looks good. Are you getting your printf text?
__________________
Branden Ghena - Michigan Tech Student and Team 240 Alumnus
Working Towards: Electrical Engineering and Computer Engineering Double Major

"All we have to decide is what to do with the time that is given to us." - Gandalf
  #3   Spotlight this post!  
Unread 13-01-2008, 21:24
Richard McClellan's Avatar
Richard McClellan Richard McClellan is offline
Engineering Mentor
FRC #0254 (Cheesy Poofs)
Team Role: Mentor
 
Join Date: May 2004
Rookie Year: 2004
Location: Palo Alto, CA
Posts: 322
Richard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud of
Send a message via AIM to Richard McClellan
Re: Issues with our code

Yes, our robot was not disabled, but we have make that mistake before too

We tried it both with and without the autonomous switch on and it didn't work either way.

And, the printf's do work. They run continuously, inside our while(1) loops. It prints "In Autonomous" when the our auto switch is on, and prints "In OperatorControl" when the auto switch is off.
__________________
~ Richard McClellan ~
Former Student on 1477 | Northside Roboteers | 2004-2005
Former Lead Mentor for 2158 | ausTIN CANs | 2007-2010
Current Mentor for 254 | Cheesy Poofs | 2013
  #4   Spotlight this post!  
Unread 13-01-2008, 21:28
Branden Ghena's Avatar
Branden Ghena Branden Ghena is offline
Previously: tawnos23
FRC #0240 (TEMPEST)
Team Role: College Student
 
Join Date: Nov 2005
Rookie Year: 2004
Location: Houghton, Michigan (MTU)
Posts: 303
Branden Ghena has a spectacular aura aboutBranden Ghena has a spectacular aura aboutBranden Ghena has a spectacular aura about
Re: Issues with our code

Are you sure it's not a physical problem?

i.e. are the fuses in, do the victors light up when the program is running, are your pwms plugged in all the way, do you have a fully charged battery?

I know, probably not your mistake, but I can't see anything wrong with the code.
__________________
Branden Ghena - Michigan Tech Student and Team 240 Alumnus
Working Towards: Electrical Engineering and Computer Engineering Double Major

"All we have to decide is what to do with the time that is given to us." - Gandalf

Last edited by Branden Ghena : 13-01-2008 at 21:30. Reason: I can't stand typos
  #5   Spotlight this post!  
Unread 13-01-2008, 21:31
Richard McClellan's Avatar
Richard McClellan Richard McClellan is offline
Engineering Mentor
FRC #0254 (Cheesy Poofs)
Team Role: Mentor
 
Join Date: May 2004
Rookie Year: 2004
Location: Palo Alto, CA
Posts: 322
Richard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud of
Send a message via AIM to Richard McClellan
Re: Issues with our code

Well, the Victors are flashing orange, so they're not getting any signal at all. Does WPILib initialize all the pwm's to zero like the default code does? Should these be getting any signal?

We also tried loading our code from last year (default FRC code) and it worked fine, so I'm thinking it's not a hardware problem.
__________________
~ Richard McClellan ~
Former Student on 1477 | Northside Roboteers | 2004-2005
Former Lead Mentor for 2158 | ausTIN CANs | 2007-2010
Current Mentor for 254 | Cheesy Poofs | 2013
  #6   Spotlight this post!  
Unread 17-01-2008, 18:58
btgdaniel's Avatar
btgdaniel btgdaniel is offline
Registered User
FRC #1731 (Fresta Valley Robotics)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Warrenton, VA
Posts: 20
btgdaniel is an unknown quantity at this point
Question Re: Issues with our code

Did you ever get WPIlib to work? We are having the *exact* same problem. No outputs to PWMs, last year's code works fine. A little more info: (1) joystick input seems to work; (2) analog input works.
__________________
Team 1731
Fresta Valley Robotics

Catch the FeVeR ~ If You Can!
  #7   Spotlight this post!  
Unread 17-01-2008, 19:07
Redneck's Avatar
Redneck Redneck is offline
Hacker Hick
AKA: Jamie (2.0) Moran
FRC #0599 (Robodox)
Team Role: Engineer
 
Join Date: Aug 2004
Rookie Year: 2004
Location: California
Posts: 90
Redneck is just really niceRedneck is just really niceRedneck is just really niceRedneck is just really nice
Send a message via AIM to Redneck
Re: Issues with our code

We've been having the same problem. Using WPI Lib, we cannot get any output on PWMs 13-16. We tried using the SetPWM() function, along with Motor(), Motors() and Drive(), all to no effect. We also tried using WPI Lib with the IFI header files and setting the PWMs using the aliases from ifi_aliases.h, and again 13-16 are non-responsive. When using the default IFI code by itself, we can control them just fine.
__________________


Which badges can you claim?
  #8   Spotlight this post!  
Unread 18-01-2008, 03:03
Richard McClellan's Avatar
Richard McClellan Richard McClellan is offline
Engineering Mentor
FRC #0254 (Cheesy Poofs)
Team Role: Mentor
 
Join Date: May 2004
Rookie Year: 2004
Location: Palo Alto, CA
Posts: 322
Richard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud of
Send a message via AIM to Richard McClellan
Re: Issues with our code

Well, I'm not exactly sure what we did, but it is working now. Unfortunately, I don't know exactly what fixed it, but here's a few things to check:

Download the latest firmware to the RC, which can be found here:
http://www.ifirobotics.com/docs/frc-master-ver15.zip
Try tethering to the OI at least once first.
The OI needs to be on and communicating properly for the RC to output to anything.
Make sure you have your backup battery plugged in.
__________________
~ Richard McClellan ~
Former Student on 1477 | Northside Roboteers | 2004-2005
Former Lead Mentor for 2158 | ausTIN CANs | 2007-2010
Current Mentor for 254 | Cheesy Poofs | 2013
  #9   Spotlight this post!  
Unread 18-01-2008, 10:55
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

There are issues with the PWM ports 13-16 since they are controller by the user processor. Try the program with ports 1-12 instead. I think the motors will start working.

Brad
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #10   Spotlight this post!  
Unread 18-01-2008, 11:15
Richard McClellan's Avatar
Richard McClellan Richard McClellan is offline
Engineering Mentor
FRC #0254 (Cheesy Poofs)
Team Role: Mentor
 
Join Date: May 2004
Rookie Year: 2004
Location: Palo Alto, CA
Posts: 322
Richard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud ofRichard McClellan has much to be proud of
Send a message via AIM to Richard McClellan
Re: Issues with our code

That actually makes a lot of sense now! We got our code working on our new RC (using PWM 1&2), but the old one wasn't working (using PWM 13&15). We didn't originally change the old RC ports because on last year's robot it is very difficult to access and requires unscrewing a lot of electronic components. We're planning on making this year's much easier to access.

Does this mean that we will be limited to 12 PWM ports if we use WPILib? Or is there any way to use 13-16? Right now we're only planning on using 10 PWM ports, so we should be okay, but would we have room to expand to more than 12 ports?
__________________
~ Richard McClellan ~
Former Student on 1477 | Northside Roboteers | 2004-2005
Former Lead Mentor for 2158 | ausTIN CANs | 2007-2010
Current Mentor for 254 | Cheesy Poofs | 2013

Last edited by Richard McClellan : 18-01-2008 at 11:21. Reason: added second paragraph
  #11   Spotlight this post!  
Unread 19-01-2008, 10:07
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

Kevin Watson wrote some code last year that allowed control of the extra PWMs in your user program. It works with easyC and WPILib and can be integrated easily into an existing program. You can find the explanation here.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #12   Spotlight this post!  
Unread 19-01-2008, 15:14
btgdaniel's Avatar
btgdaniel btgdaniel is offline
Registered User
FRC #1731 (Fresta Valley Robotics)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Warrenton, VA
Posts: 20
btgdaniel is an unknown quantity at this point
Re: Issues with our code

Thanks, Brad! That new pwm code fixed it! PWM's 13-16 are now good.
__________________
Team 1731
Fresta Valley Robotics

Catch the FeVeR ~ If You Can!
  #13   Spotlight this post!  
Unread 22-01-2008, 12:20
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

Hi,

We are also having problems with our gyro. I plug it in to port one, as init, start it, ect. It gives zero for awhile, then starts increasing and doesn't stop, even if the gyro isn't moving. Any help would be great.
__________________
CRUD Name: Windows
Rookie Year: 2005
Alumni to Team: 350
  #14   Spotlight this post!  
Unread 22-01-2008, 16:00
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
Hi,

We are also having problems with our gyro. I plug it in to port one, as init, start it, ect. It gives zero for awhile, then starts increasing and doesn't stop, even if the gyro isn't moving. Any help would be great.
Make sure it's plugged into an analog port rather than a digital port.

The gyro returns the rate of rotation as an analog value - where no rotation is will return a value around 512 (center).

You can easily test if the gyro is working by running easyC and opening the Online Window. Load the Online code into the robot and look on the screen at analog port 1. Now you should be able to twist the gyro (or robot if it's attached) and see the analog values jump from a centered value around 512 to either smaller or larger numbers for left and right twists. Remember, the value will only change while the robot is moving since it is measuring rate of rotation, not the heading.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #15   Spotlight this post!  
Unread 23-01-2008, 13:45
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

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?
__________________
CRUD Name: Windows
Rookie Year: 2005
Alumni to Team: 350
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 18:36.

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