본문 바로가기

전체 글

(49)
Use a Custom Interface Now that you've learned how to create a custom interface, let's see how you can use it in your ROS 2 node!- Example 3.6 -It's time to use the custom interface RoverEvents that we created.When compiling, the Python and C++ classes for this interface were created.This means that if we want to use them, it will be just like any other interface already installed in the system, like the ones we have ..
How to Create a Custom Interface It is always recommended to use the interfaces that ROS2 already provides. Remember you can check all ROS2 available interfaces using the ros2 interface list) command. However, if none fits your needs, you can create a new one.Create a new package named custom_interfaces. This package, however, has to be a CMake package. Currently, there is no way to generate custom interfaces in a pure Python p..
How to mix Publishers and Subscribers Let’s build an object detection system using both subscribers and publishers.We need to develop a script that detects plants using the RGB camera sensor.Create a script named plant_detector_node.py.This script should subscribe to the image topic /leo/camera/image_raw.We will use an AI model developed by NASA’s Space Biology Division to identify plants.Once a plant is detected, the program should..
Topic Publisher To get started, it’s important to understand what a publisher is. Based on what you’ve learned so far, you can think of a publisher as a node that sends data to a specific Topic.To practice this concept, we’ll dive into a new mission!MISSION 2: Controlling the Movements of the Mars Rover Through CodeThe main goal of this mission is to send movement commands to the Mars Rover. To do this, we’ll p..
Topic Subscriber To get started, it’s important to understand what a subscriber is. Based on what you’ve learned so far, you can think of a subscriber as a node that reads data from a specific Topic.To put this concept into practice, we’ll create an obstacle detection program.The goal is to build an obstacle detector that subscribes to the laser_scan topic in order to detect obstacles around the robot.In the fil..
Define a Topic In the last section, you learned the basics of working with Topics in ROS 2: how to list them, extract key information, publish messages, and capture them.Let’s recap these concepts:You can send messages to a Topic (known as publishing to a Topic) and read messages from a Topic (known as subscribing to it).In Example 3.3, you published Twist messages (which represent velocities) to the /cmd_vel ..
Explore the topics MISSION: Detect Obstacles for the Mars RoverTo prevent the Mars Rover from colliding with obstacles during its missions, we need to detect nearby objects.A great option for this task is a laser sensor, which measures the distance to objects both in front of and on the sides of the robot.Here’s its range:You can see that each laser beam will measures the distance to the first object detected.You ..
Basic Topic commands Before diving into a full understanding of Topics, let’s start by interacting with them a bit. To help with this, you’ll be introduced to some basic command-line tools that ROS 2 provides for working with topics. - TIP -No matter where you are, in order to be able to execute ROS2 commands, you need to source ROS2.We can directly source the basic ROS2 installation: Execute in Terminal #1source ..