robotpy_ext.common_drivers package
robotpy_ext.common_drivers.distance_sensors module
- class robotpy_ext.common_drivers.distance_sensors.SharpIR2Y0A02(port)[source]
Sharp GP2Y0A02YK0F is an analog IR sensor capable of measuring distances from 20cm to 150cm. Output distance is measured in centimeters.
Distance is calculated using the following equation derived from the graph provided in the datasheet:
62.28*x ^ -1.092
Warning
FRC Teams: the case on these sensors is conductive and grounded, and should not be mounted on a metallic surface!
- Parameters:
port – Analog port number
- class robotpy_ext.common_drivers.distance_sensors.SharpIR2Y0A21(port)[source]
Sharp GP2Y0A21YK0F is an analog IR sensor capable of measuring distances from 10cm to 80cm. Output distance is measured in centimeters.
Distance is calculated using the following equation derived from the graph provided in the datasheet:
26.449*x ^ -1.226
Warning
FRC Teams: the case on these sensors is conductive and grounded, and should not be mounted on a metallic surface!
- Parameters:
port – Analog port number
- class robotpy_ext.common_drivers.distance_sensors.SharpIR2Y0A41(port)[source]
Sharp GP2Y0A41SK0F is an analog IR sensor capable of measuring distances from 4cm to 40cm. Output distance is measured in centimeters.
Distance is calculated using the following equation derived from the graph provided in the datasheet:
12.84*x ^ -0.9824
Warning
FRC Teams: the case on these sensors is conductive and grounded, and should not be mounted on a metallic surface!
- Parameters:
port – Analog port number
- robotpy_ext.common_drivers.distance_sensors.SharpIRGP2Y0A41SK0F
alias of
SharpIR2Y0A41
robotpy_ext.common_drivers.driver_base module
- class robotpy_ext.common_drivers.driver_base.DriverBase[source]
This should be the base class for all drivers in the cdl, currently all it does is spit out a warning message if the driver has not been verified.
Constructor for DriverBase, all this does is print a message to console if the driver has not been verified yet.
- verified = False
robotpy_ext.common_drivers.units module
- class robotpy_ext.common_drivers.units.Unit(base_unit, base_to_unit, unit_to_base)[source]
Bases:
object
The class for all of the units here
Unit constructor, used as a mechanism to convert between various measurements :type base_unit: :param base_unit: The instance of Unit to base conversions from. If None, then assume it is the ultimate base unit :type base_to_unit: :param base_to_unit: A callable to convert measurements between this unit and the base unit :type unit_to_base: :param unit_to_base: A callable to convert measurements between the base unit and this unit
- robotpy_ext.common_drivers.units.convert(source_unit, target_unit, value)[source]
Convert between units, returns value in target_unit :type source_unit: :param source_unit: The unit of value :type target_unit: :param target_unit: The desired output unit :type value: :param value: The value, in source_unit, to convert
robotpy_ext.common_drivers.xl_max_sonar_ez module
These are a set of drivers for the XL-MaxSonar EZ series of sonar modules. The devices have a few different ways of reading from them, and the these drivers attempt to cover some of the methods
- class robotpy_ext.common_drivers.xl_max_sonar_ez.MaxSonarEZAnalog(channel, output_units=<robotpy_ext.common_drivers.units.Unit object>)[source]
Bases:
DriverBase
This is a driver for the MaxSonar EZ series of sonar sensors, using the analog output of the sensor.
To use this driver, pin 3 on the sensor must be mapped to an analog pin, and the sensor must be on a 5v supply.
Sonar sensor constructor
- Parameters:
channel – The analog input index which is wired to the analog output pin (pin 3) on the sensor.
output_units – The Unit instance specifying the format of value to return
- verified = False
- class robotpy_ext.common_drivers.xl_max_sonar_ez.MaxSonarEZPulseWidth(channel, output_units=<robotpy_ext.common_drivers.units.Unit object>)[source]
Bases:
DriverBase
This is a driver for the MaxSonar EZ series of sonar sensors, using the pulse-width output of the sensor.
To use this driver, pin 2 on the sensor must be mapped to a dio pin.
Sonar sensor constructor
- Parameters:
channel – The digital input index which is wired to the pulse-width output pin (pin 2) on the sensor.
output_units – The Unit instance specifying the format of value to return
- verified = True