示例#1
0
    def __init__(self, wheel_base, steer_ratio, min_speed, max_lat_accel,
                 max_steer_angle, vehicle_mass):
        self.vehicle_mass = vehicle_mass
        self.wheel_radius = wheel_base

        self.yawcontroller = YawController(wheel_base, steer_ratio, min_speed,
                                           max_lat_accel, max_steer_angle)
        self.set_controllers()
        pass
示例#2
0
    def __init__(self, **kwargs):
        self.yaw_controller = YawController(kwargs['wheel_base'],
                                            kwargs['steer_ratio'], 0.0,
                                            kwargs['max_lat_accel'],
                                            kwargs['max_steer_angle'])
        self.throttle_pid = PID(0.5, 0.002, 0.0, kwargs['decel_limit'],
                                kwargs['accel_limit'])

        self.previous_time = None
示例#3
0
 def __init__(self, vehicle_mass, decel_limit, wheel_radius, wheel_base,
              steer_ratio, min_speed, max_lat_accel, max_steer_angle):
     self.vehicle_mass = vehicle_mass
     self.decel_limit = decel_limit
     self.wheel_radius = wheel_radius
     self.min_speed = min_speed
     self.vel_controller = PID(0.5, 0.01, 0.05, 0.0, 1.0)
     self.yaw_controller = YawController(wheel_base, steer_ratio, min_speed,
                                         max_lat_accel, max_steer_angle)
 def __init__(self, params):
     # TODO: Implement
     self.yaw_controller = YawController(
         wheel_base=params['wheel_base'],
         steer_ratio=params['steer_ratio'],
         min_speed=params['min_speed'],
         max_lat_accel=params['max_lat_accel'],
         max_steer_angle=params['max_steer_angle'])
     self.set_controllers()
示例#5
0
    def __init__(self, vehicle_info):
        self.pid_controller = PID(0.5, 0.002, 0.0, vehicle_info.decel_limit,
                                  vehicle_info.accel_limit)
        self.yaw_controller = YawController(vehicle_info.wheel_base,
                                            vehicle_info.steer_ratio, 0,
                                            vehicle_info.max_lat_accel,
                                            vehicle_info.max_steer_angle)

        self.prev_time = None
示例#6
0
    def __init__(self, wheel_base, steer_ratio, max_lat_accel, max_steer_angle,
                 vehicle_mass, wheel_radius, brake_deadband):

        self.yaw_controller = YawController(wheel_base, steer_ratio, MIN_SPEED,
                                            max_lat_accel, max_steer_angle)
        self.pid = PID(KP, KI, KD, -MAX_ACCEL, MAX_ACCEL)
        self._vehicle_mass = vehicle_mass
        self._wheel_radius = wheel_radius
        self._brake_deadband = brake_deadband
示例#7
0
 def __init__(self, vehicle_mass, wheel_radius, wheel_base, steer_ratio,
              max_lat_accel, max_steer_angle):
     self.vehicle_mass = vehicle_mass
     self.wheel_radius = wheel_radius
     # TODO: Determine proper PID control parameters
     self.speed_controller = PID(1.0, 0.0, 0.0, -5.0, GAS_DENSITY)
     self.yaw_controller = YawController(wheel_base, steer_ratio, ONE_MPH,
                                         max_lat_accel, max_steer_angle)
     pass
示例#8
0
    def __init__(self, *args, **kwargs):  # cleaner way to setup parameters

        #def __init__(self, vehicle_mass, fuel_capacity, brake_deadband , decel_limit, accel_limit,
        #   wheel_radius, wheel_base, steer_ratio, max_lat_accel, max_steer_angle):
        # TODO: Implement

        # Retrieve parameters.
        self.vehicle_mass = kwargs['vehicle_mass']
        self.fuel_capacity = kwargs['fuel_capacity']  # not used in project
        self.brake_deadband = kwargs['brake_deadband']
        self.decel_limit = kwargs[
            'decel_limit']  # comfort parameter, not used in project
        self.accel_limit = kwargs[
            'accel_limit']  # comfort parameter, not used in project
        self.wheel_radius = kwargs['wheel_radius']
        self.wheel_base = kwargs['wheel_base']
        self.steer_ratio = kwargs['steer_ratio']
        self.max_lat_accel = kwargs['max_lat_accel']
        self.max_steer_angle = kwargs['max_steer_angle']
        self.last_time = rospy.get_time()

        self.yaw_controller = YawController(self.wheel_base, self.steer_ratio,
                                            0.1, self.max_lat_accel,
                                            self.max_steer_angle)
        #0.5, 0.00001, 0.
        # trial and error values, can be changed
        kp = 0.3  #0.8 #0.3
        ki = 0.0  #0.1
        kd = 0.8  #0.06
        min_thr = 0.  # Min throttle value
        max_thr = 0.1  #0.1 #0.2 # Max throttle value
        self.throttle_controller = PID(kp, ki, kd, min_thr, max_thr)

        #Account for cross track error in steering angle
        #kp_cte = 0.5  #CTE
        #ki_cte = 0.0  #CTE
        #kd_cte = 0.2  #CTE
        #self.steer_cte_controller = PID(kp_cte, ki_cte, kd_cte, -self.max_steer_angle, self.max_steer_angle)  #CTE

        #filters the high freq noise in the velocity input
        tau = 0.5  # cutoff_freq = 1/(2*pi*tau)
        ts = 0.02  # sample time
        self.vel_lpf = LowPassFilter(tau, ts)
        self.steer_filter = LowPassFilter(0.2, 0.1)

        #self.vehicle_mass = vehicle_mass
        #self.fuel_capacity = fuel_capacity  # not used in project
        #self.brake_deadband = brake_deadband
        #self.decel_limit = decel_limit   # comfort parameter, not used in project
        #self.accel_limit = accel_limit   # comfort parameter, not used in project
        #self.wheel_radius = wheel_radius # required

        #published by tl_detector, so that throttle can be reduced if incoming traffic light is detected
        #rospy.Subscriber('/traffic_light_ahead', Int32, self.traffic_light_ahead_cb) #? Check definition
        #self.traffic_signal_ahead = -1

        rospy.logwarn("initialized Controller")
示例#9
0
 def __init__(self, vehicle_mass, fuel_capacity, brake_deadband,
              decel_limit, accel_limit, wheel_radius, wheel_base,
              steer_ratio, max_lat_accel, max_steer_angle, min_speed):
     # TODO: Implement
     self.yaw_controller = YawController(wheel_base, steer_ratio, min_speed,
                                         max_lat_accel, max_steer_angle)
     kp = 0.12
     ki = 0.006
     kd = 3.0
     self.pid = PID(kp, ki, kd)
 def __init__(self, *args, **kwargs):
     self.throttle_pid = PID(kwargs['throttle_gains'])
     self.yaw_control = YawController(kwargs['wheel_base'],
                                      kwargs['steer_ratio'],
                                      kwargs['min_speed'],
                                      kwargs['max_lat_accel'],
                                      kwargs['max_steer_angle'],
                                      kwargs['steering_gains'])
     self.last_t = None
     self.filter = LowPassFilter(0.2, 0.1)
    def __init__(self, *args):
        # for calcuate brake(torque[N/m])
        self.total_mass = args[4] + args[5] * GAS_DENSITY
        self.wheel_radius = args[6]

        self.yaw_controller = YawController(args[0], args[1], 0.15, args[2],
                                            args[3])
        self.pid = PID(0.0198, 0.0002, 0.0064, -1.0, 0.35)
        # tau = 0.01, ts = 50Hz -> 20ms
        self.lowpass_filter = LowPassFilter(0.01, 0.02)
示例#12
0
    def __init__(self, wheel_base, steer_ratio, min_speed, max_lat_accel, max_steer_angle):
        self.wheel_base = wheel_base
        self.steer_ratio = steer_ratio
        self.PID_lon = PID(lon_kp, lon_ki, lon_kd, mn = 0.0, mx = 1.0)
        self.PID_steer = PID(lat_kp, lat_ki, lat_kd, mn=-max_steer_angle, mx=max_steer_angle)

        self.time_old = rospy.get_time()
        self.time = 0

        self.yaw_controller = YawController(wheel_base, steer_ratio, min_speed, max_lat_accel, max_steer_angle)
示例#13
0
 def __init__(self, vehicle_mass, decel_limit, accel_limit, wheel_radius,
              wheel_base, steer_ratio, max_lat_accel, max_steer_angle):
     self.yaw_controller = YawController(wheel_base, steer_ratio, 0.1,
                                         max_lat_accel, max_steer_angle)
     self.throttle_controller = PID(0.1, 0.001, 3, 0, accel_limit)
     self.velocity_lpf = LowPassFilter(0.5, 0.02)
     self.decel_limit = decel_limit
     self.vehicle_mass = vehicle_mass
     self.wheel_radius = wheel_radius
     self.last_time = rospy.get_time()
示例#14
0
    def __init__(self):
        rospy.init_node('dbw_node')

        vehicle_mass = rospy.get_param('~vehicle_mass', 1736.35)
        fuel_capacity = rospy.get_param('~fuel_capacity', 13.5)
        brake_deadband = rospy.get_param('~brake_deadband', .1)
        decel_limit = rospy.get_param('~decel_limit', -5)
        accel_limit = rospy.get_param('~accel_limit', 1.)
        wheel_radius = rospy.get_param('~wheel_radius', 0.2413)
        wheel_base = rospy.get_param('~wheel_base', 2.8498)
        steer_ratio = rospy.get_param('~steer_ratio', 14.8)
        max_lat_accel = rospy.get_param('~max_lat_accel', 3.)
        max_steer_angle = rospy.get_param('~max_steer_angle', 8.)

        self.dbw_enabled = True
        self.twist = None
        self.waypoints = None
        self.pose = None
        self.velocity = None

        self.steer_pub = rospy.Publisher('/vehicle/steering_cmd',
                                         SteeringCmd,
                                         queue_size=1)
        self.throttle_pub = rospy.Publisher('/vehicle/throttle_cmd',
                                            ThrottleCmd,
                                            queue_size=1)
        self.brake_pub = rospy.Publisher('/vehicle/brake_cmd',
                                         BrakeCmd,
                                         queue_size=1)

        # TODO: Create `TwistController` object
        # self.controller = TwistController(<Arguments you wish to provide>)
        self.controller = Controller(vehicle_mass, wheel_radius, accel_limit,
                                     decel_limit, max_steer_angle)
        self.yaw_controller = YawController(wheel_base, steer_ratio, 0.0,
                                            max_lat_accel, max_steer_angle)

        # TODO: Subscribe to all the topics you need to
        rospy.Subscriber('/final_waypoints',
                         Lane,
                         self.waypoints_cb,
                         queue_size=1)
        rospy.Subscriber('/current_pose',
                         PoseStamped,
                         self.pose_cb,
                         queue_size=1)
        rospy.Subscriber('/current_velocity',
                         TwistStamped,
                         self.velocity_cb,
                         queue_size=1)

        rospy.Subscriber('/twist_cmd', TwistStamped, self.twist_cb)
        rospy.Subscriber('/dbw_enabled', PoseStamped, self.dbw_cb)

        self.loop()
    def __init__(
        self, vehicle_mass, fuel_capacity, brake_deadband, decel_limit,
        accel_limit, wheel_radius, wheel_base, steer_ratio, max_lat_accel,
        max_steer_angle, min_speed
    ):  # I went back to regular variable passing because it was getting too confusing
        # TODO: Implement
        #all below from Q+A video
        #video never mentioend the4 kwags eror below
        #self.yaw_controller = YawController(wheel_base,steer_ratio, 0.1, max_lat_accel,max_steer_angle)
        '''
        #another attempt around kwargs issue
        self.yaw_controller = YawController(wheel_base = kwargs['wheel_base'],
                                            steer_ratio = kwargs['steer_ratio'],
                                            min_speed =  kwargs['min_speed'],
                                            max_lat_accel = kwargs['max_lat_accel'],
                                            max_steer_angle = kwargs['max_steer_angle'])
        '''
        # note no using some things that were passed in ie  vehicle_mass, fuel_capacity ,brake_deadband , decel_limit  ,  accel_limit  , wheel_radius ,
        self.yaw_controller = YawController(wheel_base, steer_ratio,
                                            max_lat_accel, max_steer_angle,
                                            min_speed)

        ##error
        #File "/home/workspace/CarND-Capstone/ros/src/twist_controller/twist_controller.py", line 10, in __init__
        #    self.yaw_controller = YawController(wheel_base,steer_ratio, 0.1, max_lat_accel,max_steer_angle)
        #NameError: global name 'YawController' is not defined
        #0.1,.01 and .01 gives good throttle but keeps going at end of loop

        kp = 0.1  #0.05#1.0# 1.0#0.7#0.2#0.7##1.0 #0.3#5.0#1.0#0.1#5#2.0# 0.3
        ki = 0.0005  #0.005#0.01#0.3#0.1#0.1#1.0 #0.1#0.5#1.0#0.1 #0.5 #0.4 # 0.1 # had k1 here mistake
        kd = 0.005  #0.0050#0.01#0.7#1.0# 0.0# 0.5# 1.0#0.1# 0.5 #0.5# 0.1 # 0.1 # 0. # ?? this is how it is in Q+A
        mn = 0  #0.01 # 0. # Minimum throttle value ### ?? this is how it is in Q+A
        mx = 1.0  #0.3#1.0 # evern as low as 0.05 did not fix the lag from camera on 0.05 #experiemnt using max throttle to limit speed to overcome lag with camera on 1.0#was 0.2 # Maximum throttle value
        #at 0.2 it got stuck in site sim! at PID = 1.0
        #self.throttle_controller = PID(kp, ki, mn, mx)
        self.throttle_controller = PID(kp, ki, kd, mn, mx)  #kd was missing....
        # I am going to commment the LPF out as it may be casueing trouble
        tau = 0.5  # 1/(2pi*tau) = cutoff frequency
        ts = 0.02  # sample time
        self.vel_lpf = LowPassFilter(tau, ts)

        self.vehicle_mass = vehicle_mass  # changed back from kwarg becuase one was becoming a string...kwargs['vehicle_mass'] #maybe not best way I could take all the kwargs together at start of thsi section might be easier to read
        self.fuel_capacity = fuel_capacity  #removed kwargs way as above and same for following #same as above all kwargs added here
        self.brake_deadband = brake_deadband
        self.decel_limit = decel_limit
        self.accel_limit = accel_limit
        self.wheel_radius = wheel_radius

        self.wheel_base = wheel_base  #not currently used
        self.steer_ratio = steer_ratio  #not currently used
        self.max_lat_accel = max_lat_accel  #not currently used
        self.max_steer_angle = max_steer_angle  #not currently used
        self.min_speed = min_speed  #not currently used

        self.last_time = rospy.get_time()
示例#16
0
    def __init__(self):
        rospy.init_node('dbw_node')

        vehicle_mass = rospy.get_param('~vehicle_mass', 1736.35)
        fuel_capacity = rospy.get_param('~fuel_capacity', 13.5)
        brake_deadband = rospy.get_param('~brake_deadband', .1)
        decel_limit = rospy.get_param('~decel_limit', -5)
        accel_limit = rospy.get_param('~accel_limit', 1.)
        wheel_radius = rospy.get_param('~wheel_radius', 0.2413)
        wheel_base = rospy.get_param('~wheel_base', 2.8498)
        steer_ratio = rospy.get_param('~steer_ratio', 14.8)
        max_lat_accel = rospy.get_param('~max_lat_accel', 3.)
        max_steer_angle = rospy.get_param('~max_steer_angle', 8.)

        self.steer_pub = rospy.Publisher('/vehicle/steering_cmd',
                                         SteeringCmd,
                                         queue_size=1)
        self.throttle_pub = rospy.Publisher('/vehicle/throttle_cmd',
                                            ThrottleCmd,
                                            queue_size=1)
        self.brake_pub = rospy.Publisher('/vehicle/brake_cmd',
                                         BrakeCmd,
                                         queue_size=1)

        # TODO: Subscribe to all the topics you need to

        rospy.Subscriber('/current_velocity', TwistStamped,
                         self.current_velocity_cb)
        rospy.Subscriber('/vehicle/dbw_enabled', Bool, self.dbw_enabled_cb)
        rospy.Subscriber('/twist_cmd', TwistStamped, self.twist_cmd_cb)

        # TODO maybe adjust min_speed

        self.frequency = 5

        min_speed = 0  # brake_deadband # ??
        yawCont = YawController(wheel_base, steer_ratio, min_speed,
                                max_lat_accel, max_steer_angle)
        veloPID = PID(0.2, 0.001, 0.05, decel_limit, accel_limit)

        #  TODO: Create `TwistController` object
        # self.controller = TwistController(<Arguments you wish to provide>)
        self.controller = Controller(veloPID, yawCont)

        self.cur_linvel = 0
        self.lin_vel = 0
        self.ang_vel = 0

        self.is_dbw_enabled = False  # the simulator comes all the time with the "manual" box ticked

        self.throttle_before = 0.0
        self.brake_before = 0.0
        self.steering_before = 0.0

        self.loop()
示例#17
0
    def __init__(self, kp, ki, kd, max_torque, accel_limit, brake_deadband,
                 wheel_base, steer_ratio, min_speed, max_lat_accel,
                 max_steer_angle):
        # TODO: Implement
        self.max_torque = abs(max_torque)
        self.accel_limit = accel_limit
        self.brake_deadband = brake_deadband
        self.pid = PID(kp, ki, kd, -1, 1)

        self.yaw = YawController(wheel_base, steer_ratio, min_speed,
                                 max_lat_accel, max_steer_angle)
示例#18
0
    def control(self, tgt_linear, tgt_angular, cur_linear, cur_angular,
                dbw_enabled):
        if not dbw_enabled:
            if self.dbw_enabled:
                self.dbw_enabled = False
                self.acc_pid.reset()
                self.acc_filter.reset()
                self.steer_filter.reset()
            return 0., 0., 0.

        dt = 0.02  # in seconds (~ 50 Hz)
        v = max(0., cur_linear)
        vel_error = tgt_linear - v

        # Get the angle from the yaw_controller
        yawcontroller = YawController(self.wheel_base, self.steer_ratio,
                                      ONE_MPH, self.max_lat_accel,
                                      self.max_steer_angle)
        steer_raw = yawcontroller.get_steering(tgt_linear, tgt_angular,
                                               cur_linear)
        steer = self.steer_filter.filt(steer_raw)
        acc_raw = self.acc_pid.step(vel_error, dt)
        acc = self.acc_filter.filt(acc_raw)

        # If dbw was just activated, we wait for the next call
        if not self.dbw_enabled:
            self.dbw_enabled = True
            return 0., 0., 0.

        # drag force due to air
        F_drag = 0.4 * v * v
        # rolling resistance
        c_rr = .01 + 0.005 * pow(v / 28., 2)
        F_rr = c_rr * self.vehicle_mass * 9.8
        torque = (acc * self.vehicle_mass + F_drag + F_rr) * self.wheel_radius
        max_torque = 1000.

        # there is a constant bias of throttle we need to correct for
        torque -= 0.02 * max_torque

        if acc > 0:
            throttle = min(.25, max(torque, 0.) / max_torque)
            brake = 0.
        else:
            brake = max(0., -torque)
            # for idle state, we apply a small constant brake :
            if tgt_linear < 0.01:
                brake = 10.
            throttle = 0.0

        # rospy.logdebug("throttle : %s %s %s %s", throttle, acc, cur_linear, brake)

        # Return throttle, brake, steer
        return throttle, brake, steer
示例#19
0
    def __init__(self, wheel_base, steer_ratio, min_speed, max_lat_accel,
                 max_steer_angle):

        # Init controllers
        self.pid = PID(1, 0.4, 0)
        self.yaw_controller = YawController(wheel_base, steer_ratio, min_speed,
                                            max_lat_accel, max_steer_angle)
        self.lowpassFilt = LowPassFilter(0.07, 0.02)

        # Save time for delta time calculation
        self.previous_time = rospy.get_time()
示例#20
0
    def __init__(self, *args, **kwargs):
        wheel_base = 2.8498
        steer_ratio = 14.8
        max_lat_accel = 1.  # 3.
        max_steer_angle = 8.

        self.yaw_controller = YawController(wheel_base, steer_ratio, 0.00,
                                            max_lat_accel, max_steer_angle)
        self.throttle_pid_controller = PID(5, 0.01, 1)
        self.throttle_low_pass_filter = LowPassFilter(.1, 1)
        self.steering_pass_filter = LowPassFilter(1, 1)
示例#21
0
    def __init__(self):
        rospy.init_node('dbw_node', log_level=rospy.DEBUG)

        vehicle_mass = rospy.get_param('~vehicle_mass', 1736.35)
        fuel_capacity = rospy.get_param('~fuel_capacity', 13.5)
        brake_deadband = rospy.get_param('~brake_deadband', .1)
        decel_limit = rospy.get_param('~decel_limit', -5)
        accel_limit = rospy.get_param('~accel_limit', 1.)
        wheel_radius = rospy.get_param('~wheel_radius', 0.2413)
        wheel_base = rospy.get_param('~wheel_base', 2.8498)
        steer_ratio = rospy.get_param('~steer_ratio', 14.8)
        max_lat_accel = rospy.get_param('~max_lat_accel', 3.)
        max_steer_angle = rospy.get_param('~max_steer_angle', 8.)

        self.steer_pub = rospy.Publisher('/vehicle/steering_cmd',
                                         SteeringCmd,
                                         queue_size=1)
        self.throttle_pub = rospy.Publisher('/vehicle/throttle_cmd',
                                            ThrottleCmd,
                                            queue_size=1)
        self.brake_pub = rospy.Publisher('/vehicle/brake_cmd',
                                         BrakeCmd,
                                         queue_size=1)

        self.current_velocity = None
        self.dbw_enabled = False
        self.twist_cmd = None

        self.rate = 10  # 10Hz
        self.sample_time = 1. / self.rate

        # Create YawController object
        self.yaw_controller = YawController(wheel_base, steer_ratio, 1.0,
                                            max_lat_accel, max_steer_angle)

        # TODO: Create `TwistController` object
        self.controller = Controller(self.yaw_controller, vehicle_mass,
                                     wheel_radius)

        # TODO: Subscribe to all the topics you need to
        rospy.Subscriber('/current_velocity',
                         TwistStamped,
                         self.current_velocity_cb,
                         queue_size=1)
        rospy.Subscriber('/vehicle/dbw_enabled',
                         Bool,
                         self.dbw_enabled_cb,
                         queue_size=1)
        rospy.Subscriber('/twist_cmd',
                         TwistStamped,
                         self.twist_cmd_cb,
                         queue_size=1)

        self.loop()
    def __init__(self, wheel_base, steer_ratio, min_speed, max_lat_accel,
                 max_steer_angle, v_mass, d_accel, wheel_radius):
        # PID controller for velocity
        self.vel_pid_ = PID(0.1, 0.0001, 0.0, mn=-2, mx=1)

        # Yaw controller buit by Udacity
        self.yaw_controller_ = YawController(wheel_base, steer_ratio,
                                             min_speed, max_lat_accel,
                                             max_steer_angle)

        self.max_decel = v_mass * (-d_accel) * wheel_radius
        self.k_decel = 1750
示例#23
0
	def __init__(self, *args, **kwargs):
		self.yaw_controller = YawController(kwargs['wheel_base'], kwargs['steer_ratio'],
											kwargs['min_speed'] + ONE_MPH, kwargs['max_lat_accel'],
											kwargs['max_steer_angle'])
		self.steering_controller = PID(0.5, 0.05, 0.1, -0.35, 0.35)
		self.min_speed = kwargs['min_speed']
		self.prev_time = rospy.get_time()
		self.brake_deadband = kwargs['brake_deadband']
		self.total_mass = kwargs['vehicle_mass'] + kwargs['fuel_capacity']*GAS_DENSITY
		self.wheel_radius = kwargs['wheel_radius']
		self.accel_limit = kwargs['accel_limit']
		self.decel_limit = kwargs['decel_limit']
    def __init__(self, *args, **kwargs):
        # TODO: Implement
		# linear velocity controller
        self.longitudinal = PID(kp=0.4, ki=0.001, kd=0.1, mn=kwargs['decel_limit'], mx=kwargs['accel_limit'])
		# angular velocity controller
        self.lateral = YawController(wheel_base=kwargs['wheel_base'],
                                     steer_ratio=kwargs['steer_ratio'],
                                     min_speed=0,
                                     max_lat_accel=kwargs['max_lat_accel'],
                                     max_steer_angle=kwargs['max_steer_angle'])
		# low-pass filter not used not
        self.LPF = LowPassFilter(tau=1, ts=1)
示例#25
0
    def __init__(self, wheel_base, steer_ratio, max_lat_accel, max_steer_angle,
                 decel_limit, vehicle_mass, wheel_radius):

        self.yaw_control = YawController(wheel_base, steer_ratio, 0.1,
                                         max_lat_accel, max_steer_angle)
        self.throttel_control = PID(0.3, 0.1, 0.001, 0., 1.)
        self.filter = LowPassFilter(0.5, 0.02)

        self.last_step = rospy.get_time()
        self.decel_limit = decel_limit
        self.vehicle_mass = vehicle_mass
        self.wheel_radius = wheel_radius
示例#26
0
    def __init__(self, wheel_base, steer_ratio, min_speed, max_lat_accel,
                 max_steer_angle, decel_limit, accel_limit):
        # TODO: Implement
        self.YawController = YawController(wheel_base, steer_ratio, min_speed,
                                           max_lat_accel, max_steer_angle)

        # self.PID = PID(0.9, 0.0005, 0.075, decel_limit, accel_limit)
        self.PID = PID(4.0, 0.001, 0.05, decel_limit, accel_limit)
        self.low_pass_filer_vel = LowPassFilter(10.0, 1.0)

        self.lastT = None
        self.last_dbw_enabled = False
 def __init__(self, vehicle_mass, fuel_capacity, brake_deadband,
              decel_limit, accel_limit, wheel_radius, wheel_base,
              steer_ratio, max_lat_accel, max_steer_angle):
     min_speed = 1.0 * ONE_MPH
     self.pid = PID(2.0, 0.4, 0.1)
     self.lpf = LowPassFilter(0.5, 0.02)
     self.yaw = YawController(wheel_base, steer_ratio, min_speed,
                              max_lat_accel, max_steer_angle)
     self.v_mass = vehicle_mass
     self.w_radius = wheel_radius
     self.d_limit = decel_limit
     self.last_time = None
示例#28
0
    def __init__(self, *args, **kwargs):

        self.throttle_pid = PID(kwargs['throttleKsOfPid'])
        self.yaw_control = YawController(kwargs['wheelBase'], kwargs['steerRatio'],
                                         kwargs['minimumSpeed'], kwargs['maximumLateralAcceleration'],
                                         kwargs['maximumSteeringAngle'],
                                         kwargs['steeringKsOfPid']
                                         )
        self.lastTime = None
        self.accelerationLimit = kwargs['accelerationLimit']
        self.deaccelerationLimit = kwargs['deaccelerationLimit']
        self.filter = LowPassFilter(0.2,0.1)
示例#29
0
 def __init__(self, ps):
     self.yaw_controller = YawController(ps.wheel_base, ps.steer_ratio, 0.1,
                                         ps.max_lat_accel,
                                         ps.max_steer_angle)
     #Init params, PID, and filters
     self.ps = ps
     self.driverless_mass = self.ps.vehicle_mass + self.ps.fuel_capacity * GAS_DENSITY
     self.pid_steer = PID(.5, .0025, .25, -ps.max_steer_angle,
                          ps.max_steer_angle)
     self.last_cte = 0
     self.p1 = .0001
     self.p2 = .0001
示例#30
0
	def __init__(self, car_params):
		self.car_params = car_params

		self.lpf_accel = LowPassFilter(tau = 0.5, ts = 0.02)

		self.accel_pid = PID(kp = 0.4, ki = 0.1, kd = 0.0, mn = 0.0, mx = 1.0)
		self.speed_pid = PID(kp = 2.0, ki = 0.0, kd = 0.0, mn = car_params.decel_limit,
							 mx = car_params.accel_limit)

		self.yaw_control = YawController(car_params.wheel_base, car_params.steer_ratio, 4. * ONE_MPH, car_params.max_lat_accel, car_params.max_steer_angle)
		
		self.prev_velocity = 0