Implement new controller

Dependencies:   mbed-rtos mbed QEI BNO055 MPU6050_DMP_Nucleo-I2Cdev virgo3_imuHandler_Orion_PCB MAX17048 Servo

Fork of Orion_newPCB_test by Team Virgo v3

Committer:
akashvibhute
Date:
Thu Feb 04 02:11:36 2016 +0000
Revision:
6:690db8b5030b
Parent:
5:099cb2e76c7d
Child:
8:b4da70727fd4
PID tuned, general code cleanup

Who changed what in which revision?

UserRevisionLine numberNew contents of line
akashvibhute 2:761e3c932ce0 1 /*
akashvibhute 2:761e3c932ce0 2 *
akashvibhute 2:761e3c932ce0 3 * config.h Virgo v3 PCB AV22032015
akashvibhute 2:761e3c932ce0 4 *
akashvibhute 2:761e3c932ce0 5 */
akashvibhute 2:761e3c932ce0 6
akashvibhute 2:761e3c932ce0 7 #ifndef VirgoConfig_H
akashvibhute 2:761e3c932ce0 8 #define VirgoConfig_H
akashvibhute 2:761e3c932ce0 9
akashvibhute 2:761e3c932ce0 10 //** General Functions ****************************************************************************
akashvibhute 2:761e3c932ce0 11 #define PC_BAUDRATE 921600
akashvibhute 2:761e3c932ce0 12
akashvibhute 2:761e3c932ce0 13 //-------------------------------------------------------------------------------------------------
akashvibhute 2:761e3c932ce0 14
akashvibhute 2:761e3c932ce0 15 //** Function exectution rates ********************************************************************
akashvibhute 6:690db8b5030b 16 #define Hearbeat_RateHz 1 //hearbeat loop run rate in Hz
akashvibhute 4:315716ef8178 17 #define Hearbeat_RateMS (1000/Hearbeat_RateHz) //hearbeat loop run rate in ms
akashvibhute 4:315716ef8178 18
akashvibhute 2:761e3c932ce0 19 #define imu_UpdateRateHz 200 // imu update rate in Hz
akashvibhute 4:315716ef8178 20 #define imu_UpdatePeriodMS (1000/imu_UpdateRateHz) // imu update rate in ms
akashvibhute 4:315716ef8178 21
akashvibhute 2:761e3c932ce0 22 #define motorControl_UpdateRateHz 100 // motorControl update rate in Hz
akashvibhute 4:315716ef8178 23 #define motorControl_UpdatePeriodMS (1000/motorControl_UpdateRateHz) // motorControl update rate in ms
akashvibhute 4:315716ef8178 24
akashvibhute 2:761e3c932ce0 25 #define odometry_UpdateRateHz 125 //odometry update rate in Hz
akashvibhute 4:315716ef8178 26 #define odometry_UpdatePeriodMS (1000/odometry_UpdateRateHz) //odometry update rate in ms
akashvibhute 4:315716ef8178 27
akashvibhute 6:690db8b5030b 28 #define PrintLoop_RateHz 100 //print loop run rate in Hz
akashvibhute 4:315716ef8178 29 #define PrintLoop_PeriodMS (1000/PrintLoop_RateHz) //print loop run rate in ms
akashvibhute 4:315716ef8178 30
akashvibhute 2:761e3c932ce0 31 #define PurePursuit_UpdateRateHz 20//Pure pursuit update run rate in Hz
akashvibhute 4:315716ef8178 32 #define PurePursuit_UpdatePeriodMS (1000/PurePursuit_UpdateRateHz)//Pure pursuit update run rate in ms
akashvibhute 4:315716ef8178 33
akashvibhute 2:761e3c932ce0 34 #define WaypointCmd_UpdateRateHz 10 //waypoint commander run rate in Hz
akashvibhute 4:315716ef8178 35 #define WaypointCmd_UpdatePeriodMS (1000/WaypointCmd_UpdateRateHz) //waypoint commander run rate in ms
akashvibhute 4:315716ef8178 36
akashvibhute 6:690db8b5030b 37 #define CommLoop_UpdateRateHz 10 //Communications loop run rate in Hz
akashvibhute 4:315716ef8178 38 #define CommLoop_UpdatePeriodMS (1000/CommLoop_UpdateRateHz) //Communications loop run rate in ms
akashvibhute 4:315716ef8178 39
akashvibhute 6:690db8b5030b 40 #define CommPump_UpdateRateHz 250 //nRF network communications pump run rate in Hz
akashvibhute 5:099cb2e76c7d 41 #define CommPump_UpdatePeriodMS (1000/CommPump_UpdateRateHz) //nRF network communications pump run rate in ms
akashvibhute 5:099cb2e76c7d 42
akashvibhute 2:761e3c932ce0 43 #define nRfDefault_uploadRateMS 200 //default upload rate in ms for nRF wireless comm
akashvibhute 5:099cb2e76c7d 44
akashvibhute 5:099cb2e76c7d 45 #define camera_cycleMinutes 15 //default camera switch on frequency in minutes
akashvibhute 2:761e3c932ce0 46 #define camera_CaptureTimeS 30 //default camera capture time in seconds
akashvibhute 2:761e3c932ce0 47 //-------------------------------------------------------------------------------------------------
akashvibhute 2:761e3c932ce0 48
akashvibhute 4:315716ef8178 49
akashvibhute 4:315716ef8178 50 //** Drivetrain ********************************************************************************
akashvibhute 4:315716ef8178 51 //** Motor **
akashvibhute 4:315716ef8178 52 #define PWMfreq_khz 20
akashvibhute 2:761e3c932ce0 53
akashvibhute 6:690db8b5030b 54 #define PIDFf_kP 1.5
akashvibhute 6:690db8b5030b 55 #define PIDFf_kI 9.5
akashvibhute 6:690db8b5030b 56 #define PIDFf_kD 0.5
akashvibhute 6:690db8b5030b 57 #define PIDFf_kFf 1.5
akashvibhute 2:761e3c932ce0 58
akashvibhute 6:690db8b5030b 59 #define PIDFf_lim_P 0.3
akashvibhute 6:690db8b5030b 60 #define PIDFf_lim_I 0.5
akashvibhute 6:690db8b5030b 61 #define PIDFf_lim_D 0.2
akashvibhute 6:690db8b5030b 62 #define PIDFf_lim_Ff 0.5
akashvibhute 2:761e3c932ce0 63
akashvibhute 6:690db8b5030b 64 #define PIDFf_range_min -1.0
akashvibhute 6:690db8b5030b 65 #define PIDFf_range_max 1.0
akashvibhute 2:761e3c932ce0 66
akashvibhute 2:761e3c932ce0 67 #define pid_MWindowSize 10
akashvibhute 6:690db8b5030b 68
akashvibhute 6:690db8b5030b 69 //#define motor_LimitRPM_min -100.0
akashvibhute 6:690db8b5030b 70 //#define motor_LimitRPM_max 300.0
akashvibhute 6:690db8b5030b 71
akashvibhute 6:690db8b5030b 72 //#define motor_Acc_limit 200.0
akashvibhute 4:315716ef8178 73 //-------------
akashvibhute 2:761e3c932ce0 74
akashvibhute 4:315716ef8178 75 //** Encoder **
akashvibhute 4:315716ef8178 76 #define encoder_resolution 104
akashvibhute 4:315716ef8178 77 #define encoder_MWindowSize 12
akashvibhute 4:315716ef8178 78 //-------------
akashvibhute 2:761e3c932ce0 79 //-------------------------------------------------------------------------------------------------
akashvibhute 2:761e3c932ce0 80
akashvibhute 2:761e3c932ce0 81
akashvibhute 4:315716ef8178 82
akashvibhute 2:761e3c932ce0 83 //** Localization *********************************************************************************
akashvibhute 4:315716ef8178 84 //** IMU **
akashvibhute 4:315716ef8178 85 #define Pose_MWindowSize 10
akashvibhute 4:315716ef8178 86 #define GyroAcc_MWindowSize 25
akashvibhute 4:315716ef8178 87
akashvibhute 4:315716ef8178 88 //* MPU9150 *
akashvibhute 4:315716ef8178 89 #define MPU6050_StabilizationReadings 10 //number of non deviating data points to determine if imu has stabilized
akashvibhute 4:315716ef8178 90 #define IMU_FIFO_RATE_DIVIDER 0x01 // FIFO rate = 200Hz / (1 + this value), range 0x00 to 0x09. Here, 0x01 implies 100Hz.
akashvibhute 4:315716ef8178 91 #define IMU_SAMPLE_RATE_DIVIDER 1 // Sample rate = 1kHz / (1 + this value), Here, 1 implies 500Hz.
akashvibhute 4:315716ef8178 92 #define MPU6050_GYRO_FS MPU6050_GYRO_FS_2000 // measuring range of gyroscope (±n deg/s)
akashvibhute 4:315716ef8178 93 #define MPU6050_ACCEL_FS MPU6050_ACCEL_FS_2 // measuring range of acceleration sensor (±n g)
akashvibhute 4:315716ef8178 94 //* ** *
akashvibhute 4:315716ef8178 95
akashvibhute 4:315716ef8178 96 //* BNO055 *
akashvibhute 4:315716ef8178 97 #define BNO055_StabilizationReadings 10 //number of non deviating data points to determine if imu has stabilized
akashvibhute 4:315716ef8178 98
akashvibhute 4:315716ef8178 99 //* ** *
akashvibhute 4:315716ef8178 100
akashvibhute 5:099cb2e76c7d 101 //* Localization *
akashvibhute 2:761e3c932ce0 102 #define wheel_dia 10 //wheel dia in mm
akashvibhute 5:099cb2e76c7d 103 #define track_width 25 //wheel dia in mm
akashvibhute 5:099cb2e76c7d 104
akashvibhute 2:761e3c932ce0 105
akashvibhute 2:761e3c932ce0 106 //-------------------------------------------------------------------------------------------------
akashvibhute 2:761e3c932ce0 107
akashvibhute 2:761e3c932ce0 108
akashvibhute 2:761e3c932ce0 109 //** Drivetrain commander *************************************************************************
akashvibhute 2:761e3c932ce0 110 #define track_width 25 //track width in mm
akashvibhute 2:761e3c932ce0 111 #define driveTrain_minV 100 //min velocity of individual drive in mm/s
akashvibhute 2:761e3c932ce0 112 #define driveTrain_maxV 200 //max velocity of individual drive in mm/s
akashvibhute 2:761e3c932ce0 113
akashvibhute 2:761e3c932ce0 114 //-------------------------------------------------------------------------------------------------
akashvibhute 2:761e3c932ce0 115
akashvibhute 2:761e3c932ce0 116 //** Communications *******************************************************************************
akashvibhute 2:761e3c932ce0 117 #define virgo3_robot_address 01 //address of this robot node
akashvibhute 2:761e3c932ce0 118 #define virgo3_network_channel 90 //communications channel number
akashvibhute 2:761e3c932ce0 119
akashvibhute 2:761e3c932ce0 120 //-------------------------------------------------------------------------------------------------
akashvibhute 2:761e3c932ce0 121
akashvibhute 2:761e3c932ce0 122
akashvibhute 2:761e3c932ce0 123 //** HansonController *****************************************************************************
akashvibhute 2:761e3c932ce0 124 #define wheelV_MWindowSize 25 //wheel velocity moving window filter size, customized for Pitch controller
akashvibhute 2:761e3c932ce0 125
akashvibhute 2:761e3c932ce0 126 //-------------------------------------------------------------------------------------------------
akashvibhute 2:761e3c932ce0 127 #endif /* VirgoConfig_H */