Sensors
package com.seattlesolvers.solverslib.hardware
Sensors
There are a few sensors that are offered in SolversLib:
The SensorColor
class is just an extension for the ColorSensor
class that is in the SDK.
SensorDistance
and SensorDistanceEx
are interfaces for creating custom distance sensors if desired. An implementation of the SensorDistanceEx
interface is SensorRevTOFDistance
which utilizes the time-of-flight mechanic to track distance.
Gyro Extensions
The GyroEx
class is an extended gyro that allows users to add more configurable methods and possible control to their gyro. An example would be creating a ModernRoboticsGyro
class. The abstract class has the following methods:
init()
: initializes the gyro and sets the current direction to the 0 headinggetHeading()
: returns the heading of the robot compared to the last resetgetAbsoluteHeading()
: returns the absolute heading relative to the initial directiongetAngles()
: returns the x, y, and z orientation of the gyro. This is functionally the same as yaw, pitch, and roll.getRotation2d()
: transforms the heading into aRotation2d
objectreset()
: applies an offset so thatgetHeading()
returns the 0 position
A useful implementation of this is the RevIMU class for the built-in imu on your REV hub.
Last updated