Go to Post Boy, am I ever glad we decided not to use eggs as game pieces like I originally suggested... - dlavery [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 01-05-2014, 02:06
gappleto97 gappleto97 is offline
Registered User
FRC #3617
 
Join Date: Oct 2013
Location: Marquette, MI
Posts: 12
gappleto97 is an unknown quantity at this point
Post Setting custom disable behaviors

Tried the following snippet on DisabledInit() and DisabledPeriodic(). Neôther worked.

@Override
Public void DisabledInit()
{
Super.DisabledInit();
LED.disable();
}

It didn't like the override. I may have typed it in wrong, as I'm going off of 2-month old memory, but still.

How do I get this to work?
Reply With Quote
  #2   Spotlight this post!  
Unread 01-05-2014, 07:03
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,728
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Setting custom disable behaviors

Quote:
Originally Posted by gappleto97 View Post
Tried the following snippet on DisabledInit() and DisabledPeriodic(). Neôther worked.

@Override
Public void DisabledInit()
{
Super.DisabledInit();
LED.disable();
}

It didn't like the override. I may have typed it in wrong, as I'm going off of 2-month old memory, but still.

How do I get this to work?
Should be

Code:
public void disabledInit()
{
    super.disabledInit();
    LED.disable();
}
Unfortunately annotations are not supported in the version of java that runs on the cRIO.

Last edited by notmattlythgoe : 01-05-2014 at 09:41.
Reply With Quote
  #3   Spotlight this post!  
Unread 01-05-2014, 09:27
cgmv123's Avatar
cgmv123 cgmv123 is offline
FRC RI/FLL Field Manager
AKA: Max Vrany
FRC #1306 (BadgerBOTS)
Team Role: College Student
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Madison, WI
Posts: 2,085
cgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond repute
Re: Setting custom disable behaviors

Note that disabled, by definition, disables all outputs, regardless of what code you write. This is a safety feature (or "feature", depending on who you talk to.) It doesn't look like you're trying to activate any inputs, but it's something to be aware of when customizing disable code.
__________________
BadgerBOTS Robotics|@team1306|Facebook: BadgerBOTS
2016 FIRST Championship Tesla Division | 2016 Wisconsin Regional Engineering Inspiration Award

2015 FIRST Championship Carson Division | 2015 Wisconsin Regional Chairman's Award

2013 FIRST Championship Curie Division | 2013 Wisconsin Regional Chairman's Award

2012 FIRST Championship Archimedes Division | 2012 Wisconsin Regional Engineering Inspiration Award, Woodie Flowers Finalist Award (Lead Mentor Ben Senson)

Reply With Quote
  #4   Spotlight this post!  
Unread 01-05-2014, 14:18
gappleto97 gappleto97 is offline
Registered User
FRC #3617
 
Join Date: Oct 2013
Location: Marquette, MI
Posts: 12
gappleto97 is an unknown quantity at this point
Re: Setting custom disable behaviors

Is there an alternate way to override then?
Reply With Quote
  #5   Spotlight this post!  
Unread 01-05-2014, 14:24
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,728
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Setting custom disable behaviors

Quote:
Originally Posted by gappleto97 View Post
Is there an alternate way to override then?
You don't need annotations to actually override, just using the same method signature will override the method.
Reply With Quote
  #6   Spotlight this post!  
Unread 01-05-2014, 22:53
gappleto97 gappleto97 is offline
Registered User
FRC #3617
 
Join Date: Oct 2013
Location: Marquette, MI
Posts: 12
gappleto97 is an unknown quantity at this point
Re: Setting custom disable behaviors

Quote:
Originally Posted by notmattlythgoe View Post
You don't need annotations to actually override, just using the same method signature will override the method.
In that case, where do I put it? Because I tried this, and I distinctly remember it not working. I'm thinking I must have put it in the wrong place or something, maybe.
Reply With Quote
  #7   Spotlight this post!  
Unread 01-05-2014, 23:40
NotInControl NotInControl is offline
Controls Engineer
AKA: Kevin
FRC #2168 (Aluminum Falcons)
Team Role: Engineer
 
Join Date: Oct 2011
Rookie Year: 2004
Location: Groton, CT
Posts: 261
NotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond repute
Re: Setting custom disable behaviors

Quote:
Originally Posted by cgmv123 View Post
Note that disabled, by definition, disables all outputs, regardless of what code you write. This is a safety feature (or "feature", depending on who you talk to.) It doesn't look like you're trying to activate any inputs, but it's something to be aware of when customizing disable code.
Only PWM and Relay outputs are disabled. Digital In, Digital Out, and Analog In are all fully functional during the disabled state of the robot. You can set digital output pins high or low in disabled. Digital IO should never be used to drive actuators as per FRC rules, which is why its state are allowed to be commanded during disable.


Quote:
Originally Posted by gappleto97 View Post
In that case, where do I put it? Because I tried this, and I distinctly remember it not working. I'm thinking I must have put it in the wrong place or something, maybe.
Unless you are creating a new class which extends IterativeRobot, the super.DisableInit() does not exist. That implies that disabledInit() exist in the parent class you are inheriting from.

The first definition of DisabledInit() is in the IterativeRobot class, so is you are trying to call super.DisabledInit() inside of IterativeRobot, or CommandBasedRobot, that is probably why its failing.

Also do not include any @override annotations, as mentioned already they are not supported by the JVM on the cRIO.

Hope this helps,
Kevin
__________________
Controls Engineer, Team 2168 - The Aluminum Falcons
[2016 Season] - World Championship Controls Award, District Controls Award, 3rd BlueBanner
-World Championship- #45 seed in Quals, World Championship Innovation in Controls Award - Curie
-NE Championship- #26 seed in Quals, winner(195,125,2168)
[2015 Season] - NE Championship Controls Award, 2nd Blue Banner
-NE Championship- #26 seed in Quals, NE Championship Innovation in Controls Award
-MA District Event- #17 seed in Quals, Winner(2168,3718,3146)
[2014 Season] - NE Championship Controls Award & Semi-finalists, District Controls Award, Creativity Award, & Finalists
-NE Championship- #36 seed in Quals, SemiFinalist(228,2168,3525), NE Championship Innovation in Controls Award
-RI District Event- #7 seed in Quals, Finalist(1519,2168,5163), Innovation in Controls Award
-Groton District Event- #9 seed in Quals, QuarterFinalist(2168, 125, 5112), Creativity Award
[2013 Season] - WPI Regional Winner - 1st Blue Banner
Reply With Quote
  #8   Spotlight this post!  
Unread 02-05-2014, 23:23
gappleto97 gappleto97 is offline
Registered User
FRC #3617
 
Join Date: Oct 2013
Location: Marquette, MI
Posts: 12
gappleto97 is an unknown quantity at this point
Re: Setting custom disable behaviors

Quote:
Originally Posted by NotInControl View Post
Only PWM and Relay outputs are disabled. Digital In, Digital Out, and Analog In are all fully functional during the disabled state of the robot. You can set digital output pins high or low in disabled. Digital IO should never be used to drive actuators as per FRC rules, which is why its state are allowed to be commanded during disable.




Unless you are creating a new class which extends IterativeRobot, the super.DisableInit() does not exist. That implies that disabledInit() exist in the parent class you are inheriting from.

The first definition of DisabledInit() is in the IterativeRobot class, so is you are trying to call super.DisabledInit() inside of IterativeRobot, or CommandBasedRobot, that is probably why its failing.

Also do not include any @override annotations, as mentioned already they are not supported by the JVM on the cRIO.

Hope this helps,
Kevin
While this helps explain why it doesn't work, it doesn't explain how to make it work. Should I just put that in robotcode.java and see what happens?
Reply With Quote
  #9   Spotlight this post!  
Unread 04-05-2014, 01:00
NotInControl NotInControl is offline
Controls Engineer
AKA: Kevin
FRC #2168 (Aluminum Falcons)
Team Role: Engineer
 
Join Date: Oct 2011
Rookie Year: 2004
Location: Groton, CT
Posts: 261
NotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond repute
Re: Setting custom disable behaviors

Quote:
Originally Posted by gappleto97 View Post
While this helps explain why it doesn't work, it doesn't explain how to make it work. Should I just put that in robotcode.java and see what happens?
I am not sure what file robotcode.java is. If that is the file where you have disableInit. Then yes.

It would be helpful if you pasted you full file so we can better assist you.
__________________
Controls Engineer, Team 2168 - The Aluminum Falcons
[2016 Season] - World Championship Controls Award, District Controls Award, 3rd BlueBanner
-World Championship- #45 seed in Quals, World Championship Innovation in Controls Award - Curie
-NE Championship- #26 seed in Quals, winner(195,125,2168)
[2015 Season] - NE Championship Controls Award, 2nd Blue Banner
-NE Championship- #26 seed in Quals, NE Championship Innovation in Controls Award
-MA District Event- #17 seed in Quals, Winner(2168,3718,3146)
[2014 Season] - NE Championship Controls Award & Semi-finalists, District Controls Award, Creativity Award, & Finalists
-NE Championship- #36 seed in Quals, SemiFinalist(228,2168,3525), NE Championship Innovation in Controls Award
-RI District Event- #7 seed in Quals, Finalist(1519,2168,5163), Innovation in Controls Award
-Groton District Event- #9 seed in Quals, QuarterFinalist(2168, 125, 5112), Creativity Award
[2013 Season] - WPI Regional Winner - 1st Blue Banner
Reply With Quote
  #10   Spotlight this post!  
Unread 07-05-2014, 21:01
Cel Skeggs Cel Skeggs is offline
Robot Software Manager Alumnus
AKA: Previously known as Colby
FRC #1540 (The Flaming Chickens)
Team Role: Alumni
 
Join Date: Feb 2013
Rookie Year: 2009
Location: Portland, Oregon, USA
Posts: 107
Cel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of light
Re: Setting custom disable behaviors

Importantly, it's not DisabledInit(), but rather disabledInit(). Capitalization matters. The same thing goes for DisabledPeriodic() - it's disabledPeriodic().

If you aren't sure if the code is getting called, you can try adding
Code:
System.out.println("Yes, I'm working properly.");
to the method.
__________________
Software manager alumnus. Developer of the CCRE, a powerful robot code framework based on dataflow and composibility.
Refer to as she/her/hers. Years of FRC: 2012, 2013, 2014, 2015, 2016. FLL for a few years beforehand.
Team 1540: The Flaming Chickens | Portland, Oregon | Twitter | Facebook
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 12:42.

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