From 861b3978f8dcbd6330a326c671c344975aee4e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ag=C3=BCero?= Date: Wed, 9 Oct 2024 16:39:09 +0200 Subject: [PATCH] Use main in tutorials MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Agüero --- tutorials/04_messages.md | 18 +++++++++--------- tutorials/05_services.md | 20 ++++++++++---------- tutorials/06_python_support.md | 14 +++++++------- tutorials/08_relay.md | 6 +++--- tutorials/10_logging.md | 6 +++--- tutorials/23_topic_statistics.md | 4 ++-- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/tutorials/04_messages.md b/tutorials/04_messages.md index 52ccf4db..0f3efb5f 100644 --- a/tutorials/04_messages.md +++ b/tutorials/04_messages.md @@ -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 @@ -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 @@ -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. @@ -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 @@ -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. diff --git a/tutorials/05_services.md b/tutorials/05_services.md index 939c811f..4402095d 100644 --- a/tutorials/05_services.md +++ b/tutorials/05_services.md @@ -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} @@ -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} @@ -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} @@ -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} @@ -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} @@ -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: @@ -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: @@ -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 diff --git a/tutorials/06_python_support.md b/tutorials/06_python_support.md index b7fcbd1e..dd4fc94f 100644 --- a/tutorials/06_python_support.md +++ b/tutorials/06_python_support.md @@ -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 @@ -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 @@ -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 @@ -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} @@ -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 @@ -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 diff --git a/tutorials/08_relay.md b/tutorials/08_relay.md index dc95f12b..e1026c84 100644 --- a/tutorials/08_relay.md +++ b/tutorials/08_relay.md @@ -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: diff --git a/tutorials/10_logging.md b/tutorials/10_logging.md index 356187f6..78d0fc52 100644 --- a/tutorials/10_logging.md +++ b/tutorials/10_logging.md @@ -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 @@ -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: @@ -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 diff --git a/tutorials/23_topic_statistics.md b/tutorials/23_topic_statistics.md index e2ba6de3..1ecf6ff0 100644 --- a/tutorials/23_topic_statistics.md +++ b/tutorials/23_topic_statistics.md @@ -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 @@ -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