"using" directives are no longer used in global namespaces (#219)

This commit is contained in:
Tyler Veness
2016-11-01 23:09:51 -07:00
committed by Peter Johnson
parent 78f0b1562c
commit ba8761e39e
39 changed files with 292 additions and 256 deletions

View File

@@ -11,7 +11,7 @@
GZ_REGISTER_MODEL_PLUGIN(DCMotor)
void DCMotor::Load(physics::ModelPtr model, sdf::ElementPtr sdf) {
void DCMotor::Load(gazebo::physics::ModelPtr model, sdf::ElementPtr sdf) {
this->model = model;
signal = 0;
@@ -36,21 +36,21 @@ void DCMotor::Load(physics::ModelPtr model, sdf::ElementPtr sdf) {
std::string scoped_name =
model->GetWorld()->GetName() + "::" + model->GetScopedName();
boost::replace_all(scoped_name, "::", "/");
node = transport::NodePtr(new transport::Node());
node = gazebo::transport::NodePtr(new gazebo::transport::Node());
node->Init(scoped_name);
sub = node->Subscribe(topic, &DCMotor::Callback, this);
// Connect to the world update event.
// This will trigger the Update function every Gazebo iteration
updateConn = event::Events::ConnectWorldUpdateBegin(
updateConn = gazebo::event::Events::ConnectWorldUpdateBegin(
boost::bind(&DCMotor::Update, this, _1));
}
void DCMotor::Update(const common::UpdateInfo& info) {
void DCMotor::Update(const gazebo::common::UpdateInfo& info) {
joint->SetForce(0, signal * multiplier);
}
void DCMotor::Callback(const msgs::ConstFloat64Ptr& msg) {
void DCMotor::Callback(const gazebo::msgs::ConstFloat64Ptr& msg) {
signal = msg->data();
if (signal < -1) {
signal = -1;

View File

@@ -15,8 +15,6 @@
#include "simulation/gz_msgs/msgs.h"
using namespace gazebo;
/**
* \brief Plugin for controlling a joint with a DC motor.
*
@@ -37,13 +35,13 @@ using namespace gazebo;
* - `topic`: Optional. Message type should be gazebo.msgs.Float64.
* - `multiplier`: Optional. Defaults to 1.
*/
class DCMotor : public ModelPlugin {
class DCMotor : public gazebo::ModelPlugin {
public:
/// \brief Load the dc motor and configures it according to the sdf.
void Load(physics::ModelPtr model, sdf::ElementPtr sdf);
void Load(gazebo::physics::ModelPtr model, sdf::ElementPtr sdf);
/// \brief Update the torque on the joint from the dc motor each timestep.
void Update(const common::UpdateInfo& info);
void Update(const gazebo::common::UpdateInfo& info);
private:
/// \brief Topic to read control signal from.
@@ -56,14 +54,20 @@ class DCMotor : public ModelPlugin {
double multiplier;
/// \brief The joint that this dc motor drives.
physics::JointPtr joint;
gazebo::physics::JointPtr joint;
/// \brief Callback for receiving msgs and storing the signal.
void Callback(const msgs::ConstFloat64Ptr& msg);
void Callback(const gazebo::msgs::ConstFloat64Ptr& msg);
physics::ModelPtr model; ///< \brief The model that this is attached to.
event::ConnectionPtr
updateConn; ///< \brief Pointer to the world update function.
transport::NodePtr node; ///< \brief The node we're advertising on.
transport::SubscriberPtr sub; ///< \brief Subscriber handle.
/// \brief The model to which this is attached.
gazebo::physics::ModelPtr model;
/// \brief Pointer toe the world update function.
gazebo::event::ConnectionPtr updateConn;
/// \brief The node on which we're advertising.
gazebo::transport::NodePtr node;
/// \brief Subscriber handle.
gazebo::transport::SubscriberPtr sub;
};