Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CARLA ROS Bridge Docker Container having issues initially connecting to CARLA Server running in a Docker Container #6373

Open
UrbanPistek opened this issue Apr 2, 2023 · 1 comment
Labels
stale Issue has not had recent activity

Comments

@UrbanPistek
Copy link

UrbanPistek commented Apr 2, 2023

CARLA version: 0.9.13
Platform/OS: Docker/Linux

I am using docker compose to launch Carla and a Carla ROS Bridge instance, here is my docker compose file:

version: '3.8'

services:

  # Carla server container
  carla:
    image: carlasim/carla:0.9.13
    container_name: carla_server
    runtime: nvidia
    ports:
      - 2000-2002:2000-2002
    command: /bin/bash -c "./CarlaUE4.sh -nosound -carla-server -RenderOffscreen -world-port=2000"

  # Carla ROS bridge container
  bridge:
    build:
      context: ./docker/ros_carla_bridge/
      dockerfile: Dockerfile
    container_name: carla_ros_bridge
    command: ros2 launch carla_ros_bridge carla_ros_bridge_with_example_ego_vehicle.launch.py host:=carla_server timeout:=5
    runtime: nvidia
    restart: always
    depends_on: 
      carla:
        condition: service_started

And here is my ROS Bridge docker file:

FROM osrf/ros:foxy-desktop-focal AS base

SHELL ["/bin/bash", "-c"]

RUN apt update && apt install -y python3-pip

RUN sudo apt install python3-colcon-common-extensions

RUN mkdir -p ~/carla-ros-bridge
WORKDIR /root/carla-ros-bridge

RUN git clone --recurse-submodules https://github.com/carla-simulator/ros-bridge.git src/ros-bridge

RUN rosdep update && rosdep install --from-paths src --ignore-src -r

RUN source /opt/ros/foxy/setup.bash && \
    colcon build

COPY ros_entrypoint.sh /

# Ensure script is executable
RUN ["sudo", "chmod", "+x", "/ros_entrypoint.sh"]

ENTRYPOINT ["/ros_entrypoint.sh"]

RUN python3 -m pip install --upgrade pip && python3 -m pip install numpy pygame
RUN python3 -m pip install 'carla==0.9.13'

I found when I run docker-compose up the carla_ros_bridge has trouble connecting to the carla server, the container crashes then restarts and then its able to connect, here is the error:

carla_ros_bridge   | [bridge-1] [ERROR] [1680446255.811228168] [carla_ros_bridge]: Error: time-out of 5000ms while waiting for the simulator, make sure the simulator is ready and connected to carla_server:2000
carla_ros_bridge   | [bridge-1] [INFO] [1680446255.811739344] [carla_ros_bridge]: Shutting down...

Then on the second retry it is able to connect.

I was wondering why it might be failing to connect on the first try, any ideas?

Thanks

Note: I am not sure if this is a Carla issue or a ROS bridge issue, I've also created a issue in ros-bridge for this: carla-simulator/ros-bridge#673

@stale
Copy link

stale bot commented Jun 1, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Issue has not had recent activity label Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issue has not had recent activity
Projects
None yet
Development

No branches or pull requests

1 participant