def output_percent_run_until_stalled(self, speed, stop_type=Stop.COAST, duty_limit=100, depth=None): """Keep the motor or linked gears running at a constant speed (percentage) until it stalls :param speed: Speed of the Motor or Gear (percentage) :type speed: int, float :param stop_type: Whether to coast, brake, or hold after coming to a standstill, defaults to Stop.COAST :type stop_type: Stop, optional :param duty_limit: Relative torque limit, defaults to 100 :type duty_limit: int, optional :param depth: Depth of the gear in the link to set the speed for, defaults to None :type depth: int, optional """ if depth is None: self.percent_run_until_stalled(speed, stop_type=stop_type, duty_limit=duty_limit) super(MotorExt, self).run_until_stalled(speed_deg(speed, rpm=self.rpm) * get_ratio(self.gears, depth=depth), stop_type=stop_type, duty_limit=duty_limit)
def output_percent_run_target(self, speed, target_angle, stop_type=Stop.COAST, wait=True, depth=None): """Keep the motor or linked gears running at a constant speed (percentage) towards a speicified target degree :param speed: Speed of the Motor or Gear (percentage) :type speed: int, float :param target_angle: Target angle that the Motor should rotate to, regardless of its current angle :type target_angle: int :param stop_type: Whether to coast, brake, or hold after coming to a standstill, defaults to Stop.COAST :type stop_type: Stop, optional :param wait: Whether to wait for the maneuver to complete before continuing with the rest of the program, defaults to True :type wait: bool, optional :param depth: Depth of the gear in the link to set the speed for, defaults to None :type depth: int, optional """ if depth is None: self.percent_run_target(speed, target_angle, stop_type=stop_type, wait=wait) ratio = get_ratio(self.gears, depth=depth) super(MotorExt, self).run_target(speed_deg(speed, rpm=self.rpm) / ratio, target_angle / ratio, stop_type=stop_type, wait=wait)
def output_run_angle(self, speed, rotation_angle, stop_type=Stop.COAST, wait=True, depth=None): """Keep the motor or linked gears running at a constant speed for a speicified amount of degrees :param speed: Speed of the Motor or Gear :type speed: int, float :param rotation_angle: Angle (degrees) by which the Motor should run :type rotation_angle: int :param stop_type: Whether to coast, brake, or hold after coming to a standstill, defaults to Stop.COAST :type stop_type: Stop, optional :param wait: Whether to wait for the maneuver to complete before continuing with the rest of the program, defaults to True :type wait: bool, optional :param depth: Depth of the gear in the link to set the speed for, defaults to None :type depth: int, optional """ if depth is None: super(MotorExt, self).run_angle(speed, rotation_angle, stop_type=stop_type, wait=wait) ratio = get_ratio(self.gears, depth=depth) super(MotorExt, self).run_angle(speed / ratio, rotation_angle / ratio, stop_type=stop_type, wait=wait)
def output_percent_run_time(self, speed, time, stop_type=Stop.COAST, wait=True, depth=None): """Keep the motor or linked gears running at a constant speed (percentage) for a specified amount of time :param speed: Speed of the Motor or Gear (percentage) :type speed: int, float :param time: Duration (milliseconds) of the maneuver :type time: int :param stop_type: Whether to coast, brake or hold after coming to a standstill, defaults to Stop.COAST :type stop_type: Stop, optional :param wait: Whether to wait for the maneuver to complete before continuing with the rest of the program, defaults to True :type wait: bool, optional :param depth: Depth of the gear in the link to set the speed for, defaults to None :type depth: int, optional """ if depth is None: self.percent_run_time(speed, time, stop_type=stop_type, wait=wait) super(MotorExt, self).run_time(speed_deg(speed, rpm=self.rpm) / get_ratio(self.gears, depth=depth), time, stop_type=stop_type, wait=wait)
def output_speed(self, depth=None): """ Gets the speed (angular velocity) of the motor or its linked gears :param depth: Depth of the gear in the link to get the angle for, defaults to None :type depth: int, optional :return: Rotational speed in deg/s :rtype: int, float """ return super(MotorExt, self).speed() * get_ratio(self.gears, depth=depth)
def output_run(self, speed, depth=None): """ Keep the motor or linked gears running at a constant speed (angular velocity) :param speed: Speed of the Motor or Gear :type speed: int, float :param depth: Depth of the gear in the link to set the speed for, defaults to None :type depth: int, optional """ if depth is None: super(MotorExt, self).run(speed) super(MotorExt, self).run(speed / get_ratio(self.gears, depth=depth))
def output_angle(self, depth=None): """ Get the rotation angle of the motor or its linked gears :param depth: Depth of the gear in the link to get the angle for, defaults to None :type depth: int, optional :return: Motor angle :rttype: int, float """ return super(MotorExt, self).angle() * get_ratio(self.gears, depth=depth)