spikedev.unit¶
-
class
spikedev.unit.
DistanceValue
¶ Bases:
object
A base class for
Distance
classes. Do not use this directly. Use one of:
-
class
spikedev.unit.
DistanceMillimeters
(millimeters)¶ Bases:
spikedev.unit.DistanceValue
Distance in millimeters
- Parameters
millimeters (int) – the number of millimeters
Example:
import hub from spikedev.motor import MoveDifferential, MotorSpeedDPS from spikedev.unit import DistanceMillimeters, DistanceStuds from spikedev.wheel import SpikeWheel md = MoveDifferential(hub.port.E, hub.port.F, SpikeWheel, DistanceStuds(11)) # drive forward 600 millimeters md.run_for_distance(DistanceMillimeters(600), MotorSpeedDPS(100))
-
property
mm
¶ Returns: int: our distance in millimeters
-
class
spikedev.unit.
DistanceCentimeters
(centimeters)¶ Bases:
spikedev.unit.DistanceValue
Distance in centimeters
- Parameters
centimeters (int) – the number of centimeters
Example:
import hub from spikedev.motor import MoveDifferential, MotorSpeedDPS from spikedev.unit import DistanceCentimeters, DistanceStuds from spikedev.wheel import SpikeWheel md = MoveDifferential(hub.port.E, hub.port.F, SpikeWheel, DistanceStuds(11)) # drive forward 60 centimeters md.run_for_distance(DistanceCentimeters(60), MotorSpeedDPS(100))
-
property
mm
¶ Returns: int: our distance in millimeters
-
class
spikedev.unit.
DistanceDecimeters
(decimeters)¶ Bases:
spikedev.unit.DistanceValue
Distance in decimeters
- Parameters
decimeters (int) – the number of decimeters
Example:
import hub from spikedev.motor import MoveDifferential, MotorSpeedDPS from spikedev.unit import DistanceDecimeters, DistanceStuds from spikedev.wheel import SpikeWheel md = MoveDifferential(hub.port.E, hub.port.F, SpikeWheel, DistanceStuds(11)) # drive forward 6 decimeters md.run_for_distance(DistanceDecimeters(6), MotorSpeedDPS(100))
-
property
mm
¶ Returns: int: our distance in millimeters
-
class
spikedev.unit.
DistanceMeters
(meters)¶ Bases:
spikedev.unit.DistanceValue
Distance in meters
- Parameters
meters (int) – the number of meters
Example:
import hub from spikedev.motor import MoveDifferential, MotorSpeedDPS from spikedev.unit import DistanceMeters, DistanceStuds from spikedev.wheel import SpikeWheel md = MoveDifferential(hub.port.E, hub.port.F, SpikeWheel, DistanceStuds(11)) # drive forward 2 meters md.run_for_distance(DistanceMeters(2), MotorSpeedDPS(100))
-
property
mm
¶ Returns: int: our distance in millimeters
-
class
spikedev.unit.
DistanceInches
(inches)¶ Bases:
spikedev.unit.DistanceValue
Distance in inches
- Parameters
inches (int) – the number of inches
Example:
import hub from spikedev.motor import MoveDifferential, MotorSpeedDPS from spikedev.unit import DistanceInches, DistanceStuds from spikedev.wheel import SpikeWheel md = MoveDifferential(hub.port.E, hub.port.F, SpikeWheel, DistanceStuds(11)) # drive forward 6 inches md.run_for_distance(DistanceInches(6), MotorSpeedDPS(100))
-
property
mm
¶ Returns: int: our distance in millimeters
-
class
spikedev.unit.
DistanceFeet
(feet)¶ Bases:
spikedev.unit.DistanceValue
Distance in feet
- Parameters
feet (int) – the number of feet
Example:
import hub from spikedev.motor import MoveDifferential, MotorSpeedDPS from spikedev.unit import DistanceFeet, DistanceStuds from spikedev.wheel import SpikeWheel md = MoveDifferential(hub.port.E, hub.port.F, SpikeWheel, DistanceStuds(11)) # drive forward 3 feet md.run_for_distance(DistanceFeet(3), MotorSpeedDPS(100))
-
property
mm
¶ Returns: int: our distance in millimeters
-
class
spikedev.unit.
DistanceYards
(yards)¶ Bases:
spikedev.unit.DistanceValue
Distance in yards
- Parameters
yards (int) – the number of yards
Example:
import hub from spikedev.motor import MoveDifferential, MotorSpeedDPS from spikedev.unit import DistanceYards, DistanceStuds from spikedev.wheel import SpikeWheel md = MoveDifferential(hub.port.E, hub.port.F, SpikeWheel, DistanceStuds(11)) # drive forward 2 yards md.run_for_distance(DistanceYards(2), MotorSpeedDPS(100))
-
property
mm
¶ Returns: int: our distance in millimeters
-
class
spikedev.unit.
DistanceStuds
(studs)¶ Bases:
spikedev.unit.DistanceValue
Distance in studs
- Parameters
studs (int) – the number of LEGO studs
Example:
import hub from spikedev.motor import MoveDifferential, MotorSpeedDPS from spikedev.unit import DistanceStuds from spikedev.wheel import SpikeWheel md = MoveDifferential(hub.port.E, hub.port.F, SpikeWheel, DistanceStuds(11)) # drive forward 2 studs md.run_for_distance(DistanceStuds(6), MotorSpeedDPS(100))
-
property
mm
¶ Returns: int: our distance in millimeters
-
spikedev.unit.
distance_in_mm
(distance)¶ - Parameters
distance (DistanceValue, int) – the distance to convert to millimeters
- Returns
distance
converted to millimeters- Return type
int
Example:
from spikedev.unit import DistanceFeet two_feet_in_mm = distance_in_mm(DistanceFeet(2))