|
RoboJDETM v2.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
com.ridgesoft.robotics.OdometricLocalizer
public class OdometricLocalizer
This class implements a localizer for position tracking of a two wheel differential-drive robot using odometry.
This class keeps track of the robot's position using ShaftEncoder objects to monitor movements of the robot's left and right wheels.
This class extends the thread class enabling it to use it's own thread to monitor and integrate movement of the wheels to track the robot's position.
ShaftEncoder
,
AnalogShaftEncoder
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
OdometricLocalizer(ShaftEncoder leftEncoder,
ShaftEncoder rightEncoder,
float wheelDiameter,
float trackWidth,
int countsPerRevolution,
int threadPriority,
int period)
Constructs an OdometricLocalizer object. |
Method Summary | |
---|---|
Pose |
getPose()
Gets the robot's pose (x, y position and heading). |
void |
run()
Run method for the localizer thread. |
void |
setHeading(float heading)
Sets the robot's current heading. |
void |
setPose(float x,
float y,
float heading)
Sets the robot's current pose. |
void |
setPose(Pose pose)
Sets the robot's current pose. |
void |
setPosition(float x,
float y)
Sets the robot's current x and y coordinates. |
String |
toString()
Returns a String indicating the current pose. |
Methods inherited from class java.lang.Thread |
---|
activeCount, currentThread, dumpStack, getName, getPriority, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, setDaemon, setName, setPriority, sleep, start, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait |
Constructor Detail |
---|
public OdometricLocalizer(ShaftEncoder leftEncoder, ShaftEncoder rightEncoder, float wheelDiameter, float trackWidth, int countsPerRevolution, int threadPriority, int period)
leftEncoder
- reference to the left wheel's shaft encoder objectrightEncoder
- reference to the right wheel's shaft encoder objectwheelDiameter
- diameter of the wheelstrackWidth
- distance between the centerlines of the wheelscountsPerRevolution
- number of encoder counts per one wheel revolutionthreadPriority
- priority of the threadperiod
- period of thread in millisecondsMethod Detail |
---|
public Pose getPose()
getPose
in interface Localizer
public void run()
run
in interface Runnable
run
in class Thread
public void setHeading(float heading)
setHeading
in interface Localizer
heading
- heading in radianspublic void setPose(float x, float y, float heading)
setPose
in interface Localizer
x
- x coordiante in whatever units the localizer usesy
- y coordinate in whatever units the localizer usesheading
- heading in radianspublic void setPose(Pose pose)
setPose
in interface Localizer
pose
- a Pose object containing the new posepublic void setPosition(float x, float y)
setPosition
in interface Localizer
x
- x coordiante in whatever units the localizer usesy
- y coordinate in whatever units the localizer usespublic String toString()
toString
in class Thread
|
RoboJDETM v2.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |