Go to Post Did Dean by any chance mention red herrings? ;) - Cory [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

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 04-02-2017, 01:39
MRT45's Avatar
MRT45 MRT45 is offline
Registered User
FRC #0253 (Mills Robotics Team)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2013
Location: CA
Posts: 18
MRT45 is an unknown quantity at this point
Java - Class extensions and exception errors (for commands)

Hey everyone,

Team 253 would much appropriate help for this issue.

The whole team is waiting for programming (well... me) to get this fixed ASAP.

First off, here is the code for reference
https://github.com/MillsRoboticsTeam...e2017/commands


So my team wanted to take the data of multiple sensors and use it in multiple different classes (commands).

These other classes allow us to do various tasks with our robot by using the data from the SensorData class.

In order to get the sensors - Example -

public class SensorData extends Command {
public class GearAutoCorrect extends SensorData {

However, we are running into a snag.

We get "WARNING! Robots don't quit"

And an illegal exception error linking to drivetrain.java and tankdrive.java

However, when we tried debugging the error and putting the SensorData and one of our classes (GearsAutoCorrect that takes that data into our last year's code, it throws an error at the GearsAutoCorrect class (right at the super()

Particularly, I believe its an inheritance problem with the superclass or..

... me completely misunderstanding this concept of FRC java.



Please,
Any advice helps!

We need this issue fixed ASAP to test out our robot this weekend!
Reply With Quote
  #2   Spotlight this post!  
Unread 06-02-2017, 22:53
codedr codedr is offline
Registered User
FRC #0537
Team Role: Mentor
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Wisconsin
Posts: 76
codedr will become famous soon enoughcodedr will become famous soon enough
Re: Java - Class extensions and exception errors (for commands)

Can you post the exception and the java traceback from the error?
Reply With Quote
  #3   Spotlight this post!  
Unread 06-02-2017, 23:20
codedr codedr is offline
Registered User
FRC #0537
Team Role: Mentor
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Wisconsin
Posts: 76
codedr will become famous soon enoughcodedr will become famous soon enough
Re: Java - Class extensions and exception errors (for commands)

I'm sorry, I not familiar with the Command based code up until what I've just read.
What I would recommend (after posting your traceback error) is to create a simple 'Code2017test' project and only create the main Robot.java, OI.java, and Drivetrain.

Get simple code to work first with just one simple piece, and then gradually add the next piece and test it. Once you get some simple code working, go back to your main project and apply the lessons learned.
Reply With Quote
  #4   Spotlight this post!  
Unread 06-02-2017, 23:26
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,604
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Java - Class extensions and exception errors (for commands)

I suggest reading the command based programming guide here and exploring the GearsBot example in eclipse. http://wpilib.screenstepslive.com/s/.../13809/c/88893

Your problem is that you're declaring your sensors in SensorData, and then creating instances in each of your commands that extend it. This causes multiple allocations, the same root cause as your last issue.

In the Simple Subsystems page, notice how a subsystem contains the hardware, while the command invokes the methods provided by the subsystem. That way hardware is only instantiated once.
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 18:29.

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