Skip to content

Commit

Permalink
Fix initial floor logic
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Della Vedova <[email protected]>
  • Loading branch information
luca-della-vedova committed May 23, 2024
1 parent c1f74fd commit 54b559c
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions rmf_building_sim_gz_plugins/src/lift.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class LiftPlugin
// Set the initial floor
const auto target_it = lift.floors.find(lift.initial_floor);
auto initial_floor = std::string("");
auto target_elevation = 0.0;
auto target_elevation = std::numeric_limits<double>::max();
if (target_it != lift.floors.end())
{
initial_floor = target_it->first;
Expand All @@ -136,18 +136,13 @@ class LiftPlugin
}
}

if (!lift.floors.empty())
{
target_elevation = lift.floors.at(0).elevation;
}
else
if (lift.floors.empty())
{
gzwarn << "The lift [" << lift.name << "] does not support any "
<< "floors. This is probably an error in your building "
<< "configuration." << std::endl;
target_elevation = 0.0;
}
target_elevation = lift.floors.at(0).elevation;
}
lift_command.destination_floor = initial_floor;
_last_lift_command[entity] = lift_command;
Expand Down

0 comments on commit 54b559c

Please sign in to comment.