[ROS2] 명령어 모음

2024. 12. 31. 14:55·ROS2

 

재설치 명령어

sudo apt remove ros-<distro>-* && sudo apt autoremove
ex) sudo apt remove ros-humble-* && sudo apt autoremove

 

재설치 후 colcon build Warning 발생 시

export AMENT_PREFIX_PATH=''
export CMAKE_PREFIX_PATH=''

 

노드명 변경하여 노드 실행

#ros2 run <package> <node> __node:== <node_name>
ros2 run turtlesim turtlesim_node __node:=new_turtle

 

패키지 위치 찾기

#ros2 pkg prefix <package_name>
ros2 pkg prefix rosbag2

 

executable 파일 찾기

#ros2 pkg executables <package_name>
ros2 pkg executables action_tutorials_py

 

워크스페이스의 패키지가 의존하는 패키지 설치

rosdep install --from-paths src --ignore-src -r --rosdistro <distro> -y

 

노드 리스트

ros2 node list

 

토픽 subcribe

#ros2 topic echo <topic_name>
ros2 topic echo /turtle1/cmd_vel

 

토픽 publish

#ros2 topic pub --option <topic_name> <msg_type> "<args>"
# publish 한번
ros2 topic pub --once /turtle1/cmd_vel geometry_msgs/msg/Twist "{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 1.8}}"

# publish rate 1로
ros2 topic pub --rate 1 /turtle1/cmd_vel geometry_msgs/msg/Twist "{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 1.8}}"

 

서비스 요청

#ros2 service call <service_name> <service_type> "<args>"
ros2 service call /kill turtlesim/srv/Kill "name: 'turtle1'"

 

액션 전달

#ros2 action send_goal <action_name> <action_type> "<values>"
ros2 action send_goal /turtle1/rotate_absolute turtlesim/action/RotateAbsolute "{theta: 1.5708}"

 

인터페이스 확인

#ros2 interface show <interface_name> 
ros2 interface show turtlesim/srv/Spawn.srv

 

tf tree view (with namespace, namesapce가 /robot1일 때)

ros2 run tf2_tools view_frames --ros-args -r __ns:=/robot1 -r /tf:=tf -r /tf_static:=tf_static

 

a frame과 b frame의 tf 확인 ( with namespace, namesapce가 /robot1일 때)

ros2 run tf2_ros tf2_echo <source_frame_id> <target_frame_id> --ros-args -r __ns:=/robot1 -r /tf:=tf -r /tf_static:=tf_static

 

'ROS2' 카테고리의 다른 글

[ROS2] pointcloud_to_laserscan  (0) 2025.03.08
[nav2] 트러블 슈팅 goal_checker stateful  (0) 2025.03.08
[ROS2] livox_ros_driver2 QoS 트러블 슈팅  (0) 2025.02.08
[Nav2] map-> odom -> base_link에 대하여  (0) 2024.12.31
[Nav2] 파라미터 튜닝  (1) 2024.12.31
'ROS2' 카테고리의 다른 글
  • [nav2] 트러블 슈팅 goal_checker stateful
  • [ROS2] livox_ros_driver2 QoS 트러블 슈팅
  • [Nav2] map-> odom -> base_link에 대하여
  • [Nav2] 파라미터 튜닝
Danny.Song
Danny.Song
  • Danny.Song
    일기장
    Danny.Song
  • 전체
    오늘
    어제
    • 분류 전체보기 (61)
      • Web (11)
        • React.js (1)
        • Next.js (1)
        • Node.js (2)
        • Web 전반 (7)
      • Unity Robotics (7)
      • ROS2 (7)
      • SW 이것저것 (3)
      • 일상 (1)
      • etc (4)
        • 프로젝트 (1)
        • 주식일기 (1)
        • Unity (1)
        • 하루 계획 (0)
        • 배움 (0)
        • 소프트웨어공학 (0)
        • 운영체제 (1)
        • etc... (0)
      • Java (26)
        • 프로젝트 (8)
        • cmd에서 자바실행 (2)
        • 통신 (3)
        • xml (6)
        • Database (3)
        • 코딩테스트 (0)
        • 디자인패턴 (1)
        • 기타 (1)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    날짜 관련
    livox_ros_driver2
    java
    지뢰찾기
    Schema
    invalid frame header
    ai navigation
    Dom
    ros2
    goal_checker
    Unity
    ros2 qos
    self signed ssl 인증서 발급
    decontruct
    minesweeper
    amcl
    XML Schema
    nav2
    pointcloud_to_laserscan
    telegram chatbot
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
Danny.Song
[ROS2] 명령어 모음
상단으로

티스토리툴바