20 #include <yaml-cpp/yaml.h>
29 spinner_(1, &callback_queue_) {}
32 sdf::ElementPtr _sdf) {
37 if (not _sdf->HasElement(
"trackedModels"))
39 YAML::Node node = YAML::Load(_sdf->Get<std::string>(
"trackedModels"));
40 for (
const auto &model : node)
44 if (not _sdf->HasElement(
"cameras"))
46 node = YAML::Load(_sdf->Get<std::string>(
"cameras"));
47 for (
const auto &camera : node)
cameras_.push_back(camera.as<std::string>());
50 if (not _sdf->HasElement(
"pose"))
52 auto pose = _sdf->Get<ignition::math::Pose3d>(
"pose");
55 if (not _sdf->HasElement(
"size"))
57 auto size = _sdf->Get<ignition::math::Vector3d>(
"size");
60 container_ = ignition::math::OrientedBoxd(size, pose);
64 "A ROS node for Gazebo has not been initialized, unable to load "
65 "plugin. Load the Gazebo system plugin 'libgazebo_ros_api_plugin.so' "
66 "in the gazebo_ros package");
70 nh_ = boost::make_shared<ros::NodeHandle>();
75 if (not _sdf->HasElement(
"topic"))
77 publisher_ =
nh_->advertise<gazebo_video_monitor_msgs::Strings>(
78 _sdf->Get<std::string>(
"topic"), 10);
82 bool visualize =
false;
83 if (_sdf->HasElement(
"visualize")) visualize = _sdf->Get<
bool>(
"visualize");
86 std::make_shared<BoxMarkerVisualizer>(_sdf->Get<std::string>(
"name"));
91 if (not _sdf->HasElement(
"updateRate"))
93 double update_rate = _sdf->Get<
double>(
"updateRate");
101 auto model =
world_->ModelByName(name);
102 if (not model)
return false;
103 auto position = model->WorldPose().Pos();
111 bool contains_model = std::any_of(
113 [&](
const auto &name) ->
bool { return this->contains(name); });
115 if (contains_model) {