'math' has not been declared Gazebo 8 Write Plug in Tutorial
I am following this tutorial --> click me <--
I am getting this error:
**error:** 'math' has not been declared
this->model->SetLinearVel(math::Vector3(.03, 0, 0));
^
Wasn't math imported with some kind of library in the script?
Full script:
#include <boost/bind.hpp>
#include <gazebo/gazebo.hh>
#include <gazebo/physics/physics.hh>
#include <gazebo/common/common.hh>
#include <stdio.h>
namespace gazebo
{
class ModelPush : public ModelPlugin
{
public: void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/)
{
// Store the pointer to the model
this->model = _parent;
// Listen to the update event. This event is broadcast every
// simulation iteration.
this->updateConnection = event::Events::ConnectWorldUpdateBegin(
boost::bind(&ModelPush::OnUpdate, this, _1));
}
// Called by the world update start event
public: void OnUpdate(const common::UpdateInfo & /*_info*/)
{
// Apply a small linear velocity to the model.
this->model->SetLinearVel(math::Vector3(.03, 0, 0));
}
// Pointer to the model
private: physics::ModelPtr model;
// Pointer to the update event connection
private: event::ConnectionPtr updateConnection;
};
// Register this plugin with the simulator
GZ_REGISTER_MODEL_PLUGIN(ModelPush)
}
What's your Gazebo version?
It is Gazebo 8.
You can try adding `#include <gazebo math="" math.hh="">` to the top. I believe the tutorial needs to be updated for Gazebo > 7
It didn't work for me.