Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Drive an individual moter (http://www.chiefdelphi.com/forums/showthread.php?t=101563)

adrusi 30-01-2012 18:27

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?

davidthefat 30-01-2012 18:42

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.

Djur 30-01-2012 20:38

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.

eddie12390 30-01-2012 23:20

Re: Drive an individual moter
 
Quote:

Originally Posted by davidthefat (Post 1116672)
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?

Djur 31-01-2012 09:00

Re: Drive an individual moter
 
Quote:

Originally Posted by eddie12390 (Post 1116876)
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.

Joe Ross 31-01-2012 12:32

Re: Drive an individual moter
 
Quote:

Originally Posted by eddie12390 (Post 1116876)
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.

RufflesRidge 31-01-2012 12:58

Re: Drive an individual moter
 
Quote:

Originally Posted by Djur (Post 1117000)
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.

davidthefat 31-01-2012 15:12

Re: Drive an individual moter
 
Quote:

Originally Posted by eddie12390 (Post 1116876)
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 (Post 1117102)
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 (Post 1117000)
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.


All times are GMT -5. The time now is 11:45.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi