|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.nxt.I2CSensor lejos.nxt.addon.tetrix.TetrixServoController
public class TetrixServoController
HiTechnic Servo Controller abstraction. Provides TetrixServo
instances which are used to control
the Tetrix servos.
Servos are driven by a PWM signal with varying pulse widths controlling the rotational position of the servo actuator. The pulse nominally ranges from 1.0 ms to 2.0 ms with 1.5 ms always being center of range. Pulse widths outside this range can be used for "overtravel" -moving the servo beyond its normal range.
As an example, for a servo with a 90 deg. travel range, a pulse width of 1.5 ms (1500 microseconds) will typically set the servo to its "neutral" position or 45 degrees, a pulse of 1.25 ms could set it to 0 degrees and a pulse of 1.75 ms to 90 degrees. The physical limits and timings of the servo hardware varies between brands and models, but a general 90 degree servo's angular motion will travel somewhere in the range of 90 deg. - 120 deg. and the neutral position is almost always at 1.5 ms. This is the "standard pulse servo mode" used by all hobby analog servos.
The HiTechic Servo Controller allows setting of the PWM output from 0.75 - 2.25ms. Note that some servos may hit their internal mechanical limits at each end of this range causing them to consume excessive current and potentially be damaged.
Use
to retrieve a TetrixControllerFactory.newServoController()
TetrixServoController
instance.
TetrixControllerFactory
Field Summary | |
---|---|
static int |
SERVO_1
Represents the servo connected to Channel 1 as indicated on the controller |
static int |
SERVO_2
Represents the servo connected to Channel 2 as indicated on the controller |
static int |
SERVO_3
Represents the servo connected to Channel 3 as indicated on the controller |
static int |
SERVO_4
Represents the servo connected to Channel 4 as indicated on the controller |
static int |
SERVO_5
Represents the servo connected to Channel 5 as indicated on the controller |
static int |
SERVO_6
Represents the servo connected to Channel 6 as indicated on the controller |
Fields inherited from class lejos.nxt.I2CSensor |
---|
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION |
Fields inherited from interface lejos.nxt.SensorConstants |
---|
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, GREEN, GREEN_INDEX, MAX_AD_RAW, MAX_TYPE, MIN_TYPE, MODE_ANGLESTEP, MODE_BOOLEAN, MODE_CELSIUS, MODE_FARENHEIT, MODE_PCTFULLSCALE, MODE_PERIODCOUNTER, MODE_RAW, MODE_TRANSITIONCNT, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HISPEED, TYPE_LIGHT_ACTIVE, TYPE_LIGHT_INACTIVE, TYPE_LOWSPEED, TYPE_LOWSPEED_9V, TYPE_NO_SENSOR, TYPE_REFLECTION, TYPE_SOUND_DB, TYPE_SOUND_DBA, TYPE_SWITCH, TYPE_TEMPERATURE, WHITE, YELLOW |
Constructor Summary | |
---|---|
TetrixServoController(I2CPort port,
int daisyChainPosition)
Instantiate for a HiTechnic TETRIX Servo Controller connected to the given port and daisy chain position. |
Method Summary | |
---|---|
void |
flt()
Set all servos connected to this controller to float mode. |
TetrixServo |
getServo(int servoID)
Get the TetrixServo instance that is associated with the passed servoID . |
int |
getStepTime()
Gets the step time used for all servos on this controller. |
boolean |
isMoving()
Returns whether or not there are servos on this controller that are moving. |
void |
setStepTime(int step)
Sets the step time used for all servos on this controller. |
Methods inherited from class lejos.nxt.I2CSensor |
---|
fetchString, getAddress, getData, getData, getPort, getProductID, getVendorID, getVersion, sendData, sendData, sendData, setAddress |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SERVO_1
public static final int SERVO_2
public static final int SERVO_3
public static final int SERVO_4
public static final int SERVO_5
public static final int SERVO_6
Constructor Detail |
---|
public TetrixServoController(I2CPort port, int daisyChainPosition)
port
and daisy chain position.
port
- The sensor port the controller (if daisy-chained, the first) is connected to.daisyChainPosition
- The position of the controller in the daisy chain.
IllegalStateException
- if a Servo Controller was not found with given port
and daisyChainPosition
TetrixControllerFactory.DAISY_CHAIN_POSITION_1
,
TetrixControllerFactory.DAISY_CHAIN_POSITION_2
,
TetrixControllerFactory.DAISY_CHAIN_POSITION_3
,
TetrixControllerFactory.DAISY_CHAIN_POSITION_4
,
SensorPort
Method Detail |
---|
public TetrixServo getServo(int servoID)
TetrixServo
instance that is associated with the passed servoID
.
servoID
- The motor ID number SERVO_1
to SERVO_6
. This is indicated on the
HiTechnic Servo Controller.
TetrixServo
instance associated with the labeled channelSERVO_1
,
SERVO_2
,
SERVO_3
,
SERVO_4
,
SERVO_5
,
SERVO_6
public boolean isMoving()
false
when the step time is set to 0 (disabled).
true
if any servo is moving to position.setStepTime(int)
public void flt()
public void setStepTime(int step)
The step time can be considered a delay before progressing to the next step. For example, if a servo is positioned at 1500 microseconds pulse width, and you give it a new position command of 2000 microseconds, it will normally go as fast as it can to get to the new position. If you want it to go to the new position but not at the maximum output, you can set the step to a value from 0 to 15.
One of the main things it could be useful for, is if you have two servos with different loads, and you want them to be as much in sync as possible. You can set the speed to slow the controller from changing the servo signals instantly.
The isMoving()
method always returns false
if the step time is set to zero.
step
- Step Time, 0-15. Setting to 0 disables step time.
IllegalArgumentException
- If step is not in the range 0 to 15getStepTime()
,
isMoving()
public int getStepTime()
setStepTime(int)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |