Skip to content

Commit

Permalink
Use default param values for warehouse port, host and plugin name
Browse files Browse the repository at this point in the history
  • Loading branch information
RoboticsYY committed Oct 13, 2020
1 parent 506449f commit 63668cb
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/database_loader.cpp
Expand Up @@ -79,7 +79,7 @@ typename DatabaseConnection::Ptr DatabaseLoader::loadDatabase()
// if (!nh_.searchParam("warehouse_plugin", paramName))
paramName = "warehouse_plugin";
string db_plugin;
if (!node_->get_parameter(paramName, db_plugin))
if (!node_->get_parameter_or(paramName, db_plugin, std::string("warehouse_ros_mongo::MongoDatabaseConnection")))
{
RCLCPP_ERROR(LOGGER, "Could not find parameter for database plugin name");
return typename DatabaseConnection::Ptr(new DBConnectionStub());
Expand All @@ -104,19 +104,15 @@ typename DatabaseConnection::Ptr DatabaseLoader::loadDatabase()
// if (!nh_.searchParam("warehouse_host", paramName))
paramName = "warehouse_host";
std::string host;
if (node_->get_parameter(paramName, host))
{
hostFound = true;
}
node_->get_parameter_or(paramName, host, std::string("localhost"));
hostFound = true;

// TODO: Revise parameter lookup
// if (!nh_.searchParam("warehouse_port", paramName))
paramName = "warehouse_port";
int port;
if (node_->get_parameter(paramName, port))
{
portFound = true;
}
node_->get_parameter_or(paramName, port, 33829);
portFound = true;

if (hostFound && portFound)
{
Expand Down

0 comments on commit 63668cb

Please sign in to comment.