public class Coordinate extends java.lang.Object implements IMqttHandler
Modifier and Type | Field and Description |
---|---|
protected RobotMqttClient |
robotMqttClient |
Constructor and Description |
---|
Coordinate(int robotId,
double x,
double y,
double heading,
RobotMqttClient mqttClient)
Coordinate class
|
Modifier and Type | Method and Description |
---|---|
double |
getHeading()
Get robot's current heading direction
|
double |
getHeadingRad()
Get robot's current heading direction
|
double |
getX()
Get robot's current X coordinate
|
double |
getY()
Get robot's current Y coordinate
|
void |
handleSubscription(Robot robot,
MqttMsg message)
Handle localization related MQTT subscriptions
|
void |
print()
Print robot's current (x,y,heading) values to StdOut
|
void |
publishCoordinate()
Publish current (x,y,heading) values to the MQTT channel
|
void |
setCoordinate(double x,
double y)
Set robot's current (x,y) coordinate
|
void |
setCoordinate(double x,
double y,
double heading)
Set robot's current (x,y) coordinate and heading direction
|
void |
setHeading(double heading)
Set robot's current heading direction
|
void |
setHeadingRad(double heading)
Set robot's current heading direction
|
void |
setX(double x)
Set robot's current X coordinate
|
void |
setY(double y)
Set robot's current Y coordinate
|
java.lang.String |
toString()
Returns robot's current (x,y,heading) values as a string
|
protected RobotMqttClient robotMqttClient
public Coordinate(int robotId, double x, double y, double heading, RobotMqttClient mqttClient)
robotId
- x
- X coordinate as doubley
- Y coordinate as doubleheading
- Heading direction in degrees, as doublemqttClient
- mqttClient objectpublic void handleSubscription(Robot robot, MqttMsg message)
handleSubscription
in interface IMqttHandler
robot
- Robot objectmessage
- Subscription topic valuepublic double getX()
public double getY()
public void setX(double x)
x
- coordinate as a doublepublic void setY(double y)
y
- coordinate as a doublepublic double getHeading()
public double getHeadingRad()
getHeading()
public void setHeading(double heading)
heading
- in degrees, [-180, 180]public void setHeadingRad(double heading)
heading
- in radians, [-PI, PI]public void setCoordinate(double x, double y)
x
- X coordinate as a doubley
- Y coordinate as a doublepublic void setCoordinate(double x, double y, double heading)
x
- X coordinate as a doubley
- Y coordinate as a doubleheading
- Heading in radians, [-PI, PI]public void print()
public java.lang.String toString()
toString
in class java.lang.Object
public void publishCoordinate()