Skip to content

Commit

Permalink
Use main in tutorials
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Agüero <[email protected]>
  • Loading branch information
caguero committed Oct 9, 2024
1 parent 3deca35 commit 861b397
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 34 deletions.
18 changes: 9 additions & 9 deletions tutorials/04_messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cd ~/gz_transport_tutorial

## Publisher

Download the [publisher.cc](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/publisher.cc) file within the `gz_transport_tutorial`
Download the [publisher.cc](https://github.com/gazebosim/gz-transport/raw/main/example/publisher.cc) file within the `gz_transport_tutorial`
folder and open it with your favorite editor:

\snippet example/publisher.cc complete
Expand Down Expand Up @@ -76,7 +76,7 @@ The method *Publish()* sends a message to all the subscribers.

## Subscriber

Download the [subscriber.cc](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/subscriber.cc)
Download the [subscriber.cc](https://github.com/gazebosim/gz-transport/raw/main/example/subscriber.cc)
file into the `gz_transport_tutorial` folder and open it with your favorite editor:

\snippet example/subscriber.cc complete
Expand Down Expand Up @@ -126,7 +126,7 @@ until you hit *CTRL-C*. Note that this function captures the *SIGINT* and

## Building the code

Download the [CMakeLists.txt](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/CMakeLists.txt) file within the `gz_transport_tutorial` folder.
Download the [CMakeLists.txt](https://github.com/gazebosim/gz-transport/raw/main/example/CMakeLists.txt) file within the `gz_transport_tutorial` folder.

Once you have all your files, go ahead and create a `build/` directory within
the `gz_transport_tutorial` directory.
Expand Down Expand Up @@ -287,7 +287,7 @@ between Gazebo Transport and another protocol or if you want to just print the
content of a generic protobuf message using `DebugString()`, among other use
cases.

Download the [subscriber_generic.cc](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/subscriber_generic.cc) file within the `gz_transport_tutorial` folder and open it with your favorite editor:
Download the [subscriber_generic.cc](https://github.com/gazebosim/gz-transport/raw/main/example/subscriber_generic.cc) file within the `gz_transport_tutorial` folder and open it with your favorite editor:

```{.cpp}
#include <google/protobuf/message.h>
Expand Down Expand Up @@ -416,12 +416,12 @@ often the integration of the message generation into the build system of your
project. Next, you can find an example of a publisher and subscriber using a
custom Protobuf message integrated with CMake.

Download the [publisher_custom_msg.cc](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/publisher_custom_msg.cc)
and the [subscriber_custom_msg.cc](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/subscriber_custom_msg.cc)
Download the [publisher_custom_msg.cc](https://github.com/gazebosim/gz-transport/raw/main/example/publisher_custom_msg.cc)
and the [subscriber_custom_msg.cc](https://github.com/gazebosim/gz-transport/raw/main/example/subscriber_custom_msg.cc)
files within the `gz_transport_tutorial`. Then, create a `msgs` folder and
download the [stringmsg.proto](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/msgs/stringmsg.proto)
and the [CMakeLists.txt](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/msgs/CMakeLists.txt)
files within the `msgs` folder. Finally, we'll need the main [CMakeLists.txt](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/CMakeLists.txt)
download the [stringmsg.proto](https://github.com/gazebosim/gz-transport/raw/main/example/msgs/stringmsg.proto)
and the [CMakeLists.txt](https://github.com/gazebosim/gz-transport/raw/main/example/msgs/CMakeLists.txt)
files within the `msgs` folder. Finally, we'll need the main [CMakeLists.txt](https://github.com/gazebosim/gz-transport/raw/main/example/CMakeLists.txt)
file. You should have this file from the previous examples. Otherwise,
download and place it within the `gz_transport_tutorial` folder.

Expand Down
20 changes: 10 additions & 10 deletions tutorials/05_services.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ cd ~/gz_transport_tutorial

## Responser

Download the [responser.cc](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/responser.cc) file within the ``gz_transport_tutorial``
Download the [responser.cc](https://github.com/gazebosim/gz-transport/raw/main/example/responser.cc) file within the ``gz_transport_tutorial``
folder and open it with your favorite editor:

```{.cpp}
Expand Down Expand Up @@ -133,7 +133,7 @@ until you hit *CTRL-C*. Note that this function captures the *SIGINT* and

## Synchronous requester

Download the [requester.cc](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/requester.cc) file within the ``gz_transport_tutorial``
Download the [requester.cc](https://github.com/gazebosim/gz-transport/raw/main/example/requester.cc) file within the ``gz_transport_tutorial``
folder and open it with your favorite editor:

```{.cpp}
Expand Down Expand Up @@ -228,7 +228,7 @@ message.

## Asynchronous requester

Download the [requester_async.cc](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/requester_async.cc) file within the
Download the [requester_async.cc](https://github.com/gazebosim/gz-transport/raw/main/example/requester_async.cc) file within the
``gz_transport_tutorial`` folder and open it with your favorite editor:

```{.cpp}
Expand Down Expand Up @@ -314,7 +314,7 @@ oneway service to process service requests without sending back responses.
Oneway services don't accept any output parameters nor the requests have to wait
for the response.

Download the [responser_oneway.cc](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/responser_oneway.cc) file within the
Download the [responser_oneway.cc](https://github.com/gazebosim/gz-transport/raw/main/example/responser_oneway.cc) file within the
``gz_transport_tutorial`` folder and open it with your favorite editor:

```{.cpp}
Expand Down Expand Up @@ -389,7 +389,7 @@ This case is similar to the oneway service provider. This code can be used for
requesting a service that does not need a response back. We don't need any
output parameters in this case nor we have to wait for the response.

Download the [requester_oneway.cc](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/requester_oneway.cc) file within the
Download the [requester_oneway.cc](https://github.com/gazebosim/gz-transport/raw/main/example/requester_oneway.cc) file within the
``gz_transport_tutorial`` folder and open it with your favorite editor:

```{.cpp}
Expand Down Expand Up @@ -454,7 +454,7 @@ request was already published.
Sometimes we want to receive some result but don't have any input parameter to
send.

Download the [responser_no_input.cc](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/responser_no_input.cc)
Download the [responser_no_input.cc](https://github.com/gazebosim/gz-transport/raw/main/example/responser_no_input.cc)
file within the ``gz_transport_tutorial`` folder and open it with your
favorite editor:

Expand Down Expand Up @@ -534,7 +534,7 @@ service requests.
This case is similar to the service without input parameter. We don't send any
request.

Download the [requester_no_input.cc](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/requester_no_input.cc)
Download the [requester_no_input.cc](https://github.com/gazebosim/gz-transport/raw/main/example/requester_no_input.cc)
file within the ``gz_transport_tutorial`` folder and open it with your
favorite editor:

Expand Down Expand Up @@ -577,14 +577,14 @@ request timed out or reached the service provider and ``result`` shows if the
service was successfully executed.

We also have the async version for service request without input. You should
download [requester_async_no_input.cc](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/requester_async_no_input.cc)
download [requester_async_no_input.cc](https://github.com/gazebosim/gz-transport/raw/main/example/requester_async_no_input.cc)
file within the ``gz_transport_tutorial`` folder.

## Building the code

Download the [CMakeLists.txt](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/CMakeLists.txt) file
Download the [CMakeLists.txt](https://github.com/gazebosim/gz-transport/raw/main/example/CMakeLists.txt) file
within the ``gz_transport_tutorial`` folder. Then, create a `msgs` directory
and download [CMakeLists.txt](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/msgs/CMakeLists.txt) and [stringmsg.proto](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/msgs/stringmsg.proto) inside the
and download [CMakeLists.txt](https://github.com/gazebosim/gz-transport/raw/main/example/msgs/CMakeLists.txt) and [stringmsg.proto](https://github.com/gazebosim/gz-transport/raw/main/example/msgs/stringmsg.proto) inside the
``msgs`` directory.

Once you have all your files, go ahead and create a ``build/`` folder within
Expand Down
14 changes: 7 additions & 7 deletions tutorials/06_python_support.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ In this tutorial, we are going to show the functionalities implemented in Python
These features are brought up by creating bindings from the C++ implementation
using pybind11. It is important to note that not all of C++ features are available
yet, on this tutorial we will go over the most relevant features. For more information,
refer to the [__init__.py](https://github.com/gazebosim/gz-transport/blob/gz-transport15/python/src/__init__.py)
refer to the [__init__.py](https://github.com/gazebosim/gz-transport/blob/main/python/src/__init__.py)
file which is a wrapper for all the bindings.

For this tutorial, we will create two nodes that communicate via messages. One node
Expand All @@ -24,7 +24,7 @@ cd ~/gz_transport_tutorial

## Publisher

Download the [publisher.py](https://github.com/gazebosim/gz-transport/blob/gz-transport15/python/examples/publisher.py) file within the `gz_transport_tutorial`
Download the [publisher.py](https://github.com/gazebosim/gz-transport/blob/main/python/examples/publisher.py) file within the `gz_transport_tutorial`
folder and open it with your favorite editor:

\snippet python/examples/publisher.py complete
Expand Down Expand Up @@ -89,7 +89,7 @@ each topic. The method *publish()* sends a message to all the subscribers.

## Subscriber

Download the [subscriber.py](https://github.com/gazebosim/gz-transport/blob/gz-transport15/python/examples/subscriber.py)
Download the [subscriber.py](https://github.com/gazebosim/gz-transport/blob/main/python/examples/subscriber.py)
file into the `gz_transport_tutorial` folder and open it with your favorite editor:

\snippet python/examples/subscriber.py complete
Expand Down Expand Up @@ -240,9 +240,9 @@ in several places (publisher and subscribers).

We developed a couple of examples that demonstrate this particular issue. Take
a look at a publisher and subscriber (whithin the same node) that have race
conditions triggered in the [data_race_without_mutex.py](https://github.com/gazebosim/gz-transport/blob/gz-transport15/python/examples/data_race_without_mutex.py) file. The proposed solution to this
conditions triggered in the [data_race_without_mutex.py](https://github.com/gazebosim/gz-transport/blob/main/python/examples/data_race_without_mutex.py) file. The proposed solution to this
issue is to use the `threading` library, you can see the same example with a mutex
in the [data_race_with_mutex.py](https://github.com/gazebosim/gz-transport/blob/gz-transport15/python/examples/data_race_with_mutex.py) file.
in the [data_race_with_mutex.py](https://github.com/gazebosim/gz-transport/blob/main/python/examples/data_race_with_mutex.py) file.

You can run any of those examples by just doing the following in a terminal:
```{.sh}
Expand Down Expand Up @@ -380,7 +380,7 @@ The command `gz log playback` also supports the notion of topic remapping. Run

## Service Requester

Download the [requester.py](https://github.com/gazebosim/gz-transport/blob/gz-transport15/python/examples/requester.py)
Download the [requester.py](https://github.com/gazebosim/gz-transport/blob/main/python/examples/requester.py)
file into the `gz_transport_tutorial` folder and open it with your favorite editor:

\snippet python/examples/requester.py complete
Expand Down Expand Up @@ -421,7 +421,7 @@ result and response of the request in some variables and printing them out.

Unfortunately, this feature is not available on Python at the moment. However,
we can use a service responser created in C++ and make a request to it from a
code in Python. Taking that into account, we will use the [response.cc](https://github.com/gazebosim/gz-transport/blob/gz-transport15/example/responser.cc) file as the service responser.
code in Python. Taking that into account, we will use the [response.cc](https://github.com/gazebosim/gz-transport/blob/main/example/responser.cc) file as the service responser.

## Running the examples

Expand Down
6 changes: 3 additions & 3 deletions tutorials/08_relay.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ install Docker following any of the existing guides available
([here](https://docs.docker.com/get-docker/)'s one).

We're going to build a Docker image and run it inside your host computer.
Download the [build.bash](https://github.com/gazebosim/gz-transport/raw/gz-transport15/docker/build.bash), [run.bash](https://github.com/gazebosim/gz-transport/raw/gz-transport15/docker/run.bash) and
[Dockerfile](https://github.com/gazebosim/gz-transport/raw/gz-transport15/docker/gz-transport/Dockerfile) files.
Download the [build.bash](https://github.com/gazebosim/gz-transport/raw/main/docker/build.bash), [run.bash](https://github.com/gazebosim/gz-transport/raw/main/docker/run.bash) and
[Dockerfile](https://github.com/gazebosim/gz-transport/raw/main/docker/gz-transport/Dockerfile) files.

```{.sh}
wget https://github.com/gazebosim/gz-transport/raw/gz-transport15/docker/gz-transport/Dockerfile -O Dockerfile
wget https://github.com/gazebosim/gz-transport/raw/main/docker/gz-transport/Dockerfile -O Dockerfile
```

Now, it's time to build the Docker image:
Expand Down
6 changes: 3 additions & 3 deletions tutorials/10_logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ cd ~/gz_transport_tutorial

## Record

Download the [record.cc](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/record.cc)
Download the [record.cc](https://github.com/gazebosim/gz-transport/raw/main/example/record.cc)
file within the `gz_transport_tutorial` folder and open it with your favorite editor:

\snippet example/record.cc complete
Expand Down Expand Up @@ -79,7 +79,7 @@ stops the log recording as expected.

## Play back

Download the [playback.cc](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/playback.cc)
Download the [playback.cc](https://github.com/gazebosim/gz-transport/raw/main/example/playback.cc)
file within the `gz_transport_tutorial` folder and open it with your favorite
editor:

Expand Down Expand Up @@ -125,7 +125,7 @@ thread until all messages have been published.

## Building the code

Download the [CMakeLists.txt](https://github.com/gazebosim/gz-transport/raw/gz-transport15/example/CMakeLists.txt)
Download the [CMakeLists.txt](https://github.com/gazebosim/gz-transport/raw/main/example/CMakeLists.txt)
file within the `gz_transport_tutorial` folder.

Once you have all your files, go ahead and create a `build/` directory within
Expand Down
4 changes: 2 additions & 2 deletions tutorials/23_topic_statistics.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ if (!node.EnableStats(topic, true))
}
```

A complete example can be found in the [subscriber_stats example program](https://github.com/gazebosim/gz-transport/blob/gz-transport15/example/subscriber_stats.cc).
A complete example can be found in the [subscriber_stats example program](https://github.com/gazebosim/gz-transport/blob/main/example/subscriber_stats.cc).

With both `GZ_TRANSPORT_TOPIC_STATISTICS` set to `1` and a node
enabling topic statistics, then you will be able to echo statistic
Expand Down Expand Up @@ -76,7 +76,7 @@ if (!node.EnableStats(topic, true, "/my_stats", 100))
For running the example, build the binaries in the example directory:

```
git clone https://github.com/gazebosim/gz-transport -b gz-transport15
git clone https://github.com/gazebosim/gz-transport -b main
cd gz-transport/example
cmake -S . -B build
# For UNIX
Expand Down

0 comments on commit 861b397

Please sign in to comment.