Q
Dependencies: SRF05 ros_lib_kinetic TinyGPSPlus
Diff: PROJ515.hpp
- Revision:
- 0:215bdd87b602
- Child:
- 1:ea2ee36038e7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PROJ515.hpp Mon Apr 22 18:28:24 2019 +0000 @@ -0,0 +1,55 @@ +#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 "ros.h" // ROS Library +#include "sensor_msgs/Range.h" // ROS Sensor Messages component +//#include "std_msgs/Char.h" // ROS Standard Messages component + + +/* Definitions */ +#define LEDS_OFF 0x00 // LED bus all off +#define LEDS_ON 0x07 // LED bus all on +#define ULS_EC PC_10 // Ultrasound Trigger Pin +#define ULS_TG PC_11 // Ultrasound Echo Pin + +#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 + +/* Declarations */ +extern unsigned int cmDistance1; // Distance measured by u_sensor_1 in cm +extern float sPeriod; // Sampling period of the sensors (sec) + +/* GPIO */ +DigitalIn bttn(USER_BUTTON); // Onboard blue user button +BusOut leds(LED1, LED2, LED3); // Onboard LEDs bus + +/* Instantiations */ +HCSR04 usensor1(ULS_TG,ULS_EC); // Ultrasound sensor 1 +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 publisher (Odometry Message) +Publisher ultrasound_pub("ultrasound_range", &ultrasound_msg); + +/* 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 + +/* Threads and Signals */ +//Thread myThread (osPriorityNormal); +//EventFlags myEventFlag; + +/* Function Prototypes */ +//void myFunctionPrototype(); + +/*============================================================================*/ +#endif // End of inclusion \ No newline at end of file