MCPcopy Create free account
hub / github.com/AutonomousFieldRoboticsLab/SVIn / publishImages

Method publishImages

okvis_ros/src/Publisher.cpp:880–906  ·  view source on GitHub ↗

Publish the last set images.

Source from the content-addressed store, hash-verified

878
879// Publish the last set images.
880void Publisher::publishImages() {
881 // advertise what's been missing:
882 if (images_.size() != pubImagesVector_.size()) {
883 pubImagesVector_.clear();
884 for (size_t i = 0; i < images_.size(); ++i) {
885 std::stringstream drawingNameStream;
886 drawingNameStream << "okvis_drawing_" << i;
887 pubImagesVector_.push_back(image_transport_.advertise(drawingNameStream.str(), 10));
888 }
889 }
890
891 // publish:
892 for (size_t i = 0; i < images_.size(); ++i) {
893 sensor_msgs::msg::Image msg;
894 std::stringstream cameraNameStream;
895 cameraNameStream << "camera_" << i;
896 msg.header.stamp = node_->get_clock()->now();
897 msg.header.frame_id = cameraNameStream.str();
898 sensor_msgs::fillImage(msg,
899 sensor_msgs::image_encodings::MONO8,
900 images_[i].rows,
901 images_[i].cols,
902 images_[i].step.buf[0],
903 images_[i].data);
904 pubImagesVector_[i].publish(msg);
905 }
906}
907
908// Publish the last set path.
909void Publisher::publishPath() { pubPath_->publish(path_); }

Callers

nothing calls this directly

Calls 3

nowMethod · 0.80
sizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected