Fell free to improve the documentation on this project! Need Help? Tips on how to modify README.md files here!
killall -9 gazebo & killall -9 gzserver & killall -9 gzclient
killall -9 rosmaster
killall -9 roscore
find . -name '*.pyc' -delete
mkdir -p ~/CATKIN_WORSPACE_NAME/src
cd ~/CATKIN_WORKSPACE_NAME/
catkin_make
Once your catkin workspace has been created navigate to the src folder to create your first package.
catkin_create_pkg NAME_PROJECT
If you don't do this steps the world models you create will be unaccessible from your gazebo_ros project
- Add this this term in the package.xml file inside the tag package. This allows Gazebo to access the meshes saved on your package, inside the folder meshes. It's preferably to add this lines at the end of the file.
<package>
...
<export>
<gazebo_ros gazebo_model_path="${prefix}/models"/>
<gazebo_ros gazebo_media_path="${prefix}/models"/>
</export>
</package>
- Use this .launch file as a template for others:
This way every time you create a new .launch file you won't forget to add this two critical lines
<launch>
...
<env name="GAZEBO_MODEL_PATH" value="$(find upc_driverless_gazebo)"/>
<env name="GAZEBO_RESOURCE_PATH" value="$(find upc_driverless_gazebo)"/>
...
</launch>
This command runs a ROS .launch file from the gazebo_ros package, additionaly roslaunch is passing arguments: ( The arguments can change form file to file ).
roslaunch gazebo_ros empty_world.launch paused:=true use_sim_time:=false gui:=true throttled:=false recording:=false debug:=true verbose:=true
This a simple .launch program that opens a .world file. World files define the spaces in which we simulate our robots.
<launch>
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="worlds/mud.world"/> <!-- The world_name changes in function of which file you want to open -->
<arg name="paused" value="false"/>
<arg name="use_sim_time" value="true"/>
<arg name="gui" value="true"/>
<arg name="recording" value="false"/>
<arg name="debug" value="false"/>
</include>
</launch>
We are importing empty_world.launch because the package gazebo_ros already defines the basic function of the world.
<include file="$(find gazebo_ros)/launch/empty_world.launch">
When it's time to pass the parameters to the empty_world.launch file we change the world_name argument to the one of the file we want to open. (Note: You must set the path to the file in relation to the directory you are working from, ROS has different tools to help you with this).
<arg name="world_name" value="worlds/mud.world"/> <!-- The world_name value changes in function of which file you want to open -->
By adding this snippet at the beginning of your file the editor will automaticly set the type to XML saving you time and making the code easier to read.
<?xml version="1.0" ?>
- When writting code on any XML (.world, .launch, .urdf, ...) file remember to name links with different names. For instances the SDF files, that are responsible for diffining the maps, were not responding accordingly to what was expected because all the tags link had the same name. This meant that all the cones concured in the same position. The Visual Studio Code marketapp Insert Numbers help to speed up the process of name each link tag.
Website | Links | Sujects converd |
---|---|---|
Gazebo Tutorials | http://gazebosim.org/tutorials/?tut=ros_roslaunch | roslaunch, world files, urdf models |
Gazebo Tutorials | http://gazebosim.org/tutorials?tut=build_world&cat=build_world | edit world files, save world files |
Gazebo Tutorials | http://gazebosim.org/tutorials/?tut=ros_urdf#Nextsteps | udrf models |
Gazebo Tutorials | http://gazebosim.org/tutorials?tut=ros_gzplugins | plugins |
ROS Tutorials | http://wiki.ros.org/roslaunch/XML | launch files |
ROS Tutorials | http://wiki.ros.org/urdf/XML/Transmission | urdf Transmisions |
ROS Tutorials | http://wiki.ros.org/controller_manager | controller manager |