ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ROS2 with Turtlebot3 Simulation

asked 2020-05-05 04:02:29 -0500

swaroophs gravatar image

updated 2020-05-05 04:04:46 -0500

I wanted to play with ROS2 today. I started of installing Dashing then uninstalling it and then installing Eloquent. But I believe I am seeing the following issue for both the versions....

I just installed ROS2 Eloquent today using these instructions. I also installed ROS2 Turtlebot3 packages based on this link.

Note that I already have ROS Melodic on my system. So, I am sourcing my ROS2 environment using the following bash file. ROS1 has a separate file like this as well and is NOT sourced in the default bashrc file:

source /opt/ros/eloquent/setup.bash
source ~/ros2_ws/install/setup.bash

export ROS_DOMAIN_ID=30 #TURTLEBOT3
export GAZEBO_MODEL_PATH=~/ros2_ws/src/turtlebot3/turtlebot3_simulations/turtlebot3_gazebo/models
export TURTLEBOT3_MODEL=waffle

export LD_LIBRARY_PATH="/home/swaroophs/ros2_ws/install/turtlebot3_msgs/lib:/home/swaroophs/ros2_ws/install/dynamixel_sdk/lib:/usr/lib/x86_64-linux-gnu/gazebo-9/plugins:/opt/ros/eloquent/opt/yaml_cpp_vendor/lib:/opt/ros/eloquent/opt/rviz_ogre_vendor/lib:/opt/ros/eloquent/lib"

Now in terminal 1, I launch my gazebo world. All seems good in the world (literally teehee), I see the Gazebo window:

$ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
[INFO] [launch]: All log files can be found below /home/swaroophs/.ros/log/2020-05-05-16-53-45-858857-swarooph-xps-30663
[INFO] [launch]: Default logging verbosity is set to INFO
urdf_file_name : turtlebot3_waffle.urdf
[INFO] [gazebo-1]: process started with pid [30680]
[INFO] [robot_state_publisher-2]: process started with pid [30681]
[robot_state_publisher-2] Initialize urdf model from file: /home/swaroophs/ros2_ws/install/turtlebot3_description/share/turtlebot3_description/urdf/turtlebot3_waffle.urdf
[robot_state_publisher-2] Parsing robot urdf xml string.
[robot_state_publisher-2] Link base_link had 7 children
[robot_state_publisher-2] Link camera_link had 2 children
[robot_state_publisher-2] Link camera_depth_frame had 1 children
[robot_state_publisher-2] Link camera_depth_optical_frame had 0 children
[robot_state_publisher-2] Link camera_rgb_frame had 1 children
[robot_state_publisher-2] Link camera_rgb_optical_frame had 0 children
[robot_state_publisher-2] Link caster_back_left_link had 0 children
[robot_state_publisher-2] Link caster_back_right_link had 0 children
[robot_state_publisher-2] Link imu_link had 0 children
[robot_state_publisher-2] Link base_scan had 0 children
[robot_state_publisher-2] Link wheel_left_link had 0 children
[robot_state_publisher-2] Link wheel_right_link had 0 children
[robot_state_publisher-2] got segment base_footprint
[robot_state_publisher-2] got segment base_link
[robot_state_publisher-2] got segment base_scan
[robot_state_publisher-2] got segment camera_depth_frame
[robot_state_publisher-2] got segment camera_depth_optical_frame
[robot_state_publisher-2] got segment camera_link
[robot_state_publisher-2] got segment camera_rgb_frame
[robot_state_publisher-2] got segment camera_rgb_optical_frame
[robot_state_publisher-2] got segment caster_back_left_link
[robot_state_publisher-2] got segment caster_back_right_link
[robot_state_publisher-2] got segment imu_link
[robot_state_publisher-2] got segment wheel_left_link
[robot_state_publisher-2] got segment wheel_right_link
[robot_state_publisher-2] Adding fixed segment from base_footprint to base_link
[robot_state_publisher-2] Adding fixed segment from base_link to camera_link
[robot_state_publisher-2] Adding fixed segment from camera_link to camera_depth_frame
[robot_state_publisher-2] Adding fixed segment from camera_depth_frame to camera_depth_optical_frame
[robot_state_publisher-2] Adding fixed segment from camera_link to camera_rgb_frame
[robot_state_publisher-2] Adding fixed segment from camera_rgb_frame to camera_rgb_optical_frame
[robot_state_publisher-2] Adding fixed segment from base_link to caster_back_left_link
[robot_state_publisher-2] Adding fixed segment from base_link to caster_back_right_link
[robot_state_publisher-2] Adding fixed segment from base_link to imu_link
[robot_state_publisher-2] Adding fixed segment from base_link to base_scan
[robot_state_publisher-2] Adding moving segment from base_link to wheel_left_link
[robot_state_publisher-2] Adding moving segment from base_link to wheel_right_link
[gazebo-1] Gazebo multi-robot simulator, version 9.13.0
[gazebo-1] Copyright (C) 2012 Open Source Robotics Foundation.
[gazebo-1] Released under the Apache 2 License.
[gazebo-1] http://gazebosim.org
[gazebo-1] 
[gazebo-1] Gazebo multi-robot simulator, version 9.13.0
[gazebo-1] Copyright ...
(more)
edit retag flag offensive close merge delete

Comments

You are correct! I figured out the same thing after pouring through a bunch of GitHub issues (this and this) and then looking at the Navigation 2 tutorial, this is what I gathered as well. Also note that, you have to provide a 2D pose estimate as well to get things going. If I find command line ways to do both

  1. starting the nav stack
  2. providing an initial pose

I'll update here.

swaroophs gravatar image swaroophs  ( 2020-05-06 04:07:03 -0500 )edit

So I figured out that I can call the service "/lifecycle_manager/manage_nodes" with the default parameter to startup the navigation. I can also request global localization with the /reinitialize_global_localization service, to get an inital pose estimate - however this locate the robot within a wall and it can not really start :(

basti_mai gravatar image basti_mai  ( 2020-05-06 04:24:19 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-05-06 01:03:37 -0500

basti_mai gravatar image

I did exactly the same yesterday and hit the same problem. The short answer is: You have to press "startup" in rviz, to start the nodes. (In the lower left there is a little Box labeled "Navigation 2"). Long Answer the nodes in the navigation 2 stack are started using the life-cycle features and need to be set to the "active" state. Before that no map is published and the nodes are not publishing the tf-frames that are needed.

As I am only a beginner user of nav2 myself I have yet to figure out what exactly to do from the console ;)

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2020-05-05 04:02:29 -0500

Seen: 2,055 times

Last updated: May 05 '20