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.
|
GenericMotor |
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.
|
GenericMotor |
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.
|
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()
public void setSpeedFactor(double value)
value
- the velocity per speed unitpublic double speedToVelocity(int speed)
speed
- the speed as set in setSpeed()public int velocityToSpeed(double velocity)
velocity
- the velocity in m/spublic int getMotorCount()
public GenericMotor resetMotorCount()
public GenericMotor rotateTo(int count)
count
- the rotation counter value to be reachedpublic GenericMotor rotateTo(int count, boolean blocking)
count
- the rotation counter value to be reachedblocking
- if true, the method blocks until the count is reached,
otherwise it returns immediatelypublic GenericMotor continueTo(int count)
count
- the rotation counter value to be reachedpublic GenericMotor continueTo(int count, boolean blocking)
count
- the rotation counter value to be reachedblocking
- if true, the method blocks until the count is reached, otherwise it returns immediatelypublic GenericMotor continueRelativeTo(int count)
count
- the rotation counter value to be increased/decreasedpublic 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 immediatelypublic boolean isMoving()
public GenericMotor setAcceleration(int acceleration)
acceleration
- the new accelaration