Go to Post Life isn't a set track: you have to go out and make your own path. - Greg Marra [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 03-01-2016, 07:06 PM
LFRobotics's Avatar
LFRobotics LFRobotics is offline
Registered User
FRC #4623
 
Join Date: Jan 2014
Location: Little Falls, MN
Posts: 95
LFRobotics is on a distinguished road
Broken Code

So our program is compiling in Eclipse but is returning an error that I dont understand in the DS. I added a second driveTele command that runs on the second XBox controller which has completely inverted controls. Thats the only questionable code that I can think of.

Here is the error:

Quote:
241)]ERROR Unhandled exception: java.lang.RuntimeException: Code: -1029. HAL: Resource already allocated at [edu.wpi.first.wpilibj.hal.PWMJNI.allocatePWMChanne l(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.team4623.robot.subsystems.Chassis2 .<init>(Chassis2.java:23), org.usfirst.frc.team4623.robot.Robot.robotInit(Rob ot.java:53), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:72), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:
Here is the link to the code on GitHub:

https://github.com/FranklinMarquette...team4623/robot

I really hope somebody has the answer to this because I have no idea whats going on. Thanks for the help!
Reply With Quote
  #2   Spotlight this post!  
Unread 03-01-2016, 07:15 PM
yonip yonip is offline
Registered User
FRC #0449 (The Blair Robot Project)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: Silver Spring, MD
Posts: 24
yonip is an unknown quantity at this point
Broken Code

the error you are seeing is caused by one port being allocated to two objects. In this case, your problem is that both Chassis and Chassis2 have talons set to ports 1 through 4, and both are initialized in Robot.java, hence the crash originating on line 23 of Chassis2.
Is there any reason you have both Chassis and Chassis2 in your code?
EDIT: nevermind, i see. why do you have two controllers controlling on robot chassis? i'd recommend having a command that simply flips the sign on a constant in Chassis when a certain button is pressed (allowing you to keep to a single contoller).
if you *really* want two controllers, the only working solution i see is having one command for chassis that looks at the input from both controllers, picks the one that has a bigger value (or something like that) and if it picked the values from the inverted joustick, it negates them when it passes them to the Chassis's driveTele method.
If you'd like more specific tips and/or code snippets id be at my computer in ~30 mins to supply those

Last edited by yonip : 03-01-2016 at 07:28 PM.
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:57 AM.

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