/****************************************************************************
*   File: libwheeled.h
*                                                                           *
*       Copyright 1995 by Loral Advanced Distributed Simulation, Inc.       *
*                                                                           *
*               Loral Advanced Distributed Simulation, Inc.                 *
*               50 Moulton Street                                           *
*               Cambridge, MA 02138                                         *
*               617-441-2000                                                *
*                                                                           *
*       This software was developed by Loral under U. S. Government contracts *
*       and may be reproduced by or for the U. S. Government pursuant to    *
*       the copyright license under the clause at DFARS 252.227-7013        *
*       (OCT 1988).                                                         *
*                                                                           *
*       Contents: Public header file for libwheeled
*       Created: Tue Jul 20 16:42:59 EDT 1993
*       Author: wtaylor
*      $Revision$                                                     *
*       Remarks:                                                            *
*                                                                           *
****************************************************************************/

#ifndef _LIBWHEELED_H_INCLUDED
#define _LIBWHEELED_H_INCLUDED

#include <stdtypes.h> /*common/include/global*/
#include <libclass.h>
#include <libctdb.h>

/**
 ** wheeled parametric data structure.
 **/

/* Data file entry should read:
 *
 * (wheeled (soils (<integer soil type> (max_speeds <float forward KPH>
 *                                                  <float reverse KPH>)
 *                                      (max_accel <float mps2>)
 *                                      (max_decel <float mps2>)
 *                                      (max_turn  <float dps>)
 *                                      (max_climb <float degrees>)
 *                                      (dust_speeds <float smallKPH>
 *                                                   <float mediumKPH>
 *                                                   <float largeKPH>))
 *                 (<integer soil type> (max_speeds <float KPH>
 *                                                  <float reverse KPH>)
 *                                      (max_accel <float mps2>)
 *                                      (max_decel <float mps2>)
 *                                      (max_turn  <float dps>)
 *                                      (max_climb <float degrees>)
 *                                      (dust_speeds <float smallKPH>
 *                                                   <float mediumKPH>
 *                                                   <float largeKPH>))
 *                  ...)
 *          (fuel_usage (<float speed> ...)
			(<float rate>  ...))
 *  )
 */

#define WHL_MAX_FUEL_DIM 10

typedef struct wheeled_parametric_data
{
#if 0
    float64 fuel_usage_mpl; /* meters per liter */
#endif
    int fuel_table_length;
    float64 fuel_speeds[WHL_MAX_FUEL_DIM]; 
    float64 fuel_rates[WHL_MAX_FUEL_DIM];
    uint32  in_trouble_limit;         /* milliseconds */

    /* CCTT Mobility Model Parameters */
    int32       mobility_model;
    float64     throttle_forward_loop_gain;
    float64     throttle_accel_feedback_gain;
    float64     tau_throttle_inv;
    float64     heading_error_rate_tau;
    float64     reverse_drive_factor;
    float64     turn_radius_inv;
    int32     n_throttle_positions;
    int32     n_slopes;
    int32     n_soil_types;
    int32     n_speeds;
    int32     n_brake_positions;

    int32 n_soils;
    struct wheeled_soils
    {
	uint32 soil_type;
#define WHEELED_MAX_FORWARD 0
#define WHEELED_MAX_REVERSE 1
	float64 max_speeds_mps[2];
	float64 max_dry_slope;
	float64 max_wet_slope;
	float64 max_accel_mps2;
	float64 max_decel_mps2;
	float64 max_turn_rps;
	float64 max_climb_sin;
	float64 dust_speeds_mps[3];
    } soils[1];	
} WHEELED_PARAMETRIC_DATA;

/** 
 ** Functions relating to global libtwheeled operation
 **
 **/

/* wheeled_init:
 *
 * Initializes libwheeled.  Call this before calling any other libwheeled
 * functions.
 */
extern void wheeled_init(int32 cant, char *data_path, int32 constant_env,
			 int32 mobility_sw);

/* functions for interfacing statistics to parser commands */
extern void wheeled_statsOn(void);
extern void wheeled_statsOff(void);
extern void wheeled_statsReset(void);
extern void wheeled_statsPrint(void);
extern void wheeled_statsStatus(void);
extern void wheeled_statsQuit(void);


/**
 ** Functions relating to per-vehicle wheeled class information.
 **
 **/

#endif /*_LIBWHEELED_H_INCLUDED*/
