재설치 명령어
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 |