|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavaclient.PlayerDevice
javaclient.MotorInterface
public class MotorInterface
The motor interface is used to control a single motor.
Field Summary | |
---|---|
protected short |
PLAYER_MOTOR_MOTOR_POWER_REQ
|
protected short |
PLAYER_MOTOR_POSITION_MODE_REQ
|
protected short |
PLAYER_MOTOR_POSITION_PID_REQ
|
protected short |
PLAYER_MOTOR_RESET_ODOM_REQ
|
protected short |
PLAYER_MOTOR_SET_GEAR_REDUCTION_REQ
|
protected short |
PLAYER_MOTOR_SET_ODOM_REQ
|
protected short |
PLAYER_MOTOR_SET_TICS_REQ
|
protected short |
PLAYER_MOTOR_SPEED_PID_REQ
|
protected short |
PLAYER_MOTOR_SPEED_PROF_REQ
|
protected short |
PLAYER_MOTOR_VELOCITY_MODE_REQ
|
Fields inherited from class javaclient.PlayerDevice |
---|
device, DIFFERENCE_SYNCH_FACTOR, index, is, os, pc, PLAYER_MAX_REQREP_SIZE, PLAYER_STXX, reserved, size, t_sec, t_usec, ts_sec, ts_usec |
Constructor Summary | |
---|---|
MotorInterface(PlayerClient pc,
short indexOfDevice)
Constructor for MotorInterface. |
Method Summary | |
---|---|
void |
changePositionControl(byte mode)
Configuration request: Change position control. |
int |
getStall()
Get motors status. |
int |
getTheta()
Get theta in mrad (1 milliradian = ~.06 degrees). |
int |
getThetaSpeed()
Get angular velocity in mrad/sec. |
void |
handleEARMessage()
Handle Error Acknowledgement Response messages. |
void |
handleNARMessage()
Handle Negative Acknowledgement Response messages. |
void |
readData()
The motor interface returns data regarding the position and velocity of the motor, as well as stall information. |
void |
resetOdometry()
Configuration request: Reset odometry. |
void |
setMotor(int thetaP,
int thetaS,
int state,
int type)
The motor interface accepts new positions and/or velocities for the motors (drivers may support position control, speed control, or both). |
void |
setMotorPIDParams(int kp,
int ki,
int kd)
Configuration request: Set motor PID parameters. |
void |
setMotorPower(int state)
Configuration request: Motor power. |
void |
setOdometry(int xT,
int yT,
int theta)
Configuration request: Set odometry. |
void |
setSpeedProfileParams(int sp,
int acc)
Configuration request: Set speed profile parameters. This is usefull in position control mode when you want to ramp your acceleration and deacceleration. |
void |
setVelocityControl(byte mode)
Configuration request: Change velocity control mode. |
void |
setVelocityPIDParams(int kp,
int ki,
int kd)
Configuration request: Set velocity PID parameters. |
Methods inherited from class javaclient.PlayerDevice |
---|
getTimeForDataSampled_sec, getTimeForDataSampled_usec, getTimeForDataSampled, getTimeForDataSent_sec, getTimeForDataSent_usec, getTimeForDataSent, handleResponse, readHeader, sendHeader |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final short PLAYER_MOTOR_MOTOR_POWER_REQ
protected final short PLAYER_MOTOR_VELOCITY_MODE_REQ
protected final short PLAYER_MOTOR_RESET_ODOM_REQ
protected final short PLAYER_MOTOR_POSITION_MODE_REQ
protected final short PLAYER_MOTOR_SPEED_PID_REQ
protected final short PLAYER_MOTOR_POSITION_PID_REQ
protected final short PLAYER_MOTOR_SPEED_PROF_REQ
protected final short PLAYER_MOTOR_SET_ODOM_REQ
protected final short PLAYER_MOTOR_SET_GEAR_REDUCTION_REQ
protected final short PLAYER_MOTOR_SET_TICS_REQ
Constructor Detail |
---|
public MotorInterface(PlayerClient pc, short indexOfDevice)
pc
- a reference to the PlayerClient objectindexOfDevice
- the index of the deviceMethod Detail |
---|
public void readData()
readData
in class PlayerDevice
public int getTheta()
public int getThetaSpeed()
public int getStall()
public void setMotor(int thetaP, int thetaS, int state, int type)
thetaP
- theta in mradthetaS
- angular velocities, in mrad/secstate
- motor state (zero is either off or locked, depending on the driver)type
- command type; 0 = velocity, 1 = positionpublic void changePositionControl(byte mode)
mode
- 0 for velocity mode, 1 for position modepublic void setVelocityControl(byte mode)
mode
- driver-specificpublic void resetOdometry()
public void setOdometry(int xT, int yT, int theta)
theta
- theta in mradpublic void setVelocityPIDParams(int kp, int ki, int kd)
kp
- P parameterki
- I parameterkd
- D parameterpublic void setMotorPIDParams(int kp, int ki, int kd)
kp
- P parameterki
- I parameterkd
- D parameterpublic void setSpeedProfileParams(int sp, int acc)
sp
- max speedacc
- max accelerationpublic void setMotorPower(int state)
state
- 0 for off, 1 for onpublic void handleNARMessage()
handleNARMessage
in class PlayerDevice
public void handleEARMessage()
handleEARMessage
in class PlayerDevice
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |