#define	sampling_period_wheels	0.05
#define	sampling_period_rpm	0.15//0.125

#define	fl_ticks_to_rpm		(60/sampling_period_wheels)/100		//60sec update 100ticks per rev
#define	fr_ticks_to_rpm		(60/sampling_period_wheels)/100		//60sec update 100ticks per rev
#define	rl_ticks_to_rpm		(60/sampling_period_wheels)/100		//60sec update 100ticks per rev
#define	rr_ticks_to_rpm		(/*0.6*/60/sampling_period_wheels)/100		//60sec update 100ticks per rev
#define	rpm_ticks_to_rpm	(60/sampling_period_rpm)			//60sec update / ignitions per rev

//ADC convertions
#define	VRef_5							5
#define	VRef_3_3						3.3
#define	fr_acc_volts_2_g(voltage)		(double)((voltage-((double)VRef_5/2))/0.75)
#define	imu_acc_volts_2_g(voltage)		(double)((voltage-((double)VRef_3_3/2))/0.33)
#define	imu_rate_volts_2_deg_x(voltage)	(double)((voltage-1.5)/0.002)//((voltage-1.395)/0.002)
#define	imu_rate_volts_2_deg_y(voltage)	(double)((voltage-1.5)/0.002)//((voltage-1.4705)/0.002)

//Torque sensor
#define	torque_a		10
#define	torque_b		0.68
#define	torque_volts_2_NM(voltage,torque_a,torque_b)			(double)(torque_a*(voltage-torque_b))

//Handbrake position
#define	handbrake_volts_2_pos(voltage,a,b)		(double)(a*voltage+b)

//Steering angle
#define	steering_volts_2_deg(voltage,a,b)		(double)(-a*voltage+b)

//Brakes
#define	front_brake_volts_2_bar(voltage)		(double)(((voltage - 0.58)/4)*250)
#define	rear_brake_volts_2_bar(voltage)			(double)(((voltage - 0.58)/4)*250)
