uwcse.location.core
Class State

java.lang.Object
  |
  +--uwcse.location.core.State

public class State
extends Object

This class is and point estimate of an objet's location (translation and quaternion rotation) and its forward velocity in meters per seconds. A right-handed coordinate frame is assumed.

Version:
$Revision: 1.4 $
Author:
Jeffrey Hightower

Constructor Summary
State()
          Constructs and initializes a State to the origin with no rotation.
State(Point3d position)
          Constructs and initializes a State with the given position and no rotation.
State(Point3d position, Quat4d quaternion)
          Constructs and initializes a State with the given position and quaternion with 0 velocity.
State(Point3d position, Quat4d quaternion, double velocity)
          Constructs and initializes a State with the given position, quaternion, and velocity.
State(Point3d position, Vector3d eulerAngles)
          Constructs and initializes a State with the given position and Euler angles with 0 velocity.
State(State s)
          Constructs and initializes a State from the given State object.
 
Method Summary
 void addGaussianNoise(Random rand, Vector3d posSD, Vector3d rotSD)
          Add gaussian white noise to this state where the current position is used as the mean.
 Object clone()
          Overridden to perform a deep copy on the State.
static State computeMean(Collection states)
          Compute the mean State of the given collection of states.
static State computeWeightedMean(Collection samples)
          Compute the weighted mean State of the given collection of samples.
static State computeWeightedSD(State mean, Collection samples)
          Compute the weighted standard deviation State of the given collection of samples.
static double distanceBetween(State s1, State s2)
          Returns the linear distance between the position of the State sm1 and that of the sm2 State.
 boolean equals(Object o)
          Test for semantic equality to another State.
 Vector3d getHeading()
          Get the heading vector represented by this state given the "forward" vector of the object is the default unit vector along the x-axis.
 Point3d getPosition()
          Get the position of this state.
 Quat4d getQuaternion()
          Get the quaternion rotation of this State.
 double getVelocity()
          Get the linear velocity of this State.
 void move(double distance)
          Translate the position of this state the given distance along the current heading.
 void move(Vector3d motionVector)
          Translate the position of this state according to the given vector's direction and magnitude.
 void rotate(Quat4d quaternion)
          Rotate a state by the given quaterion.
 void rotate(Vector3d eulerAngles)
          Rotate this state by the given Euler angles.
 void set(State s)
          Set the this State using the given one.
 void setPosition(Point3d pos)
          Set the position of this state.
 void setQuaternion(Quat4d quaternion)
          Set the quaternion rotation of this State.
 void setQuaternionFromEuler(Vector3d eulerAngles)
          Set the quaternion rotation of this State using the given Euler angles.
 void setRandom(Random rand, Point3d min, Point3d max)
          Using the given source of randomness, set the position of this state according to a uniform distribution constrained by the upper and lower corners of the specified box and set the rotation randomly around all 3 axes.
 void setVelocity(double velocity)
          Set the linear velocity of this State.
 String toString()
          Overridden method to print the State in a human readable format.
 Point3d transform(Point3d p)
          Return a new point that is the given point transformed using the translation and rotation parameters of this state.
 Vector3d transform(Vector3d v)
          Return a new vector that is the given vector transformed using the translation and rotation parameters of this state.
 State transform(State s)
          Return a new State that is the given argument State transformed using the translation and rotation parameters of this state.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

State

public State()
Constructs and initializes a State to the origin with no rotation.


State

public State(Point3d position)
Constructs and initializes a State with the given position and no rotation.


State

public State(Point3d position,
             Vector3d eulerAngles)
Constructs and initializes a State with the given position and Euler angles with 0 velocity. Euler rotations are applied first about the X, then Y then Z axis. These rotations are applied using a static frame of reference. In other words, the orientation of the Y rotation axis is not affected by the X rotation and the orientation of the Z rotation axis is not affected by the X or Y rotation.


State

public State(Point3d position,
             Quat4d quaternion)
Constructs and initializes a State with the given position and quaternion with 0 velocity.


State

public State(Point3d position,
             Quat4d quaternion,
             double velocity)
Constructs and initializes a State with the given position, quaternion, and velocity.


State

public State(State s)
Constructs and initializes a State from the given State object.

Method Detail

clone

public Object clone()
Overridden to perform a deep copy on the State.

Overrides:
clone in class Object

getPosition

public Point3d getPosition()
Get the position of this state.


setPosition

public void setPosition(Point3d pos)
Set the position of this state.


getQuaternion

public Quat4d getQuaternion()
Get the quaternion rotation of this State.


setQuaternion

public void setQuaternion(Quat4d quaternion)
Set the quaternion rotation of this State.


getVelocity

public double getVelocity()
Get the linear velocity of this State.


setVelocity

public void setVelocity(double velocity)
Set the linear velocity of this State.


setQuaternionFromEuler

public void setQuaternionFromEuler(Vector3d eulerAngles)
Set the quaternion rotation of this State using the given Euler angles. Euler rotations are applied first about the X, then Y then Z axis. These rotations are applied using a static frame of reference. In other words, the orientation of the Y rotation axis is not affected by the X rotation and the orientation of the Z rotation axis is not affected by the X or Y rotation.


set

public void set(State s)
Set the this State using the given one.


equals

public boolean equals(Object o)
Test for semantic equality to another State.

Overrides:
equals in class Object

setRandom

public void setRandom(Random rand,
                      Point3d min,
                      Point3d max)
Using the given source of randomness, set the position of this state according to a uniform distribution constrained by the upper and lower corners of the specified box and set the rotation randomly around all 3 axes.

Parameters:
rand - A source of randomness.
min - Lower corner of the box in which to set the state randomly.
max - Upper corner of the box in which to set the state randomly.

getHeading

public Vector3d getHeading()
Get the heading vector represented by this state given the "forward" vector of the object is the default unit vector along the x-axis.


transform

public Point3d transform(Point3d p)
Return a new point that is the given point transformed using the translation and rotation parameters of this state. The given point is unmodified.


transform

public Vector3d transform(Vector3d v)
Return a new vector that is the given vector transformed using the translation and rotation parameters of this state. The given vector is unmodified.


transform

public State transform(State s)
Return a new State that is the given argument State transformed using the translation and rotation parameters of this state. The given State is unmodified.


move

public void move(double distance)
Translate the position of this state the given distance along the current heading. The rotation is unchanged.


move

public void move(Vector3d motionVector)
Translate the position of this state according to the given vector's direction and magnitude. The rotation is unchanged.


rotate

public void rotate(Vector3d eulerAngles)
Rotate this state by the given Euler angles. Euler rotations are applied first about the X, then Y then Z axis. These rotations are applied using a static frame of reference. In other words, the orientation of the Y rotation axis is not affected by the X rotation and the orientation of the Z rotation axis is not affected by the X or Y rotation.


rotate

public void rotate(Quat4d quaternion)
Rotate a state by the given quaterion.


addGaussianNoise

public void addGaussianNoise(Random rand,
                             Vector3d posSD,
                             Vector3d rotSD)
Add gaussian white noise to this state where the current position is used as the mean. This method assumes the noise is not correlated among the dimensions.

Parameters:
rand - a source of randomness
posSD - standard deviation of the positional noise
rotSD - standard deviation in radians of the Euler angle rotational noise

distanceBetween

public static double distanceBetween(State s1,
                                     State s2)
Returns the linear distance between the position of the State sm1 and that of the sm2 State.


computeMean

public static State computeMean(Collection states)
Compute the mean State of the given collection of states. The collection of states not modified. TODO: This almost certainly averages the quaternions incorrectly right now.


computeWeightedMean

public static State computeWeightedMean(Collection samples)
Compute the weighted mean State of the given collection of samples. The collection of samples not modified. TODO: This almost certainly averages the quaternions incorrectly right now.


computeWeightedSD

public static State computeWeightedSD(State mean,
                                      Collection samples)
Compute the weighted standard deviation State of the given collection of samples. The collection of samples is not modified. TODO: This almost certainly handles the quaternions incorrectly right now.


toString

public String toString()
Overridden method to print the State in a human readable format.

Overrides:
toString in class Object


This documentation is for the Location Stack v0.8. The latest distribution, the documentation, and the list of contributors to the Location Stack can always be found at http://portolano.cs.washington.edu/projects/location/

© Copyright 2004 University of Washington CSE