Ejemplo n.º 1
0
    def __init__(self, pose_stream, waypoints_stream, control_stream, flags):
        pose_stream.add_callback(self.on_pose_update)
        waypoints_stream.add_callback(self.on_waypoints_update)
        erdos.add_watermark_callback([pose_stream, waypoints_stream],
                                     [control_stream], self.on_watermark)
        self._logger = erdos.utils.setup_logging(self.config.name,
                                                 self.config.log_file_name)
        self._flags = flags
        self._mpc_config = global_config

        pid_use_real_time = False
        if self._flags.execution_mode == 'real-world':
            # The PID is executing on a real car. Use the real time delta
            # between two control commands.
            pid_use_real_time = True
        if self._flags.carla_control_frequency == -1:
            dt = 1.0 / self._flags.carla_fps
        else:
            dt = 1.0 / self._flags.carla_control_frequency
        self._pid = PIDLongitudinalController(flags.pid_p, flags.pid_d,
                                              flags.pid_i, dt,
                                              pid_use_real_time)
        self._pose_msgs = deque()
        self._obstacles_msgs = deque()
        self._traffic_light_msgs = deque()
        self._waypoint_msgs = deque()
        self._mpc = None
Ejemplo n.º 2
0
 def __init__(self, pose_stream, waypoints_stream, control_stream, flags):
     pose_stream.add_callback(self.on_pose_update)
     waypoints_stream.add_callback(self.on_waypoints_update)
     erdos.add_watermark_callback([pose_stream, waypoints_stream],
                                  [control_stream], self.on_watermark)
     self._flags = flags
     self._logger = erdos.utils.setup_logging(self.config.name,
                                              self.config.log_file_name)
     # TODO(ionel): Add path to calculate pid error with real time.
     if self._flags.carla_control_frequency == -1:
         dt = 1.0 / self._flags.carla_fps
     else:
         dt = 1.0 / self._flags.carla_control_frequency
     self._pid = PIDLongitudinalController(1.0, 0, 0.05, dt)
     # Queues in which received messages are stored.
     self._waypoint_msgs = deque()
     self._pose_msgs = deque()
Ejemplo n.º 3
0
 def __init__(self, pose_stream: ReadStream, waypoints_stream: ReadStream,
              control_stream: WriteStream, flags):
     pose_stream.add_callback(self.on_pose_update)
     waypoints_stream.add_callback(self.on_waypoints_update)
     erdos.add_watermark_callback([pose_stream, waypoints_stream],
                                  [control_stream], self.on_watermark)
     self._flags = flags
     self._logger = erdos.utils.setup_logging(self.config.name,
                                              self.config.log_file_name)
     pid_use_real_time = False
     if self._flags.execution_mode == 'real-world':
         # The PID is executing on a real car. Use the real time delta
         # between two control commands.
         pid_use_real_time = True
     if self._flags.simulator_control_frequency == -1:
         dt = 1.0 / self._flags.simulator_fps
     else:
         dt = 1.0 / self._flags.simulator_control_frequency
     self._pid = PIDLongitudinalController(flags.pid_p, flags.pid_d,
                                           flags.pid_i, dt,
                                           pid_use_real_time)
     # Queues in which received messages are stored.
     self._waypoint_msgs = deque()
     self._pose_msgs = deque()