disable_link_plugin.cpp
Go to the documentation of this file.
1 
24 
25 namespace gazebo {
26 
28  {
29  link_.reset();
30  }
31 
33  {
34  }
35 
36  void DisableLinkPlugin::Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)
37  {
38  model_ = _parent;
39  world_ = model_->GetWorld();
40 
41  // Check for link element
42  if (!_sdf->HasElement("link")) {
43  ROS_ERROR("No link element present. DisableLinkPlugin could not be loaded.");
44  return;
45  }
46 
47  link_name_ = _sdf->GetElement("link")->Get<std::string>();
48 
49  // Get pointers to joints
50  link_ = model_->GetLink(link_name_);
51  if (link_) {
52  link_->SetEnabled(false);
53  // Output some confirmation
54  ROS_INFO_STREAM("DisableLinkPlugin loaded! Link: " << link_name_);
55  }
56  else
57  ROS_ERROR_STREAM("Link " << link_name_ << " not found! DisableLinkPlugin could not be loaded.");
58  }
59 
61 
62 } // namespace gazebo
virtual ~DisableLinkPlugin() override
GZ_REGISTER_MODEL_PLUGIN(DisableLinkPlugin)
#define ROS_INFO_STREAM(args)
virtual void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf) override
#define ROS_ERROR_STREAM(args)
#define ROS_ERROR(...)


roboticsgroup_upatras_gazebo_plugins
Author(s): Konstantinos Chatzilygeroudis
autogenerated on Tue Dec 22 2020 04:03:12