/* Some sizes */
#define N_STATE_DIMENSIONS 6
#define N_ACTION_DIMENSIONS 3

/* State vector indices */
#define S_P1 0
#define S_P2 1
#define S_P3 2
#define S_V1 3
#define S_V2 4
#define S_V3 5

/* Action vector indices */
#define A_T1 0
#define A_T2 1
#define A_T3 2

// Timestep of integrator
#define TIMESTEP 0.01 

// 0.1 viscous friction at each joint
#define VISCOUS_FRICTION 0.0 
#define GRAVITY 9.81

/* Score parameters */
#define STATE_PENALTY 1.0
#define ACTION_PENALTY 1.0

/* Treat the contents of this definition as hidden */
typedef struct dynamics_struct
{
  double time;
  double state[N_STATE_DIMENSIONS];
  double desired_state[N_STATE_DIMENSIONS];
  unsigned seed; /* random number generator seed for rand_r() */
} Dynamics;
  
/* The dynamics API */
int init_dynamics();
Dynamics *create_dynamics();
int set_state( Dynamics *d, double time, double *state );
int integrate_one_step( Dynamics *d, double *action, double *next_state );
int integrate_one_step_alt( Dynamics *d, double *state, double *action,
			    double *next_state );
double one_step_cost( Dynamics *d, double *state, double *action );

/* It is handy to have this global */
extern double the_desired_state[];

