RoboStack / ros-humble

Recipes for ROS 2 Humble Hawksbill
81 stars 32 forks source link

Package request: gazebo_ros #130

Closed Nir0n closed 3 months ago

Nir0n commented 3 months ago

Package name

gazebo_ros

Operating System(s)

Additional context (optional)

required for running ros with gazebo (as far as I know) I don't test it on linux or windows but I think it platform agnostic

Links and references (optional)

https://stackoverflow.com/questions/77933813/cannot-find-gazebo-ros-package-in-robostack-how-run-gazebo-with-ros2-humble-in

Tobias-Fischer commented 3 months ago

In ROS2, one should use ros-ign-bridge (https://docs.ros.org/en/humble/Tutorials/Advanced/Simulators/Gazebo/Gazebo.html). This is available: https://anaconda.org/robostack-staging/ros-humble-ros-ign-bridge

Nir0n commented 3 months ago

Got you, sorry for the incorrect query, sir. Please if you can, answer several points: 1) If you can provide launch.py for it, will be great! (for example how I can change this file that its worked, I found this link that leads on 404: https://answers.ros.org/question/371785/how-to-write-a-launch-file-for-ros_ign_bridge/):

import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import ExecuteProcess

def generate_launch_description():
    # Paths to the URDF file
    pkg_share = get_package_share_directory('hrssd')
    default_model_path = os.path.join(pkg_share, 'urdf', 'hrssd.urdf')

    # Launch Gazebo with an empty world, replace this with your world file if needed
    gazebo = ExecuteProcess(
        cmd=['gazebo', '--verbose', '-s', 'libgazebo_ros_factory.so'],
        output='screen'
    )

    # Node to spawn the robot in Gazebo
    spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py',
                        arguments=['-entity', 'hrssd', '-file', default_model_path],
                        output='screen')

    return LaunchDescription([
        gazebo,
        spawn_entity,
    ])

2) when I try to use the command from the tutorial that you provided:

 ign gazebo -v 4 -r visualize_lidar.sdf
The 'ign' command provides a command line interface to the ignition tools.

  ign <command> [options]

List of available commands:

  help:          Print this help text.
  fuel:          Manage simulation resources.
  msg:           Print information about messages.
  sdf:           Utilities for SDF files.
  topic:         Print information about topics.
  service:       Print information about services.
  log:           Record or playback topics.
  param:         List, get or set parameters.

Options:

  --force-version <VERSION>  Use a specific library version.
  --versions                 Show the available versions.
  --commands                 Show the available commands.
Use 'ign help <command>' to print help for a command.

it seems "ign gazebo" don't exist. is it problem with my installation? (I used this tutorial for installation: https://robostack.github.io/GettingStarted.html#__tabbed_1_1)

Tobias-Fischer commented 3 months ago

@traversaro - you are the gazebo expert. Do you have any ideas?

traversaro commented 3 months ago

Can you provide mamba list of the environment you are using, and ideally also the command through which you created it?

Nir0n commented 3 months ago

Greetings, gentlemen. if you mean list of environments:

(ros_env) X@MSK-C02DW5J1MD6R ros_ws % conda info --envs
# conda environments:
#
                         /Users/X/miniconda3
base                     /usr/local/Caskroom/miniforge/base
jupyros                  /usr/local/Caskroom/miniforge/base/envs/jupyros
ros_env               *  /usr/local/Caskroom/miniforge/base/envs/ros_env

I use ros_env.

If you mean list of packages in environment - provided file: ros_env_pkgs.txt

about creation of environment: I use this tutorial https://robostack.github.io/GettingStarted.html#__tabbed_1_1 so the command was mamba create -n ros_env

Thank you again, gentlemen, for your support!

traversaro commented 3 months ago

I was referring to how to installed the packages that ended in the environment, anyhow I guess that the command was mamba install ros-humble-desktop and later mamba install ros-humble-ros-ign-bridge . However, this actually fails for some reason, at least on linux-64 . Then I tried to install:

mamba create -n ros_env -c conda-forge -c robostack-staging ros-humble-desktop ros-humble-ros-ign-bridge

and that seems to be working fine, even if it install the latest Python 3.11 packages instead of the Python 3.10 packages you have. However, also in this case ign gazebo fails. Indeed, ros-humble-ros-ign-bridge actually depends only on ign-transport, not on Ignition Gazebo itself. So to actually run Ignition Gazebo, run:

mamba install libignition-gazebo6

Feel free to report any problem!

traversaro commented 3 months ago

I was referring to how to installed the packages that ended in the environment, anyhow I guess that the command was mamba install ros-humble-desktop and later mamba install ros-humble-ros-ign-bridge . However, this actually fails for some reason, at least on linux-64 . Then I tried to install:

mamba create -n ros_env -c conda-forge -c robostack-staging ros-humble-desktop ros-humble-ros-ign-bridge

and that seems to be working fine, even if it install the latest Python 3.11 packages instead of the Python 3.10 packages you have. However, also in this case ign gazebo fails. Indeed, ros-humble-ros-ign-bridge actually depends only on ign-transport, not on Ignition Gazebo itself. So to actually run Ignition Gazebo, run:

mamba install libignition-gazebo6

Feel free to report any problem!

I think I got the problem. The actual problem that users should install (and that depends on libignition-gazebo6) is ros-humble-ros-gz (or ros-humble-ros-ign). However, the package at the moment is available only on linux-64, not sure what is the blocker on other platforms (perhaps we should just try to build it, not sure).

traversaro commented 3 months ago

To reply to the original question (that was asking about ROS2 integration with "Classic" Gazebo, not ROS2 integration with "Modern" ign/gz), the correct package to install is ros-humble-gazebo-ros, and it seems that the latest version of it is available for linux-64, osx-64 and osx-arm64, see https://anaconda.org/robostack-staging/ros-humble-gazebo-ros/files .

Nir0n commented 3 months ago

thank you, sir! some clarification: i DONT want to install integration with gazebo classic, I was just poorly informed how create integration between ros and gz in new versions, and I incorrectly assumed that for it I require "gazebo_ros".

Just to understand that I still with you on this topic, in order to run ros-humble with gz I need: 1) I need to install libignition-gazebo6 package with command that you provided 2) I need to install ros-humble-ros-gz package, but for now its not available on osx, so instead I will install older version ros-humble-gazebo-ros

Everything correct? And , please if you have opportunity, can you provide launch.py file for running my model with gz? Or reference to working project, anything will do. For my project is very important to simulate the physics of the environment, if I understand correctly for ROS - gazebo/ign/gz is the only way to do it. Thank you!

traversaro commented 3 months ago

Just to avoid confusion, please refer either to "Classic" Gazebo or "Modern" ign/gz, as otherwise any reference to "gazebo" is ambiguous, thanks!

Nir0n commented 3 months ago

Summarize: gazebo_ros (Classic) can be installed for ros humble like this: mamba install ros-humble-gazebo-ros regarding question for launch.py file for "modern" (ign/gz) version lets discuss here if you have time, gentelmen. Thank you for your time!