Go to Post Baker, you certainly are a trouble maker. :) - Rich Kressly [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 15-02-2016, 15:17
Team 3023 Team 3023 is offline
Registered User
FRC #3023
 
Join Date: Feb 2016
Location: Minnesota
Posts: 4
Team 3023 is an unknown quantity at this point
Help with Errors

Hey, we are new to programming and when we run the code, we get this error.
Code:
ERROR Unhandled exception: java.lang.RuntimeException: 
 Code: -1029. HAL: Resource already allocated at [edu.wpi.first.wpilibj.hal.PWMJNI.allocatePWMChannel(Native Method),
 edu.wpi.first.wpilibj.PWM.initPWM(PWM.java:117),
 edu.wpi.first.wpilibj.PWM.<init>(PWM.java:134),
 edu.wpi.first.wpilibj.SafePWM.<init>(SafePWM.java:35),
 edu.wpi.first.wpilibj.Talon.<init>(Talon.java:51),
 org.usfirst.frc.team3023.robot.DriveTrain.<init>(DriveTrain.java:10), 
 org.usfirst.frc.team3023.robot.Robot.robotInit(Robot.java:122), 
 edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:72), 
 edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:241)]
We are wondering if anyone has a solution to this
Reply With Quote
  #2   Spotlight this post!  
Unread 15-02-2016, 15:26
kmodos kmodos is offline
Registered User
AKA: Alex
FRC #1126 (SparX)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2013
Location: New York
Posts: 57
kmodos is a splendid one to beholdkmodos is a splendid one to beholdkmodos is a splendid one to beholdkmodos is a splendid one to beholdkmodos is a splendid one to beholdkmodos is a splendid one to beholdkmodos is a splendid one to beholdkmodos is a splendid one to behold
Re: Help with Errors

Quote:
Originally Posted by Team 3023 View Post
Hey, we are new to programming and when we run the code, we get this error.
Code:
ERROR Unhandled exception: java.lang.RuntimeException: 
 Code: -1029. HAL: Resource already allocated at [edu.wpi.first.wpilibj.hal.PWMJNI.allocatePWMChannel(Native Method),
 edu.wpi.first.wpilibj.PWM.initPWM(PWM.java:117),
 edu.wpi.first.wpilibj.PWM.<init>(PWM.java:134),
 edu.wpi.first.wpilibj.SafePWM.<init>(SafePWM.java:35),
 edu.wpi.first.wpilibj.Talon.<init>(Talon.java:51),
 org.usfirst.frc.team3023.robot.DriveTrain.<init>(DriveTrain.java:10), 
 org.usfirst.frc.team3023.robot.Robot.robotInit(Robot.java:122), 
 edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:72), 
 edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:241)]
We are wondering if anyone has a solution to this
You are trying to allocate the same PWM more than once.
Reply With Quote
  #3   Spotlight this post!  
Unread 15-02-2016, 15:43
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 235
TimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura about
Re: Help with Errors

Quote:
Originally Posted by kmodos View Post
You are trying to allocate the same PWM more than once.
For clarification, somewhere in your code you have
Code:
motor = Talon(0) //or a different number
then later in your code you have

Code:
motor = Talon(0)//or a different number, but same number as before
You can't assign two motor to the same PWM in code. If it so happens that you want to run two motors the exact same way (for a gearbox perhaps?) then you should use a pwm splitter (KOP I believe)
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
Reply With Quote
  #4   Spotlight this post!  
Unread 15-02-2016, 22:57
spacepenguine spacepenguine is offline
Registered User
AKA: Ian Hartwig
no team
Team Role: Mentor
 
Join Date: Nov 2010
Rookie Year: 2008
Location: Troy, MI
Posts: 43
spacepenguine is an unknown quantity at this point
Re: Help with Errors

I'm guessing you already fixed this problem with previous comments. An alternate to the PWM splitting in hardware is to map it in software. This can make life easier for your mechanical/electrical teams because they just plug each motor into a PWM slot and then you write the same value out multiple times in each software iteration:

Code:
init:
motor1 = Talon(0);
motor2 = Talon(1);

loop:
desiredMotor = 250;
motor1.Set(desiredMotor);
motor2.Set(desiredMotor);
__________________
2008-2011: #226 - The Hammerheads
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


All times are GMT -5. The time now is 07:45.

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