orc
Class Motor

java.lang.Object
  extended by orc.Motor

public class Motor
extends java.lang.Object

Basic class for controlling a motor.


Constructor Summary
Motor(Orc orc, int port, boolean invert)
          Create a new Motor.
 
Method Summary
 void clearFault()
           
 double getCurrent()
           
 double getCurrent(OrcStatus status)
          Returns an instantaneous estimate of the current magnitude (in Amps).
 double getCurrentFiltered()
           
 double getCurrentFiltered(OrcStatus status)
          Returns an instantaneous estimate of the current magnitude (in Amps).
 double getPWM()
           
 double getPWM(OrcStatus status)
          Get the instantaneous PWM output of the board, accounting for slew rate limits.
 void idle()
          Disconnects the motor output.
 boolean isFault()
          Is the motor in a fault state?
 boolean isFault(OrcStatus status)
          Is the motor in a fault state?
static void setMultiplePWM(Motor[] ms, double[] vs)
          Motors must belong to same Orc object.
 void setPWM(double v)
          Enable the motor and set an output PWM.
 void setSlewSeconds(double seconds)
          Set the amount of time required for the motor to transition from -1 to +1, in seconds.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Motor

public Motor(Orc orc,
             int port,
             boolean invert)
Create a new Motor.

Parameters:
port - [0,2]
invert - If true, the direction of the will be inverted.
Method Detail

idle

public void idle()
Disconnects the motor output. The next call to setPWM will reenable the motor. This is distinct from setPWM(0), which actively brakes the motor.


setPWM

public void setPWM(double v)
Enable the motor and set an output PWM.

Parameters:
v - [-1, 1]

getPWM

public double getPWM(OrcStatus status)
Get the instantaneous PWM output of the board, accounting for slew rate limits. Returns [-1, 1]


getPWM

public double getPWM()

getCurrent

public double getCurrent(OrcStatus status)
Returns an instantaneous estimate of the current magnitude (in Amps). The direction of the current flow is not reflected in the value.


getCurrent

public double getCurrent()

getCurrentFiltered

public double getCurrentFiltered(OrcStatus status)
Returns an instantaneous estimate of the current magnitude (in Amps). The direction of the current flow is not reflected in the value.


getCurrentFiltered

public double getCurrentFiltered()

setSlewSeconds

public void setSlewSeconds(double seconds)
Set the amount of time required for the motor to transition from -1 to +1, in seconds. Internally, slew rate is implemented by adjusting the actual PWM value closer to the goal value set by setPWM(). The maximum adjustment size is limited by the slew rate. The Orc hardware updates the PWM value at 1000Hz, with a maximum change given by a 16 bit number that represents (number of PWM values)*128.

Parameters:
seconds - [0.001, 120]. Values less than 0.001 are accepted, but increased to 0.001

setMultiplePWM

public static void setMultiplePWM(Motor[] ms,
                                  double[] vs)
Motors must belong to same Orc object.


isFault

public boolean isFault()
Is the motor in a fault state?


isFault

public boolean isFault(OrcStatus status)
Is the motor in a fault state?


clearFault

public void clearFault()