robotpy_ext.common_drivers package

robotpy_ext.common_drivers.distance_sensors module

Removed in version 2027: All sensors that were in this module are supported by wpilib.SharpIR.

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.pressure_sensors module

Removed in version 2027: Use wpilib.AnalogPotentiometer```(..., 250, -25)`, or wire the pressure sensor to a REV Pneumatic Hub.

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

get()[source]

Return the current sonar sensor reading, in the units specified from the constructor

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

get()[source]

Return the current sonar sensor reading, in the units specified from the constructor

verified = True