Commit 428a9ea1 authored by CANNERE Xavier's avatar CANNERE Xavier
Browse files

modif t5 s1/s2

parent fd999969
......@@ -21,12 +21,112 @@ The objective is to create two components, a producer and a consumer.
Step 1 : Create the package
First we'll create the package with these following lines::
First we'll create one package for the main nodes with these following lines::
cd ~/colcon_ws/src
ros2 pkg create --build-type ament_cmake --node-name follower pkg_follower
ros2 pkg create --build-type ament_cmake pkg_follower
And one for the service::
ros2 pkg create --build-type ament_cmake pkg_srv
colcon build
Step 2 : Create the service
The service will allow the reset of the counter, type these on a terminal::
cd ~/colcon_ws/src/pkg_srv
mkdir srv
cd srv
gedit Raz.srv
And on your file paste that::
int64 a
int64 b
It define there is an int in input and an other int in output. Save and close your file.
Now edit your CMakeLists.txt of ``pkg_srv``::
cmake_minimum_required(VERSION 3.8)
add_compile_options(-Wall -Wextra -Wpedantic)
# find dependencies
find_package(ament_cmake REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# uncomment the line when a copyright and license is not present in all source files
#set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# uncomment the line when this package is not in a git repo
#set(ament_cmake_cpplint_FOUND TRUE)
These lines define the service on the CMakeLists::
find_package(rosidl_default_generators REQUIRED)
And your package.xml::
<?xml version="1.0"?>
<?xml-model href="" schematypens=""?>
<package format="3">
<description>TODO: Package description</description>
<maintainer email="">etdisc</maintainer>
<license>TODO: License declaration</license>
And these lines define the service on the package.xml::
Step 2 : Create the producer
Step 3 : Create the producer
The producer is the node who'll publish information
......@@ -40,6 +140,8 @@ Open QtCreator, create a new file called ``producer.cpp`` into ``/src`` of ``pk
#include "rclcpp/rclcpp.hpp"
#include "std_msgs/msg/string.hpp"
#include "std_msgs/msg/int64.hpp"
#include "pkg_srv/srv/raz.hpp"
This is part of the code where we include libraries::
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment