Simulating GPS in Gazebo

In this section, we will see how to simulate a GPS sensor in Gazebo. As you know, GPS is one of the essential sensors in a self-driving car. You can start a GPS simulation using the following command:

$ roslaunch sensor_sim_gazebo gps.launch 

Now, you can list out the topic and find the GPS topics published from the Gazebo plugin. Here is a list of topics from the GPS plugin:

List of topics from the Gazebo GPS plugin

You can echo the /gps/fix topic to confirm that the plugin is publishing the values correctly.

You can use the following command to echo this topic:

$ rostopic echo /gps/fix 

You should see an output as shown here:

Values published to the /gps/fix topic

If you look at the code in https://github.com/PacktPublishing/ROS-Robotics-Projects-SecondEdition/blob/master/chapter_10_ws/sensor_sim_gazebo/urdf/gps.xacro, you will find <plugin name="gazebo_ros_gps" filename="libhector_gazebo_ros_gps.so">; these plugins belong to the hector_gazebo_ros_plugins package, which we installed at the beginning of the sensor interfacing. We can set all parameters related to GPS in this plugin description, and you can see the test parameters' values in the gps.xacro file. The GPS model is visualized as a box, and you can test the sensor values by moving this box in Gazebo. We will now interface GPS with ROS.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.70.157