예제 #1
0
int sched_integ(  /* RETURN: -- Always return zero */
  SCHEDULE *S )   /* INOUT:  -- Schedule struct */
{

    int ipass;

    /* LOAD THE POSITION AND VELOCITY STATES */
    load_state(
        &S->pos ,
        &S->vel ,
        NULL
    );

    /* LOAD THE POSITION AND VELOCITY STATE DERIVATIVES */
    load_deriv(
        &S->vel ,
        &S->acc ,
        NULL
    );

    /* CALL THE TRICK INTEGRATION SERVICE */
    ipass = integrate();

    /* UNLOAD THE NEW POSITION AND VELOCITY STATES */
    unload_state(
        &S->pos ,
        &S->vel ,
        NULL
    );

    /* RETURN */
    return( ipass );
}
예제 #2
0
/*!
 * @brief Bouncing ball state Trick compliant integration routine.
 *
 * This routine performs the following:
 *
 *   - Loads position into the integrator states.
 *   - Loads velocity into the integrator states.
 *   - Loads velocity into the integrator derivatives.
 *   - Loads acceleration into the integrator derivatives.
 *   - Calls the Trick integration service.
 *   - Unloads the propagated position and velocity from the integrator states.
 *
 * @job_class{ integration }
 *
 * @return Returns the Trick integration pass for the selected integration method.
 * @param [inout] state Ball EOM state parameters.
 */
int bounce_state_integ( /* RETURN: -- Integration multi-step id */
  BounceState * state ) /* INOUT:  -- Bounce EOM state parameters */
{

   int ipass;

   /* LOAD THE POSITION AND VELOCITY STATES */
   load_state(
      &state->position,
      &state->velocity,
      NULL
   );

   /* LOAD THE POSITION AND VELOCITY STATE DERIVATIVES */
   load_deriv(
      &state->velocity,
      &state->acceleration,
      NULL
   );

   /* CALL THE TRICK INTEGRATION SERVICE */
   ipass = integrate();

   /* UNLOAD THE NEW POSITION AND VELOCITY STATES */
   unload_state(
      &state->position,
      &state->velocity,
      NULL
   );

   /* RETURN */
   return( ipass );
}
예제 #3
0
/* The cannonball sim's integration job */
int cannon_integ( CANNON* C ) {

    int ipass;
    /* LOAD THE POSITION AND VELOCITY STATES */
    load_state(
        &C->pos[0], &C->pos[1] ,
        &C->vel[0], &C->vel[1] ,
        &C->time,
        NULL
    );
    /* LOAD THE POSITION AND VELOCITY STATE DERIVATIVES */
    load_deriv(
        &C->vel[0], &C->vel[1] ,
        &C->acc[0], &C->acc[1] ,
        &C->timeRate,
        NULL
    );
    /* CALL THE TRICK INTEGRATION SERVICE */
    ipass = integrate();
    /* UNLOAD THE NEW POSITION AND VELOCITY STATES */
    unload_state(
        &C->pos[0], &C->pos[1] ,
        &C->vel[0], &C->vel[1] ,
        &C->time,
        NULL
    );
    /* RETURN */
    return( ipass );
}
예제 #4
0
int cannon_integ_aero(
  CANNON_AERO* C)
{

    int ipass;

    /* GET SHORTHAND NOTATION FOR DATA STRUCTURES */
    CANNON_AERO_OUT *CAO = &(C->out) ;

    /* LOAD THE POSITION AND VELOCITY STATES */
    load_state(
        &CAO->position[0] ,
        &CAO->position[1] ,
        &CAO->position[2] ,
        &CAO->velocity[0] ,
        &CAO->velocity[1] ,
        &CAO->velocity[2] ,
        NULL
    );

    /* LOAD THE POSITION AND VELOCITY STATE DERIVATIVES */
    load_deriv(
        &CAO->velocity[0] ,
        &CAO->velocity[1] ,
        &CAO->velocity[2] ,
        &CAO->acceleration[0] ,
        &CAO->acceleration[1] ,
        &CAO->acceleration[2] ,
        NULL
    );

    /* CALL THE TRICK INTEGRATION SERVICE */
    ipass = integrate();

    /* UNLOAD THE NEW POSITION AND VELOCITY STATES */
    unload_state(
        &CAO->position[0] ,
        &CAO->position[1] ,
        &CAO->position[2] ,
        &CAO->velocity[0] ,
        &CAO->velocity[1] ,
        &CAO->velocity[2] ,
        NULL
    );

    /* RETURN */
    return( ipass );
}
예제 #5
0
int VehicleOne::state_integ() {
    int integration_step;

    load_state(
                &heading,
                &headingRate,
                &position[0],
                &position[1],
                &velocity[0],
                &velocity[1],
                (double*)0
              );

    load_deriv(
                &headingRate,
                &headingAccel,
                &velocity[0],
                &velocity[1],
                &acceleration[0],
                &acceleration[1],
                (double*)0
              );

    integration_step = integrate();

    unload_state(
                &heading,
                &headingRate,
                &position[0],
                &position[1],
                &velocity[0],
                &velocity[1],
                (double*)0
              );

    if (!integration_step) {
        if (heading < -PI) heading +=  2*PI;
        if (heading >  PI) heading += -2*PI;
    }

    return(integration_step);

}
예제 #6
0
/* ENTRY POINT */
int ball_state_integ( /* RETURN: -- Integration multi-step id */
  BSTATE *S )         /* INOUT:  -- Ball EOM state parameters */
{

    int ipass;

    /* GET SHORTHAND NOTATION FOR DATA STRUCTURES */
    BSTATE_OUT *SO = &(S->output) ;

    /* LOAD THE POSITION AND VELOCITY STATES */
    load_state(
        &SO->position[0] ,
        &SO->position[1] ,
        &SO->velocity[0] ,
        &SO->velocity[1] ,
        NULL
    );

    /* LOAD THE POSITION AND VELOCITY STATE DERIVATIVES */
    load_deriv(
        &SO->velocity[0] ,
        &SO->velocity[1] ,
        &SO->acceleration[0] ,
        &SO->acceleration[1] ,
        NULL
    );

    /* CALL THE TRICK INTEGRATION SERVICE */
    ipass = integrate();

    /* UNLOAD THE NEW POSITION AND VELOCITY STATES */
    unload_state(
        &SO->position[0] ,
        &SO->position[1] ,
        &SO->velocity[0] ,
        &SO->velocity[1] ,
        NULL
    );

    /* RETURN */
    return( ipass );
}
예제 #7
0
/* ENTRY POINT */
int Ball::state_integ() {

   int ipass;

   /* GET SHORTHAND NOTATION FOR DATA STRUCTURES */
   BallStateOutput * state_out = &(this->state.output);

   /* LOAD THE POSITION AND VELOCITY STATES */
   load_state(
       &state_out->position[0] ,
       &state_out->position[1] ,
       &state_out->velocity[0] ,
       &state_out->velocity[1] ,
       NULL
   );

   /* LOAD THE POSITION AND VELOCITY STATE DERIVATIVES */
   load_deriv(
       &state_out->velocity[0] ,
       &state_out->velocity[1] ,
       &state_out->acceleration[0] ,
       &state_out->acceleration[1] ,
       NULL
   );

   /* CALL THE TRICK INTEGRATION SERVICE */
   ipass = integrate();

   /* UNLOAD THE NEW POSITION AND VELOCITY STATES */
   unload_state(
       &state_out->position[0] ,
       &state_out->position[1] ,
       &state_out->velocity[0] ,
       &state_out->velocity[1] ,
       NULL
   );

   /* RETURN */
   return( ipass );

}
예제 #8
0
/*!
 * @brief Ball state Trick compliant integration routine.
 *
 * This routine performs the following:
 *
 *   - Loads position into the integrator states.
 *   - Loads velocity into the integrator states.
 *   - Loads velocity into the integrator derivatives.
 *   - Loads acceleration into the integrator derivatives.
 *   - Calls the Trick integration service.
 *   - Unloads the propagated position and velocity from the integrator states.
 *
 * @job_class{ integration }
 *
 * @return Returns the Trick integration pass for the selected integration method.
 * @param [inout] state Ball EOM state parameters.
 */
int ball_state_integ(
  BallState * state )
{

   int ipass;

   /* LOAD THE POSITION AND VELOCITY STATES */
   load_state(
      &state->position[0],
      &state->position[1],
      &state->velocity[0],
      &state->velocity[1],
      NULL
   );

   /* LOAD THE POSITION AND VELOCITY STATE DERIVATIVES */
   load_deriv(
      &state->velocity[0],
      &state->velocity[1],
      &state->acceleration[0],
      &state->acceleration[1],
      NULL
   );

   /* CALL THE TRICK INTEGRATION SERVICE */
   ipass = integrate();

   /* UNLOAD THE NEW POSITION AND VELOCITY STATES */
   unload_state(
      &state->position[0],
      &state->position[1],
      &state->velocity[0],
      &state->velocity[1],
      NULL
   );

   /* RETURN */
   return( ipass );
}