Next Tutorial: Custom sensors
We recommend following the binary install instructions to get up and running as quickly and painlessly as possible.
The source install instructions should be used if you need the very latest software improvements, you need to modify the code, or you plan to make a contribution.
Binary Install
Ubuntu
- Setup your computer to accept software from packages.osrfoundation.org:
- Install Gazebo Sensors # Change <#> to a version number, like 7 or 8sudo apt install libgz-sensors<#>-dev
macOS
- On macOS, add OSRF packages: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"brew tap osrf/simulation
- Install Gazebo Sensors: brew install gz-sensors<#>
Be sure to replace <#>
with a number value, such as 7 or 8, depending on which version you need.
Windows
Install Prerequisites
First, follow the source installation tutorial until step 5 included for installing Conda, Visual Studio, CMake, etc., prerequisites, and creating a Conda environment.
Navigate to condabin
if necessary to use the conda
command (i.e., if Conda is not in your PATH
environment variable. You can find the location of condabin
in Anaconda Prompt, where conda
).
Create if necessary, and activate a Conda environment:
Binary Installation
Be sure to replace <#>
with a number value, such as 7 or 8, depending on which version you need.
Source Install
Source installation can be performed in UNIX systems by first installing the necessary prerequisites followed by building from source.
Prerequisites
Gazebo Sensors requires:
- Gazebo CMake
- Gazebo Math
- Gazebo Common
- Gazebo Transport
- Gazebo Rendering
- Gazebo Msgs
- SDFormat
- Protobuf3
Ubuntu
- Make sure you are running Ubuntu Focal or above.
- Install the Prerequisites.
- Clone the repository git clone https://github.com/gazebosim/gz-sensors
- Configure and build cd gz-sensors; mkdir build; cd build; cmake ..; make
- Optionally, install the library sudo make install
macOS
- Clone the repository Be sure to replacegit clone https://github.com/gazebosim/gz-sensors -b gz-sensors<#>
<#>
with a number value, such as 5 or 6, depending on which version you need. - Install dependencies Be sure to replacebrew install --only-dependencies gz-sensors<#>
<#>
with a number value, such as 5 or 6, depending on which version you need. - Configure and build cd gz-sensorsmkdir buildcd buildcmake ..make
- Optionally, install sudo make install
Windows
This assumes you have created and activated a Conda environment while installing the Prerequisites.
Install Gazebo dependencies:
You can view available versions and their dependencies:
conda search libgz-sensors* --channel conda-forge --infoInstall dependencies, replacing
<#>
with the desired versions:conda install libgz-cmake<#> libgz-common<#> libgz-math<#> libgz-transport<#> libgz-msgs<#> libgz-rendering<#> --channel conda-forge- Navigate to where you would like to build the library, and clone the repository. # Optionally, append `-b gz-sensors#` (replace # with a number) to check out a specific versiongit clone https://github.com/gazebosim/gz-sensors.git
- Configure and build cd gz-sensorsmkdir buildcd buildcmake .. -DBUILD_TESTING=OFF # Optionally, -DCMAKE_INSTALL_PREFIX=path\to\installcmake --build . --config Release
- Optionally, install. You will likely need to run a terminal with admin privileges for this call to succeed. cmake --install . --config Release
Documentation
API and tutorials can be found at https://gazebosim.org/libs/sensors.
You can also generate the documentation from a clone of this repository by following these steps.
- You will need Doxygen. On Ubuntu Doxygen can be installed using sudo apt-get install doxygen
- Clone the repository git clone https://github.com/gazebosim/gz-sensors
- Configure and build the documentation. cd gz-sensors; mkdir build; cd build; cmake ../; make doc
- View the documentation by running the following command from the build directory. firefox doxygen/html/index.html
Testing
Follow these steps to run tests and static code analysis in your clone of this repository.
- Run tests. make test
- Static code checker. make codecheck