ROS 15

ROS_Study: Recording and playing back data

실행되고 있는 ROS의 데이터를 .bag 파일로 녹화하고, 녹화된 파일을 재생하는 방법을 알아보자 요약: 1. 녹화하고픈 노드를 실행한다 2. rosbag 폴더를 만든다 3. 해당 폴더에서 발행된 모든 토픽들을 녹화한다 4. 저장된 파일을 실행시킨다 1. turtlesim 켜기 1) roscore 2) rosrun turtlesim turtlesim_node 3) rosrun turtlesim turtle_teleop_key 2. .bag 파일 저장할 폴더로 이동 후, 녹화시작 1) cd rosbag(없으면 생성) 2) 녹화 >> rosbag record -a * -a: 발행된 모든 토픽을 .bag 파일에 저장한다 3. 저장된 .bag 파일 실행 >> rosbag play * -s 옵션을 통해 재생 시작..

ROS 2023.12.08

ROS_Study: Writing a Simple Service and Client (Python)

1. scripts 폴더에 service/client 소스코드 작성 2. 각각의 파일들을 CMakeList.txt에 추가 3. 컴파일 후 실행 roscd beginner_tutorials/scritps/ 1. add_two_ints_server.py #!/usr/bin/env python3 from __future__ import print_function from beginner_tutorials.srv import AddTwoInts,AddTwoIntsResponse import rospy def handle_add_two_ints(req): print("Returning [%s + %s = %s]"%(req.a, req.b, (req.a + req.b))) return AddTwoIntsRespon..

카테고리 없음 2023.12.08

ROS_Study: Writing a Simple Publisher and Subscriber(Python)

시작단계: $ roscd beginner_tutorials $ mkdir scripts $ cd scripts 1. Publisher Node 작성하기 1) scripts 폴더내에 python 파일 작성 #!/usr/bin/env python3 # license removed for brevity import rospy from std_msgs.msg import String def talker(): pub = rospy.Publisher('chatter', String, queue_size=10) rospy.init_node('talker', anonymous=True) rate = rospy.Rate(10) # 10hz while not rospy.is_shutdown(): hello_str = "h..

ROS 2023.11.22

ROS_Study: Creating a ROS msg and srv(Only srv)

srv: 1. describe a service. request와 response로 구성된다 2. srv 파일들은 패키지의 srv 폴더 안에 저장된다. 3. request와 response는 '---'로 구분된다 srv 파일 예시: int 64 A int 64 B --- int64 Sum srv 사용법: 1. srv 만들기 1) 패키지 안에 srv폴더를 생성하여 새로운 srv 파일 추가 *edit 프로그램(visual code 등)에서 폴더에다 생성하는게 쉬움 $ roscd beginner_tutorials $ mkdir srv * 튜토리얼에서는 새로운 srv definition을 생성하기보다는, 다른 패키지에 존재하는 srv 폴더를 복붙 roscp 사용 $ roscp [package_name] [fil..

ROS 2023.11.22

ROS_Study: Creatomg a ROS msg and srv(Only msg)

msg: 1. simple text files that describe the fields of a ROS message 2. msg 파일들은 패키지의 msg 폴더 안에 저장된다. 3. 각 줄에 field type과 field name이 적힌 간단한 텍스트 파일 field type 예시: int8, int16, int32, int64 (plus uint*) float32, float64 string time, duration other msg files variable-length array[] and fixed-length array[C] msg 사용법: 1. msg 만들기 1) 패키지 안에 새로운 msg 만들기 *edit 프로그램(visual code 등)에서 폴더에다 생성하는게 쉬움 $ roscd ..

ROS 2023.11.22

ROS_Study: Understanding ROS Nodes

ROS graph concept과 몇몇의 명령어(roscore, rosnode, rosrun) 알아보자 ROS Graph Concept 개요(아래 그림 참고): Nodes: ROS package 내부에 있는 executable files. ROS로 서로 다른 Node끼리 통신할 수 있다. Node는 또한 Service를 제공하거나 사용할 수 있다. Messages: topic에 subscribe/publish 할때 사용되는 ROS data type Topics: 한 Node는 한 Topic에 message를 subscribe/publish 한다. Master: 각 Nodes들이 서로를 찾게 도와주는 것 roscore: Master + rosout + parameter 서버 * rosout, paramet..

ROS 2023.11.08

ROS_STudy: Building Packages

Building a ROS Package 패키지의 시스템 dependencies가 설정 완료됐다면, 새로 생서된 패키지를 빌드할 수 있다.(빌드해야 된다) catkin_make: 1. 앵간하면 cm으로 alias 해두자(nano, gedit ~/.bashrc) 2. src 폴더 내의 모든 catkin projects를 build 한다. catkin make는 꼭 workspace에서! *새로운 패키지나 컴파일한 새로운 c++가 있을 때마다 build 해줘 ROS/Tutorials/BuildingPackages - ROS Wiki Building Packages Once all the system dependencies are installed, we can build our package that we ..

ROS 2023.11.08

ROS_Study: CreatingPackage

한 ws안에서 catkin package를 생성하는 법을 알아보자 catkin package: 1. 해당 pkg는 catkin compliant package.xml 파일을 포함한다. * catkin이란: a. ROS의 공식 빌드 시스템 b. 기존 ROS 빌드 시스템인 rosbuild의 단점을 보완한 버전 2. 해당 pkg는 catkin을 사용하는 CMakeLists.txt를 포함한다. 3. 각 pkg들은 한 개의 폴더와 대응된다.(= pkg는 한 개의 폴더로 이루어진다.) pkg 생성 순서 1. catkin_create_pkg package dependencies: a. first-order dependencies: pkg를 catkin_create_pkg로 생성할 때 추가한 dependencies (..

ROS 2023.09.11

ROS_Study: catkin/workspaces

우리가 매일 ROS 관련 프로젝트를 진행할 때 들어가는 작업장(workspace). 뭐하는지는 알아야되지 않을까? Source Space(src): catkin_pkgs의 소스코드가 포함된 폴더 Build Space(build): catkin_pkgs의 source space를 빌드하기 위해 CMake를 호출하는 폴더 Development Space(devel): 빌드된 대상이 설치되기 전에 놓여지는 폴더 참고: [1] catkin/workspaces - ROS Wiki catkin packages can be built as a standalone project, in the same way that normal cmake projects can be built, but catkin also provi..

ROS 2023.09.11