Go to Post Inspiration and recognition does not equal "advanced shop class". What's better for your team is not better for all teams. Remember that. - DonRotolo [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 30-01-2012, 18:27
adrusi adrusi is offline
Registered User
FRC #4137
 
Join Date: Jan 2012
Location: Columbia, MD
Posts: 3
adrusi is an unknown quantity at this point
Drive an individual moter

We're using eclipse to program our cRIO, and are having difficulty getting the .set method to work. How do we use it properly, and is there a better/different way of controlling specific motors?
Reply With Quote
  #2   Spotlight this post!  
Unread 30-01-2012, 18:42
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: Drive an individual moter

Use the PWM class. You construct it with the port # of where the speed controller is connected to. Then use its setRaw method. That is the way I prefer, but there are multiple ways to do it. Each speed controller gets its own PWM object associated to 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
  #3   Spotlight this post!  
Unread 30-01-2012, 20:38
Djur's Avatar
Djur Djur is offline
WPILib
AKA: Sam Carlberg
no team
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2009
Location: Massachusetts
Posts: 182
Djur will become famous soon enough
Re: Drive an individual moter

If you use something like
Code:
import edu.wpi.first.wpilibj.Jaguar;

public class FullSpeedAhead{
    Jaguar motor;
    public FullSpeedAhead(){
        motor = new Jaguar(1);
    }
    public void go(){
        motor.set(1);
    }
}
then your code should work just fine regardless of your IDE, assuming you have your files in the right place (edu.wpi.first.wpilibj.TeamXXYY seems to be standard). Jaguar.set() is no better/worse than the methods it actually uses to set the given value to the Jaguar, but using it is simpler than other methods.
__________________
WPILib dev (RobotBuilder, SmartDashboard, GRIP)
Reply With Quote
  #4   Spotlight this post!  
Unread 30-01-2012, 23:20
eddie12390's Avatar
eddie12390 eddie12390 is offline
Registered User
AKA: Eddie
FRC #3260 (SHARP)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Pittsburgh
Posts: 285
eddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of light
Re: Drive an individual moter

Quote:
Originally Posted by davidthefat View Post
Use the PWM class. You construct it with the port # of where the speed controller is connected to. Then use its setRaw method. That is the way I prefer, but there are multiple ways to do it. Each speed controller gets its own PWM object associated to it.
What is your reasoning to support going straight through to the PWM class? Are there any benefits provided over using a Jaguar?
Reply With Quote
  #5   Spotlight this post!  
Unread 31-01-2012, 09:00
Djur's Avatar
Djur Djur is offline
WPILib
AKA: Sam Carlberg
no team
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2009
Location: Massachusetts
Posts: 182
Djur will become famous soon enough
Re: Drive an individual moter

Quote:
Originally Posted by eddie12390 View Post
What is your reasoning to support going straight through to the PWM class? Are there any benefits provided over using a Jaguar?
Jaguar.set(double value) is equivalent to PWM.setRaw(int channel, double value). With the PWM class, you need to specify the channel each time you change the speed of a Jaguar; however, you just need to change the speed with the Jaguar class. That's the only difference.
__________________
WPILib dev (RobotBuilder, SmartDashboard, GRIP)
Reply With Quote
  #6   Spotlight this post!  
Unread 31-01-2012, 12:32
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,572
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: Drive an individual moter

Quote:
Originally Posted by eddie12390 View Post
What is your reasoning to support going straight through to the PWM class? Are there any benefits provided over using a Jaguar?
I can't think of any reason to use the PWM class instead of the jaguar class, except to brag that you like to do things low level. On the other hand, using the PWM class without fully understanding all the options will lead to worse performance.
Reply With Quote
  #7   Spotlight this post!  
Unread 31-01-2012, 12:58
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 989
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: Drive an individual moter

Quote:
Originally Posted by Djur View Post
Jaguar.set(double value) is equivalent to PWM.setRaw(int channel, double value). With the PWM class, you need to specify the channel each time you change the speed of a Jaguar; however, you just need to change the speed with the Jaguar class. That's the only difference.
That is true for the set methods, but you also have to look at how the Jaguar is constructed.The Jaguar constructor sets particular parameters for the parent PWM object that are based on the specific pulse width timings that correspond to a Jaguar's minimum, maximum, centerpoint and deadband.

The Jaguar and Victor objects exist for a reason, nobody would have bothered to code them otherwise. Please save yourself the headache and use the appropriate speed controller object instead of the raw PWM class.
Reply With Quote
  #8   Spotlight this post!  
Unread 31-01-2012, 15:12
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: Drive an individual moter

Quote:
Originally Posted by eddie12390 View Post
What is your reasoning to support going straight through to the PWM class? Are there any benefits provided over using a Jaguar?
PWM is the mother class of the Speed Controllers. The OP did not specify any speed controllers, so I had to appeal to the common denominator. I use it personally.


Quote:
Originally Posted by Joe Ross View Post
I can't think of any reason to use the PWM class instead of the jaguar class, except to brag that you like to do things low level. On the other hand, using the PWM class without fully understanding all the options will lead to worse performance.
If you really want to brag about the low level... Use the tDIO class found in fpga package.


Quote:
Originally Posted by Djur View Post
Jaguar.set(double value) is equivalent to PWM.setRaw(int channel, double value). With the PWM class, you need to specify the channel each time you change the speed of a Jaguar; however, you just need to change the speed with the Jaguar class. That's the only difference.
I don't know where you got that idea from... But for 3 years, I have used the PWM class and its "setRaw" function without having to do that. Both for Victors and Jaguars.
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.

Last edited by davidthefat : 31-01-2012 at 15:23.
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 13:39.

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