Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

ign topic message sometimes not sent

Hi,

I've installed Gazebo (Fortress) on top of a Ros2 "foxy" docker image. When running the "joint controller" demo and issuing "ign topic" commands, sometimes the command does nothing. I've copied the Dockerfile below in case the installation steps are relevant or so you can reproduce.

It appears a similar question has been posted before (https://answers.gazebosim.org//question/27064/ignition-edifice-newbie-misunderstanding-gazebo-topics/) but does not have an answer. In contrast to this other question, I did not see any issue with "ign topic --list" command.

Steps to reproduce:

  1. Build and run the docker image (I'm doing so under Windows 10). Use a VNC client to connect to localhost:5900.
  2. Open a terminal and run:

    ign gazebo joint_controller.sdf
    
  3. Press play on the gazebo simulation

  4. Open a second terminal and run:

    ign topic -et /model/joint_controller_demo/joint/j1/cmd_vel
    
  5. Open a third terminal and run:

    ign topic -t /model/joint_controller_demo/joint/j1/cmd_vel -m ignition.msgs.Double -p "data: -1.0"
    
  6. Continue sending the command from step #5, alternating the sign in data so it does something interesting.

Expected result: Each command results in an update to the second terminal and a change in behaviour in the Gazebo window.

Actual result: About 50% of commands sent are ignored; they neither appear in the second terminal nor affect the Gazebo simulation. There is no output from the "ign topic -t" command to indicate an error.

Any idea what's going on?

Thanks for your help, Carl

Dockerfile:

FROM ros:foxy-ros-base

# Install VNC, Openbox, and Vim
RUN apt-get update && apt-get install -y vim x11vnc xvfb openbox 

# Install Gazebo
RUN apt-get update && apt-get install -y lsb-release wget gnupg
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" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
RUN apt-get update && apt-get install -y ignition-fortress

# Install additional ROS packages
RUN apt-get update && apt-get install -y ros-foxy-rviz2 ros-foxy-turtlesim ros-foxy-urdf-tutorial ~nros-foxy-rqt*

# Fix for Gazebo to use ogre instead of ogre2 (ogre2 does not work, see
# https://github.com/gazebosim/gz-sim/issues/1066 and
# https://github.com/conda-forge/libignition-gazebo-feedstock/issues/27)
# We copy in a config file with ogre already selected. We can't modify it in
# place because it doesn't exist until you run gazebo.
COPY gui.config /root/.ignition/gazebo/6/gui.config

# Expose port for VNC server
EXPOSE 5900

# The following configures the locale, which is apparently required for correct
# URDF file parsing according to Ros2 tutorial.
RUN echo "export LC_NUMERIC=\"en_US.UTF-8\"" >>~/.bashrc

# The following sets up the environment for correct execution of ros commands
RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >>~/.bashrc

# Copy in a script to serve as entry-point; this script can start the VNC
# server and window manager.
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

And entrypoint.sh:

#!/bin/bash
Xvfb :1 -screen 0 1024x768x16 &
sleep 5
DISPLAY=:1 openbox-session &
DISPLAY=:1 xterm &
x11vnc -forever -create -display :1