def planning_inflation_factor(self, planning_inflation_factor): """Set the factor by which to inflate the robot's radius for planning. :param float planning_inflation_factor: The inflation factor for planning. :raise: fetchcore.exceptions.ValidationError: Thrown if planning_inflation_factor is: - not a finite non-negative number. - None while the planning footprint type is 'radius'. """ if planning_inflation_factor is None: if self.planning_footprint_type == FootprintTypes.RADIUS: raise ValidationError( "Planning robot radius cannot be set to None if planning footprint type is %s." % FootprintTypes.RADIUS) self._set('planning_inflation_factor', planning_inflation_factor) elif Number.is_real_number(planning_inflation_factor): if not Number.is_finite_non_negative(planning_inflation_factor): raise ValidationError( "Planning inflation factor must be a finite positive number (was given as %s)." % planning_inflation_factor) self._set('planning_inflation_factor', planning_inflation_factor) else: raise ValidationError( "Planning inflation factor must be a real number (was given as %s)." % planning_inflation_factor)
def planning_robot_radius(self, planning_robot_radius): """Set the robot's estimated radius for planning. :param float planning_robot_radius: The robot radius for planning. :raise: fetchcore.exceptions.ValidationError: Thrown if planning_robot_radius is: - not a finite non-negative number. - None while the planning footprint type is 'radius'. """ if planning_robot_radius is None: if self.planning_footprint_type == FootprintTypes.RADIUS: raise ValidationError( "Planning robot radius cannot be set to None if planning footprint type is %s." % FootprintTypes.RADIUS) self._set('planning_robot_radius', planning_robot_radius) elif Number.is_real_number(planning_robot_radius): if not Number.is_finite_non_negative(planning_robot_radius): raise ValidationError( "Planning robot radius must be a finite non-negative number (was given as %s)." % planning_robot_radius) self._set('planning_robot_radius', planning_robot_radius) else: raise ValidationError( "Planning Robot radius must be a real number (was given as %s)." % planning_robot_radius)
def max_velocity(self, velocity): """Sets the max velocity that robot should go during data survey :param velocity: (float) The max velocity :raises ValidationError if velocity is not a number :raises ValidationError if velocity is not a non-negative finite number """ if velocity and not Number.is_real_number(velocity): raise ValidationError("Max velocity must be a number (value is %s)" % velocity) elif velocity and not Number.is_finite_non_negative(velocity): raise ValidationError("Max velocity must be a finite non-negative number " "(value is %s)" % velocity) else: self.set_input("max_velocity", velocity)
def resolution(self, resolution): """Set the resolution of the map in meters/pixel. :param float resolution: The map resolution. :raise fetchcore.exceptions.ValidationError: Thrown if resolution is not a finite non-negative number. """ if Number.is_real_number(resolution): if not Number.is_finite_non_negative(resolution): raise exceptions.ValidationError( "Resolution must be a finite non-negative number (resolution is %s)" % resolution) self._set("resolution", resolution) else: raise exceptions.ValidationError( "Resolution must be a number (resolution is %s)" % resolution)
def repeat(self, value): """Sets the number of times the sound should be repeated :param value: (integer) The number of times the sound should be repeated :raises ValidationError if repeat is not a number """ if value and Number.is_integer(value): if not Number.is_finite_non_negative(value): raise ValidationError( "Repeat must be a finite positive number (value is %s)" % value) self.set_input("repeat", value) elif value: raise ValidationError("Repeat must be a number (value is %s)" % value) self.set_input("repeat", value)
def value(self, value): """Sets the scaled value in the range [0, 1] associated with the area :param value: A number in between 0 and 1 :raises ValidationError if value is not a number or none :raises ValidationError if value is not greater than or equal to zero and less than or equal to one """ if Number.is_real_number(value) or value is None: if not Number.is_finite_non_negative(value) and value is not None: raise ValidationError( "Value must be in between 0 and 1 (value is %s)" % value) if value > 1.0 and value is not None: raise ValidationError( "Value must be in between 0 and 1 (value is %s)" % value) self._set("value", value) else: raise ValidationError("Value must be a number (value is %s" % value)
def volume(self, volume): """Sets the volume that sound should be played at :param volume: (float) The volume :raises ValidationError if volume is not a number :raises ValidationError if volume is not a non-negative finite number """ if volume and not Number.is_real_number(volume): raise ValidationError("Volume must be a number (value is %s)" % volume) elif volume and not Number.is_finite_non_negative(volume): raise ValidationError( "Volume must be a finite non-negative number " "(value is %s)" % volume) elif not 0 <= volume <= 1: raise ValidationError( "Volume must be between 0 and 1 (value is %s)" % volume) else: self.set_input("volume", volume)
def laser_clearing_robot_radius(self, laser_clearing_robot_radius): """Set the robot's estimated radius for laser_clearing. :param float laser_clearing_robot_radius: The robot radius for laser_clearing. :raise: fetchcore.exceptions.ValidationError: Thrown if laser_clearing_robot_radius is: - not a finite non-negative number. """ if laser_clearing_robot_radius is None: self._set('laser_clearing_robot_radius', laser_clearing_robot_radius) elif Number.is_real_number(laser_clearing_robot_radius): if not Number.is_finite_non_negative(laser_clearing_robot_radius): raise ValidationError( "Robot radius must be a finite non-negative number (was given as %s)." % laser_clearing_robot_radius) self._set('laser_clearing_robot_radius', laser_clearing_robot_radius) else: raise ValidationError( "Laser clearing robot radius must be a real number (was given as %s)." % laser_clearing_robot_radius)
def laser_clearing_inflation_factor(self, laser_clearing_inflation_factor): """Set the factor by which to inflate the robot's radius for laser_clearing. :param float laser_clearing_inflation_factor: The inflation factor for laser_clearing. :raise: fetchcore.exceptions.ValidationError: Thrown if laser_clearing_inflation_factor is: - not a finite non-negative number. """ if laser_clearing_inflation_factor is None: self._set('laser_clearing_inflation_factor', laser_clearing_inflation_factor) elif Number.is_real_number(laser_clearing_inflation_factor): if not Number.is_finite_non_negative( laser_clearing_inflation_factor): raise ValidationError( "Laser clearing inflation factor must be a finite positive number (was given as %s)." % laser_clearing_inflation_factor) self._set('laser_clearing_inflation_factor', laser_clearing_inflation_factor) else: raise ValidationError( "Laser clearing inflation factor must be a real number (was given as %s)." % laser_clearing_inflation_factor)