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 this the following error
Base path: /home/kyriakos/rover_ws
Source space: /home/kyriakos/rover_ws/src
Build space: /home/kyriakos/rover_ws/build
Devel space: /home/kyriakos/rover_ws/devel
Install space: /home/kyriakos/rover_ws/install
#
Running command: "cmake /home/kyriakos/rover_ws/src -DCATKIN_DEVEL_PREFIX=/home/kyriakos/rover_ws/devel -DCMAKE_INSTALL_PREFIX=/home/kyriakos/rover_ws/install -G Unix Makefiles" in "/home/kyriakos/rover_ws/build"
#
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CATKIN_DEVEL_PREFIX: /home/kyriakos/rover_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/kyriakos/rover_ws/devel;/home/kyriakos/catkin_ws/devel;/opt/ros/melodic
-- This workspace overlays: /home/kyriakos/rover_ws/devel;/home/kyriakos/catkin_ws/devel;/opt/ros/melodic
-- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.15", minimum required is "2")
-- Using PYTHON_EXECUTABLE: /usr/bin/python2
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/kyriakos/rover_ws/build/test_results
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python2 (found version "2.7.15")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.19
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 1 packages in topological order:
-- ~~ - rover
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'rover'
-- ==> add_subdirectory(rover)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kyriakos/rover_ws/build
#
Running command: "make -j4 -l4" in "/home/kyriakos/rover_ws/build"
#
Scanning dependencies of target xyz_push
[ 50%] Building CXX object rover/CMakeFiles/xyz_push.dir/src/xyz_push.cpp.o
/home/kyriakos/rover_ws/src/rover/src/xyz_push.cpp:2:10: fatal error: gazebo/gazebo.hh: No such file or directory
#include <gazebo gazebo.hh="">
^~~~~~~~~~~~~~~~~~
compilation terminated.
rover/CMakeFiles/xyz_push.dir/build.make:62: recipe for target 'rover/CMakeFiles/xyz_push.dir/src/xyz_push.cpp.o' failed
make[2]: * [rover/CMakeFiles/xyz_push.dir/src/xyz_push.cpp.o] Error 1
CMakeFiles/Makefile2:431: recipe for target 'rover/CMakeFiles/xyz_push.dir/all' failed
make[1]: [rover/CMakeFiles/xyz_push.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: ** [all] Error 2
Invoking "make -j4 -l4" failedterminated.
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
add_executable(xyz_push src/xyz_push.cpp)
target_link_libraries(xyz_push ${catkin_LIBRARIES})
Any help will be appreciated. Thanks in advance!