|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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?
|
|
#2
|
|||
|
|||
|
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.
|
|
#3
|
||||
|
||||
|
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);
}
}
|
|
#4
|
||||
|
||||
|
Re: Drive an individual moter
What is your reasoning to support going straight through to the PWM class? Are there any benefits provided over using a Jaguar?
|
|
#5
|
||||
|
||||
|
Re: Drive an individual moter
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.
|
|
#6
|
|||
|
|||
|
Re: Drive an individual moter
Quote:
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. |
|
#7
|
||||||
|
||||||
|
Re: Drive an individual moter
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.
|
|
#8
|
|||
|
|||
|
Re: Drive an individual moter
Quote:
Quote:
Quote:
Last edited by davidthefat : 31-01-2012 at 15:23. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|