Q
Dependencies: SRF05 ros_lib_kinetic TinyGPSPlus
PROJ515.hpp
- Committer:
- Luka_Danilovic
- Date:
- 2019-05-02
- Revision:
- 2:7288dd12186e
- Parent:
- 1:ea2ee36038e7
- Child:
- 3:cd1f2bde7ac2
File content as of revision 2:7288dd12186e:
#ifndef __PROJ515_H__ //Inclusion safeguards #define __PROJ515_H__ //Definition of the inclusion /*============================================================================*/ /* Libraries */ #include "mbed.h" // Mbed RTOS #include "hcsr04.h" // HCSR04 ultrasound sensor libary //#include "SRF05_sp.h" // SRF05 single pin ultrasound sensor libary #include "ros.h" // ROS Library #include "sensor_msgs/Range.h" // ROS Sensor Messages component /* Definitions */ #define LEDS_OFF 0x00 // LED bus all off #define LEDS_ON 0x07 // LED bus all on #define USP_CF1T PG_1 // Cliff ultrasound 1 Trigger #define USP_CF1E PB_11 // Cliff ultrasound 1 Echo #define USP_CF2T PF_9 // Cliff ultrasound 2 Trigger #define USP_CF2E PB_10 // Cliff ultrasound 2 Echo #define USP_CF3T PF_7 // Cliff ultrasound 3 Trigger #define USP_CF3E PE_15 // Cliff ultrasound 3 Echo #define USP_CF4T PF_8 // Cliff ultrasound 4 Trigger #define USP_CF4E PE_12 // Cliff ultrasound 4 Echo #define USP_CB1T PE_6 // Curb ultrasound 1 Trigger #define USP_CB1E PE_7 // Curb ultrasound 1 Echo #define USP_CB2T PE_5 // Curb ultrasound 2 Trigger #define USP_CB2E PE_8 // Curb ultrasound 2 Echo #define USP_CB3T PE_4 // Curb ultrasound 3 Trigger #define USP_CB3E PG_9 // Curb ultrasound 3 Echo #define USP_CB4T PE_2 // Curb ultrasound 4 Trigger #define USP_CB4E PG_14 // Curb ultrasound 4 Echo #define ROS_Baud 921600 // ROS Baud Rate #define frameID "ultrasound_range" // ROS frame ID #define ULTRASOUND 0x00 // Ultrasound #define PRINT_DATA 0x01 // Thread communication event to print data /* Namespaces */ using namespace std; // Make all std symbols visible using namespace ros; // Make all ros symbols visible using namespace sensor_msgs; // Make all sensor_msgs symbols visible using namespace std_msgs; // Make all sdt_msgs symbols visible /* Declarations */ extern float cfDist1; // Distance returned by cliff u_sensor1 (m) extern float cfDist2; // Distance returned by cliff u_sensor2 (m) extern float cfDist3; // Distance returned by cliff u_sensor3 (m) extern float cfDist4; // Distance returned by cliff u_sensor4 (m) extern float cbDist1; // Distance returned by curb u_sensor1 (m) extern float cbDist2; // Distance returned by curb u_sensor2 (m) extern float cbDist3; // Distance returned by curb u_sensor3 (m) extern float cbDist4; // Distance returned by curb u_sensor4 (m) extern float wPeriod; // Wait period(ms) for ROS publisher /* GPIO */ DigitalIn bttn(USER_BUTTON); // Onboard blue user button BusOut leds(LED1, LED2, LED3); // Onboard LEDs bus /* Instantiations */ HCSR04 USS_CF1(USP_CF1T, USP_CF1E); // Ultrasound sensor cliff 1 HCSR04 USS_CF2(USP_CF2T, USP_CF2E); // Ultrasound sensor cliff 2 HCSR04 USS_CF3(USP_CF3T, USP_CF3E); // Ultrasound sensor cliff 3 HCSR04 USS_CF4(USP_CF4T, USP_CF4E); // Ultrasound sensor cliff 4 HCSR04 USS_CB1(USP_CB1T, USP_CB1E); // Ultrasound sensor cliff 1 HCSR04 USS_CB2(USP_CB2T, USP_CB2E); // Ultrasound sensor cliff 2 HCSR04 USS_CB3(USP_CB3T, USP_CB3E); // Ultrasound sensor cliff 3 HCSR04 USS_CB4(USP_CB4T, USP_CB4E); // Ultrasound sensor cliff 4 Serial usbSer(USBTX, USBRX); // Serial over USB OTG NodeHandle nh; // Instance for ROS Node Handler Range ultrasound_msg; // Instance for ROS NavSatFix message // Instance for ROS publishers (Range message) Publisher ultrasound_pub("/ultrasound/cb1", &ultrasound_msg); /* Threads and Signals */ //Thread myThread (osPriorityNormal); //EventFlags myEventFlag; /* Function Prototypes */ //void myFunctionPrototype(); /*============================================================================*/ #endif // End of inclusion