터틀봇3 알아보기.

Embeded/ROS : 2021. 1. 15. 14:56

리모트 PC에서  처음 해보면 이것 밖에 없다.

ros2 node list
/turtlebot3_node

 

 

터틀봇에서 bringup 을 띄운다음 해보면

ubuntu@ubuntu:~$ ros2 launch turtlebot3_bringup robot.launch.py

 

몇개 노드가 더 생긴것을 볼 수 있다. 이것만 있는건 아니고 아직 실행 안된것도 많다.

그냥 연습삼아 현재 상태에서 이것저것 찍어본다.

 

ros2 node list
/diff_drive_controller
/hlds_laser_publisher
/robot_state_publisher
/turtlebot3_node

 

지금은 이런 상태. (rqt_graph 로 확인)

ros2 topic list -t
/battery_state [sensor_msgs/msg/BatteryState]
/cmd_vel [geometry_msgs/msg/Twist]
/imu [sensor_msgs/msg/Imu]
/joint_states [sensor_msgs/msg/JointState]
/magnetic_field [sensor_msgs/msg/MagneticField]
/odom [nav_msgs/msg/Odometry]
/parameter_events [rcl_interfaces/msg/ParameterEvent]
/robot_description [std_msgs/msg/String]
/rosout [rcl_interfaces/msg/Log]
/scan [sensor_msgs/msg/LaserScan]
/sensor_state [turtlebot3_msgs/msg/SensorState]
/tf [tf2_msgs/msg/TFMessage]
/tf_static [tf2_msgs/msg/TFMessage]

 

ros2 service list -t
/diff_drive_controller/describe_parameters [rcl_interfaces/srv/DescribeParameters]
/diff_drive_controller/get_parameter_types [rcl_interfaces/srv/GetParameterTypes]
/diff_drive_controller/get_parameters [rcl_interfaces/srv/GetParameters]
/diff_drive_controller/list_parameters [rcl_interfaces/srv/ListParameters]
/diff_drive_controller/set_parameters [rcl_interfaces/srv/SetParameters]
/diff_drive_controller/set_parameters_atomically [rcl_interfaces/srv/SetParametersAtomically]
/hlds_laser_publisher/describe_parameters [rcl_interfaces/srv/DescribeParameters]
/hlds_laser_publisher/get_parameter_types [rcl_interfaces/srv/GetParameterTypes]
/hlds_laser_publisher/get_parameters [rcl_interfaces/srv/GetParameters]
/hlds_laser_publisher/list_parameters [rcl_interfaces/srv/ListParameters]
/hlds_laser_publisher/set_parameters [rcl_interfaces/srv/SetParameters]
/hlds_laser_publisher/set_parameters_atomically [rcl_interfaces/srv/SetParametersAtomically]
/motor_power [std_srvs/srv/SetBool]
/reset [std_srvs/srv/Trigger]
/robot_state_publisher/describe_parameters [rcl_interfaces/srv/DescribeParameters]
/robot_state_publisher/get_parameter_types [rcl_interfaces/srv/GetParameterTypes]
/robot_state_publisher/get_parameters [rcl_interfaces/srv/GetParameters]
/robot_state_publisher/list_parameters [rcl_interfaces/srv/ListParameters]
/robot_state_publisher/set_parameters [rcl_interfaces/srv/SetParameters]
/robot_state_publisher/set_parameters_atomically [rcl_interfaces/srv/SetParametersAtomically]
/rqt_gui_py_node_18723/describe_parameters [rcl_interfaces/srv/DescribeParameters]
/rqt_gui_py_node_18723/get_parameter_types [rcl_interfaces/srv/GetParameterTypes]
/rqt_gui_py_node_18723/get_parameters [rcl_interfaces/srv/GetParameters]
/rqt_gui_py_node_18723/list_parameters [rcl_interfaces/srv/ListParameters]
/rqt_gui_py_node_18723/set_parameters [rcl_interfaces/srv/SetParameters]
/rqt_gui_py_node_18723/set_parameters_atomically [rcl_interfaces/srv/SetParametersAtomically]
/sound [turtlebot3_msgs/srv/Sound]
/turtlebot3_node/describe_parameters [rcl_interfaces/srv/DescribeParameters]
/turtlebot3_node/get_parameter_types [rcl_interfaces/srv/GetParameterTypes]
/turtlebot3_node/get_parameters [rcl_interfaces/srv/GetParameters]
/turtlebot3_node/list_parameters [rcl_interfaces/srv/ListParameters]
/turtlebot3_node/set_parameters [rcl_interfaces/srv/SetParameters]
/turtlebot3_node/set_parameters_atomically [rcl_interfaces/srv/SetParametersAtomically]

 

 



ros2 param list
/diff_drive_controller:
  odometry.child_frame_id
  odometry.frame_id
  odometry.publish_tf
  odometry.use_imu
  use_sim_time
Exception while calling service of node '/hlds_laser_publisher': None
/robot_state_publisher:
  ignore_timestamp
  publish_frequency
  robot_description
  use_sim_time
  use_tf_static
/rqt_gui_py_node_18723:
  use_sim_time
/turtlebot3_node:
  motors.profile_acceleration
  motors.profile_acceleration_constant
  opencr.baud_rate
  opencr.id
  opencr.protocol_version
  sensors.bumper_1
  sensors.bumper_2
  sensors.illumination
  sensors.ir
  sensors.sonar
  use_sim_time
  wheels.radius
  wheels.separation

 

움직여보기

리모트PC에서 키보드 조작으로 움직일 수 있다.

 


ros2 run turtlebot3_teleop teleop_keyboard

Control Your TurtleBot3!
---------------------------
Moving around:
        w
   a    s    d
        x

w/x : increase/decrease linear velocity (Burger : ~ 0.22, Waffle and Waffle Pi : ~ 0.26)
a/d : increase/decrease angular velocity (Burger : ~ 2.84, Waffle and Waffle Pi : ~ 1.82)

space key, s : force stop

CTRL-C to quit

 

w,a,s,d,x 를 누르면 움직인다.

 

움직이면서 

 

cartographer를 실행하면 맵을 만들 수 있다.

$ ros2 launch turtlebot3_cartographer cartographer.launch.py

 

이렇게 리모트PC에서 띄워놓고 움직이면 맵이 만들어진다.

 

만들어진 맵을 저장하려면

$ ros2 run nav2_map_server map_saver_cli -f ~/map

 

이렇게 하면 ~/map.pgm 이랑 ~/map.yaml 파일이 만들어진다.

-f 옵션뒤에 이름을 지정한것이다.

 

저장한 맵은 이런식으로 불러올 수 있다.

$ ros2 launch turtlebot3_navigation2 navigation2.launch.py map:=$HOME/map.yaml

 

 

 

$ ros2 doctor 
/opt/ros/foxy/lib/python3.8/site-packages/ros2doctor/api/package.py: 112: UserWarning: turtlebot3 has been updated to a new version. local: 2.1.0 < required: 2.1.1
/opt/ros/foxy/lib/python3.8/site-packages/ros2doctor/api/package.py: 112: UserWarning: turtlebot3_teleop has been updated to a new version. local: 2.1.0 < required: 2.1.1
/opt/ros/foxy/lib/python3.8/site-packages/ros2doctor/api/package.py: 112: UserWarning: turtlebot3_bringup has been updated to a new version. local: 2.1.0 < required: 2.1.1
/opt/ros/foxy/lib/python3.8/site-packages/ros2doctor/api/package.py: 112: UserWarning: turtlebot3_node has been updated to a new version. local: 2.1.0 < required: 2.1.1
/opt/ros/foxy/lib/python3.8/site-packages/ros2doctor/api/package.py: 112: UserWarning: turtlebot3_navigation2 has been updated to a new version. local: 2.1.0 < required: 2.1.1
/opt/ros/foxy/lib/python3.8/site-packages/ros2doctor/api/package.py: 112: UserWarning: turtlebot3_example has been updated to a new version. local: 2.1.0 < required: 2.1.1
/opt/ros/foxy/lib/python3.8/site-packages/ros2doctor/api/package.py: 112: UserWarning: turtlebot3_description has been updated to a new version. local: 2.1.0 < required: 2.1.1
/opt/ros/foxy/lib/python3.8/site-packages/ros2doctor/api/package.py: 112: UserWarning: turtlebot3_cartographer has been updated to a new version. local: 2.1.0 < required: 2.1.1


DynamixelSDK, turtlebot3, turtlebot3_msgs 를 update 하고 colcon build 해준다.

 

 

조립할때 opencr 보드나 라이다 센서가 제위치에 조립 안되어 있으면 이런 일이 발생한다.

 

다시 조립을 제대로 하고 돌려보면

 

조립을 제대로 하고 다시 돌리면 잘 나오는것을 볼 수 있다.

'Embeded > ROS' 카테고리의 다른 글

터틀봇3 알아보기.  (0) 2021.01.15
ROS2 action 만들기  (0) 2021.01.13
ROS2 ros2doctor  (0) 2021.01.13
ROS2 class 에서 parameter 쓰기 (C++), launch 파일 만들기  (0) 2021.01.13
Posted by Real_G

댓글을 달아 주세요