ROS2 21

[ROS2] Tutorial Intermediate - Integrating launch files into ROS 2 packages

Integrating launch files into ROS 2 packagesTasksCreate a packagemkdir -p launch_ws/srccd launch_ws/srcros2 pkg create --build-type ament_python --license Apache-2.0 py_launch_example Creating the structure to hold launch files모든 launch file은 launch directory안에 저장된다.launch file을 사용하기 위헤 setup.py의 data_file에 launch 파일을 추가해야 한다.import osfrom glob import glob# Other imports ...package_name = 'py_la..

ROS2 2024.11.27

[ROS2] Tutorial Intermediate - Creating a launch file

Creating a launch fileBackgroundROS2의 launch 시스템은 유저가 시스템 configuration을 표현할 수 있도록 도와준다. configuration은 실행할 프로그램, 실행 위치, 전달할 argument, ROS 관련 규칙이 포함된다. 또한 launch process 상태를 모니터링할 수 있고, 보고도 한다.python, XML, YAML로 작성된 launch 파일은 다른 노드로 시작, 정지할 수 있고 다양한 event를 실행할 수 있다.  TasksWrite the launch filemkdir launch# launch/turtlesim_mimic_launch.pyfrom launch import LaunchDescriptionfrom launch_ros.actio..

ROS2 2024.11.26

[ROS2] Tutorial Intermediate - Composing multiple nodes in a single process

Composing multiple nodes in a single processRun the demosDiscover available components어떤 components가 등록되어있고 사용가능한지 알려면 아래의 코드를 사용하면 된다.ros2 component types Run-time composition using ROS services with a publisher and subscriber먼저 component container를 실행하고ros2 run rclcpp_components component_container 두번째 shell에서 ros2 command line tool을 통해 실행중인 container를 확인하자.ros2 component list 두번째 shell에서 talk..

ROS2 2024.11.18

[ROS2] Tutorial Intermediate - Writing an action server and client(Python)

Writing an action server and client(Python)Backgroundaction은 ROS2에서 비동기식 커뮤니케이션 형태이다. client는 request를 server에게 보내고, server는 feedback과 result를 client에게 보낸다.TasksWriting an action serverimport rclpyfrom rclpy.action import ActionServerfrom rclpy.node import Nodefrom action_tutorials_interfaces.action import Fibonacciclass FibonacciActionServer(Node): def __init__(self): super().__init__..

ROS2 2024.11.17

[ROS2] Tutorial Intermediate - Creating an action

Creating an actionTaskDefining an actionAction은 .action파일에서 정의된다.# Request---# Result---# Feedback action은 ---로 구분된 3가지 메세지 정의로 이루어져있다.request message는 새로운 목표를 시작할 때 server에게 client가 보내는 것이다.result message는 목표를 끝냈을 때, client에게 server가 보내는 것이다.feedback message는 주기적으로 client에게 server가 목표에 대한 정보를 update하는 것이다. 피보나치수열을 계산하는 'Fibonacci'라는 새로운 action을 정의해보자.action_tutorials_interfaces 패키지 안에 action 경로..

ROS2 2024.11.16

[ROS2] Tutorial Intermediate - Managing Dependencies with rosdep

Managing Dependencies with rosdepWhat is rosdep?rosdep은 패키지와 외부 라이브러리가 함께 작동되도록 dependency를 관리하는 유틸리티이다. 패키지를 build하거나 install하는 dependency를 구분하고 설치하기 위한 유틸리티이다.rosdep은 그 자체로 패키지를 관리하지 않는다. 특정 플랫폼을 설치하기 위한 적절한 패키지를 찾기 위해 자신이 가지고 있는 dependency를 사용하는 meta  패키지 관리인이다.실제 설치는 시스템 패키지 관리인(apt, dnf 등)을 사용한다.워크스페이스를 빌딩하기 전에 가장 많이 호출되며, 워크스페이스 안에 있는 패키지에 대한 dependency를 설치하는데 사용된다.하나 또는 여러개의 패키지가 있는 디렉토리에..

ROS2 2024.11.16

[ROS2] Tutorial Beginner : Client libraries - Using ros2doctor to identify issues

Using ros2doctor to identify issuesBackgroundros2 code를 작성했는데 구현되지 않는다면 ros2doctor tool을 이용하여 확인할 수 있다.ros2doctor는 platform, version, network, environment, running systems, warns(errors, reasons for issues) 등 모든 방면에서 확인 가능하다. Tasksros2doctor를 실행해보면 setup module을 확인 후 warnings, errors를 return 해준다.필자의 경우 튜토리얼 진행했던 폴더에서 실행했을 때 총 5가지를 체크하고 UserWarning이 출력되었다.ros2 doctor UserWarning은 큰 문제가 있는 것은 아니고 ..

ROS2 2024.11.08

[ROS2] Tutorial Beginner : Client libraries - Using parameter in a class(Python)

Using parameter in a class(Python)Backgroundlaunch file에 parameter를 추가해주곤 해야 하는데 해당 tutorial을 통해 어떻게 parameter를 생성하고 launchfile에 세팅하는지 알아보자. TasksCreate a package# ros2_ws/srcros2 pkg create --build-type ament_python --license Apache-2.0 python_parameters --dependencies rclpy--dependencies는 package.xml나 CMakeLists.txt에 dependency를 자동으로 추가해준다. package.xml에 description, maintainer, license에 대한 정보는..

ROS2 2024.11.08

[ROS2] Tutorial Beginner : Creating custom msg and srv files

Creating custom msg and srv filesTasksCreate a new package.msg, .srv를 만들어 각각의 패키지에 생성할 것이다. 패키지는 같은 workspace에 있어야 한다.pub/sub, service/client 패키지를 생성할 것이기 때문에 이또한 같은 패키지에 생성해야 한다.ros2 pkg create --build-type ament_cmake --license Apache-2.0 tutorial_interfaces tutorial_interface는 CMake기반의 패키지이지만 message, service를 사용할 수 있는 패키지 유형에 제한은 없다.CMake패키지에서 custom interface를 만들고 Python node를 사용할 수 있다..msg..

ROS2 2024.10.28

[ROS2] Tutorial Beginner : Client libraries - Writing a simple service and client(Python)

Writing a simple service and client(Python)Backgroundnode는 service를 이용해 communicate할 때, data를 request하는 node는 client node, respond하는 node를 service node라고 한다.이는 .srv 파일로 정의된다. TasksCreate a packageros2_ws/src directory를 만들어 새로운 package를 만들어보자.ros2 pkg create --build-type ament_python --license Apache-2.0 py_srvcli --dependencies rclpy example_interfaces 필요한 file, folder를 만들었음을 terminal로 확인할 수 있을 ..

ROS2 2024.10.11