public class AgentModel extends Object implements ParsedDataObserver, Serializable
Modifier and Type | Field and Description |
---|---|
private static AgentModel |
instance |
private Map<Joint,Double> |
jointAngles |
(package private) ParsedData |
lastDataReceived
Data last received from server.
|
protected double |
lastTimeFlagSeen |
(package private) Vector3D |
position
Current position of agent.
|
(package private) Vector3D |
pureBodyAcceleration |
(package private) double |
rotationX
Rotation by axis X value.
|
(package private) double |
rotationY
Rotation by axis Y value.
|
(package private) double |
rotationZ
Rotation by axis Z value.
|
private static long |
serialVersionUID |
static Side |
side |
(package private) Vector3D |
velocity |
Constructor and Description |
---|
AgentModel() |
Modifier and Type | Method and Description |
---|---|
private void |
adjustRotationsFor(Vector3D gyroscope) |
AgentModel |
afterAction(Annotation annotation)
Returns changed AgentModel object calculated from current agent model
based on specified annotation execution.
|
private Vector3D |
countRotatedXAxis(double angleRotateZ,
double angleRotateY) |
private double |
getAngleBetweenTwoVectors(Vector3D firstVec,
Vector3D secondVec) |
static AgentModel |
getInstance()
Static instance of AgentModel to work with it in other classes.
|
double |
getJointAngle(Joint joint)
Returns current angle of specified joint of AgentModel object.
|
static double |
getJointAngleOf(Joint joint)
Returns angle of specified joint of AgentModel static instance.
|
ParsedData |
getLastDataReceived()
Returns last received data from server.
|
double |
getLastTimeFlagSeen() |
Vector3D |
getPosition()
Returns agents position.
|
double |
getRotationX()
Returns agents rotation by axis X.
|
double |
getRotationY()
Returns agents rotation by axis Y.
|
double |
getRotationZ()
Returns agents rotation by axis Z.
|
Vector3D |
globalize(Vector3D relative)
Returns globalized position of agent from his relative position.
|
boolean |
isLyingOnBack()
Returns true if agent is lying on back(na chrbte), false otherwise.
|
boolean |
isLyingOnBelly()
Returns true if agent is lying on belly(na bruchu), false otherwise.
|
boolean |
isOnGround()
Returns true if agent is on ground, false otherwise.
|
private boolean |
isOnGroundJudgedByAccelerometer() |
boolean |
isStanding()
Returns true if agent is standing, false otherwise.
|
boolean |
isStanding(ParsedData data)
Returns true if agent is standing from specified ParsedData, false otherwise.
|
AgentModel |
partialCopy()
Creates partial copy of AgentModel without some parts of lastDataReceived attribute.
|
void |
processNewServerMessage(ParsedData data) |
Vector3D |
relativize(Vector3D global)
Returns relativized position of agent from his global position.
|
private Vector3D |
rotateVectorAroundVector(Vector3D initialVec,
Vector3D axisV,
double radAngle) |
private Vector3D |
rotateVectorAroundZAxis(Vector3D initialVec,
double angleV) |
void |
setPosition(Vector3D position) |
void |
setRotationX(double rotationX) |
void |
setRotationY(double rotationY) |
void |
setRotationZ(double rotationZ) |
private void |
updateJointPositions(ParsedData data) |
private void |
updatePosition(ParsedData data) |
private void |
updatePureBodyAcceleration(ParsedData data) |
private void |
updateRotations(ParsedData data) |
private Vector3D |
vectorTimesMatrix(double[][] matrix,
Vector3D vector) |
private static final long serialVersionUID
private static AgentModel instance
double rotationX
double rotationY
double rotationZ
Vector3D position
Vector3D velocity
Vector3D pureBodyAcceleration
transient ParsedData lastDataReceived
public static Side side
protected double lastTimeFlagSeen
public static AgentModel getInstance()
public AgentModel partialCopy()
public double getJointAngle(Joint joint)
joint
- public static double getJointAngleOf(Joint joint)
joint
- public Vector3D globalize(Vector3D relative)
relative
- public Vector3D relativize(Vector3D global)
relative
- public void processNewServerMessage(ParsedData data)
processNewServerMessage
in interface ParsedDataObserver
private void updateJointPositions(ParsedData data)
private Vector3D rotateVectorAroundVector(Vector3D initialVec, Vector3D axisV, double radAngle)
private Vector3D rotateVectorAroundZAxis(Vector3D initialVec, double angleV)
private Vector3D countRotatedXAxis(double angleRotateZ, double angleRotateY)
private double getAngleBetweenTwoVectors(Vector3D firstVec, Vector3D secondVec)
private void updatePureBodyAcceleration(ParsedData data)
private void adjustRotationsFor(Vector3D gyroscope)
private void updateRotations(ParsedData data)
private void updatePosition(ParsedData data)
public boolean isStanding()
public boolean isStanding(ParsedData data)
public boolean isOnGround()
private boolean isOnGroundJudgedByAccelerometer()
public boolean isLyingOnBack()
public boolean isLyingOnBelly()
public double getRotationX()
public double getRotationY()
public double getRotationZ()
public Vector3D getPosition()
public void setPosition(Vector3D position)
public void setRotationX(double rotationX)
public void setRotationY(double rotationY)
public ParsedData getLastDataReceived()
public void setRotationZ(double rotationZ)
public double getLastTimeFlagSeen()
public AgentModel afterAction(Annotation annotation)
annotation
-