Go to Post Give us six more motors in the kit, and we'll try and come up with something... - Karthik [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 05-11-2010, 13:04
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: RELAY!!

Quote:
Originally Posted by krudeboy51 View Post
Code:
myRobot(1, 2),
...			
	{
...
		pair1 = new Victor(1);
		pair2 = new Victor(2);
This is the source of your error. You presumably (since you didn't actually show it) have a RobotDrive member called myRobot which uses PWM channels 1 and 2. You then create 2 Victors which use PWM channels 1 and 2. These 2 channels are already in use by your robot drive object.
Reply With Quote
  #17   Spotlight this post!  
Unread 05-11-2010, 13:17
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: RELAY!!

Thanks for the correction Joe. After reading through the WPILib code again, I see how this is being done and agree with what you said about the resources. I also see what you mean about my code example. With the realays and digitial i/o on the same slot, it doesn't make any difference to specify the slot number in this case. I went back and put my original post in a spoiler tag to prevent confusion yet still have my bad analysis still available to learn from.

So, back to the analysis of the original error. The error clearly states that a resource is being allocated that was already allocated. I saw that Alan just posted a good suggestion that I was going to suggest next. My other suggestion (somewhat related) was to make sure there were no other places in the code that create relays, speed controllers, or analog/digital inputs on channels that were already in use for that resource type.
Reply With Quote
  #18   Spotlight this post!  
Unread 05-11-2010, 13:21
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: RELAY!!

Quote:
Originally Posted by jhersh View Post
This is the source of your error. You presumably (since you didn't actually show it) have a RobotDrive member called myRobot which uses PWM channels 1 and 2. You then create 2 Victors which use PWM channels 1 and 2. These 2 channels are already in use by your robot drive object.
One thing to add on to this is that RobotDrive creates Jaguar objects on these channels. Based on the code it looks like you are using Victors.

You might want to look into using one of these two implementations of RobotDrive.
RobotDrive::RobotDrive(SpeedController *leftMotor, SpeedController *rightMotor, float sensitivity);
RobotDrive::RobotDrive(SpeedController &leftMotor, SpeedController &rightMotor, float sensitivity);
Reply With Quote
  #19   Spotlight this post!  
Unread 06-11-2010, 15:52
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: RELAY!!

Quote:
Originally Posted by Dave Scheck View Post
My other suggestion (somewhat related) was to make sure there were no other places in the code that create relays, speed controllers, or analog/digital inputs on channels that were already in use for that resource type.
Very true. We only saw a small snippet of code and it's quite conceivable that other objects are constructed else where. Wouldn't it be nice if the error told you which allocation cause the reuse?
Reply With Quote
Reply


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
Relay Code dnrobotics11 C/C++ 3 08-03-2010 23:03
Relay Issues Stealth NI LabVIEW 4 16-02-2010 00:24
Relay AllocationException EHaskins Java 3 14-02-2010 15:30
Relay Robopanda6 Java 5 07-02-2010 01:08
C++ Relay Code? Happyisgood C/C++ 10 16-07-2009 14:54


All times are GMT -5. The time now is 12:34.

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