Adding .env file and better log messages
Create and publish a Docker image / build-and-push-image (push) Has been cancelled Details

This commit is contained in:
Emran Billah 2024-08-01 12:59:13 -03:00
parent 6b29a9690f
commit 31e689c389
3 changed files with 8 additions and 4 deletions

2
.env Normal file
View File

@ -0,0 +1,2 @@
DEVICE_PATH=/dev/ttyUSB1
BAUD_RATE=230400

View File

@ -2,11 +2,11 @@ version: "3.8"
services:
xbee-mav:
command: rosrun xbee_ros_node xbee_config /dev/ttyUSB0 230400
command: rosrun xbee_ros_node xbee_config ${DEVICE_PATH} ${BAUD_RATE}
build:
context: .
dockerfile: Dockerfile
devices:
- /dev/ttyUSB0:/dev/ttyUSB0
- ${DEVICE_PATH}:${DEVICE_PATH}

View File

@ -13,9 +13,11 @@ bool setupXBee(const std::string &device_port, const unsigned int baud_rate) {
XBeeModule xbee_module;
XMLConfigParser config_parser;
std::string argsStr = "device_port: " + device_port + ", baud_rate: " + std::to_string(baud_rate);
// Init port at specified baud rate
if (!xbee_module.Init_Port(device_port, baud_rate)) {
std::cout << "XBee Configuration Failed. Could not Init_Port." << std::endl;
std::cout << "XBee Configuration Failed. Could not Init_Port. " << argsStr << std::endl;
return false;
}
@ -34,7 +36,7 @@ bool setupXBee(const std::string &device_port, const unsigned int baud_rate) {
}
// Flash config params to device
std::cout << "Connected to XBee. Flashing Config File..." << std::endl;
std::cout << "Connected to XBee on port: " << argsStr << ". Flashing Config File..." << std::endl;
std::vector<XBee_Parameter_S> *config_parameters = config_parser.Get_Loaded_Parameters();
for (auto& param : *config_parameters) {
std::string current_command = "";