# Revision history [back]

### Troubles adding a gps sensor

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 error

"fatal error: gazebo/sensors/SensorFactory.hh: No such file or directory #include "gazebo/sensors/SensorFactory.hh" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated."

Then i found this GpsSensor_link but as I'm relatively new at this I can't understand how to derive the appropriate code.

My aim is to extract data about the x position of my rover. Any ideas on how to attach the gps sensor? Any help will be appreciated. Thanks in advance!

### Troubles adding a gps sensor

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 error

"fatal error: gazebo/sensors/SensorFactory.hh: No such file or directory #include "gazebo/sensors/SensorFactory.hh" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated."

Then i found this GpsSensor_link but as I'm relatively new at this I can't understand how to derive the appropriate code.

My aim is to extract data about the x position of my rover. Any ideas on how to attach the gps sensor? Any help will be appreciated. Thanks in advance!

### Troubles adding a gps sensorfatal 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 error

Base path: /home/kyriakos/rover_ws


"fatal 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

### #

-- 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

### #

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/sensors/SensorFactory.hh: gazebo/gazebo.hh: No such file or directory #include "gazebo/sensors/SensorFactory.hh" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <gazebo gazebo.hh=""> ^~~~~~~~~~~~~~~~~~ compilation terminated."

Then i found this GpsSensor_link but as I'm relatively new at this I can't understand how to derive the appropriate code. 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" failed

My aim is to extract data about the x x,y,z position of my rover. Any ideas on how to attach the gps sensor? Any help will be appreciated. Thanks in advance! advance!

### 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

### #

-- 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

### #

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!  5 None Jose Luis Rivero 1360 ●2 ●10 ●23 ### 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=""> <gazebo/gazebo.hh> ^~~~~~~~~~~~~~~~~~ compilation terminated.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=""> <gazebo/gazebo.hh> #include <gazebo physics="" physics.hh=""> <gazebo/physics/physics.hh> #include <gazebo common="" common.hh=""> <gazebo/common/common.hh> #include <ignition math="" vector3.hh=""> <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!