Skip to content

Commit

Permalink
Add a conditional check for level transformation (#520)
Browse files Browse the repository at this point in the history
Signed-off-by: tanjunkiat <tanjunkiat@outlook.sg>
  • Loading branch information
TanJunKiat authored Dec 20, 2024
1 parent 5ed7be2 commit cb95b26
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rmf_traffic_editor/gui/building.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,16 @@ Building::Transform Building::compute_transform(

// calculate the rotation between each pair of fiducials
vector<std::pair<double, double>> rotations;

if (fiducials.size() < 2)
{
printf(
"not enough fiducials to compute transform between levels %d and %d\n",
from_level_idx,
to_level_idx);
return Building::Transform();
}

// we take the first fiducial as the reference point
std::pair<Fiducial, Fiducial> ref_rotation = make_pair(fiducials[0].first,
fiducials[0].second);
Expand Down

0 comments on commit cb95b26

Please sign in to comment.