|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#16
|
|||
|
|||
|
Re: RELAY!!
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.
|
|
#17
|
||||
|
||||
|
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. |
|
#18
|
||||
|
||||
|
Re: RELAY!!
Quote:
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); |
|
#19
|
|||
|
|||
|
Re: RELAY!!
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?
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |