launching Gazebo model in docker compose

asked 2022-07-24 20:38:22 -0500

mercury gravatar image

I am trying create a docker-compose file to launch a couple models in gazebo. I have set up a couple container and linked with a ros bridge. When I try to bring up the docker-compose file, The warthog container fails since it cannot find the warthog_description package which should be installed in the line: https://github.com/warthog-cpr/warthog

I dont understand why its not find the warthog description package. When I run the image by it self it finds the package no problem. Also when I run "rospack list" it prints out the package. I am not sure why its not find the local package.

Does anyone have an idea what is going on? Her e is a snipit of my errors:

ros-master_1  | ROS_MASTER_URI=http://96e28cb2ac0f:11311/
ros-master_1  | 
ros-master_1  | setting /run_id to 97fed9da-0bb5-11ed-be91-0242ac150002
ros-master_1  | process[rosout-1]: started with pid [51]
ros-master_1  | started core service [/rosout]
warthog_1     | xacro: in-order processing became default in ROS Melodic. You can drop the option.
gazebo_1      | [INFO] [1658711009.783663, 0.000000]: Loading model XML from file /catkin_ws/src/ship_models/model/plane.sdf
gazebo_1      | [INFO] [1658711009.784726, 0.000000]: Waiting for service /gazebo/spawn_sdf_model
gazebo_1      | [INFO] [1658711011.290788, 0.000000]: Calling service /gazebo/spawn_sdf_model
gazebo_1      | [INFO] [1658711011.477288, 0.174000]: Spawn status: SpawnModel: Successfully spawned entity
gazebo_1      | [rospack] Error: package 'warthog_description' not found
gazebo_1      | [librospack]: error while executing command
gazebo_1      | [FATAL] [1658711011.486786843, 0.175000000]: Package[warthog_description] does not have a path
warthog_1     | [ERROR] [1658711011.487059, 0.000000]: Spawn service failed. Exiting.

Here is the warthog Docker file

FROM nvidia_ros:latest 
# Change the default shell to Bash
SHELL [ "/bin/bash" , "-c" ]


# Install Git
RUN apt-get update && apt-get install -y git 
RUN apt update && apt install -y gcc clang clang-tools cmake python3
# RUN apt-get install ros-noetic-joy


# Create a Catkin workspace and clone TurtleBot3 repos
RUN source /opt/ros/noetic/setup.bash \
 && mkdir -p /catkin_ws/src \
 && cd /catkin_ws/src \
 && catkin_init_workspace \
 && git clone  https://github.com/warthog-cpr/warthog_simulator.git \
 && git clone  https://github.com/warthog-cpr/warthog_manipulation.git --recursive \
 && git clone  https://github.com/warthog-cpr/warthog.git



COPY /my_warthog /catkin_ws/src/my_warthog
# Build the Catkin workspace and ensure it's sourced
RUN source /opt/ros/noetic/setup.bash \
 && cd catkin_ws \
 && catkin_make
RUN source /opt/ros/noetic/setup.bash
RUN echo "source /catkin_ws/devel/setup.bash" >> ~/.bashrc

# # Set the working folder at startup
WORKDIR /catkin_ws

COPY ./entrypoint.sh /
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
CMD ["bash"]

Here is my docker compose file:

docker-compose file
        version: '2.3'
        networks:
          ros:
            driver: bridge

        services:
          ros-master:
            image: ros:melodic-ros-core
            command: stdbuf -o L roscore
            networks:
              - ros
            restart: always

          gazebo:
            image: ship
            depends_on:
              - ros-master
            environment:
              - "ROS_MASTER_URI=http://ros-master:11311"
              # - "ROS_HOSTNAME=gazebo"
              - "NVIDIA_VISIBLE_DEVICES=all"
              - "NVIDIA_DRIVER_CAPABILITIES=all"
              - "QT_X11_NO_MITSHM=1" 
              - "DISPLAY=$DISPLAY"
              - "DISPLAY"
            volumes:
              - /tmp/.X11-unix:/tmp/.X11-unix:rw
            #command: stdbuf -o L roslaunch ship_models my_world.launch
            command:  ["/bin/bash", "-c", "source devel/setup.bash && roslaunch ship_motion makeWaves.launch"]
            runtime: nvidia
            networks:
              - ros
            restart: always


          warthog:
            image: warthog
            depends_on:
              - ros-master
            environment:
              - "ROS_MASTER_URI=http://ros-master ...
(more)
edit retag flag offensive close merge delete