lejos.hardware.motor.EV3MediumRegulatedMotor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lejos-ev3-api Show documentation
Show all versions of lejos-ev3-api Show documentation
leJOS (pronounced like the Spanish word "lejos" for "far") is a tiny Java Virtual Machine. In 2013 it was ported to the LEGO EV3 brick.
The newest version!
package lejos.hardware.motor;
import lejos.hardware.port.Port;
import lejos.hardware.port.TachoMotorPort;
import lejos.hardware.sensor.EV3SensorConstants;
/**
* Abstraction for a Medium Lego EV3/NXT motor.
*
*/
public class EV3MediumRegulatedMotor extends BaseRegulatedMotor
{
static final float MOVE_P = 8f;
static final float MOVE_I = 0.04f;
static final float MOVE_D = 8f;
static final float HOLD_P = 8f;
static final float HOLD_I = 0.02f;
static final float HOLD_D = 0f;
static final int OFFSET = 1000;
private static final int MAX_SPEED = 260*360/60;
/**
* Use this constructor to assign a variable of type motor connected to a particular port.
* @param port to which this motor is connected
*/
public EV3MediumRegulatedMotor(TachoMotorPort port)
{
super(port, null, EV3SensorConstants.TYPE_MINITACHO, MOVE_P, MOVE_I, MOVE_D,
HOLD_P, HOLD_I, HOLD_D, OFFSET, MAX_SPEED);
}
/**
* Use this constructor to assign a variable of type motor connected to a particular port.
* @param port to which this motor is connected
*/
public EV3MediumRegulatedMotor(Port port)
{
super(port, null, EV3SensorConstants.TYPE_NEWTACHO, MOVE_P, MOVE_I, MOVE_D,
HOLD_P, HOLD_I, HOLD_D, OFFSET, MAX_SPEED);
}
}