diff --git a/CMakeLists.txt b/CMakeLists.txt
index 49d6148..0bd4af3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -45,7 +45,11 @@ catkin_package(
###########
## Build ##
###########
-
+## Add definitions
+add_definitions(
+ -DDATABASE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/Resources/database.xml"
+ -DXBEE_CONFIG_PATH="${CMAKE_CURRENT_SOURCE_DIR}/Resources/XBee_Config.xml"
+)
## Specify additional locations of header files
include_directories(
diff --git a/launch/xbeemav.launch b/launch/xbeemav.launch
index 060dac3..4d789ce 100644
--- a/launch/xbeemav.launch
+++ b/launch/xbeemav.launch
@@ -9,4 +9,6 @@
+
+
diff --git a/src/PacketsHandler.cpp b/src/PacketsHandler.cpp
index 4b0cb45..f662614 100644
--- a/src/PacketsHandler.cpp
+++ b/src/PacketsHandler.cpp
@@ -466,12 +466,11 @@ void PacketsHandler::Send_End_Of_Packet_Ping(const uint8_t packet_ID, const uint
//*****************************************************************************
bool PacketsHandler::Load_Database_Addresses()
{
- const std::string FILE_PATH = "/home/ubuntu/ROS_WS/src/xbeemav/Resources/database.xml";
-
-
+ const std::string FILE_PATH = DATABASE_PATH;
+
if (!boost::filesystem::exists(FILE_PATH))
{
- std::cout << "database.xml Not Found." << std::endl;
+ std::cout << "database.xml Not Found with path: " << FILE_PATH << std::endl;
return false;
}
diff --git a/src/Xbee.cpp b/src/Xbee.cpp
index 496d531..53b2669 100644
--- a/src/Xbee.cpp
+++ b/src/Xbee.cpp
@@ -14,10 +14,11 @@ int main(int argc, char* argv[])
try
{
ros::init(argc, argv, "xbee");
+ ros::NodeHandle node_handle;
Mist::Xbee::CommunicationManager communication_manager;
- const std::string& device = "/dev/ttyUSB0"; // TO DO can be introduced as command.
- const std::size_t baud_rate = 230400; // TO DO Can be introduced as command.
+ std::string device;
+ double baud_rate;
Mist::Xbee::CommunicationManager::DRONE_TYPE drone_type =
Mist::Xbee::CommunicationManager::DRONE_TYPE::SLAVE;
Mist::Xbee::CommunicationManager::RUNNING_MODE running_mode =
@@ -34,8 +35,18 @@ int main(int argc, char* argv[])
running_mode = Mist::Xbee::CommunicationManager::RUNNING_MODE::SWARM;
}
}
-
- if (communication_manager.Init(device, baud_rate))
+ if (!node_handle.getParam("USB_port", device))
+ {
+ std::cout << "Failed to Get Topic Name: param 'USB_port' Not Found." << std::endl;
+ return EXIT_FAILURE;
+ }
+
+ if (!node_handle.getParam("Baud_rate", baud_rate))
+ {
+ std::cout << "Failed to Get Topic Name: param 'Baud_rate' Not Found." << std::endl;
+ return EXIT_FAILURE;
+ }
+ if (communication_manager.Init(device, static_cast(baud_rate)))
communication_manager.Run(drone_type, running_mode);
}
catch (const std::exception& e)