Closed rows-of-houses closed 1 year ago
Can you try using the humble
branch, which is recommended for that combination.
I tried using humble
branch, but it also didn't work.
After
ros2 run ros_gz_bridge parameter_bridge /imu/data_raw@sensor_msgs/msg/Imu[gz.msgs.IMU
I got
[INFO] [1677239017.350256340] [ros_gz_bridge]: Creating GZ->ROS Bridge: [/imu/data_raw (gz.msgs.IMU) -> /imu/data_raw (sensor_msgs/msg/Imu)] (Lazy 0)
,
but there is still no messages in /imu/data_raw
ROS2 topic. But I see messages in Gazebo topic.
I tried to run imu.launch.py
from demos of humble
branch. If I launch it without any changes, everything works nice, but Gazebo 6 is launched (I need Gazebo 7).
In the console output there are lines:
[parameter_bridge-2] [INFO] [1677577587.087082303] [ros_gz_bridge]: Creating GZ->ROS Bridge: [/imu (gz.msgs.IMU) -> /imu (sensor_msgs/msg/Imu)] (Lazy 0)
[parameter_bridge-2] [INFO] [1677577587.093286646] [ros_gz_bridge]: Creating ROS->GZ Bridge: [/imu (sensor_msgs/msg/Imu) -> /imu (gz.msgs.IMU)] (Lazy 0)
Are these messages correct? I think there should be msg types of ignition.
I added next strings to gz_sim.launch.py
(which is referred by launch file of IMU):
print(env)
print(gz_args)
print(gz_version)
print(ign_args)
print(ign_version)
print(debugger)
Output is:
{'GZ_SIM_SYSTEM_PLUGIN_PATH':
':/home/username/humble_gz_ws/install/ros_ign_interfaces/lib:
/home/username/humble_gz_ws/install/ros_gz_sim/lib:
/home/username/humble_gz_ws/install/ros_gz_bridge/lib:
/home/username/humble_gz_ws/install/ros_gz_interfaces/lib:
/opt/ros/humble/opt/rviz_ogre_vendor/lib:
/opt/ros/humble/lib/x86_64-linux-gnu
:/opt/ros/humble/lib',
'IGN_GAZEBO_SYSTEM_PLUGIN_PATH':
':/home/username/humble_gz_ws/install/ros_ign_interfaces/lib
:/home/username/humble_gz_ws/install/ros_gz_sim/lib:
/home/username/humble_gz_ws/install/ros_gz_bridge/lib:
/home/username/humble_gz_ws/install/ros_gz_interfaces/lib:
/opt/ros/humble/opt/rviz_ogre_vendor/lib:
/opt/ros/humble/lib/x86_64-linux-gnu:
/opt/ros/humble/lib'}
-r sensors.sdf
6
false
If I try to specify gz_version
in launch arguments of imu.launch.py
:
gz_sim = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(pkg_ros_gz_sim, 'launch', 'gz_sim.launch.py')),
launch_arguments={
'gz_args': '-r sensors.sdf', 'gz_version': '7'
}.items(),
)
and launch the IMU launch file, it actually launches Gazebo 7, but there is no messages in ROS2 topic /imu
. Console output:
[INFO] [launch]: All log files can be found below /home/username/.ros/log/2023-02-28-13-15-21-757298-username-pc-68226
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [ruby $(which gz) sim-1]: process started with pid [68228]
[INFO] [parameter_bridge-2]: process started with pid [68230]
[INFO] [rqt_topic-3]: process started with pid [68233]
[parameter_bridge-2] [INFO] [1677579322.213397669] [ros_gz_bridge]: Creating GZ->ROS Bridge: [/imu (gz.msgs.IMU) -> /imu (sensor_msgs/msg/Imu)] (Lazy 0)
[parameter_bridge-2] [INFO] [1677579322.220332381] [ros_gz_bridge]: Creating ROS->GZ Bridge: [/imu (sensor_msgs/msg/Imu) -> /imu (gz.msgs.IMU)] (Lazy 0)
[ruby $(which gz) sim-1]
[ruby $(which gz) sim-1] Using deprecated environment variable [IGN_GAZEBO_RESOURCE_PATH].
[ruby $(which gz) sim-1] Please use [GZ_SIM_RESOURCE_PATH] instead.
[ruby $(which gz) sim-1] Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
[ruby $(which gz) sim-1] Warning [Utils.cc:130] [/sdf/world[@name="sensors"]/model[@name="force_torque_demo"]/link[@name="base_plate"]/static:/usr/share/gz/gz-sim7/worlds/sensors.sdf:L209]: XML Element[static], child of element[link], not defined in SDF. Copying[static] as children of [link].
[ruby $(which gz) sim-1] Warning [Utils.cc:130] [/sdf/model[@name="force_torque_demo"]/link[@name="base_plate"]/static:<data-string>:L3]: XML Element[static], child of element[link], not defined in SDF. Copying[static] as children of [link].
[ruby $(which gz) sim-1] Warning [Utils.cc:130] [/sdf/model[@name="force_torque_demo"]/link[@name="base_plate"]/static:<data-string>:L3]: XML Element[static], child of element[link], not defined in SDF. Copying[static] as children of [link].
There is also /lidar/points
topic, but I don't know what has spawned it.
I added new enviromental variable:
export GZ_SIM_RESOURCE_PATH=/home/username/humble_gz_ws/install/ros_gz_sim_demos/share
but it didn't help.
UPD: I noticed that in files
/home/username/humble_gz_ws/install/ros_gz_sim_demos/share/ament_index/resource_index/parent_prefix_path/ros_gz_sim_demos
,
/home/username/humble_gz_ws/install/ros_gz_sim_demos/share/ament_index/resource_index/package_run_dependencies/ros_gz_sim_demos
and
/home/username/humble_gz_ws/install/ros_gz_sim_demos/share/colcon-core/packages/ros_gz_sim_demos
only ignition-gazebo6
package mentioned, but there is no any package referred to Gazebo 7. Is it crucial problem? How can I solve it? By the way, rosdep install -i --from-path src --rosdistro humble -y
shows that All required rosdeps installed successfully.
I would suggest using the humble
branch since the caguery/humble_garden
branch is quite outdated now (https://github.com/gazebosim/ros_gz/compare/caguero/humble_garden..humble). If your build crashes, it's probably due to insufficient memory and following the suggestion in https://github.com/gazebosim/ros_gz/issues/235#issuecomment-1093124301 might help
I am having the same problem, using the humble
branch, the bridge seems to actually make the topics visible from either side but no message is being delivered, I'm trying the standard chatter message.
Btw the doc is outdated and uses ignition message types
This is a reproducible Dockerfile with the configuration and build steps I'm using:
FROM osrf/ros:humble-desktop
RUN apt-get update
RUN apt-get install kakoune wget gnupg apt-utils -y
RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
RUN apt-get update
RUN apt-get install gz-sim7-cli libgz-transport12-dev libgz-math7-dev libgz-cmake3-dev libignition-cmake2-dev -y
RUN useradd --create-home --shell /bin/bash ros2
USER ros2
WORKDIR /home/ros2
RUN rosdep update
RUN mkdir -p /home/ros2/ws/src/
RUN cd /home/ros2/ws/src/ && git clone --depth 1 -b humble https://github.com/gazebosim/ros_gz.git
USER root
WORKDIR /home/ros2/ws
RUN rosdep install -r --from-paths src -i -y --rosdistro humble
RUN echo "source /opt/ros/humble/setup.bash" >> /home/ros2/.bashrc
WORKDIR /home/ros2/ws
RUN bash -c "source /opt/ros/humble/setup.bash && colcon build"
RUN apt-get install gz-garden -y
USER ros2
RUN echo "source /home/ros2/ws/install/setup.bash" >> /home/ros2/.bashrc
Can you try exporting the Gazebo version (GZ_VERSION
) per https://github.com/gazebosim/ros_gz/tree/humble#gazebo
Can you try exporting the Gazebo version (
GZ_VERSION
) per https://github.com/gazebosim/ros_gz/tree/humble#gazebo
Wow thanks, I had missed that. It seems to be working now, at least the basic chatter message.
As a side note, rosdep doesn't seem so good at finding all the dependencies, I had to install some dev packages manually, but I'm very new to the whole ROS ecosystem so there may be something missing.
I haven't cleaned this up yet, but I guess it could be useful for someone:
FROM osrf/ros:humble-desktop
RUN apt-get update
RUN apt-get install kakoune wget gnupg apt-utils -y
RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
RUN apt-get update
RUN apt-get install gz-sim7-cli libgz-transport12-dev libgz-math7-dev libgz-cmake3-dev libignition-cmake2-dev libgz-sim7-dev -y
RUN useradd --create-home --shell /bin/bash ros2
USER ros2
WORKDIR /home/ros2
RUN rosdep update
RUN mkdir -p /home/ros2/ws/src/
RUN cd /home/ros2/ws/src/ && git clone --depth 1 -b humble https://github.com/gazebosim/ros_gz.git
USER root
WORKDIR /home/ros2/ws
ENV GZ_VERSION=garden
RUN rosdep install -r --from-paths src -i -y --rosdistro humble
RUN echo "source /opt/ros/humble/setup.bash" >> /home/ros2/.bashrc
WORKDIR /home/ros2/ws
RUN bash -c "source /opt/ros/humble/setup.bash && colcon build"
RUN apt-get install gz-garden -y
USER ros2
RUN echo "source /home/ros2/ws/install/setup.bash" >> /home/ros2/.bashrc
I can't make a host gz sim instance talk to the dockerized gz bridge, as was in my original plans, but I guess I'll just go on with using gz sim from inside docker. (Yes I tried sharing the same host network for everything.. didn't work)
Wow thanks, I had missed that. It seems to be working now, at least the basic chatter message.
Glad it works! And thanks for the reproducible Dockerfile.
As a side note, rosdep doesn't seem so good at finding all the dependencies, I had to install some dev packages manually, but I'm very new to the whole ROS ecosystem so there may be something missing.
We need to link this in the readme here, but there are some instructions for rosdep
issues at https://gazebosim.org/docs/garden/ros_installation
@rows-of-houses can you try my suggestion in https://github.com/gazebosim/ros_gz/issues/365#issuecomment-1460937619
@tommysmth Have you built ros_gz
from source using GZ_VERSION=garden
?
Closing since the issue was resolved by setting GZ_VERSION=garden
when compiling ros_gz
.
Environment
Description
Steps to reproduce
First terminal
gz sim world.sdf
Second terminal
cd <bridge_workspace>
. install/setup.bash
ros2 run ros_gz_bridge parameter_bridge /imu/data_raw@sensor_msgs/msg/Imu[gz.msgs.IMU
Third terminal
cd <bridge_workspace>
. install/setup.bash
ros2 topic echo /imu/data_raw
Output
/imu/data_raw topic is empty