"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

@@ -19,7 +19,7 @@
GZ_REGISTER_MODEL_PLUGIN(Potentiometer)
void Potentiometer::Load(physics::ModelPtr model, sdf::ElementPtr sdf) {
void Potentiometer::Load(gazebo::physics::ModelPtr model, sdf::ElementPtr sdf) {
this->model = model;
// Parse SDF properties
@@ -43,19 +43,19 @@ void Potentiometer::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);
pub = node->Advertise<msgs::Float64>(topic);
pub = node->Advertise<gazebo::msgs::Float64>(topic);
// 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(&Potentiometer::Update, this, _1));
}
void Potentiometer::Update(const common::UpdateInfo& info) {
void Potentiometer::Update(const gazebo::common::UpdateInfo& info) {
joint->GetAngle(0).Normalize();
msgs::Float64 msg;
gazebo::msgs::Float64 msg;
if (radians) {
msg.set_data(joint->GetAngle(0).Radian());
} else {

View File

@@ -13,8 +13,6 @@
#include "simulation/gz_msgs/msgs.h"
using namespace gazebo;
/**
* \brief Plugin for reading the angle of a joint.
*
@@ -34,13 +32,13 @@ using namespace gazebo;
* - `topic`: Optional. Message will be published as a gazebo.msgs.Float64.
* - `units`: Optional. Defaults to radians.
*/
class Potentiometer : public ModelPlugin {
class Potentiometer : public gazebo::ModelPlugin {
public:
/// \brief Load the potentiometer 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 Sends out the potentiometer reading each timestep.
void Update(const common::UpdateInfo& info);
void Update(const gazebo::common::UpdateInfo& info);
private:
/// \brief Publish the angle on this topic.
@@ -50,11 +48,17 @@ class Potentiometer : public ModelPlugin {
bool radians;
/// \brief The joint that this potentiometer measures
physics::JointPtr joint;
gazebo::physics::JointPtr joint;
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::PublisherPtr pub; ///< \brief Publisher handle.
/// \brief The model to which this is attached.
gazebo::physics::ModelPtr model;
/// \brief Pointer to the world update function.
gazebo::event::ConnectionPtr updateConn;
/// \brief The node on which we're advertising.
gazebo::transport::NodePtr node;
/// \brief Publisher handle.
gazebo::transport::PublisherPtr pub;
};