|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--EDU.cmu.cs.coral.cye.JCyeSrv
The JCyeSrv class acts as an interactive server for the Cye mobile robot. All user interaction with Cye should take place through this class.
edu.cmu.cs.JavaCye.JCyeComm
,
edu.cmu.cs.JavaCye.JCyeMsg
,
edu.cmu.cs.JavaCye.JCyeStatus
Constructor Summary | |
JCyeSrv(java.lang.String d,
int b,
int c,
byte i)
The constructor for class JCyeSrv . |
Method Summary | |
void |
ClearObstacle()
Clears Cye's obstacle detector. |
double |
encoderToRadian(int e)
Convert a heading from robot coordinates (encoder values) to world coordinates (radians). |
double |
GetLastB()
Return the last reported battery charge of Cye. |
double |
GetLastH()
Return the last reported Heading of Cye. |
double |
GetLastX()
Return the last reported X position of Cye. |
double |
GetLastY()
Return the last reported Y position of Cye. |
boolean |
GetObstacle()
Return the state of Cye's obstacle detector. |
byte |
InttoByte(int l,
int i)
Return a specific byte (8 bits) ripped out of an integer (32 bits). |
int |
radianToEncoder(double h)
Convert a heading from world coordinates (radians) to robot coordinates (encoder values). |
double |
robotToWorld(int r)
Convert a position value from robot coordinates (encoder ticks) to world coordinates (inches). |
void |
SendBuzzerFrequency(int Frequency)
Wanna play a tune? Set the buzzer frequency to a specific value. |
void |
SendBuzzerOn(boolean OnOff)
Turn on or off Cye's buzzer. |
void |
SendHandleLength(int Length)
Set the length of the "bungee-cord" virtual handle on the front of Cye. |
void |
SendHeading(double h)
Tell Cye its true heading, overwriting dead-reckoned value. |
void |
SendHeadingCorrectionFactor(int Correction)
Instruct Cye to set the internal heading correction factor. |
void |
SendHeadingDestination(double heading,
int velocity)
Instruct Cye to rotate to a specifed heading at a specified velocity. |
void |
SendMaxPWM(int MaxPWM)
Instruct Cye to set the maximum PWM value. |
void |
SendMaxSpeed(int MaxSpeed)
Instruct Cye to set its maximum speed. |
void |
SendMotorControlConstants(byte Kp,
byte Ki,
byte Kd,
byte Kb,
byte Kpwm)
Not implemented. |
void |
SendMotorsPWM(int m0PWM,
int m1PWM)
Instruct Cye to set the motors to specific PWM values |
void |
SendMotorVelocities(int M0Vel,
int M1Vel)
Instruct Cye to move with specified motor velocities. |
JCyeMsg |
SendMsg(JCyeMsg Msg)
Sends a JCyeMsg to Cye using the JCyeComm object |
void |
SendPoll()
Send a poll message to the robot. |
void |
SendPosition(double x,
double y)
Tell Cye its true position, overwriting dead-reckoned value. |
void |
SendPositionDestination(double x,
double y)
Instruct Cye to move to a specified location |
void |
SendPositionVelocityDestination(double x,
double y,
int v)
Instruct Cye to move to a specific (x,y) position at a specified velocity. |
void |
SendPowerOff()
Instruct Cye to commit ritual suicide. |
void |
SendRequestState()
Request state information from Cye. |
void |
SendSensitiveObstacleDetection(int Sensitive)
Not implemented. |
void |
SendStopMotors()
Instruct Cye to stop its motors. |
void |
SendStraightVelocity(int v,
double h)
Instruct Cye to move straight with a specified velocity at a specified heading. |
void |
SendTurn(double Heading,
int Velocity,
int Diameter)
Not implemented. |
void |
SendVelocityDirection(double Heading,
int Velocity)
Not implemented. |
void |
Wait(int ms)
Wait for ms milliseconds |
int |
worldToRobot(double w)
Convert a position value from world coordinates (inches) to robot coordinates (encoder ticks). |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public JCyeSrv(java.lang.String d, int b, int c, byte i)
JCyeSrv
.
Creates a new JCyeComm
object to handle robot interaction,
and issues a start
command to it.d
- the device to open to the robot.b
- the baud rate to open to the robot.c
- connection to the robot (WIRED or OLD_RADIO or NEW_RADIO).i
- the id number of the robot.Method Detail |
public void Wait(int ms)
ms
- the number of milliseconds to waitpublic JCyeMsg SendMsg(JCyeMsg Msg)
JCyeMsg
to Cye using the JCyeComm
objectMsg
- the message (of type JCyeMsg
) to be sentJCyeMsg
reply from Cyepublic void SendPositionDestination(double x, double y)
x
- the desired X position, in world coordinates(inches)y
- the desired Y position, in world coordinates(inches)public void SendMotorsPWM(int m0PWM, int m1PWM)
m0PWM
- the PWM value for Motor 0 (right)m1PWM
- the PWM value for Motor 1 (left)public void SendStopMotors()
public void SendHeadingDestination(double heading, int velocity)
heading
- the commanded heading, in world coordinates (radians).velocity
- the velocity at which to turn.public void SendMaxPWM(int MaxPWM)
MaxPWM
- the maximum PWM value...????public void SendHeadingCorrectionFactor(int Correction)
Correction
- the correction valuepublic void SendMotorVelocities(int M0Vel, int M1Vel)
M0Vel
- the velocity command value for Motor 0 (right)M1Vel
- the velocity command value for Motor 1 (left)public void SendPosition(double x, double y)
x
- Cye's true X position, in world coordinates (inches)y
- Cye's true Y position, in world coordinates (inches)public void SendHeading(double h)
H
- Cye's true heading, in world coordinates (radians)public void SendMaxSpeed(int MaxSpeed)
MaxSpeed
- the maximum speed valuepublic void SendPositionVelocityDestination(double x, double y, int v)
x
- the commanded x position, in world coordinates (inches)y
- the commanded y position, in world coordinates (inches)v
- the velocity at which to movepublic void SendStraightVelocity(int v, double h)
v
- the commanded velocityh
- the commanded heading, in world coordinates (radians)public void SendSensitiveObstacleDetection(int Sensitive)
public void SendTurn(double Heading, int Velocity, int Diameter)
public void SendMotorControlConstants(byte Kp, byte Ki, byte Kd, byte Kb, byte Kpwm)
public void SendHandleLength(int Length)
Length
- the length of the handlepublic void SendBuzzerOn(boolean OnOff)
OnOff
- duhpublic void SendBuzzerFrequency(int Frequency)
Frequency
- the frequencypublic void SendVelocityDirection(double Heading, int Velocity)
public void SendRequestState()
public void SendPowerOff()
public void SendPoll()
public byte InttoByte(int l, int i)
l
- the integeri
- the byte position (0..3)public double GetLastX()
public double GetLastY()
public double GetLastH()
public double GetLastB()
public boolean GetObstacle()
true
if Cye has hit an obstacle since the last call to
ClearObstacle
, false otherwise.public void ClearObstacle()
public int radianToEncoder(double h)
h
- a heading in radianspublic double encoderToRadian(int e)
e
- a heading in robot coordinatespublic double robotToWorld(int r)
r
- a position value in robot coordinatespublic int worldToRobot(double w)
w
- a position value in world coordinates (inches)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |