Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: AsyncSerial Lib_DFPlayerMini Lib_MPU9250_SPI mbed
defines.h
00001 #ifndef __DEFINES_H__ 00002 #define __DEFINES_H__ 00003 00004 #include "mbed.h" 00005 #include "AsyncSerial.hpp" 00006 00007 #include "Lib_DFPlayerMini.h" 00008 #include "Lib_MPU9250.h" 00009 #include "filter_func.h" 00010 00011 // compile option 00012 //#define USE_SERIAL_DEBUG 00013 #define USE_LED_DEBUG 00014 #define USE_FILESYSTEM 00015 #define USE_FIRST_IMU 00016 #define USE_SECOND_IMU 00017 #define USE_MOTOR_CONTROL 00018 #define USE_STEER_CONTROL 00019 00020 #ifdef USE_SERIAL_DEBUG 00021 #define DEBUG_BAUDRATE 115200 00022 AsyncSerial usb_serial( USBTX, USBRX ); 00023 #endif 00024 00025 #ifdef USE_LED_DEBUG 00026 DigitalOut myled[4] = { LED1, LED2, LED3, LED4 }; 00027 #endif 00028 00029 #define PROCESS_INTERVAL_SEC (0.01f) 00030 00031 #define CAN_RX (p30) 00032 #define CAN_TX (p29) 00033 00034 #define MPU9250_CS (p7) 00035 #define MPU9250_MOSI (p11) 00036 #define MPU9250_MISO (p12) 00037 #define MPU9250_SCK (p13) 00038 #define MPU9250_INT (p8) 00039 00040 #define MPU9250_SDA (p9) 00041 #define MPU9250_SCL (p10) 00042 00043 #define DFPLAYER_RX (p27) 00044 #define DFPLAYER_TX (p28) 00045 #define DFPLAYER_BUSY (p18) 00046 00047 #define NEOPIXEL_DOUT (p21) 00048 00049 #define DEVID_LEFT (0x01) 00050 #define DEVID_RIGHT (0x04) 00051 00052 typedef struct _STRUCTSENSOR{ 00053 float acc[3]; 00054 float gyro[3]; 00055 float mag[3]; 00056 } STRUCTSENSOR; 00057 00058 typedef struct _STRUCTPOSTURE{ 00059 float angle; 00060 float angle_vel; 00061 float wheel[2]; 00062 float wheel_vec[2]; 00063 } STRUCTPOSTURE; 00064 00065 typedef struct _STRUCTCONRTOLPARAM{ 00066 float K_angle; 00067 float K_angle_vel; 00068 float K_wheel; 00069 float K_wheel_vel; 00070 float K_rot_vel; 00071 float K_trans_vel; 00072 float C_max_angle; 00073 float C_offset_angle; 00074 } STRUCTCONRTOLPARAM; 00075 00076 typedef struct _STRUCTGAMEPAD{ 00077 float x_raw; 00078 float y_raw; 00079 float x_filtered; 00080 float y_filtered; 00081 float C_dead_angle; 00082 float C_max_angle; 00083 } STRUCTGAMEPAD; 00084 00085 extern STRUCTSENSOR sensor_vehicle; 00086 extern STRUCTSENSOR sensor_interface; 00087 extern STRUCTPOSTURE posture; 00088 extern STRUCTCONRTOLPARAM control; 00089 extern STRUCTGAMEPAD pad; 00090 00091 00092 //extern Ticker tic_sen_ctrl; 00093 //extern CAN can_driver; 00094 //extern MPU9250 imu; 00095 //extern DFPlayerMini player; 00096 00097 #endif
Generated on Sat Jul 16 2022 06:27:20 by
