def __init__(self, can_bus_stream, ground_obstacles_stream, ground_traffic_lights_stream, waypoints_stream, control_stream, name, flags, log_file_name=None, csv_file_name=None): can_bus_stream.add_callback(self.on_can_bus_update) ground_obstacles_stream.add_callback(self.on_obstacles_update) ground_traffic_lights_stream.add_callback( self.on_traffic_lights_update) waypoints_stream.add_callback(self.on_waypoints_update) erdos.add_watermark_callback([ can_bus_stream, ground_obstacles_stream, ground_traffic_lights_stream, waypoints_stream ], [control_stream], self.on_watermark) self._name = name self._logger = erdos.utils.setup_logging(name, log_file_name) self._csv_logger = erdos.utils.setup_csv_logging( name + '-csv', csv_file_name) self._flags = flags self._map = HDMap( get_map(self._flags.carla_host, self._flags.carla_port, self._flags.carla_timeout), log_file_name) self._pid = PID(p=flags.pid_p, i=flags.pid_i, d=flags.pid_d) self._can_bus_msgs = deque() self._obstacle_msgs = deque() self._traffic_light_msgs = deque() self._waypoint_msgs = deque()
def run(self): # Run method is invoked after all operators finished initializing, # including the CARLA operator, which reloads the world. Thus, if # we get the map here we're sure it is up-to-date. world_map = get_map(self._flags.carla_host, self._flags.carla_port, self._flags.carla_timeout) self._town_name = world_map.name
def run(self): # Run method is invoked after all operators finished initializing. # Thus, we're sure the world is up-to-date here. world_map = get_map(self._flags.simulator_host, self._flags.simulator_port, self._flags.simulator_timeout) self._town_name = world_map.name
def __init__(self, can_bus_stream, open_drive_stream, global_trajectory_stream, waypoints_stream, name, flags, goal_location=None, log_file_name=None, csv_file_name=None): can_bus_stream.add_callback(self.on_can_bus_update, [waypoints_stream]) open_drive_stream.add_callback(self.on_opendrive_map) global_trajectory_stream.add_callback(self.on_global_trajectory) self._log_file_name = log_file_name self._logger = erdos.utils.setup_logging(name, log_file_name) self._csv_logger = erdos.utils.setup_csv_logging( name + '-csv', csv_file_name) self._flags = flags # Initialize the state of the behaviour planner. # XXX(ionel): The behaviour planner is not ready yet. self.__initialize_behaviour_planner() # We do not know yet the vehicle's location. self._vehicle_transform = None # Deque of waypoints the vehicle must follow. The waypoints are either # received on the global trajectory stream when running using the # scenario runner, or computed using the Carla global planner when # running in stand-alone mode. The waypoints are Pylot transforms. self._waypoints = collections.deque() # The operator picks the wp_num_steer-th waypoint to compute the angle # it has to steer by when taking a turn. self._wp_num_steer = 9 # use 10th waypoint for steering # The operator picks the wp_num_speed-th waypoint to compute the angle # it has to steer by when driving straight. self._wp_num_speed = 4 # use tth waypoint for speed # We're not running in challenge mode if no track flag is present. # Thus, we can directly get the map from the simulator. if not hasattr(self._flags, 'track'): self._map = HDMap( get_map(self._flags.carla_host, self._flags.carla_port, self._flags.carla_timeout), log_file_name) self._logger.info('Planner running in stand-alone mode') assert goal_location, 'Planner has not received a goal location' # Transform goal location to carla.Location self._goal_location = goal_location # Recompute waypoints upon each run. self._recompute_waypoints = True else: # Do not recompute waypoints upon each run. self._recompute_waypoints = False # TODO(ionel): HACK! In Carla challenge track 1 and 2 the waypoints # are coarse grained (30 meters apart). We pick the first waypoint # to compute the angles. However, we should instead implement # trajectory planning. if self._flags.track == 1 or self._flags == 2: self._wp_num_steer = 1 self._wp_num_speed = 1
def run(self): # Run method is invoked after all operators finished initializing. # Thus, we're sure the world is up-to-date here. if self._flags.execution_mode == 'simulation': from pylot.map.hd_map import HDMap from pylot.simulation.utils import get_map self._map = HDMap( get_map(self._flags.simulator_host, self._flags.simulator_port, self._flags.simulator_timeout), self.config.log_file_name) self._logger.info('Planner running in stand-alone mode')
def run(self): # Run method is invoked after all operators finished initializing, # including the CARLA operator, which reloads the world. Thus, if # we get the map here we're sure it is up-to-date. if self._flags.track == -1: from pylot.map.hd_map import HDMap from pylot.simulation.utils import get_map self._map = HDMap( get_map(self._flags.carla_host, self._flags.carla_port, self._flags.carla_timeout)) self._logger.info('Planner running in stand-alone mode')
def run(self): # Run method is invoked after all operators finished initializing, # including the CARLA operator, which reloads the world. Thus, if # we get the world here we're sure it is up-to-date. if self._flags.execution_mode == 'simulation': from pylot.map.hd_map import HDMap from pylot.simulation.utils import get_map self._map = HDMap( get_map(self._flags.carla_host, self._flags.carla_port, self._flags.carla_timeout), self.config.log_file_name) from pylot.simulation.utils import get_world _, self._world = get_world(self._flags.carla_host, self._flags.carla_port, self._flags.carla_timeout)
def __init__(self, can_bus_stream, waypoints_stream, traffic_lights_stream, obstacles_stream, point_cloud_stream, open_drive_stream, control_stream, name, flags, camera_setup, log_file_name=None, csv_file_name=None): can_bus_stream.add_callback(self.on_can_bus_update) waypoints_stream.add_callback(self.on_waypoints_update) traffic_lights_stream.add_callback(self.on_traffic_lights_update) obstacles_stream.add_callback(self.on_obstacles_update) point_cloud_stream.add_callback(self.on_point_cloud_update) open_drive_stream.add_callback(self.on_open_drive_map) erdos.add_watermark_callback([ can_bus_stream, waypoints_stream, traffic_lights_stream, obstacles_stream, point_cloud_stream ], [control_stream], self.on_watermark) self._name = name self._flags = flags self._camera_setup = camera_setup self._log_file_name = log_file_name self._logger = erdos.utils.setup_logging(name, log_file_name) self._csv_logger = erdos.utils.setup_csv_logging( name + '-csv', csv_file_name) if not hasattr(self._flags, 'track'): # The agent is not used in the Carla challenge. It has access to # the simulator, and to the town map. self._map = HDMap( get_map(self._flags.carla_host, self._flags.carla_port, self._flags.carla_timeout), log_file_name) self._logger.debug('Agent running using map') else: self._map = None self._pid = PID(p=self._flags.pid_p, i=self._flags.pid_i, d=self._flags.pid_d) # Queues in which received messages are stored. self._waypoint_msgs = deque() self._can_bus_msgs = deque() self._traffic_lights_msgs = deque() self._obstacles_msgs = deque() self._point_clouds = deque() self._vehicle_labels = {'car', 'bicycle', 'motorcycle', 'bus', 'truck'}
def run(self): # Run method is invoked after all operators finished initializing, # including the CARLA operator, which reloads the world. Thus, if # we get the map here we're sure it is up-to-date. # We're not running in challenge mode if no track flag is present. # Thus, we can directly get the map from the simulator. if not hasattr(self._flags, 'track'): from pylot.map.hd_map import HDMap from pylot.simulation.utils import get_map self._map = HDMap( get_map(self._flags.carla_host, self._flags.carla_port, self._flags.carla_timeout)) self._logger.info('Planner running in stand-alone mode') # Recompute waypoints every RECOMPUTE_WAYPOINT_EVERY_N_WATERMARKS. self._recompute_waypoints = True else: # Do not recompute waypoints upon each run. self._recompute_waypoints = False self._watermark_cnt = 0
def __init__(self, can_bus_stream, prediction_stream, waypoints_stream, name, flags, goal_location, log_file_name=None, csv_file_name=None): """ Initialize the RRT* planner. Setup logger and map attributes. Args: name: Name of the operator. flags: Config flags. goal_location: Global goal carla.Location for planner to route to. """ can_bus_stream.add_callback(self.on_can_bus_update) prediction_stream.add_callback(self.on_prediction_update) erdos.add_watermark_callback([can_bus_stream, prediction_stream], [waypoints_stream], self.on_watermark) self._name = name self._logger = erdos.utils.setup_logging(name, log_file_name) self._csv_logger = erdos.utils.setup_csv_logging( name + '-csv', csv_file_name) self._flags = flags self._wp_index = 9 self._waypoints = None self._carla_map = get_map(self._flags.carla_host, self._flags.carla_port, self._flags.carla_timeout) self._hd_map = HDMap(self._carla_map, log_file_name) self._goal_location = goal_location self._can_bus_msgs = deque() self._prediction_msgs = deque()