javax.robotics.ode
Interface Solver2

All Known Implementing Classes:
Euler2, RungeKutta4th2

public interface Solver2

This class is an interface for differents numerical integration methods of first order differential equations system.
The implementation of a solver could be done writing:

 ...
 public MyODESolver implements DerivableFunction2
 {
      ...
      RVector x0 = new RVector(n);
      RVector y0 = new RVector(n);
      // Creating the solver
      Solver2 mySolver = Euler2(0.1, // time interval integration
                              x0,  // initial condition position
                              y0,  // initial condition velocity 
                              this // function xDot2 is passed to Solver
                             );
      ...
      
      // integration at time t+dt of x'' = f(x, y) implemented by xDot2(x, y) function - y=x'
      mySolver.step(x_t, y_t);
      
      // current time integration
      t_dt = mySolver.getTime();
      
      // current integrated value
      x_dt = mySolver.getLastValuePosition();
      y_dt = mySolver.getLastValueVelocity();
      ...
      
      // implementation of x'' = f(x, x') y= x';
      public RVector xDot2(RVector x, RVector y)
      {
          ...
          // code to calculate x'' = f(x, y)
          ...
          return xdot2;
      }
 }
 

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

Field Summary
static double startTime
           
 
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').
 

Field Detail

startTime

static final double startTime
See Also:
Constant Field Values
Method Detail

setSampleTime

void setSampleTime(double dt)
Sets the interval of integration.

Parameters:
dt - interval [sec]

getSampleTime

double getSampleTime()
Gets the interval of integration.

Returns:
the dt interval [sec]

getTime

double getTime()
Gets current time of integration.

Returns:
the current time [sec]

resetTime

void resetTime()
Sets the current time to zero.


setInitialConditionPosition

void setInitialConditionPosition(RVector initialCondition)
Sets the initial condition for position x(0) = x0.

Parameters:
initialCondition -

getInitialConditionPosition

RVector getInitialConditionPosition()
Gets the initial condition for position x(0).

Returns:
the initialCondition

getLastValuePosition

RVector getLastValuePosition()
Gets the current value of position x computed by step function.

Returns:
the current position.

setInitialConditionVelocity

void setInitialConditionVelocity(RVector initialCondition)
Sets the initial condition for velocity x'(0) = y0.

Parameters:
initialCondition -

getInitialConditionVelocity

RVector getInitialConditionVelocity()
Gets the initial condition for velocity x'(0).

Returns:
the initialCondition

getLastValueVelocity

RVector getLastValueVelocity()
Gets the current value of velocity x'computed by step function.

Returns:
the current velocity.

setTargetFunction

void setTargetFunction(DerivableFunction2 target)
Sets the target function to be integrated

Parameters:
target - the function.

step

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

Parameters:
position - x argument of f(x, x')
velocity - x' argument of f(x, x')