def vehicle_info_updated(self, vehicle_info):
        """
        Stores the ackermann drive message for the next controller calculation

        :param ros_ackermann_drive: the current ackermann control input
        :type ros_ackermann_drive: ackermann_msgs.AckermannDrive
        :return:
        """
        # set target values
        self.vehicle_info = vehicle_info

        # calculate restrictions
        self.info.restrictions.max_steering_angle = phys.get_vehicle_max_steering_angle(
            self.vehicle_info)
        self.info.restrictions.max_speed = phys.get_vehicle_max_speed(
            self.vehicle_info)
        self.info.restrictions.max_accel = phys.get_vehicle_max_acceleration(
            self.vehicle_info)
        self.info.restrictions.max_decel = phys.get_vehicle_max_deceleration(
            self.vehicle_info)
        self.info.restrictions.min_accel = rospy.get_param(
            '/carla/ackermann_control/min_accel', 1.)
        # clipping the pedal in both directions to the same range using the usual lower
        # border: the max_accel to ensure the the pedal target is in symmetry to zero
        self.info.restrictions.max_pedal = min(
            self.info.restrictions.max_accel, self.info.restrictions.max_decel)
Пример #2
0
    def vehicle_info_updated(self, carMass=None):
        """
        Stores the car info for the next controller calculation
        :return:
        """
        # set target values
        self.vehicle_info = {}

        if carMass is not None:
            self.vehicle_info['mass'] = carMass

        # calculate restrictions
        self.info['restrictions']['max_speed'] = phys.get_vehicle_max_speed(
            self.vehicle_info)
        self.info['restrictions'][
            'max_accel'] = phys.get_vehicle_max_acceleration(self.vehicle_info)
        self.info['restrictions'][
            'max_decel'] = phys.get_vehicle_max_deceleration(self.vehicle_info)
        self.info['restrictions']['min_accel'] = 1.0

        # clipping the pedal in both directions to the same range using the usual lower
        # border: the max_accel to ensure the the pedal target is in symmetry to zero

        self.info['restrictions']['max_pedal'] = min(
            self.info['restrictions']['max_accel'],
            self.info['restrictions']['max_decel'])
 def vehicle_info_updated(self, vehicle_info):
     """
     Function used to store the ackermann drive info messages for the next controller calculation
     :param vehicle_info: current ackermann vehicle control info
     :type vehicle_info: ackermann_msgs.AckermannDrive
     :return:
     """
     # set target values
     self.vehicle_info = vehicle_info
     # calculate restrictions
     self.info.restrictions.max_steering_angle = phys.get_vehicle_max_steering_angle(self.vehicle_info)
     self.info.restrictions.max_speed = phys.get_vehicle_max_speed(self.vehicle_info)
     self.info.restrictions.max_accel = phys.get_vehicle_max_accelaration(self.vehicle_info)
     self.info.restrictions.max_decel = phys.get_vehicle_max_decelaration(self.vehicle_info)
     self.info.restrictions.min_accel = rospy.get_param('/carla/ackermann_control/min_accel', 1.)
     # clipping the pedal in both directions to the same range using the usual lower border.
     # The max acceleration to ensure the pedal target is in symetry to zero.
     self.info.restrictions.max_pedal = min(self.info.restrictions.max_accel, self.info.restrictions.max_decel)