javax.robotics.ode
Class Euler2

java.lang.Object
  extended by javax.robotics.ode.Euler2
All Implemented Interfaces:
DerivableFunction2, Solver2
Direct Known Subclasses:
RungeKutta4th2

public class Euler2
extends java.lang.Object
implements DerivableFunction2, Solver2

This class implements forward Euler integration method for systems of two first order differential equations.

x''=f(x, x') with x(0)=x0, x'(0)= y0, is equivalent to system of two first order of differential equation:
y' = f(x, y)
x' = y
with x(0)=x0, y(0)= y0

Since:
1.0.3
Version:
09/11/2005
Author:
Carmine Lia

Field Summary
 
Fields inherited from interface javax.robotics.ode.Solver2
startTime
 
Constructor Summary
Euler2(double dt, RVector initialConditionPosition, RVector initialConditionVelocity)
          Defines numerical integration for x'' = f(x, x') as system of two first order differential equation.
Euler2(double dt, RVector initialConditionPosition, RVector initialConditionVelocity, DerivableFunction2 target)
          Defines numerical integration for x'' = f(x, x') as system of two first order differential equation.
 
Method Summary
 RVector getInitialConditionPosition()
          Gets the initial condition for position x(0).
 RVector getInitialConditionVelocity()
          Gets the initial condition for velocity x'(0).
 RVector getLastValuePosition()
          Gets the current value of position x computed by step function.
 RVector getLastValueVelocity()
          Gets the current value of velocity x'computed by step function.
 double getSampleTime()
          Gets the interval of integration.
 double getTime()
          Gets current time of integration.
 void resetTime()
          Sets the current time to zero.
 void setInitialConditionPosition(RVector initialCondition)
          Sets the initial condition for position x(0) = x0.
 void setInitialConditionVelocity(RVector initialCondition)
          Sets the initial condition for velocity x'(0) = y0.
 void setSampleTime(double dt)
          Sets the interval of integration.
 void setTargetFunction(DerivableFunction2 target)
          Sets the target function to be integrated
 void step(RVector position, RVector velocity)
          Computes step integration from time t to t+dt of x'' = f(x, x').
 RVector xDot2(RVector x, RVector y)
          Second order function x'' = f(x, x').
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Euler2

public Euler2(double dt,
              RVector initialConditionPosition,
              RVector initialConditionVelocity)
Defines numerical integration for x'' = f(x, x') as system of two first order differential equation.

Parameters:
dt - time interval of integration [sec]
initialConditionPosition - position at time zero x(0).
initialConditionVelocity - velocity at time zero x'(0).

Euler2

public Euler2(double dt,
              RVector initialConditionPosition,
              RVector initialConditionVelocity,
              DerivableFunction2 target)
Defines numerical integration for x'' = f(x, x') as system of two first order differential equation.

Parameters:
dt - time interval of integration [sec]
initialConditionPosition - position at time zero x(0).
initialConditionVelocity - velocity at time zero x'(0).
target - differential equation to be integrated
Method Detail

setSampleTime

public final void setSampleTime(double dt)
Description copied from interface: Solver2
Sets the interval of integration.

Specified by:
setSampleTime in interface Solver2
Parameters:
dt - interval [sec]

getSampleTime

public final double getSampleTime()
Description copied from interface: Solver2
Gets the interval of integration.

Specified by:
getSampleTime in interface Solver2
Returns:
the dt interval [sec]

setInitialConditionPosition

public final void setInitialConditionPosition(RVector initialCondition)
Description copied from interface: Solver2
Sets the initial condition for position x(0) = x0.

Specified by:
setInitialConditionPosition in interface Solver2

setInitialConditionVelocity

public final void setInitialConditionVelocity(RVector initialCondition)
Description copied from interface: Solver2
Sets the initial condition for velocity x'(0) = y0.

Specified by:
setInitialConditionVelocity in interface Solver2

getInitialConditionPosition

public final RVector getInitialConditionPosition()
Description copied from interface: Solver2
Gets the initial condition for position x(0).

Specified by:
getInitialConditionPosition in interface Solver2
Returns:
the initialCondition

getInitialConditionVelocity

public final RVector getInitialConditionVelocity()
Description copied from interface: Solver2
Gets the initial condition for velocity x'(0).

Specified by:
getInitialConditionVelocity in interface Solver2
Returns:
the initialCondition

getLastValuePosition

public final RVector getLastValuePosition()
Description copied from interface: Solver2
Gets the current value of position x computed by step function.

Specified by:
getLastValuePosition in interface Solver2
Returns:
the current position.

getLastValueVelocity

public final RVector getLastValueVelocity()
Description copied from interface: Solver2
Gets the current value of velocity x'computed by step function.

Specified by:
getLastValueVelocity in interface Solver2
Returns:
the current velocity.

getTime

public final double getTime()
Description copied from interface: Solver2
Gets current time of integration.

Specified by:
getTime in interface Solver2
Returns:
the current time [sec]

resetTime

public final void resetTime()
Description copied from interface: Solver2
Sets the current time to zero.

Specified by:
resetTime in interface Solver2

setTargetFunction

public void setTargetFunction(DerivableFunction2 target)
Description copied from interface: Solver2
Sets the target function to be integrated

Specified by:
setTargetFunction in interface Solver2
Parameters:
target - the function.

step

public void step(RVector position,
                 RVector velocity)
Description copied from interface: Solver2
Computes step integration from time t to t+dt of x'' = f(x, x'). The params last value position and velocity are modified.

Specified by:
step in interface Solver2
Parameters:
position - x argument of f(x, x')
velocity - x' argument of f(x, x')

xDot2

public RVector xDot2(RVector x,
                     RVector y)
Description copied from interface: DerivableFunction2
Second order function x'' = f(x, x').

Specified by:
xDot2 in interface DerivableFunction2
Parameters:
x - first indipendent variable (position)
y - second indipendent variable (velocity).
Returns:
x'' (acceleration)