Skip to content

Commit

Permalink
Merge branch 'master' into jrivero/ros_ionic
Browse files Browse the repository at this point in the history
  • Loading branch information
j-rivero authored Sep 5, 2024
2 parents ec0febc + ba2d873 commit 1400ca1
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 63 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
with:
name: website
path: dist
if-no-files-found: 'error'
include-hidden-files: 'true'

# Build Docs
build_docs:
Expand Down Expand Up @@ -67,6 +69,8 @@ jobs:
with:
name: docs
path: .build
if-no-files-found: 'error'
include-hidden-files: 'true'

deploy:
runs-on: ubuntu-latest
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/nightly-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,14 @@ jobs:
required-gazebo-distributions: ${{ matrix.gazebo_distribution }}
use-gazebo-nightly: ${{ matrix.gazebo_distribution == 'ionic'}}
- name: 'Add Doxygen'
run: sudo apt-get install -y doxygen graphviz
run: sudo apt-get install -y doxygen graphviz texlive-latex-extra
- name: 'Add missing dependencies'
run: sudo apt-get install -y libopengl-dev
- name: 'Build Docs'
run: |
mkdir -p ws/src
cd ws/src
vcs import --input https://raw.githubusercontent.com/gazebo-tooling/gazebodistro/master/collection-${{ matrix.gazebo_distribution}}.yaml
rm -rf sdformat
rm -rf gz-tools
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install $(sort -u $(find . -iname 'packages-'${{ matrix.ubuntu_distribution}}'.apt' -o -iname 'packages.apt' | grep -v '/\.git/') | tr '\n' ' ')
cd ..
colcon build --merge-install --event-handlers console_cohesion+ --cmake-args -DBUILD_DOCS=ON -DBUILD_TESTING=OFF --cmake-target doc
Expand All @@ -56,6 +54,8 @@ jobs:
with:
name: api-docs-${{ matrix.gazebo_distribution }}
path: ws/build/**/doxygen/html
if-no-files-found: 'error'
include-hidden-files: 'true'

upload:
name: Upload docs to production
Expand All @@ -82,7 +82,12 @@ jobs:
with:
name: api-docs
path: .api-out/*
if-no-files-found: 'error'
include-hidden-files: 'true'
- name: Commit
# The workflow upto this point is good for generating a preview,
# but only commit to deploy if we are on the master branch (not a pull request).
if: github.ref == 'refs/heads/master'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
3 changes: 2 additions & 1 deletion harmonic/ros2_spawn_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ Additionally, it's possible to spawn new models at any time. To do so using ROS
we have provided the following mechanisms:

## Spawn a model using the launch file included in `ros_gz_sim`.
*Currently only available in Rolling.*

The package `ros_gz_sim` contains a launch file named
`ros_gz_spawn_model.launch.py`. You can use it to spawn a new model into an
existing simulation. Here's an example:

```bash
ros2 launch ros_gz_sim gz_spawn_model.launch.py world:=empty file:=$(ros2 pkg prefix --share ros_gz_sim_demos)/models/vehicle/model.sdf name:=my_vehicle x:=5.0 y:=5.0 z:=0.5
ros2 launch ros_gz_sim ros_gz_spawn_model.launch.py world:=empty file:=$(ros2 pkg prefix --share ros_gz_sim_demos)/models/vehicle/model.sdf name:=my_vehicle x:=5.0 y:=5.0 z:=0.5
```

Check [this block](https://github.com/gazebosim/ros_gz/blob/cadae1c8323a74395c09a37e3de4c669c8c09d4f/ros_gz_sim/launch/ros_gz_spawn_model.launch.py#L33-L44)
Expand Down
18 changes: 9 additions & 9 deletions ionic/Model_insertion_fuel.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,31 @@ Check that the file size on the right is reasonable for your application before

There are a few different ways to spawn a model into the simulation.

1. **Spawn from 'Fuel Resource' using the Resource Spawner plugin.**
1. **Spawn from 'Fuel resources' using the Resource Spawner plugin.**

Select the Resource Spawner plugin from the plugin menu (top right corner).
The plugin will appear in the right panel, you might need to scroll down to be able to see the plugin.
Wait until the resource are loaded under the 'Fuel Resource' panel.
Wait until the resources are loaded under the 'Fuel resources' panel.
Select a resource owner (e.g. openrobotics), you can now search for the model name in the right panel.
Click on the cloud icon to download the model.
When the model has been downloaded, you can click on the model and insert it into your simulation scene.

![Resource Spawner - Fuel Resource](tutorials/fuel_insert/resource_spawner_cloud.png)
![Resource Spawner - Fuel resources](tutorials/fuel_insert/resource_spawner_cloud.png)


2. **Download model files from Fuel and spawn from local sources using the Resource Spawner plugin.**

- Download the model files from [app.gazebosim.org/fuel/models](https://app.gazebosim.org/fuel/models).
- Extract the files and places them under your local model directory (e.g. `~/my-local-models/model-name`).
- Extract the files and place them under your local model directory (e.g. `~/my-local-models/model-name`).
The folder should contain `materials`, `meshes` as well as the `model.config` and the `model.sdf` files.
- Add your model directory as a resource with `export GZ_SIM_RESOURCE_PATH=~/my-local/models/`
- Add your model directory as a resource with `export GZ_SIM_RESOURCE_PATH=~/my-local-models/model-name`
- Open the Gazebo Simulator and add the Resource Spawner Plugin, the model should now show up under your local resources.

![Resource Spawner - Fuel Resource](tutorials/fuel_insert/resource_spawner_local.png)
![Resource Spawner - Fuel resources](tutorials/fuel_insert/resource_spawner_local.png)

3. **Copying the SDF snippet and adding it to your custom world SDF file.**

With the `<>` button you can directly copy a SDF snippet to paste into your world SDF file.
With the `<>` button you can directly copy an SDF snippet to paste into your world SDF file.
The SDF snippet will look something like this:

```
Expand All @@ -72,10 +72,10 @@ There are a few different ways to spawn a model into the simulation.

![spawn](tutorials/fuel_insert/husky.gif)

4. **Downloading the code to permanently add a Fuel model to your custum SDF file.**
4. **Downloading the code to permanently add a Fuel model to your custom SDF file.**

If you prefer to add a Fuel model permanently to an `sdf` file, you can just as easily download the code by clicking the download-arrow icon to the right of the model's image.
Kook at the tutorial on [SDF Worlds](sdf_worlds) for more information on how to construct a custom world SDF file.
Look at the tutorial on [SDF Worlds](sdf_worlds) for more information on how to construct a custom world SDF file.

Now you can add more models, or even load in any one of the plugins you learned about to interact with the model the same way you could with the shapes in the previous tutorial.

Expand Down
14 changes: 1 addition & 13 deletions ionic/hotkeys.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,17 @@

<tr><th colspan="3" class="sub"><b>MODE</b></th></tr>

<tr><td>Enter Selection mode (default mode)</td><td>Esc</td><td>press "Esc" for Select (model) mode</td></tr>

<tr><td>Enter Rotate mode</td><td>r</td><td>press "r" for Rotate (model) mode</td></tr>

<tr><td>Enter Translate mode</td><td>t</td><td>press "t" for Translate (model) mode</td></tr>

<tr><td>Pause / unpause</td><td>Space</td><td>press the space bar to pause / unpause</td></tr>

<!--Manipulating Models section -->

<tr><th colspan="3" class="sub"><b>MANIPULATING MODELS</b></th></tr>

<tr><td>Rotate model</td><td>r</td><td>press "r" for Rotate mode; click a model & rotate it using markers</td></tr>

<tr><td>Translate model</td><td>t</td><td>press "t" for Translate mode; click a model & translate it using markers</td></tr>

<tr><td>Constrain along axis</td><td>x/y/z</td><td>hold key while manipulating a model to constrain movement along that axis</td></tr>

<tr><td>Snap when rotating</td><td>Ctrl + drag</td><td>hold Ctrl while rotating a model to rotate in customizable increments (default is 45° but can be changed from Tranform Control GUI)</td></tr>

<tr><td>Snap when translating</td><td>Ctrl + drag</td><td>hold Ctrl while translating a model to move in customizable increments (default is 1m but can be changed from Tranform Control GUI)</td></tr>

<tr><td>Align to world frame</td><td>Shift</td><td>hold Shift while manipulating a model to temporarily align axis its to the world frame</td></tr>
<tr><td>Align to world frame</td><td>Shift</td><td>hold Shift while manipulating a model to temporarily align its axis to the world frame</td></tr>

<tr><th colspan="3" class="sub"><b>MAIN WINDOW</b></th></tr>

Expand Down
42 changes: 18 additions & 24 deletions ionic/install_ubuntu_src.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,17 @@ sudo apt install python3-pip lsb-release gnupg curl

## vcstool and colcon from pip

PIP is available on all platforms:
PIP is available on all platforms. Using a PIP workspace to install the tools:

```bash
pip install vcstool || pip3 install vcstool
python3 -m venv $HOME/vcs_colcon_installation
. $HOME/vcs_colcon_installation/bin/activate
pip3 install vcstool colcon-common-extensions
```

```bash
pip install -U colcon-common-extensions || pip3 install -U colcon-common-extensions
```

Check that no errors were printed while installing with PIP. If your system is not recognising the commands, and you're using a system that is compatible with Debian or Ubuntu packages, see the instructions below to install using `apt`.

After installing `vcstool` and `colcon` with PIP, you may need to add their executables to your `$PATH`.
Check where the installation of these packages took place:

```bash
pip show vcstool || pip3 show vcstool | grep Location

pip show colcon-common-extensions || pip3 show colcon-common-extensions | grep Location
```

If your install path is prefixed with `$HOME/.local`, you'll probably need to add the executables within this directory to your `$PATH` in order to avoid "command not found" errors when using `vcstool` and `colcon` later on:

```bash
export PATH=$PATH:$HOME/.local/bin/
```
`vcs` and `colcon` are now available from the PIP workspace in the current
terminal. For using them in other terminals run the `activate` script as
done above.

## vcstool and colcon from apt

Expand Down Expand Up @@ -143,14 +128,23 @@ colcon graph
If that is the case, then you are ready
to build the whole set of libraries:

:::{warning}

Compilation can take up to 16Gb of RAM memory. Use MAKEFLAGS with
colcon as detailed in its instructions to reduce the number of
compilation threads if needed.

:::


```bash
colcon build --merge-install
```

To speed up the build process, you could also disable tests by using

```bash
colcon build --cmake-args -DBUILD_TESTING=OFF --merge-install
colcon build --cmake-args ' -DBUILD_TESTING=OFF' --merge-install
```

To use debuggers activate debug symbols. Gazebo will run slower, but you'll be able to use GDB:
Expand Down Expand Up @@ -228,7 +222,7 @@ To perform QML debugging you'll need:
You will need to build Gazebo with:
```bash
colcon build --cmake-args -DQT_QML_DEBUG --merge-install
colcon build --cmake-args ' -DQT_QML_DEBUG' --merge-install
```
> **Note:** Advanced users may note that only the `gz-sim` project needs this flag.
Expand Down
2 changes: 1 addition & 1 deletion ionic/install_windows_src.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ colcon graph
If that is the case, then you are ready to build the whole set of libraries:

```bash
colcon build --cmake-args -DBUILD_TESTING=OFF --merge-install --packages-up-to gz-sim9 gz-tools2
colcon build --cmake-args -DBUILD_TESTING=OFF -DSKIP_SWIG=ON --merge-install --packages-up-to gz-sim9 gz-tools2
```
Tests are turned off as they are not currently supported on Windows.

Expand Down
23 changes: 21 additions & 2 deletions ionic/moving_robot.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,26 @@ The last command will display all messages sent on `/keyboard/keypress` topic.

In the Gazebo window press different keys and you should see data (numbers) on the terminal where you run the `gz topic -e -t /keyboard/keypress` command.

![KeyPublisher](tutorials/moving_robot/keypublisher_data.png)
```
$ gz topic -e -t /keyboard/keypress
data: 68
data: 85
data: 72
data: 74
data: 81
data: 16777235
data: 16777234
data: 16777237
data: 16777236
```

We want to map these keystrokes into messages of type `Twist` and publish them to the `/cmd_vel` topic which our model listens to.
The `TriggeredPublisher` plugin will do this.
Expand Down Expand Up @@ -116,7 +135,7 @@ It accepts messages of type `gz.msgs.Int32` on the `/keyboard/keypress` topic an

Now launch `building_robot.sdf` then add the Key Publisher plugin and our robot should move forward as we press the Up arrow key &#8593; (make sure you start the simulation by pressing the play button to see the robot move forward after pressing the Up arrow key).

There is a demo explaining how the [Triggered Publisher](https://github.com/gazebosim/gz-sim/blob/gz-sim7/tutorials/triggered_publisher.md) works.
There is a demo explaining how the [Triggered Publisher](https://github.com/gazebosim/gz-sim/blob/gz-sim9/tutorials/triggered_publisher.md) works.

### Moving using arrow keys

Expand Down
17 changes: 9 additions & 8 deletions ionic/sensors.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ The last command listens to the messages sent over the `/imu` topic. The IMU dat

![Imu_message](tutorials/sensors/imu_msgs.png)

Move your robot forward using the keyboard up key. You should see the sensor values changing.
Move your robot forward using the keyboard up key. To do so, don't forget to enable the Key Publisher Plugin. You should see the sensor values changing.

## Contact sensor

Expand Down Expand Up @@ -315,24 +315,25 @@ To do that, we'll write a short C++ program that listens to
the sensor data and sends velocity commands to the robot.
This program is called a node. We will build a node that subscribes
to the `/lidar` topic and reads its data.
Have a look at this [tutorial](https://gazebosim.org/api/transport/9.0/messages.html)
Have a look at this [tutorial](https://gazebosim.org/api/transport/14/messages.html)
to learn how to build a `publisher` and a `subscriber` node.
You can download the finished node for this demo from [here](https://github.com/gazebosim/docs/blob/master/ionic/tutorials/sensors/lidar_node.cc).

#### The lidar_node

```cpp
gz::transport::Node node;
std::string topic_pub = "/cmd_vel";
gz::msgs::Twist data;
gz::transport::Node node;
auto pub = node.Advertise<gz::msgs::Twist>(topic_pub);
```

We declare a `node` which will publish to `cmd_vel` topic and defined the message type `Twist`. Then advertise our node.
We declare a `node` which will publish to `cmd_vel` topic. Then advertise our node.

```cpp
void cb(const gz::msgs::LaserScan &_msg)
{
gz::msgs::Twist data;

bool allMore = true;
for (int i = 0; i < _msg.ranges_size(); i++)
{
Expand Down Expand Up @@ -362,11 +363,11 @@ If so we publish a message to our car to move forward. Otherwise we make the rob
```cpp
int main(int argc, char **argv)
{
std::string topic = "/lidar";
std::string topic_sub = "/lidar";
// Subscribe to a topic by registering a callback.
if (!node.Subscribe(topic, cb))
if (!node.Subscribe(topic_sub, cb))
{
std::cerr << "Error subscribing to topic [" << topic << "]" << std::endl;
std::cerr << "Error subscribing to topic [" << topic_sub << "]" << std::endl;
return -1;
}
Expand Down
Binary file removed ionic/tutorials/moving_robot/keypublisher_data.png
Binary file not shown.
8 changes: 6 additions & 2 deletions tools/restructure_doxygen_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
output_dir = pathlib.Path(sys.argv[2])
output_dir.mkdir(exist_ok=True)

re_expr = R"(ignition|gz)-([a-z_]*)(\d*)"
re_expr = R"(?:ignition|gz)-([a-z_]*)(\d*)"
sdf_re_expr = R"(sdformat)(\d*)"


def copy_library(lib_html, lib_name, lib_version):
Expand All @@ -47,8 +48,11 @@ def copy_library(lib_html, lib_name, lib_version):

for lib in input_dir.iterdir():
m = re.match(re_expr, lib.name)
if not m:
m = re.match(sdf_re_expr, lib.name)

if m:
_, lib_name, lib_version = m.groups()
lib_name, lib_version = m.groups()
lib_html = lib/"doxygen"/"html"
copy_library(lib_html, lib_name, lib_version)
# Handle gazebo->sim rename by making a copy into the sim directory
Expand Down

0 comments on commit 1400ca1

Please sign in to comment.