|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Observable
dlife.robot.Device
dlife.robot.DifferentialDriveEffector
public abstract class DifferentialDriveEffector
Abstract base class for the effector controlling the motion of robots with differential drive system.
A NOTE ON DYNAMICS: Wheel speeds are mechanically limited and thus are bounded to [-1...1]. When converting from rotation and translation specifications to wheel speeds, if any value falls outside of that range then both values are scaled proportionately such that they both fall within the range. Thus, the values returned from a call to getRotation or getTranslation may not return the same value that was specified in the call to rotate, translate or move. Similarly, if the wheel speeds are set directly using the setWheelSpeeds method, then the values returned from getRotation and getTranslation may not lie within [-1...1] bounds imposed on move, rotate and translate.
The conversion from rotation and translation to wheel speeds and vice versa is done based on an approximation of the induced motion as being infinitesimal and independent in both the forward and rotational directions. Also, the wheel base of the robot is taken to be 1. Under this approximation:
dX/dt = (vR + vL) / 2
dTheta/dt = (vR - vL)
Similarly, to compute wheel velocities from translation (dX/dt) and rotation (dTheta/dt) values:
vL = dX/dt - 1/2 * dTheta/dt
vR = dX/dt + 1/2 * dTheta/dt
| Field Summary | |
|---|---|
protected double |
vL
|
protected double |
vR
|
| Fields inherited from class dlife.robot.Device |
|---|
DEFAULT_GUI_UPDATE_DELAY, DEFAULT_READ_DELAY, myRobot, readCount |
| Constructor Summary | |
|---|---|
DifferentialDriveEffector()
Construct a new DifferentialDriveEffector. |
|
DifferentialDriveEffector(boolean autoRead)
Construct a new DifferentialDriveEffector with or without an AutoReadTimer running. |
|
DifferentialDriveEffector(int readDelay,
int guiDelay,
boolean autoRead)
Construct a new DifferentialDriveEffector with the specified settings for the readDelay, guiDelay and autoRead. |
|
| Method Summary | |
|---|---|
protected DeviceDisplay[] |
createGUIObjects()
Get the object that is the GUI controller for this DifferentialDriveEffector. |
void |
freeze()
Stop the motion of the Robot controlled by this DifferentialDriveEffector. |
double |
getLeftWheelSpeed()
Get the current rotational speed of the left wheel. |
double |
getRightWheelSpeed()
Get the current rotational speed of the right wheel. |
double |
getRotation()
Get the current rate of rotation of the robot about its center axis. |
double |
getTranslation()
Get the current rate of translation of the robot. |
void |
move(double tSpeed,
double rSpeed)
This method should cause the robot to move with a combination of translation and rotation along a curved trajectory. |
void |
rotate(double speed)
This method will cause the robot to rotate in place at the specified fraction of its maximum speed. |
protected abstract void |
setRobotWheelSpeeds(double left,
double right)
All concrete sub-classes must implement this method such that it sends the appropriate command to the robot such that the wheels will turn with the specified relative speeds. |
void |
setWheelSpeeds(double left,
double right)
Set the rotational speeds of the left and right wheels of the robot. |
void |
shutDown()
Stop the motion of the robot and invoke the superclass shutDown method. |
void |
translate(double speed)
This method will cause the robot to move straight forward or backward at the specified fraction of its maximum speed. |
| Methods inherited from class dlife.robot.Device |
|---|
getAutoRead, getGUI, getGUIUpdateDelay, getReadDelay, getRobot, getSensorReadCount, getSensorReadRate, readStateFromRobot, setAutoRead, setGUIUpdateDelay, setReadDelay, setRobot, startAutoReadTimer, startUp, stopAutoReadTimer |
| Methods inherited from class java.util.Observable |
|---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected double vL
protected double vR
| Constructor Detail |
|---|
public DifferentialDriveEffector()
public DifferentialDriveEffector(boolean autoRead)
public DifferentialDriveEffector(int readDelay,
int guiDelay,
boolean autoRead)
readDelay - the delay between attempts to read the wheel speeds from
the robot.guiDelay - the delay between updates to the GUI display.autoRead - whether or not to start the autoread timer for this
DifferentialDriveEffector.| Method Detail |
|---|
public void translate(double speed)
This is a convenience method for the call move(speed, 0.0). The values of speed should be in the range [-1...1]. Values outside of that range are bounded to the range.
speed - the speed at which to move.public void rotate(double speed)
This is a convenience method for the call move(0.0, speed). The values of speed should be in the range [-1...1]. Values outside of that range are bounded to the range.
speed - the speed at which to rotate.
public void move(double tSpeed,
double rSpeed)
tSpeed - the speed at which to translate.rSpeed - the speed at which to rotate.public void freeze()
freeze in class Devicepublic void shutDown()
shutDown in class Devicepublic double getTranslation()
public double getRotation()
public void setWheelSpeeds(double left,
double right)
This method invokes the protected abstract method setRobotWheelSpeeds, which is responsible for issuing the command to the robot that will cause its wheels to move.
left - the rotational speed of the left wheel.right - the rotational speed of the right wheel.
protected abstract void setRobotWheelSpeeds(double left,
double right)
left - the rotational speed of the left wheel.right - the rotational speed of the right wheel.public double getLeftWheelSpeed()
public double getRightWheelSpeed()
protected DeviceDisplay[] createGUIObjects()
createGUIObjects in class Device
|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||