Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:

jobs:
build_ros2:
uses: ros-misc-utilities/ros_build_scripts/.github/workflows/ros2_recent_ci.yml@master
uses: ros-misc-utilities/ros_build_scripts/.github/workflows/ci_humble_and_later.yml@master
with:
repo: ${{ github.event.repository.name }}
vcs_url: https://raw.githubusercontent.com/${{ github.repository }}/master/${{ github.event.repository.name }}.repos
vcs_url: ${{ github.event.repository.name }}.repos
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class DetectorComponent : public rclcpp::Node
const rclcpp::NodeOptions & options = rclcpp::NodeOptions());
~DetectorComponent();
auto getNumMessages() const { return (num_messages_); }
auto getNumTagsDetected() const { return (num_tags_detected_); }
auto isSubscribed() const { return (is_subscribed_); }

private:
void subscribe();
Expand All @@ -55,6 +57,7 @@ class DetectorComponent : public rclcpp::Node
std::string image_qos_profile_{"default"};
std::string in_transport_{"raw"};
std::size_t num_messages_{0};
std::size_t num_tags_detected_{0};
pluginlib::ClassLoader<apriltag_detector::Detector> detector_loader_;
std::shared_ptr<apriltag_detector::Detector> detector_;
};
Expand Down
1 change: 1 addition & 0 deletions apriltag_detector/src/detector_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ void DetectorComponent::callback(
std::make_unique<apriltag_msgs::msg::AprilTagDetectionArray>();
detector_->detect(cvImg->image, array_msg.get());
array_msg->header = msg->header;
num_tags_detected_ += array_msg->detections.size();
detect_pub_->publish(std::move(array_msg));
}
}
Expand Down
10 changes: 8 additions & 2 deletions apriltag_tools/src/detect_from_bag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ int main(int argc, char ** argv)
rclcpp::shutdown();
throw std::runtime_error("must specify image_topic parameter!");
}
dummy_node.reset(); // delete dummy node object

rclcpp::executors::SingleThreadedExecutor exec;

Expand Down Expand Up @@ -107,6 +108,7 @@ int main(int argc, char ** argv)
{Parameter("storage.uri", in_uri),
Parameter("play.clock_publish_on_topic_publish", true),
Parameter("play.start_paused", true), Parameter("play.rate", 0.9),
Parameter("play.progress_bar_update_rate", 0),
Parameter("play.disable_keyboard_controls", true)});
player_options.use_intra_process_comms(true);
auto player_node =
Expand Down Expand Up @@ -138,7 +140,9 @@ int main(int argc, char ** argv)

exec.add_node(recorder_node);
if (player_node->play_next() && rclcpp::ok()) {
while (rclcpp::ok() && !draw_node->isSubscribed()) {
while (rclcpp::ok() &&
!(draw_node->isSubscribed() && detector_node->isSubscribed() &&
recorder_node->subscriptions().size() == topics.size())) {
exec.spin_some();
}
}
Expand All @@ -151,7 +155,9 @@ int main(int argc, char ** argv)
exec.spin_some(); // for recording the last message

RCLCPP_INFO_STREAM(
get_logger(), "num messages detected: " << detector_node->getNumMessages());
get_logger(), "num messages found: " << detector_node->getNumMessages());
RCLCPP_INFO_STREAM(
get_logger(), "num tags detected: " << detector_node->getNumTagsDetected());
RCLCPP_INFO(get_logger(), "detect_from_bag finished!");
rclcpp::shutdown();
return 0;
Expand Down