원래 자꾸 까먹는 것은 모아두고 필요할 때마다 봐야합니다. 어떻게 그걸 다 외우나요?
ROS2 삭제
#본인의 ROS 버전을 적습니다.
sudo apt remove ~nros-foxy-* && sudo apt autoremove
sudo rm /etc/apt/sources.list.d/ros2.list
sudo apt update
sudo apt autoremove
# Consider upgrading for packages previously shadowed.
sudo apt upgrade
ROS2 CLI
패키지
패키지 생성하는 명령어
ros2 pkg create --build-type ament_cmake <패키지_이름> --dependencies <의존_패키지> --node-name <만들_노드이름>
LOG
# Foxy 버전
ros2 run <패키지_이름> <노드_이름> --ros-args --log-level debug
# Galactic ~ Humble
ros2 run <패키지_이름> <노드_이름> --ros-args --log-level <로거_이름(logger_usage)>:=debug
pub
CLI로 multiarray 메시지 퍼블리시하기
ros2 topic pub /multiarray_msg std_msgs/Float32MultiArray '{layout: {dim: [{label: 'abc', size: 2, stride: 2}], data_offset: 2}, data: [1.0, 5.0]}'
action
ros2 action send_goal
ROS2 action 메시지를 터미널에서 퍼블리시할 때
ros2 action send_goal <action_name> <action_type> '<value>'
#ex) ros2 action send_goal /action_name interfaces/action/type 'point: {x: 0, y: 0, z: 0}'
#ex) ros2 action send_goal /turtle1/rotate_absolute turtlesim/action/RotateAbsolute "{theta: 1.5708}"
이 때 Action 메시지 형태는 각각
### interfaces/action/type
# Goal
geometry_msgs/Point point
---
# Result
bool result
---
# Feedback
bool feedback
-----------------
### turtlesim/action/RotateAbsolute
# The desired heading in radians
float32 theta
---
# The angular displacement in radians to the starting position
float32 delta
---
# The remaining rotation in radians
float32 remaining
이다.
옵션
--feedback 피드백이 지속적으로 표시가 된다.
기타 패키지
TF StaticTransformBroadcaster
터미널에서 사용할 때
RPY
단위는 [m]와 [rad]입니다.
ros2 run tf2_ros static_transform_publisher x y z yaw pitch roll frame_id child_frame_id
쿼터니언
ros2 run tf2_ros static_transform_publisher x y z qx qy qz qw frame_id child_frame_id
런치파일에서 사용할 때
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
return LaunchDescription([
Node(
package='tf2_ros',
executable='static_transform_publisher',
arguments = ['0', '0', '1', '0', '0', '0', 'world', 'mystaticturtle']
),
])
'Robot > ROS' 카테고리의 다른 글
[ros2_control] 아키텍처 분석 (0) | 2022.08.21 |
---|---|
[ros2_contorl] ros2_control과 ros2_control_demo (1) | 2022.08.15 |
[MicroROS] 참고할만한 자료들 (0) | 2022.08.06 |
[MicroROS] Publisher와 Subscriber 생성하기 (2) | 2022.08.06 |
[MicroROS] MicroROS + Arduino DUE 튜토리얼 (9) | 2022.07.24 |
댓글