Go to Post We always have a party on Friday. It's called scouting. - Meredith Novak [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 06-01-2012, 11:51
linuxboy linuxboy is offline
Registered User
AKA: Oliver Graff
FRC #3780
Team Role: Alumni
 
Join Date: Nov 2010
Rookie Year: 2009
Location: MI, USA
Posts: 217
linuxboy has much to be proud oflinuxboy has much to be proud oflinuxboy has much to be proud oflinuxboy has much to be proud oflinuxboy has much to be proud oflinuxboy has much to be proud oflinuxboy has much to be proud oflinuxboy has much to be proud oflinuxboy has much to be proud of
Re: Custom RobotDrive

When subclassing you need to call a super constructor with the proper arguments. This has a few impacts. First of all, in your constructor, you need to call super(cone, ctwo, cthree, cfour). You should also not need your own instance variables to keep track of those jaguars, since RobotDrive already does.

If my train of thought was a little confusing let me know. Here is how I would modify the code.

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.SimpleRobot;

public class DriveTrain extends RobotDrive {

public DriveTrainMecanum(int cone, int ctwo, int cthree, int cfour){
super(cone, ctwo, cthree, cfour);
}

}
Reply With Quote
  #2   Spotlight this post!  
Unread 06-01-2012, 13:01
whcirobotics's Avatar
whcirobotics whcirobotics is offline
Registered User
FRC #1514 (Vikings)
 
Join Date: Nov 2008
Rookie Year: 2009
Location: WHCI
Posts: 174
whcirobotics is an unknown quantity at this point
Re: Custom RobotDrive

Quote:
Originally Posted by linuxboy View Post
When subclassing you need to call a super constructor with the proper arguments....you need to call super(cone, ctwo, cthree, cfour).
What do you mean by "super constructor"?
__________________
"A team back in training !"
Reply With Quote
  #3   Spotlight this post!  
Unread 06-01-2012, 14:21
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,043
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Custom RobotDrive


Quote:
Originally Posted by whcirobotics View Post
What do you mean by "super constructor"?
perhaps a superclass constructor?

http://docs.oracle.com/javase/tutori...ndI/super.html


Reply With Quote
  #4   Spotlight this post!  
Unread 06-01-2012, 14:49
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Re: Custom RobotDrive

Personally, I always just deal with the PWM class. I don't even bother with anything higher level than that. It just simplifies things by writing everything from scratch.
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
Reply With Quote
  #5   Spotlight this post!  
Unread 08-01-2012, 10:58
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: Custom RobotDrive

Quote:
Originally Posted by davidthefat View Post
Personally, I always just deal with the PWM class. I don't even bother with anything higher level than that. It just simplifies things by writing everything from scratch.
If that were simpler, there would not be any other classes on top of it. It's bad form to make your project more complicated for other team members and call it "simpler". If you want to increase the amount you code you write, simply admit your desire to your team and others who may be reading this. Please don't mislead others with claims like this.

Using the PWM class is the least simple way to control your robot drive base.

Joe
Reply With Quote
  #6   Spotlight this post!  
Unread 10-01-2012, 13:41
gixxy's Avatar
gixxy gixxy is offline
Programming and Arduino Mentor
AKA: Gustave Michel III
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2012
Location: Ruston, LA
Posts: 207
gixxy is on a distinguished road
Re: Custom RobotDrive

Quote:
Originally Posted by jhersh View Post
If that were simpler, there would not be any other classes on top of it. It's bad form to make your project more complicated for other team members and call it "simpler". If you want to increase the amount you code you write, simply admit your desire to your team and others who may be reading this. Please don't mislead others with claims like this.

Using the PWM class is the least simple way to control your robot drive base.

Joe
I think what he meant was that when you write it all yourself you assure yourself it works exactly as you need it to. You have the greatest understanding of your code.
Reply With Quote
  #7   Spotlight this post!  
Unread 10-01-2012, 13:44
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,043
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Custom RobotDrive


Quote:
Originally Posted by gixxy View Post
You have the greatest understanding of your code.
But what about the rest of the programming team?



Reply With Quote
  #8   Spotlight this post!  
Unread 10-01-2012, 18:29
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Re: Custom RobotDrive

Quote:
Originally Posted by Ether View Post



But what about the rest of the programming team?



Comments, comments, comments. Just like how the rest of the world does it.
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
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 11:22.

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