public abstract class GenericMotor extends Part
Modifier and Type | Method and Description |
---|---|
GenericMotor |
backward()
Starts the backward rotation with preset speed.
|
GenericMotor |
continueRelativeTo(int count)
Same as rotateTo(int count), but the rotation counter
is not set to zero.
|
GenericMotor |
continueRelativeTo(int count,
boolean blocking)
Same as rotateTo(int count, boolean blocking), but the rotation counter
is not set to zero.
|
GenericMotor |
continueTo(int count)
Same as rotateTo(int count), but the rotation counter
is not set to zero.
|
GenericMotor |
continueTo(int count,
boolean blocking)
Same as rotateTo(int count, boolean blocking), but the rotation counter
is not set to zero.
|
GenericMotor |
forward()
Starts the forward rotation with preset speed.
|
int |
getMotorCount()
Returns current value of the rotation counter.
|
int |
getPortId()
Returns the port number.
|
java.lang.String |
getPortLabel()
Returns the port label.
|
int |
getSpeed()
Returns the current speed (arbitrary units).
|
double |
getVelocity()
Returns the current velocity.
|
boolean |
isMoving()
Checks if the motor is rotating.
|
void |
resetMotorCount()
Resets the rotation counter to zero.
|
GenericMotor |
rotateTo(int count)
Sets the rotation counter to zero and rotates the motor until the given count is reached.
|
GenericMotor |
rotateTo(int count,
boolean blocking)
Sets the rotation counter to zero and rotates the motor until the given count is reached.
|
void |
setAcceleration(int acceleration)
Sets the acceleration rate of the motor in degrees/sec/sec
The default value is 6000.
|
GenericMotor |
setSpeed(int speed)
Sets the speed to the given value (arbitrary units).
|
void |
setSpeedFactor(double value)
Sets the motor speed factor to given value.
|
GenericMotor |
setVelocity(double velocity)
Sets the velocity to the given value.
|
double |
speedToVelocity(int speed)
Conversion from speed to velocity.
|
GenericMotor |
stop()
Stops the motor.
|
GenericMotor |
stop(boolean immediately)
Stops the motor.
|
int |
velocityToSpeed(double velocity)
Conversion from velocity to speed.
|
public int getPortId()
public java.lang.String getPortLabel()
public GenericMotor forward()
public GenericMotor backward()
public GenericMotor setSpeed(int speed)
speed
- the speed 0..100public int getSpeed()
public GenericMotor setVelocity(double velocity)
velocity
- the velocity in m/spublic double getVelocity()
public GenericMotor stop(boolean immediately)
immediately
- if true, the method returns immediately; otherwise
it blocks until the motor is at restpublic GenericMotor stop()
public void setSpeedFactor(double value)
value
- the velocity per speed unitpublic double speedToVelocity(int speed)
speed
- the speed as set in setSpeed()setSpeedFactor(double value)
public int velocityToSpeed(double velocity)
velocity
- the velocity in m/ssetSpeedFactor(double value)
public void resetMotorCount()
rotateTo(int count)
public int getMotorCount()
public GenericMotor rotateTo(int count)
rotateTo(int count, boolean blocking)
public GenericMotor rotateTo(int count, boolean blocking)
rotateTo(int count)
public GenericMotor continueTo(int count)
count
- the rotation counter value to be reachedrotateTo(int count)
public GenericMotor continueTo(int count, boolean blocking)
count
- the rotation counter value to be reachedrotateTo(int count, boolean blocking)
public GenericMotor continueRelativeTo(int count)
count
- the rotation counter value to be increased/decreasedrotateTo(int count)
public GenericMotor continueRelativeTo(int count, boolean blocking)
count
- the rotation counter value to be increased/decreasedblocking
- if true, the method blocks until the count is reached, otherwise it returns immediatelyrotateTo(int count, boolean blocking)
public boolean isMoving()
public void setAcceleration(int acceleration)
acceleration
- the new accelaration