ros2 [verb] [sub-verbs] [options] [arguments]
verb : 동작을 지정하여 수행할 작업의 유형을 나타낸다.
sub-verb : 특정 동작에 대한 세부 동작을 지정한다.
options : 명령어의 실행 방식을 설정하는 파라미터이다.
argument : 실행할 때 필요한 인수를 지정한다. 특정 노드나 토픽, 서비스 이름 등이 올 수 있다.
| Verb | 설명 | 주요 명령어 예시 |
|---|---|---|
| topic | ROS 2 토픽과 관련된 작업 수행 | ros2 topic list, ros2 topic echo <topic_name> |
| service | ROS 2 서비스와 관련된 작업 수행 | ros2 service list, ros2 service call <service_name> |
| action | ROS 2 액션과 관련된 작업 수행 | ros2 action list, ros2 action send_goal <action_name> |
| node | ROS 2 노드와 관련된 작업 수행 | ros2 node list, ros2 node info <node_name> |
| param | ROS 2 노드의 파라미터와 관련된 작업 수행 | ros2 param list <node_name>, ros2 param get <node_name> |
| lifecycle | ROS 2 라이프사이클 노드의 상태 관리 | ros2 lifecycle get <node_name>, ros2 lifecycle set <node_name> |
| bag | ROS 2 bag 파일의 기록 및 재생 관련 작업 수행 | ros2 bag record <topic_name>, ros2 bag play <bag_file> |
| daemon | ROS 2 daemon(백그라운드 프로세스)와 관련된 작업 수행 | ros2 daemon start, ros2 daemon stop |
| doctor | ROS 2 시스템의 상태 점검 및 문제 진단 | ros2 doctor |
| launch | ROS 2 launch 파일 실행 및 관련 작업 수행 | ros2 launch <package_name> <launch_file> |
| verb | sub-verbs | arguments | 설명 |
|---|---|---|---|
| node | list | 사용 가능한 노드 목록을 출력 | |
| info | <node_name> | 특정 노드의 상세 정보를 출력 | |
| services | <node_name> | 특정 노드가 제공하는 서비스 목록을 출력 | |
| topics | <node_name> | 특정 노드가 구독 또는 퍼블리시하는 토픽 목록을 출력 | |
| topic | list | 사용 가능한 토픽 목록을 출력 | |
| echo | <topic_name> | 특정 토픽의 메시지를 실시간으로 출력 | |
| info | <topic_name> | 특정 토픽의 상세 정보를 출력 | |
| hz | <topic_name> | 특정 토픽의 메시지 퍼블리싱 속도를 측정 | |
| bw | <topic_name> | 특정 토픽의 대역폭(throughput)을 측정 | |
| service | list | 사용 가능한 서비스 목록을 출력 | |
| call | <service_name> <service_type> <request_arguments> | 특정 서비스 호출 | |
| action | list | 사용 가능한 액션 목록을 출력 | |
| info | <action_name> | 특정 액션의 상세 정보를 출력 | |
| interface | list | msg, srv, action 중 하나 선택 | 사용 가능한 메시지, 서비스, 액션 인터페이스를 출력 |
| show | <interface_type> <interface_name> | 특정 인터페이스의 상세 내용을 출력 | |
| param | list | <node_name> | 특정 노드에서 사용 가능한 파라미터 목록을 출력 |
| get | <node_name> <parameter_name> | 특정 노드의 파라미터 값을 가져옴 | |
| set | <node_name> <parameter_name> <parameter_value> | 특정 노드의 파라미터 값을 설정 | |
| bag | record | <topic_name>... | 특정 토픽의 메시지를 레코딩 |
| play | <bag_file> | 레코딩된 bag 파일을 재생 | |
| info | <bag_file> | bag 파일의 정보를 출력 | |
| extensions | list | 사용 가능한 확장 목록을 출력 | |
| daemon | start | ROS 2 daemon을 시작 | |
| stop | ROS 2 daemon을 중지 | ||
| status | ROS 2 daemon의 상태를 출력 | ||
| doctor | check | 시스템 상태 점검 | |
| lifecycle | list | lifecycle 상태를 가진 노드 목록을 출력 | |
| get | <node_name> | 특정 노드의 lifecycle 상태를 확인 | |
| set | <node_name> <state> | 특정 노드의 lifecycle 상태를 설정 | |
| component | list | 사용 가능한 컴포넌트 목록을 출력 | |
| load | <container_node> <library> | 특정 컨테이너 노드에 컴포넌트를 로드 | |
| unload | <container_node> <component_name> | 특정 컴포넌트를 언로드 | |
| security | generate_policy | <policy_file> | 보안 정책 파일 생성 |
| list | 사용 가능한 보안 설정 목록을 출력 |
ros2 pkg create <패키지이름> --build-type <ament_빌드타입>ros2 pkg create <패키지이름> --build-type <ament_빌드타입> --dependencies <의존패키지이름>ros2 node list : 실행 중인 노드 목록 확인ros2 node info /turtlesim : 노드 정보 확인ros2 topic list -t : 실행중인 모든 노드들의 인터페이스형태와 토픽 이름 확인ros2 topic echo /turtle1/cmd_vel : cmd_vel 토픽의 데이터 확인ros2 service call /turtle1/set_pen turtlesim/srv/Setpen "{r: 255, g: 255, b: 255, width: 10}" : turtlesim/srv/Setpen 인터페이스 형태를 사용하는 /turtle1/set_pen 서비스에 특정 값 요청 ros2 action send_goal /turtle1/rotate_absolute turtlesim/action/RotateAbsolute "{theta: 1.57}" : turtlesim/action/RotateAbsolute 언터페이스 형태를 사용하는 /turtle1/rotate_absolute 에 액션 목표 전달ros2 bag record -o <저장할이름> /turtle1/cmd_vel : 원하는 토픽 정보를 저장할이름으로 저장ros2 bag play <저장할이름> : 저장한 bag파일 재생ros2 daemon start : daemon 시작ros2 daemon status : daemon 상태 확인ros2 daemon stop : daemon 정지ros2 doctor hello : 네트워크 연결 확인ros2 doctor -r : 체크한 모든 아이템 확인(report)ros2 dorctor -rf : 체크할 때 실패한 아이템 확인(report-fail)ros2 doctor -iw : 경고성 아이템 확인(include-warnings)ros2 lifecycle get : 실행 중인 노드의 lifecycle 가져오기ros2 lifcecycle list /lc_talker : lc_talker노드의 상태 천이가 가능한 lifecycle 목록 출력ros2 lifecycle nodes : lifecycle을 가지고 있는 노드 목록 출력ros2 lifecycle set /lc_talker congfigure or activate or deactivate or shutdown : lc_talker 의 상태를 4가지 중 하나로 전환
ros2 security create_keystore demo_keystore : 보안키 저장소 생성ros2 security create_enclave demo_keystore /talker_listener/talker : 보안키 생성ros2 security create_enclave demo_keystore /talker_listener/listener : 보안키 생성export ROS_SECURITY_KEYSTORE=~/demo_keystore
export ROS_SECURITY_ENABLE=ture
export ROS_SECURITY_STRATEGY=Enforce
ros2 run demo_nodes_cpp talker --ros-args --enclave /talker_listner/talker
ros2 run demo_nodes_cpp talker --ros-args --enclave /talker_listner/listener
