ediff iitb / Mbed 2 deprecated HIL_FMEA_oursteering

Dependencies:   mbed

define_variables.h

Committer:
ediff_iitbracing
Date:
2013-03-06
Revision:
2:eb4101b574bc
Parent:
1:fec1d091fa34

File content as of revision 2:eb4101b574bc:

#ifndef DEFINEVARIABLES_H
#define DEFINEVARIABLES_H

#include "mbed.h"
#include "steering.h"
#define wheel_Left_pin  p25
#define wheel_Right_pin p23

#define throttle_Left_pwm_pin  p22
#define throttle_Right_pwm_pin p21

#define algoperiod 100000                         //entire algo (pid + steering
#define fmeatime 

//car parameters
extern const float trackwidth; 
extern const float wheelradius; 
extern const float rear_wheelbase;

//constant parameters
extern const float full_throttle;
extern const float dead_steering;
extern const float dead_rpm;
extern const float integral_saturation;

//steering and throttle inputs
extern float steering;          //input steering angle
extern float throttle;          //throttle input from pedal

//delta_Left, delta_Right, turnradius and wratio_desired calculated realtime from delta (delta_Left and delta_Right are Left and Right tyre angles)
extern float delta_Left;        //Left wheel Steer angle
extern float delta_Right;       //Right wheel Steer angle
extern float turnradius;
extern float wratio_desired;    //Right/Left

// output values
// assumed range of output 0-5V
extern float throttle_Left, throttle_Right, throttle_Left_pulsewidth, throttle_Right_pulsewidth;

extern Ticker check;
//Serial pc(USBTX, USBRX);

//rpm counts
extern volatile int cnt_Left, cnt_Right;

//RPM feedback pins
extern AnalogIn steeringread;
extern AnalogIn throttleread;

//Left and Right rear RPMs feedback-input 
extern float rpm_Left;
extern float rpm_Right;

//Openloop Flag
extern volatile bool openloop;
extern const float rpm_openloop_limit;

//PID constants
extern float kp;
extern float kd;
extern float ki;
extern float c;

//For PID
extern const float timeint;
extern float integral;
extern float derivative;
extern float error_prev;     //error at t0
extern float error_new;       //error at t
extern float wratio_actual;
extern float w_ratio;      //ratio of controller voltages - Right/Left

//virtual sensors
extern float steering2, throttle2, yaw_rate;
extern float yaw_rate_desired;

//fmea output
extern bool shutdown;
extern bool Dash;

#endif