Q
Dependencies: SRF05 ros_lib_kinetic TinyGPSPlus
Diff: PROJ515.hpp
- Revision:
- 12:1a3272d67500
- Parent:
- 11:955c2ed70de2
- Child:
- 13:78b9acd2e873
diff -r 955c2ed70de2 -r 1a3272d67500 PROJ515.hpp --- a/PROJ515.hpp Wed May 08 14:50:32 2019 +0000 +++ b/PROJ515.hpp Thu May 09 18:37:25 2019 +0000 @@ -6,42 +6,35 @@ #include "mbed.h" // Mbed RTOS #include "SRF05.h" // SRF05 ultrasound sensor custom libary #include "TinyGPSPlus.h" // GPS Module Library -#include "PololuLedStrip.h" // LED Strip Library -#include "string" // Character String Library #include "ros.h" // ROS Library -#include "std_msgs/String.h" // ROS String Messages component #include "sensor_msgs/Range.h" // ROS Sensor Messages component #include "sensor_msgs/NavSatFix.h" // ROS Sensor Messages component -#include "nav_msgs/Odometry.h" // ROS Odom Messages component -#include "geometry_msgs/Twist.h" // ROS Twist Messages component + /* Definitions */ #define LEDS_OFF 0x00 // LED bus all off #define LEDS_ON 0x07 // LED bus all on -#define USP_CF1T PA_4 // Cliff ultrasound 1 Trigger -#define USP_CF1E PA_3 // Cliff ultrasound 1 Echo -#define USP_CF2T PB_0 // Cliff ultrasound 2 Trigger -#define USP_CF2E PA_10 // Cliff ultrasound 2 Echo -#define USP_CF3T PC_1 // Cliff ultrasound 3 Trigger -#define USP_CF3E PB_3 // Cliff ultrasound 3 Echo -#define USP_CF4T PC_0 // Cliff ultrasound 4 Trigger -#define USP_CF4E PB_5 // Cliff ultrasound 4 Echo +#define USP_CF1T PF_7 // Cliff ultrasound 1 Trigger +#define USP_CF1E PE_15 // Cliff ultrasound 1 Echo +#define USP_CF2T PF_8 // Cliff ultrasound 2 Trigger +#define USP_CF2E PE_12 // Cliff ultrasound 2 Echo +#define USP_CF3T PF_9 // Cliff ultrasound 3 Trigger +#define USP_CF3E PB_10 // Cliff ultrasound 3 Echo +#define USP_CF4T PG_1 // Cliff ultrasound 4 Trigger +#define USP_CF4E PB_11 // Cliff ultrasound 4 Echo -#define USP_CB1T PC_15 // Curb ultrasound 1 Trigger -#define USP_CB1E PB_4 // Curb ultrasound 1 Echo -#define USP_CB2T PC_14 // Curb ultrasound 2 Trigger -#define USP_CB2E PB_10 // Curb ultrasound 2 Echo -#define USP_CB3T PC_13 // Curb ultrasound 3 Trigger -#define USP_CB3E PA_8 // Curb ultrasound 3 Echo -#define USP_CB4T PB_7 // Curb ultrasound 4 Trigger -#define USP_CB4E PA_9 // Curb ultrasound 4 Echo +#define USP_CB1T PE_4 // Curb ultrasound 1 Trigger +#define USP_CB1E PG_9 // Curb ultrasound 1 Echo +#define USP_CB2T PE_2 // Curb ultrasound 2 Trigger +#define USP_CB2E PG_14 // Curb ultrasound 2 Echo +#define USP_CB3T PE_6 // Curb ultrasound 3 Trigger +#define USP_CB3E PE_7 // Curb ultrasound 3 Echo +#define USP_CB4T PE_5 // Curb ultrasound 4 Trigger +#define USP_CB4E PE_8 // Curb ultrasound 4 Echo -#define GPS_TX PC_10 // GPS Transmit Pin -#define GPS_RX PC_11 // GPS Recieve Pin - -#define LED_F PB_6 // LED Strip Front Data -#define LED_B PC_7 // LED Strip Back Data +#define GPS_TX PD_5 // GPS Transmit Pin +#define GPS_RX PD_6 // GPS Recieve Pin #define FOV 1.396 // Ultrasound sensor field of view #define MIN_RANGE 0.2 // Ultrasound sensor min range @@ -59,11 +52,9 @@ #define CVZ 0x01 // Covariance value for X from the datasheet #define CVO 0x00 // Covariance value for zero components -#define LED_COUNT 30 // LED strip LED count -#define MaxVelocity 0.5 // Max Wheel Velocity - #define ROS_Baud 460800 // ROS Baud Rate #define GPS_Baud 9600 // GPS Baud Rate +//#define frameID_u "ultrasound_range"// ROS frame ID #define frameID_g "gps_odom" // ROS frame ID //#define PRINT_DATA 0x01 // Thread communication event to print data @@ -72,9 +63,7 @@ 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 std_msgs symbols visible -using namespace nav_msgs; -using namespace Pololu; +using namespace std_msgs; // Make all sdt_msgs symbols visible /* Declarations */ extern float cfDist1; // Distance returned by cliff u_sensor1 (m) @@ -89,12 +78,8 @@ extern float wPeriod; // Wait period(ms) for ROS publisher -extern char gps_c; // GPS stream character - Defined in PROJ515.cpp -extern int sats_n; // GPS satelite number - Defined in PROJ515.cpp - -extern float vel; // Odom linear velocity -extern float ang; // Odom angular velocity -extern string audio_state; // Audio Information (Playing/Stopped) +extern char gps_c; // GPS stream character - Defined in PROJ515.cpp +extern int sats_n; // GPS satelite number - Defined in PROJ515.cpp /* GPIO */ DigitalIn bttn(USER_BUTTON); // Onboard blue user button @@ -113,13 +98,8 @@ SRF05 USS_CB4(USP_CB4T, USP_CB4E); // Ultrasound sensor cliff 4 // Instance for GPS -TinyGPSPlus gpsModule; // Instance of GPS class -Serial gpsSer(GPS_TX, GPS_RX); // Instance of Serial class to gps - -// Instance for LED Strip -PololuLedStrip ledStripFront(LED_F);// LED Strip Front -PololuLedStrip ledStripBack(LED_B); // LED Strip Back -rgb_color colors[LED_COUNT]; // RGB Colour Array +TinyGPSPlus gpsModule; // Instance of GPS class +Serial gpsSer(GPS_TX, GPS_RX); // Instance of Serial class to gps // Instance for ROS node and messages NodeHandle nh; // Instance for ROS Node Handler @@ -160,9 +140,6 @@ void setRosDist(); // Put distance in ROS messages void setRosStamp(); // Put time into ROS messages void publishRosMsg(); // Publish ROS messages -//void AudioStatusCB(const std_msgs::String &status); -//void VelocityCB(const nav_msgs::Odometry &odom); -float Map(float x, float in_min, float in_max, float out_min, float out_max); /*============================================================================*/ #endif // End of inclusion \ No newline at end of file