Skip to content

Commit

Permalink
Merge pull request RoboSense-LiDAR#48 from DUT-Racing/fix/fake_perc-map
Browse files Browse the repository at this point in the history
fix(fake_perception): check for existence of map frame
  • Loading branch information
OlafBraakman authored Nov 9, 2021
2 parents 45dbe23 + bf6108d commit b6e2030
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/simulation/fake_perception/src/fake_perception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ uint8_t Perception::get_noisy_type(uint8_t type, const ConfusionMatrix matrix) {
}

void Perception::generate_lidar_cone_data() {
// At the beginning, the right transforms will not have been published yet.
const auto tf_frames = buffer.getAllFrameNames();
bool map_frame_exists = std::any_of(tf_frames.begin(), tf_frames.end(), [](const std::string &frame_name) { return frame_name == "map"; });
if (!map_frame_exists) {
RCLCPP_INFO(get_logger(), "Transform from 'map' to '%s' not yet received", lidar_frame.c_str());
return;
}

const auto map_to_lidar_transform = buffer.lookupTransform(lidar_frame, "map", rclcpp::Time(0), 1ns);

// Start time of cone detection
Expand Down

0 comments on commit b6e2030

Please sign in to comment.