Commit 54d6eaa1 authored by CANNERE Xavier's avatar CANNERE Xavier
Browse files

6.1.4

parent b9a306fe
......@@ -23,8 +23,8 @@ We'll create a new package who allow the following of a visual target called ``p
- visual : main node
- DetectionCnam_codels : ??? (à modifier)
Step 2 :
--------
Step 2 : Node's skeleton
------------------------
Open on QtCreator and edit visu.cpp. You can delete all what is written. First, include the libraries::
......@@ -53,7 +53,7 @@ Now paste this universal main code::
Now we'll create a class ``visual``, we'll declare inside this class the main algorithm. Paste that between the ``include`` and the ``main()``::
class Visu : public rclcpp::Node
class Visual : public rclcpp::Node
{
};
......@@ -62,13 +62,46 @@ You can add the following line in the ``main`` before the ``spin``, it will defi
auto node = std::make_shared<Visual>();
Now create the constructor of the class (paste inside the class)::
Visu()
: Node("visual")
{
}
Make sure your code looks like this::
#include <cstdio>
#include "opencv2/opencv.hpp"
#include "rclcpp/rclcpp.hpp"
#include "sensor_msgs/msg/image.hpp"
#include "geometry_msgs/msg/twist.hpp"
#include "cv_bridge/cv_bridge.h"
class Visual : public rclcpp::Node
{
public:
Visual()
: Node("visu")
{
}
};
int main(int argc, char ** argv)
{
(void) argc;
(void) argv;
rclcpp::init(argc, argv);
auto node = std::make_shared<Visual>();
rclcpp::spin(node);
rclcpp::shutdown();
return 0;
}
Step 3 : The constructor
------------------------
......
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