Skip to content
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
uses: ros-misc-utilities/ros_build_scripts/.github/workflows/ros2_recent_ci.yml@master
with:
repo: ${{ github.event.repository.name }}
vcs_url: https://raw.githubusercontent.com/${{ github.repository }}/master/${{ github.event.repository.name }}.repos
vcs_url: https://raw.githubusercontent.com/${{ github.repository }}/${{ github.head_ref || github.ref_name }}/${{ 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_); }
void resetNumTagsDetected() { num_tags_detected_ = 0; }

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
5 changes: 4 additions & 1 deletion 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 @@ -151,7 +152,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
Loading