carla-simulator / ros-bridge

ROS bridge for CARLA Simulator
MIT License
522 stars 423 forks source link

Timeout while waiting for world info, should use rosparam timeout #545

Open rowandempster opened 3 years ago

rowandempster commented 3 years ago

In the ego vehicle node main loop:

    def run(self):
        """
        main loop
        """
        # wait for ros-bridge to set up CARLA world
        rospy.loginfo("Waiting for CARLA world (topic: /carla/world_info)...")
        try:
            rospy.wait_for_message("/carla/world_info", CarlaWorldInfo, timeout=10.0)
        except rospy.ROSException:
            rospy.logerr("Timeout while waiting for world info!")
            sys.exit(1)

the timeout is hardcoded to 10 seconds, whereas sometimes it takes more than 10 seconds for our simulator to start up, and thus the ego node exits. If we then restart the ego node it starts successfully.

Seems like the code should be using the /carla/timeout' rosparam from here: https://github.com/carla-simulator/ros-bridge/blob/0700f2d24bf46b47188a03dce51615ee353d5aa9/carla_ego_vehicle/src/carla_ego_vehicle/carla_ego_vehicle.py#L53 which we have set to 60s.

rowandempster commented 3 years ago

Note that our issue seems to be separate from https://github.com/carla-simulator/ros-bridge/issues/272 and https://github.com/carla-simulator/ros-bridge/issues/296, we can successfully communicate w/ the server after a restart of the node, seems like a race condition between server and client startup that could be fixed by allowing users to define the timeout instead of hardcoding it.