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
 double getCurrent()
          Returns an instantaneous estimate of the current magnitude (in Amps).
 void idle()
          Disconnects the motor output.
 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.
 void setWatchDog(int usec)
          Change the watchdog timer to disable motors on the uorc.
 
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]

setWatchDog

public void setWatchDog(int usec)
Change the watchdog timer to disable motors on the uorc. A setting of zero results in no watchdog shutdowns. This setting affects all motors.

Parameters:
usec - >= 0

getCurrent

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


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