Hood NUC Melih ROS2 TB3 Install

From wikidb
Revision as of 21:48, 23 January 2020 by Edc (Talk | contribs)

Jump to: navigation, search

Context

January 18, 2020

ROS 2 on Turtlebot 3 takes place here. Navigation will be removed from the install. I suspect so that the we will be working with the a current release of the Intel Navigation 2 stack.

Reference

ROS 2 Turtlebot 3 Installation

Install Cartographer dependencies

The following was already installed previously.

 $ sudo apt install -y \
     google-mock \
     libceres-dev \
     liblua5.3-dev \
     libboost-dev \
     libboost-iostreams-dev \
     libprotobuf-dev \
     protobuf-compiler \
     libcairo2-dev \
     libpcl-dev \
     python3-sphinx

See Hood ROS2 Melih Cartography Dependencies Log

Install Navigation2 dependencies

The following was already installed previously as well.

 $ sudo apt install -y \
     libsdl-image1.2 \
     libsdl-image1.2-dev \
     libsdl1.2debian \
     libsdl1.2-dev

See Hood ROS2 Melih Navigation2 Dependencies Log

Create a Workspace for TB3

 eepp@hood:navigation2_ws$ cd ~/ros2_all_ws

 eepp@hood:ros2_all_ws$ mkdir turtlebot3_ws
 
 eepp@hood:ros2_all_ws$ cd turtlebot3_ws

 eepp@hood:turtlebot3_ws$ mkdir src

Clone all the up to date repositories

 eepp@hood:turtlebot3_ws$ wget https://raw.githubusercontent.com/ROBOTIS-GIT/turtlebot3/ros2/turtlebot3.repos
     --2020-01-18 10:33:00--  https://raw.githubusercontent.com/ROBOTIS-GIT/turtlebot3/ros2/turtlebot3.repos
     Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.52.133
     Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.52.133|:443... connected.
     HTTP request sent, awaiting response... 200 OK
     Length: 620 [text/plain]
     Saving to: ‘turtlebot3.repos’

     turtlebot3.repos    100%[===================>]     620  --.-KB/s    in 0s      

     2020-01-18 10:33:00 (32.7 MB/s) - ‘turtlebot3.repos’ saved [620/620]

 eepp@hood:turtlebot3_ws$ vcs import src < turtlebot3.repos
     .....
     === src/turtlebot3/turtlebot3 (git) ===
     Cloning into '.'...
     Switched to a new branch 'ros2'
     Branch 'ros2' set up to track remote branch 'ros2' from 'origin'.
     === src/turtlebot3/turtlebot3_msgs (git) ===
     Cloning into '.'...
     Switched to a new branch 'ros2'
     Branch 'ros2' set up to track remote branch 'ros2' from 'origin'.
     === src/turtlebot3/turtlebot3_simulations (git) ===
     Cloning into '.'...
     Switched to a new branch 'ros2'
     Branch 'ros2' set up to track remote branch 'ros2' from 'origin'.
     === src/utils/DynamixelSDK (git) ===
     Cloning into '.'...
     Switched to a new branch 'ros2'
     Branch 'ros2' set up to track remote branch 'ros2' from 'origin'.
     === src/utils/hls_lfcd_lds_driver (git) ===
     Cloning into '.'...
     Switched to a new branch 'ros2'
     Branch 'ros2' set up to track remote branch 'ros2' from 'origin'.

Remove Navigation Stack

 eepp@hood:turtlebot3_ws$ cd ~/ros2_all_ws/turtlebot3_ws/src

 eepp@hood:src$ ls
     turtlebot3  utils

 eepp@hood:src$ sudo rm -r navigation2
     rm: cannot remove 'navigation2': No such file or directory

 eepp@hood:src$ cd ~/ros2_all_ws/turtlebot3_ws

Not sure why this happened but it made sense at the time.

Build the Package

Source the previous built packages first

 eepp@hood:turtlebot3_ws$ source ~/ros2_all_ws/ros2_ws/install/setup.bash
     ROS_DISTRO was set to 'foxy' before. Please make sure that the environment does not mix paths from different distributions.
     ROS_DISTRO was set to 'dashing' before. Please make sure that the environment does not mix paths from different distributions.

 eepp@hood:turtlebot3_ws$ source ~/ros2_all_ws/navigation2_ws/install/setup.bash
     ROS_DISTRO was set to 'foxy' before. Please make sure that the environment does not mix paths from different distributions.
     ROS_DISTRO was set to 'dashing' before. Please make sure that the environment does not mix paths from different distributions.

 eepp@hood:turtlebot3_ws$ source ~/ros2_all_ws/navstack_dependencies_ws/install/setup.bash
     ROS_DISTRO was set to 'foxy' before. Please make sure that the environment does not mix paths from different distributions.
     ROS_DISTRO was set to 'dashing' before. Please make sure that the environment does not mix paths from different distributions.

Now do the build

 eepp@hood:turtlebot3_ws$ colcon build --symlink-install
     Starting >>> turtlebot3_msgs
     Starting >>> turtlebot3_description
     Starting >>> dynamixel_sdk
     Starting >>> hls_lfcd_lds_driver
     Finished <<< turtlebot3_description [7.35s]                          
     Starting >>> turtlebot3_cartographer
     Finished <<< dynamixel_sdk [9.06s]                                   
     Starting >>> turtlebot3_navigation2
     Finished <<< turtlebot3_cartographer [6.49s]                              
     Starting >>> turtlebot3_teleop
     Finished <<< turtlebot3_teleop [6.22s]                                     
     Starting >>> turtlebot3_gazebo
     Finished <<< turtlebot3_navigation2 [11.2s]                                
     Finished <<< hls_lfcd_lds_driver [20.7s]                                   
     Finished <<< turtlebot3_gazebo [8.06s]                                     
     Finished <<< turtlebot3_msgs [35.3s]                          
     Starting >>> turtlebot3_node
     Starting >>> turtlebot3_fake_node
     finished <<< turtlebot3_fake_node [23.2s]                                  
     Starting >>> turtlebot3_simulations
     Finished <<< turtlebot3_simulations [5.32s]                                    
     Finished <<< turtlebot3_node [35.4s]                                
     Starting >>> turtlebot3_bringup
     Finished <<< turtlebot3_bringup [3.08s]                          
     Starting >>> turtlebot3
     Finished <<< turtlebot3 [3.01s]                          

     Summary: 13 packages finished [1min 17s]

Test TB3

Initial Conditions

  • At system boot
  • OpenCR connected
  • Power connected to OpenCR
  • OpenCR turned on

Indicator LEDs

Initialize Each Terminal

Terminal 1

 eepp@hood:turtlebot3_ws$ export TURTLEBOT3_MODEL=waffle

 eepp@hood:turtlebot3_ws$ source ~/ros2_all_ws/ros2_ws/install/setup.bash
     ROS_DISTRO was set to 'foxy' before. Please make sure that the environment does not mix paths from different distributions.
     ROS_DISTRO was set to 'dashing' before. Please make sure that the environment does not mix paths from different distributions.

 eepp@hood:turtlebot3_ws$ source ~/ros2_all_ws/turtlebot3_ws/install/setup.bash
     ROS_DISTRO was set to 'foxy' before. Please make sure that the environment does not mix paths from different distributions.
     ROS_DISTRO was set to 'dashing' before. Please make sure that the environment does not mix paths from different distributions.

 eepp@hood:turtlebot3_ws$ source ~/ros2_all_ws/navstack_dependencies_ws/install/setup.bash
     ROS_DISTRO was set to 'foxy' before. Please make sure that the environment does not mix paths from different distributions.
     ROS_DISTRO was set to 'dashing' before. Please make sure that the environment does not mix paths from different distributions.

 eepp@hood:turtlebot3_ws$ source ~/ros2_all_ws/navigation2_ws/install/setup.bash
     ROS_DISTRO was set to 'foxy' before. Please make sure that the environment does not mix paths from different distributions.
     ROS_DISTRO was set to 'dashing' before. Please make sure that the environment does not mix paths from different distributions.

Terminal 2

Same as terminal 1

Bring up TB3

Terminal 1

 eepp@hood:~$ ros2 launch turtlebot3_bringup robot.launch.py
     [INFO] [launch]: All log files can be found below /home/eepp/.ros/log/2020-01-23-20-06-30-360853-hood-7179
     [INFO] [launch]: Default logging verbosity is set to INFO
     urdf_file_name : turtlebot3_waffle.urdf
     [INFO] [robot_state_publisher-1]: process started with pid [7190]
     [INFO] [hlds_laser_publisher-2]: process started with pid [7191]
     [INFO] [turtlebot3_ros-3]: process started with pid [7192]
     [robot_state_publisher-1] Initialize urdf model from file: /home/eepp/ros2_all_ws/turtlebot3_ws/install/turtlebot3_description/share/turtlebot3_description/urdf/turtlebot3_waffle.urdf
     [robot_state_publisher-1] Parsing robot urdf xml string.
     [robot_state_publisher-1] Link base_link had 7 children
     [robot_state_publisher-1] Link camera_link had 2 children
     [robot_state_publisher-1] Link camera_depth_frame had 1 children
     [robot_state_publisher-1] Link camera_depth_optical_frame had 0 children
     [robot_state_publisher-1] Link camera_rgb_frame had 1 children
     [robot_state_publisher-1] Link camera_rgb_optical_frame had 0 children
     [robot_state_publisher-1] Link caster_back_left_link had 0 children
     [robot_state_publisher-1] Link caster_back_right_link had 0 children
     [robot_state_publisher-1] Link imu_link had 0 children
     [robot_state_publisher-1] Link base_scan had 0 children
     [robot_state_publisher-1] Link wheel_left_link had 0 children
     [robot_state_publisher-1] Link wheel_right_link had 0 children
     [robot_state_publisher-1] got segment base_footprint
     [robot_state_publisher-1] got segment base_link
     [robot_state_publisher-1] got segment base_scan
     [robot_state_publisher-1] got segment camera_depth_frame
     [robot_state_publisher-1] got segment camera_depth_optical_frame
     [robot_state_publisher-1] got segment camera_link
     [robot_state_publisher-1] got segment camera_rgb_frame
     [robot_state_publisher-1] got segment camera_rgb_optical_frame
     [robot_state_publisher-1] got segment caster_back_left_link
     [robot_state_publisher-1] got segment caster_back_right_link
     [robot_state_publisher-1] got segment imu_link
     [robot_state_publisher-1] got segment wheel_left_link
     [robot_state_publisher-1] got segment wheel_right_link
     [turtlebot3_ros-3] [INFO] [1579838790.542159030] [turtlebot3_node]: Init TurtleBot3 Node Main
     [turtlebot3_ros-3] [INFO] [1579838790.543214023] [turtlebot3_node]: Init DynamixelSDKWrapper
     [turtlebot3_ros-3] [INFO] [1579838790.543598816] [DynamixelSDKWrapper]: Succeeded to open the port(/dev/ttyACM0)!
     [turtlebot3_ros-3] [INFO] [1579838790.545177718] [DynamixelSDKWrapper]: Succeeded to change the baudrate!
     [robot_state_publisher-1] Adding fixed segment from base_footprint to base_link
     [robot_state_publisher-1] Adding fixed segment from base_link to camera_link
     [robot_state_publisher-1] Adding fixed segment from camera_link to camera_depth_frame
     [robot_state_publisher-1] Adding fixed segment from camera_depth_frame to camera_depth_optical_frame
     [robot_state_publisher-1] Adding fixed segment from camera_link to camera_rgb_frame
     [robot_state_publisher-1] Adding fixed segment from camera_rgb_frame to camera_rgb_optical_frame
     [robot_state_publisher-1] Adding fixed segment from base_link to caster_back_left_link
     [robot_state_publisher-1] Adding fixed segment from base_link to caster_back_right_link
     [robot_state_publisher-1] Adding fixed segment from base_link to imu_link
     [robot_state_publisher-1] Adding fixed segment from base_link to base_scan
     [robot_state_publisher-1] Adding moving segment from base_link to wheel_left_link
     [robot_state_publisher-1] Adding moving segment from base_link to wheel_right_link
     [turtlebot3_ros-3] [INFO] [1579838790.588465931] [turtlebot3_node]: Start Calibration of Gyro
     [turtlebot3_ros-3] [INFO] [1579838795.588973986] [turtlebot3_node]: Calibration End
     [turtlebot3_ros-3] [INFO] [1579838795.589215048] [turtlebot3_node]: Add Motors
     [turtlebot3_ros-3] [INFO] [1579838795.590737161] [turtlebot3_node]: Add Wheels
     [turtlebot3_ros-3] [INFO] [1579838795.591533784] [turtlebot3_node]: Add Sensors
     [turtlebot3_ros-3] [INFO] [1579838795.596105356] [turtlebot3_node]: Succeeded to create battery state publisher
     [turtlebot3_ros-3] [INFO] [1579838795.597209449] [turtlebot3_node]: Succeeded to create imu publisher
     [turtlebot3_ros-3] [INFO] [1579838795.599002722] [turtlebot3_node]: Succeeded to create sensor state publisher
     [turtlebot3_ros-3] [INFO] [1579838795.599900611] [turtlebot3_node]: Succeeded to create joint state publisher
     [turtlebot3_ros-3] [INFO] [1579838795.599999528] [turtlebot3_node]: Add Devices
     [turtlebot3_ros-3] [INFO] [1579838795.600034230] [turtlebot3_node]: Succeeded to create motor power server
     [turtlebot3_ros-3] [INFO] [1579838795.601941333] [turtlebot3_node]: Succeeded to create reset server
     [turtlebot3_ros-3] [INFO] [1579838795.603099957] [turtlebot3_node]: Succeeded to create sound server
     [turtlebot3_ros-3] [INFO] [1579838795.603867740] [turtlebot3_node]: Run!
     [turtlebot3_ros-3] [INFO] [1579838795.622835516] [diff_drive_controller]: Init Odometry
     [turtlebot3_ros-3] [INFO] [1579838795.627781779] [diff_drive_controller]: Run!

Indicator LEDs

  • USER1: Amber blinking indicates pub/subscribe
  • USER2: dido
  • USER3: off
  • USER4: Green on solid
  • STATUS: off
  • ARDUINO: Green blinking
  • POWER: Green on solid

Test 1

 eepp@hood:~$ ros2 topic list
     /battery_state
     /cmd_vel
     /imu
     /joint_states
     /magnetic_field
     /odom
     /parameter_events
     /robot_description
     /rosout
     /scan
     /sensor_state
     /tf
     /tf_static

Test 2

Start and stop motors

Terminal 2

 eepp@hood:~$ ros2 topic pub /cmd_vel geometry_msgs/Twist '{linear: {x: 1.0}}' -1
     publisher: beginning loop
     publishing #1: geometry_msgs.msg.Twist(linear=geometry_msgs.msg.Vector3(x=1.0, y=0.0, z=0.0), angular=geometry_msgs.msg.Vector3(x=0.0, y=0.0, z=0.0))

 eepp@hood:~$ ros2 topic pub /cmd_vel geometry_msgs/Twist '{linear: {x: 0.0}}' -1 
     publisher: beginning loop
     publishing #1: geometry_msgs.msg.Twist(linear=geometry_msgs.msg.Vector3(x=0.0, y=0.0, z=0.0), angular=geometry_msgs.msg.Vector3(x=0.0, y=0.0, z=0.0))

Test 3

Terminal 2

 eepp@hood:~$ 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' pressed 15 times than a space. Motors rev up slowly

     currently:	linear velocity 0.01	 angular velocity 0.0 
     currently:	linear velocity 0.02	 angular velocity 0.0 
     currently:	linear velocity 0.03	 angular velocity 0.0 
     currently:	linear velocity 0.04	 angular velocity 0.0 
     currently:	linear velocity 0.05	 angular velocity 0.0 
     currently:	linear velocity 0.060000000000000005	 angular velocity 0.0 
     currently:	linear velocity 0.07	 angular velocity 0.0 
     currently:	linear velocity 0.08	 angular velocity 0.0 
     currently:	linear velocity 0.09	 angular velocity 0.0 
     currently:	linear velocity 0.09999999999999999	 angular velocity 0.0 
     currently:	linear velocity 0.10999999999999999	 angular velocity 0.0 
     currently:	linear velocity 0.11999999999999998	 angular velocity 0.0 
     currently:	linear velocity 0.12999999999999998	 angular velocity 0.0 
     currently:	linear velocity 0.13999999999999999	 angular velocity 0.0 
     currently:	linear velocity 0.0	 angular velocity 0.0

Create Node Graph

Terminal 3

Initialize the terminal

 eepp@hood:~$ rqt_graph