ROBOTIS-GIT / turtlebot3_simulations

Simulations for TurtleBot3
http://turtlebot3.robotis.com/
Apache License 2.0
329 stars 434 forks source link

Added ignition Gazebo support #180

Closed ahcorde closed 2 years ago

ahcorde commented 2 years ago

Signed-off-by: ahcorde ahcorde@gmail.com

Related issue: https://github.com/ROBOTIS-GIT/turtlebot3_simulations/issues/179

Open questions:

turtlebot3_ignition_nav

Test it

reset && ros2 launch  turtlebot3_ignition ignition.launch.py world_name:=turtlebot3_world
# or
reset && ros2 launch  turtlebot3_ignition ignition.launch.py world_name:=turtlebot3_house

In another terminal, create the map:

ros2 launch turtlebot3_cartographer cartographer.launch.py use_sim_time:=True

When the map is ready, now you can navigate:

reset && ros2 launch turtlebot3_navigation2 navigation2.launch.py use_sim_time:=true map:=$HOME/map.yaml
ahcorde commented 2 years ago

Just a note, the models in the world are all black because the turtlebot3_world model defines materials using the <script> tag. This could be easily fix using the following this kind of materials:

<material>
  <ambient>0 1 0 1</ambient>
  <diffuse>0 1 0 1</diffuse>
  <specular>0.1 0.1 0.1 1</specular>
</material>

Gazebo_023

This will be compatible with gazebo classic

ROBOTIS-Ashe commented 2 years ago

@ahcorde Thanks for letting me know how to change the turtlebot3_world model color. I tested your package, and I found that in my environment the TF error appeared. Attached is the image below for detailed explanation.


Test environment ROS version : ROS2 Galactic Install Ignition Gazebo : libignition-gazebo6-dev


the results of running ignition.launch.py image

the results of running the original way gazebo launch file. image


When ignition.launch.py was executed, odom TF were not created. I think I need more time to check this issue. thank you.

ahcorde commented 2 years ago

uhmm, can you see any errors in the terminal ?

My guess is that ign_ros2_control is not being loaded. I can see all transforms;

Selection_028

I have updated the package.xml with all the required dependencies.

ROBOTIS-Ashe commented 2 years ago

@ahcorde Thanks for the quick reply. I downloaded the ign_ros2_control package to github and built it. When I ran it, I could see the ignition gazebo launch screen quit.

ignition_support-2022-02-14_14 11 45-_online-video-cutter com_

Am i missing something? In addition, attaching my log file below.

1644815508.2398326 [INFO] [launch]: All log files can be found below /home/ashekim/.ros/log/2022-02-14-14-11-48-237103-ashekim-146596 1644815508.2401421 [INFO] [launch]: Default logging verbosity is set to INFO 1644815508.9465647 [INFO] [cmd_republisher-1]: process started with pid [146642] 1644815508.9468038 [INFO] [static_transform_publisher-2]: process started with pid [146644] 1644815508.9469392 [INFO] [create-3]: process started with pid [146646] 1644815508.9470546 [INFO] [create-4]: process started with pid [146648] 1644815508.9472153 [INFO] [ign gazebo-5]: process started with pid [146650] 1644815508.9473505 [INFO] [parameter_bridge-6]: process started with pid [146652] 1644815508.9474788 [INFO] [parameter_bridge-7]: process started with pid [146655] 1644815508.9476585 [INFO] [parameter_bridge-8]: process started with pid [146657] 1644815508.9478323 [INFO] [robot_state_publisher-9]: process started with pid [146659] 1644815508.9480026 [INFO] [spawner.py-10]: process started with pid [146661] 1644815508.9481709 [INFO] [rviz2-11]: process started with pid [146680] 1644815508.9502733 [static_transform_publisher-2] [INFO] [1644815508.945508270] [static_transform_publisher]: Spinning until killed publishing transform from 'base_scan' to 'waffle_pi/base_footprint/hls_lfcd_lds' 1644815509.1391678 [spawner.py-10] [INFO] [1644815509.138914105] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services 1644815509.7727187 [INFO] [create-3]: process has finished cleanly [pid 146646] 1644815509.7762702 [INFO] [create-4]: process has finished cleanly [pid 146648] 1644815510.7242894 [INFO] [ign gazebo-5]: process has finished cleanly [pid 146650] 1644815511.1474473 [spawner.py-10] [INFO] [1644815511.147212009] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services 1644815513.1577702 [spawner.py-10] [INFO] [1644815513.157570411] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services 1644815515.1678374 [spawner.py-10] [INFO] [1644815515.167614824] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services 1644815517.1814067 [spawner.py-10] [INFO] [1644815517.180738076] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services 1644815519.1941199 [spawner.py-10] [INFO] [1644815519.193796494] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services 1644815519.3637755 [WARNING] [launch]: user interrupted with ctrl-c (SIGINT) 1644815519.3745165 [static_transform_publisher-2] [INFO] [1644815519.362828625] [rclcpp]: signal_handler(signal_value=2) 1644815519.3764706 [cmd_republisher-1] [INFO] [1644815519.362854361] [rclcpp]: signal_handler(signal_value=2) 1644815519.3767893 [spawner.py-10] /opt/ros/galactic/lib/controller_manager/spawner.py:204: DeprecationWarning: 'spawner.py' is deprecated, please use 'spawner' (without .py extension) 1644815519.3769250 [spawner.py-10] warnings.warn( 1644815519.3770068 [spawner.py-10] Traceback (most recent call last): 1644815519.3770764 [spawner.py-10] File "/opt/ros/galactic/lib/controller_manager/spawner.py", line 207, in 1644815519.3771501 [spawner.py-10] ret = main() 1644815519.3772497 [spawner.py-10] File "/opt/ros/galactic/lib/controller_manager/spawner.py", line 118, in main 1644815519.3773210 [spawner.py-10] if not wait_for_controller_manager(node, controller_manager_name, 1644815519.3773901 [spawner.py-10] File "/opt/ros/galactic/lib/controller_manager/spawner.py", line 60, in wait_for_controller_manager 1644815519.3774695 [spawner.py-10] time.sleep(0.2) 1644815519.3775332 [spawner.py-10] KeyboardInterrupt 1644815519.5693271 [INFO] [cmd_republisher-1]: process has finished cleanly [pid 146642] 1644815519.5695384 [INFO] [static_transform_publisher-2]: process has finished cleanly [pid 146644] 1644815519.5701797 [INFO] [robot_state_publisher-9]: process has finished cleanly [pid 146659] 1644815519.5716181 [ERROR] [spawner.py-10]: process has died [pid 146661, exit code -2, cmd '/opt/ros/galactic/lib/controller_manager/spawner.py joint_state_broadcaster --controller-manager /controller_manager --ros-args --params-file /tmp/launch_params_sp84lh0e']. 1644815519.7224233 [INFO] [rviz2-11]: process has finished cleanly [pid 146680] 1644815519.8607197 [WARNING] [launch]: user interrupted with ctrl-c (SIGINT) again, ignoring...

And the warning message appeared in the terminal :

[ign gazebo-5] [GUI] [Wrn] [Application.cc:753] [QT] file:///usr/lib/x86_64-linux-gnu/qt5/qml/QtQuick/Dialogs/DefaultFileDialog.qml:102:33: QML Settings: Failed to initialize QSettings instance. Status code is: 1 [ign gazebo-5] [GUI] [Wrn] [Application.cc:753] [QT] file:///usr/lib/x86_64-linux-gnu/qt5/qml/QtQuick/Dialogs/DefaultFileDialog.qml:102:33: QML Settings: The following application identifiers have not been set: QVector("organizationName", "organizationDomain") [ign gazebo-5] [GUI] [Wrn] [Application.cc:753] [QT] file:///usr/lib/x86_64-linux-gnu/qt5/qml/QtQuick/Dialogs/DefaultFileDialog.qml:102:33: QML Settings: Failed to initialize QSettings instance. Status code is: 1 [ign gazebo-5] [GUI] [Wrn] [Application.cc:753] [QT] file:///usr/lib/x86_64-linux-gnu/qt5/qml/QtQuick/Dialogs/DefaultFileDialog.qml:102:33: QML Settings: The following application identifiers have not been set: QVector("organizationName", "organizationDomain")

[rviz2-11] Warning: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist [rviz2-11] at line 156 in /tmp/binarydeb/ros-galactic-tf2-0.17.2/src/buffer_core.cpp [rviz2-11] Warning: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist [rviz2-11] at line 156 in /tmp/binarydeb/ros-galactic-tf2-0.17.2/src/buffer_core.cpp

These are the packages I installed to run this test. Are there any additional things I need to install?

sudo apt install libignition-gazebo6-dev
sudo apt install ros-galactic-ros-ign-*
git clone -b galactic https://github.com/ignitionrobotics/ign_ros2_control

Thank you.

ahcorde commented 2 years ago

I created a dockerfile to test it, create the two following files in an empty folder

Dockerfile ``` FROM ubuntu:20.04 ENV DEBIAN_FRONTEND noninteractive ENV IGNITION_VERSION fortress # Make sure everything is up to date before building from source RUN apt-get update \ && apt-get upgrade -y \ && apt-get update && apt-get install -q -y --no-install-recommends \ dirmngr \ gnupg \ lsb-release \ wget \ curl \ git \ ca-certificates \ build-essential \ cmake \ && apt-get clean RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null && \ apt-get update && apt-get install -q -y --no-install-recommends \ python3-colcon-ros \ python3-colcon-common-extensions \ python3-rosdep \ && apt-get clean RUN mkdir -p /home/ros2_ws/src \ && cd /home/ros2_ws/src \ && git clone https://github.com/ahcorde/turtlebot3_simulations/ -b ahcorde/ignition_support \ && git clone https://github.com/ignitionrobotics/ign_ros2_control -b galactic \ && rosdep init \ && rosdep update \ && rosdep install --from-paths ./ -i -y --rosdistro galactic RUN cd /home/ros2_ws/ \ && . /opt/ros/galactic/setup.sh \ && colcon build --merge-install COPY entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] RUN apt-get update && apt-get install -q -y --no-install-recommends \ ros-galactic-ros2launch \ ros-galactic-turtlebot3-cartographer \ && apt-get clean CMD TURTLEBOT3_MODEL=burger ros2 launch turtlebot3_ignition ignition.launch.py ```
entrypoint.sh ``` #!/bin/sh . /opt/ros/galactic/setup.sh . /home/ros2_ws/install/setup.sh exec "$@ ```

run:

chmod +x entrypoint.sh
docker build -t ignition_turtblebot3 .

Install rocker with nvidia-docker2 support

Then you are ready to run:

rocker --x11 --nvidia --name ignition_turtblebot3 ignition_turtblebot3:latest

NOTE: To run SLAM or Navigation you should run ignition with this patch https://github.com/ignitionrobotics/ign-sensors/pull/195

ahcorde commented 2 years ago

The fix in ignition-gazebo is already released, this should be ready for a final review

ahcorde commented 2 years ago

ping @ashekim

ROBOTIS-Ashe commented 2 years ago

@ahcorde Thanks for reminding me. I'm currently working on other work, so testing is being delayed. I will share the results after testing as soon as possible. Thank you!

ROBOTIS-Will commented 2 years ago

Thanks @ahcorde I'm preparing an update of turtlebot3_simulations package. This will be included in the Galactic / Humble updates.

ahcorde commented 2 years ago

Super @ROBOTIS-Will,

let me know if you need something from me