23 #include "osrf_gear/VacuumGripperControl.h" 24 #include "osrf_gear/VacuumGripperState.h" 33 public: std::unique_ptr<ros::NodeHandle>
rosnode;
57 this->
dataPtr->rosnode->shutdown();
68 <<
"unable to load plugin. Load the Gazebo system plugin " 69 <<
"'libgazebo_ros_api_plugin.so' in the gazebo_ros package)");
74 std::string robotNamespace =
"";
75 if (_sdf->HasElement(
"robot_namespace"))
77 robotNamespace = _sdf->GetElement(
78 "robot_namespace")->Get<std::string>() +
"/";
81 std::string controlTopic =
"gripper/control";
82 if (_sdf->HasElement(
"control_topic"))
83 controlTopic = _sdf->Get<std::string>(
"control_topic");
85 std::string stateTopic =
"gripper/state";
86 if (_sdf->HasElement(
"state_topic"))
87 stateTopic = _sdf->Get<std::string>(
"state_topic");
95 this->
dataPtr->rosnode->advertiseService(controlTopic,
100 osrf_gear::VacuumGripperState>(stateTopic, 1000);
110 osrf_gear::VacuumGripperControl::Request &_req,
111 osrf_gear::VacuumGripperControl::Response &_res)
125 osrf_gear::VacuumGripperState
msg;
128 this->
dataPtr->statePub.publish(msg);
virtual ~ROSVacuumGripperPlugin()
Destructor.
ros::ServiceServer controlService
Receives service calls to control the gripper.
std::unique_ptr< ROSVacuumGripperPluginPrivate > dataPtr
virtual void Reset()
Documentation inherited.
ROSCPP_DECL bool isInitialized()
virtual void Publish() const
Overwrite this method for sending periodic updates with the gripper state.
ROS interface for the VacuumGripperPlugin plugin.
bool Attached() const
True if the gripper is attached to another model.
void Disable()
Disable the suction.
#define ROS_FATAL_STREAM(args)
bool OnGripperControl(osrf_gear::VacuumGripperControl::Request &_req, osrf_gear::VacuumGripperControl::Response &_res)
Receives messages on the gripper's topic.
void Enable()
Enable the suction.
virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf)
ROSVacuumGripperPlugin()
Constructor.
bool Enabled() const
Whether the suction of the gripper has been enabled.
virtual void Reset()
Documentation inherited.
ros::Publisher statePub
Publishes the state of the gripper.
GZ_REGISTER_MODEL_PLUGIN(GazeboRosP3D)
std::unique_ptr< ros::NodeHandle > rosnode
ROS node handle.
virtual void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)