fatal error: gazebo/gazebo.hh: No such file or directory
Hey, I want to add a gps sensor on my robot. Initially i tried adding the gps sensor in the urdf.xacro file, but no much luck there. So I thought to create a .cpp file as i found by hector_plugins. But when im trying to compile the c++ file i get the following error
fatal error: gazebo/gazebo.hh: No such file or directory
#include <gazebo/gazebo.hh>
^~~~~~~~~~~~~~~~~~
compilation terminated.
When I'm doing the plugin_tutorials everything works perfectly, but when I try to compile it with my files i get the above error. My aim is to extract data about the x,y,z position of my rover.
My cpp code:
#include <functional>
#include <gazebo/gazebo.hh>
#include <gazebo/physics/physics.hh>
#include <gazebo/common/common.hh>
#include <ignition/math/Vector3.hh>
namespace gazebo
{
class ModelPush : public ModelPlugin
{
public: void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/)
//Store pointer to model
this->model = _parent;
//Listen to update event. This event is broadcast every simulation iteration
this->updateConnection = event::Events::ConnectWorldUpdateBegin(
std::bind(&ModelPush::OnUpdate, this));
}
//Called by the world update start event
public: void OnUpdate()
{
//Get x,y,z position
this->model->GetWorldPose();
}
//Pointer to the model
private: physics::ModelPtr model;
//Pointer to the update event connection
private: event::ConnectionPtr updateConnection;
};
//Register plugin with simulation
GZ_REGISTER_MODEL_PLUGIN(ModelPush)
}
And to compile it i added these two lines in the CMakeLists.txt
addexecutable(xyzpush src/xyzpush.cpp) targetlinklibraries(xyzpush ${catkin_LIBRARIES})Any help will be appreciated. Thanks in advance!
Asked by Kyriakos on 2020-01-31 12:07:38 UTC
Answers
First, be sure that you have install the libgazeboX-dev
(where X is the version of gazebo being used) package if your are using Debian/Ubuntu system.
Second, give a look again into the tutorial and remember to include the include_directories(${GAZEBO_INCLUDE_DIRS})
in our CMakeLists.txt
file.
Asked by Jose Luis Rivero on 2020-02-04 10:55:31 UTC
Comments
Thanks for your answer but this is not the problem, i have everything installed and when i insert the include_directories(${GAZEBO_INCLUDE_DIRS})
the code still doesn't compile When i do the tutorial it works perfectly without any errors regarding #include gazebo/gazebo.hh
but when i try to compile the code above i get that error.
Asked by Kyriakos on 2020-02-04 14:05:47 UTC
cmake cache could be tricking you, remove the CMakeCache.txt file from the build directory and try again. If that does not fix the situation I would recommended to start using the tutorial example and change the tutorial files by yours progressively. Good luck.
Asked by Jose Luis Rivero on 2020-02-04 14:11:35 UTC
Comments