Go to the documentation of this file.
28 #ifdef ENABLE_PROFILER
29 #include <ignition/common/Profiler.hh>
68 this->
world_ = _model->GetWorld();
72 if (_sdf->HasElement(
"robotNamespace"))
73 this->
robot_namespace_ = _sdf->GetElement(
"robotNamespace")->Get<std::string>() +
"/";
75 if (!_sdf->HasElement(
"bodyName"))
77 ROS_FATAL_NAMED(
"force",
"force plugin missing <bodyName>, cannot proceed");
81 this->
link_name_ = _sdf->GetElement(
"bodyName")->Get<std::string>();
90 if (!_sdf->HasElement(
"topicName"))
92 ROS_FATAL_NAMED(
"force",
"force plugin missing <topicName>, cannot proceed");
96 this->
topic_name_ = _sdf->GetElement(
"topicName")->Get<std::string>();
103 <<
"Load the Gazebo system plugin 'libgazebo_ros_api_plugin.so' in the gazebo_ros package)");
142 #ifdef ENABLE_PROFILER
143 IGN_PROFILE(
"GazeboRosForce::OnNewFrame");
144 IGN_PROFILE_BEGIN(
"fill ROS message");
147 ignition::math::Vector3d force(this->
wrench_msg_.force.x,this->wrench_msg_.force.y,this->wrench_msg_.force.z);
148 ignition::math::Vector3d torque(this->
wrench_msg_.torque.x,this->wrench_msg_.torque.y,this->wrench_msg_.torque.z);
149 this->
link_->AddForce(force);
150 this->
link_->AddTorque(torque);
151 this->
lock_.unlock();
152 #ifdef ENABLE_PROFILER
162 static const double timeout = 0.01;
ros::NodeHandle * rosnode_
A pointer to the ROS node. A node will be instantiated if it does not exist.
std::string robot_namespace_
for setting ROS name space
event::ConnectionPtr update_connection_
boost::mutex lock_
A mutex to lock access to fields that are used in ROS message callbacks.
std::string topic_name_
ROS Wrench topic name inputs.
#define ROS_FATAL_NAMED(name,...)
ros::CallbackQueue queue_
void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf)
#define ROS_FATAL_STREAM_NAMED(name, args)
boost::thread callback_queue_thread_
Thead object for the running callback Thread.
GZ_REGISTER_MODEL_PLUGIN(GazeboRosF3D)
ROSCPP_DECL bool isInitialized()
geometry_msgs::Wrench wrench_msg_
Container for the wrench force that this plugin exerts on the body.
virtual void UpdateChild()
Subscriber subscribe(const std::string &topic, uint32_t queue_size, const boost::function< void(C)> &callback, const VoidConstPtr &tracked_object=VoidConstPtr(), const TransportHints &transport_hints=TransportHints())
void UpdateObjectForce(const geometry_msgs::Wrench::ConstPtr &_msg)
call back when a Wrench message is published
virtual ~GazeboRosForce()
Destructor.
std::string link_name_
The Link this plugin is attached to, and will exert forces on.
GazeboRosForce()
Constructor.
void QueueThread()
The custom callback queue thread function.
physics::LinkPtr link_
A pointer to the Link, where force is applied.
physics::WorldPtr world_
A pointer to the gazebo world.
gazebo_plugins
Author(s): John Hsu
autogenerated on Thu Sep 5 2024 02:49:55