Manual calibration of the IMU is definitely NOT necessary: except for the magnetometer + * (which is not used by the default {@link BNO055IMU.SensorMode#IMU + * SensorMode#IMU}), the BNO055 is internally self-calibrating and thus can be very successfully + * used without manual intervention. That said, performing a one-time calibration, saving the + * results persistently, then loading them again at each run can help reduce the time that automatic + * calibration requires.
+ * + *This summary of the calibration process, from + * Intel, is informative:
+ * + *"This device requires calibration in order to operate accurately. [...] Calibration data is + * lost on a power cycle. See one of the examples for a description of how to calibrate the device, + * but in essence:
+ * + *There is a calibration status register available [...] that returns the calibration status + * of the accelerometer (ACC), magnetometer (MAG), gyroscope (GYR), and overall system (SYS). + * Each of these values range from 0 (uncalibrated) to 3 (fully calibrated). Calibration [ideally] + * involves certain motions to get all 4 values at 3. The motions are as follows (though see the + * datasheet for more information):
+ * + *To calibrate the IMU, run this sample opmode with a gamepad attached to the driver station. + * Once the IMU has reached sufficient calibration as reported on telemetry, press the 'A' + * button on the gamepad to write the calibration to a file. That file can then be indicated + * later when running an opmode which uses the IMU.
+ * + *Note: if your intended uses of the IMU do not include use of all its sensors (for exmaple, + * you might not use the magnetometer), then it makes little sense for you to wait for full + * calibration of the sensors you are not using before saving the calibration data. Indeed, + * it appears that in a SensorMode that doesn't use the magnetometer (for example), the + * magnetometer cannot actually be calibrated.
+ * + * @see AdafruitBNO055IMU + * @see BNO055IMU.Parameters#calibrationDataFile + * @see BNO055 product page + * @see BNO055 specification + */ +@TeleOp(name = "Sensor: BNO055 IMU Calibration", group = "Sensor") +@Disabled // Uncomment this to add to the opmode list +public class SensorBNO055IMUCalibration extends LinearOpMode + { + //---------------------------------------------------------------------------------------------- + // State + //---------------------------------------------------------------------------------------------- + + // Our sensors, motors, and other devices go here, along with other long term state + BNO055IMU imu; + + // State used for updating telemetry + Orientation angles; + + //---------------------------------------------------------------------------------------------- + // Main logic + //---------------------------------------------------------------------------------------------- + + @Override public void runOpMode() { + + telemetry.log().setCapacity(12); + telemetry.log().add(""); + telemetry.log().add("Please refer to the calibration instructions"); + telemetry.log().add("contained in the Adafruit IMU calibration"); + telemetry.log().add("sample opmode."); + telemetry.log().add(""); + telemetry.log().add("When sufficient calibration has been reached,"); + telemetry.log().add("press the 'A' button to write the current"); + telemetry.log().add("calibration data to a file."); + telemetry.log().add(""); + + // We are expecting the IMU to be attached to an I2C port on a Core Device Interface Module and named "imu". + BNO055IMU.Parameters parameters = new BNO055IMU.Parameters(); + parameters.loggingEnabled = true; + parameters.loggingTag = "IMU"; + imu = hardwareMap.get(BNO055IMU.class, "imu"); + imu.initialize(parameters); + + composeTelemetry(); + telemetry.log().add("Waiting for start..."); + + // Wait until we're told to go + while (!isStarted()) { + telemetry.update(); + idle(); + } + + telemetry.log().add("...started..."); + + while (opModeIsActive()) { + + if (gamepad1.a) { + + // Get the calibration data + BNO055IMU.CalibrationData calibrationData = imu.readCalibrationData(); + + // Save the calibration data to a file. You can choose whatever file + // name you wish here, but you'll want to indicate the same file name + // when you initialize the IMU in an opmode in which it is used. If you + // have more than one IMU on your robot, you'll of course want to use + // different configuration file names for each. + String filename = "AdafruitIMUCalibration.json"; + File file = AppUtil.getInstance().getSettingsFile(filename); + ReadWriteFile.writeFile(file, calibrationData.serialize()); + telemetry.log().add("saved to '%s'", filename); + + // Wait for the button to be released + while (gamepad1.a) { + telemetry.update(); + idle(); + } + } + + telemetry.update(); + } + } + + void composeTelemetry() { + + // At the beginning of each telemetry update, grab a bunch of data + // from the IMU that we will then display in separate lines. + telemetry.addAction(new Runnable() { @Override public void run() + { + // Acquiring the angles is relatively expensive; we don't want + // to do that in each of the three items that need that info, as that's + // three times the necessary expense. + angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES); + } + }); + + telemetry.addLine() + .addData("status", new Funcgit clone --depth=1 https://github.com/ftctechnh/ftc_app.git
+ +* Or, if you prefer, you can use the "Download Zip" button available through the main repository page. Downloading the project as a .ZIP file will keep the size of the download manageable. + +* You can also download the project folder (as a .zip or .tar.gz archive file) from the Downloads subsection of the Releases page for this repository. + +Once you have downloaded and uncompressed (if needed) your folder, you can use Android Studio to import the folder ("Import project (Eclipse ADT, Gradle, etc.)"). + +## Getting Help +### User Documentation and Tutorials +*FIRST* maintains an online wiki with information and tutorials on how to use the *FIRST* Tech Challenge software and robot control system. You can access the wiki at the following address: + + https://github.com/ftctechnh/ftc_app/wiki + +### Javadoc Reference Material +The Javadoc reference documentation for the FTC SDK is now available online. Visit the following URL to view the FTC SDK documentation as a live website: + + http://ftctechnh.github.io/ftc_app/doc/javadoc/index.html + +Documentation for the FTC SDK is also included with this repository. There is a subfolder called "doc" which contains several subfolders: + + * The folder "apk" contains the .apk files for the FTC Driver Station and FTC Robot Controller apps. + * The folder "javadoc" contains the JavaDoc user documentation for the FTC SDK. + +### Online User Forum +For technical questions regarding the SDK, please visit the FTC Technology forum: + + http://ftcforum.usfirst.org/forumdisplay.php?156-FTC-Technology + +************************************************************************************** +# Release Information +************************************************************************************** + +Version 5.0 (built on 19.06.14) + + * Support for the REV Robotics Control Hub. + * Adds a Java preview pane to the Blocks editor. + * Adds a new offline export feature to the Blocks editor. + * Display wifi channel in Network circle on Driver Station. + * Adds calibration for Logitech C270 + * Updates build tooling and target SDK. + * Compliance with Google's permissions infrastructure (Required after build tooling update). + * Keep Alives to mitigate the Motorola wifi scanning problem. Telemetry substitute no longer necessary. + * Improves Vuforia error reporting. + * Fixes ftctechnh/ftc_app issues 621, 713. + * Miscellaneous bug fixes and improvements. + +************************************************************************************** +# Release Information +************************************************************************************** + +Version 4.3 (built on 18.10.31) + * Includes missing TensorFlow-related libraries and files. + +************************************************************************************** +# Release Information +************************************************************************************** + +Version 4.2 (built on 18.10.30) + * Includes fix to avoid deadlock situation with WatchdogMonitor which could result in USB communication errors. + - Comm error appeared to require that user disconnect USB cable and restart the Robot Controller app to recover. + - robotControllerLog.txt would have error messages that included the words "E RobotCore: lynx xmit lock: #### abandoning lock:" + * Includes fix to correctly list the parent module address for a REV Robotics Expansion Hub in a configuration (.xml) file. + - Bug in versions 4.0 and 4.1 would incorrect list the address module for a parent REV Robotics device as "1". + - If the parent module had a higher address value than the daisy-chained module, then this bug would prevent the Robot Controller from communicating with the downstream Expansion Hub. + * Added requirement for ACCESS_COARSE_LOCATION to allow a Driver Station running Android Oreo to scan for Wi-Fi Direct devices. + * Added google() repo to build.gradle because aapt2 must be downloaded from the google() repository beginning with version 3.2 of the Android Gradle Plugin. + - Important Note: Android Studio users will need to be connected to the Internet the first time build the ftc_app project. + - Internet connectivity is required for the first build so the appropriate files can be downloaded from the Google repository. + - Users should not need to be connected to the Internet for subsequent builds. + - This should also fix buid issue where Android Studio would complain that it "Could not find com.android.tools.lint:lint-gradle:26.1.4" (or similar). + * Added support for REV Spark Mini motor controller as part of the configuration menu for a servo/PWM port on the REV Expansion Hub. + * Provide examples for playing audio files in an Op Mode. + * Block Development Tool Changes + - Includes a fix for a problem with the Velocity blocks that were reported in the FTC Technology forum (Blocks Programming subforum). + - Change the "Save completed successfully." message to a white color so it will contrast with a green background. + - Fixed the "Download image" feature so it will work if there are text blocks in the op mode. + * Introduce support for Google's TensorFlow Lite technology for object detetion for 2018-2019 game. + - TensorFlow lite can recognize Gold Mineral and Silver Mineral from 2018-2019 game. + - Example Java and Block op modes are included to show how to determine the relative position of the gold block (left, center, right). + +************************************************************************************** +# Release Information +************************************************************************************** + +Version 4.1 (released on 18.09.24) + +Changes include: + * Fix to prevent crash when deprecated configuration annotations are used. + * Change to allow FTC Robot Controller APK to be auto-updated using FIRST Global Control Hub update scripts. + * Removed samples for non supported / non legal hardware. + * Improvements to Telemetry.addData block with "text" socket. + * Updated Blocks sample op mode list to include Rover Ruckus Vuforia example. + * Update SDK library version number. + +************************************************************************************** +# Release Information +************************************************************************************** + +Version 4.0 (released on 18.09.12) + +Changes include: + * Initial support for UVC compatible cameras + - If UVC camera has a unique serial number, RC will detect and enumerate by serial number. + - If UVC camera lacks a unique serial number, RC will only support one camera of that type connected. + - Calibration settings for a few cameras are included (see TeamCode/src/main/res/xml/teamwebcamcalibrations.xml for details). + - User can upload calibration files from Program and Manage web interface. + - UVC cameras seem to draw a fair amount of electrical current from the USB bus. + + This does not appear to present any problems for the REV Robotics Control Hub. + + This does seem to create stability problems when using some cameras with an Android phone-based Robot Controller. + + FTC Tech Team is investigating options to mitigate this issue with the phone-based Robot Controllers. + - Updated sample Vuforia Navigation and VuMark Op Modes to demonstrate how to use an internal phone-based camera and an external UVC webcam. + + * Support for improved motor control. + - REV Robotics Expansion Hub firmware 1.8 and greater will support a feed forward mechanism for closed loop motor control. + - FTC SDK has been modified to support PIDF coefficients (proportional, integral, derivative, and feed forward). + - FTC Blocks development tool modified to include PIDF programming blocks. + - Deprecated older PID-related methods and variables. + - REV's 1.8.x PIDF-related changes provide a more linear and accurate way to control a motor. + + * Wireless + - Added 5GHz support for wireless channel changing for those devices that support it. + + Tested with Moto G5 and E4 phones. + + Also tested with other (currently non-approved) phones such as Samsung Galaxy S8. + +* Improved Expansion Hub firmware update support in Robot Controller app + - Changes to make the system more robust during the firmware update process (when performed through Robot Controller app). + - User no longer has to disconnect a downstream daisy-chained Expansion Hub when updating an Expansion Hub's firmware. + + If user is updating an Expansion Hub's firmware through a USB connection, he/she does not have to disconnect RS485 connection to other Expansion Hubs. + + The user still must use a USB connection to update an Expansion Hub's firmware. + + The user cannot update the Expansion Hub firmware for a downstream device that is daisy chained through an RS485 connection. + - If an Expansion Hub accidentally gets "bricked" the Robot Controller app is now more likely to recognize the Hub when it scans the USB bus. + + Robot Controller app should be able to detect an Expansion Hub, even if it accidentally was bricked in a previous update attempt. + + Robot Controller app should be able to install the firmware onto the Hub, even if if accidentally was bricked in a previous update attempt. + + * Resiliency + - FTC software can detect and enable an FTDI reset feature that is available with REV Robotics v1.8 Expansion Hub firmware and greater. + + When enabled, the Expansion Hub can detect if it hasn't communicated with the Robot Controller over the FTDI (USB) connection. + + If the Hub hasn't heard from the Robot Controller in a while, it will reset the FTDI connection. + + This action helps system recover from some ESD-induced disruptions. + - Various fixes to improve reliability of FTC software. + + * Blocks + - Fixed errors with string and list indices in blocks export to java. + - Support for USB connected UVC webcams. + - Refactored optimized Blocks Vuforia code to support Rover Ruckus image targets. + - Added programming blocks to support PIDF (proportional, integral, derivative and feed forward) motor control. + - Added formatting options (under Telemetry and Miscellaneous categories) so user can set how many decimal places to display a numerical value. + - Support to play audio files (which are uploaded through Blocks web interface) on Driver Station in addition to the Robot Controller. + - Fixed bug with Download Image of Blocks feature. + - Support for REV Robotics Blinkin LED Controller. + - Support for REV Robotics 2m Distance Sensor. + - Added support for a REV Touch Sensor (no longer have to configure as a generic digital device). + - Added blocks for DcMotorEx methods. + + These are enhanced methods that you can use when supported by the motor controller hardware. + + The REV Robotics Expansion Hub supports these enhanced methods. + + Enhanced methods include methods to get/set motor velocity (in encoder pulses per second), get/set PIDF coefficients, etc.. + + * Modest Improvements in Logging + - Decrease frequency of battery checker voltage statements. + - Removed non-FTC related log statements (wherever possible). + - Introduced a "Match Logging" feature. + + Under "Settings" a user can enable/disable this feature (it's disabled by default). + + If enabled, user provides a "Match Number" through the Driver Station user interface (top of the screen). + * The Match Number is used to create a log file specifically with log statements from that particular Op Mode run. + * Match log files are stored in /sdcard/FIRST/matlogs on the Robot Controller. + * Once an op mode run is complete, the Match Number is cleared. + * This is a convenient way to create a separate match log with statements only related to a specific op mode run. + + * New Devices + - Support for REV Robotics Blinkin LED Controller. + - Support for REV Robotics 2m Distance Sensor. + - Added configuration option for REV 20:1 HD Hex Motor. + - Added support for a REV Touch Sensor (no longer have to configure as a generic digital device). + + * Miscellaneous + - Fixed some errors in the definitions for acceleration and velocity in our javadoc documentation. + - Added ability to play audio files on Driver Station + - When user is configuring an Expansion Hub, the LED on the Expansion Hub will change blink pattern (purple-cyan) to indicate which Hub is currently being configured. + - Renamed I2cSensorType to I2cDeviceType. + - Added an external sample Op Mode that demonstrates localization using 2018-2019 (Rover Ruckus presented by QualComm) Vuforia targets. + - Added an external sample Op Mode that demonstrates how to use the REV Robotics 2m Laser Distance Sensor. + - Added an external sample Op Mode that demonstrates how to use the REV Robotics Blinkin LED Controller. + - Re-categorized external Java sample Op Modes to "TeleOp" instead of "Autonomous". + +Known issues: + * Initial support for UVC compatible cameras + - UVC cameras seem to draw significant amount of current from the USB bus. + + This does not appear to present any problems for the REV Robotics Control Hub. + + This does seem to create stability problems when using some cameras with an Android phone-based Robot Controller. + + FTC Tech Team is investigating options to mitigate this issue with the phone-based Robot Controllers. + - There might be a possible deadlock which causes the RC to become unresponsive when using a UVC webcam with a Nougat Android Robot Controller. + + * Wireless + - When user selects a wireless channel, this channel does not necessarily persist if the phone is power cycled. + + Tech Team is hoping to eventually address this issue in a future release. + + Issue has been present since apps were introduced (i.e., it is not new with the v4.0 release). + - Wireless channel is not currently displayed for WiFi Direct connections. + + * Miscellaneous + - The blink indication feature that shows which Expansion Hub is currently being configured does not work for a newly created configuration file. + + User has to first save a newly created configuration file and then close and re-edit the file in order for blink indicator to work. + + +************************************************************************************** +# Release Information +************************************************************************************** + +Version 3.6 (built on 17.12.18) + +Changes include: + * Blocks Changes + - Uses updated Google Blockly software to allow users to edit their op modes on Apple iOS devices (including iPad and iPhone). + - Improvement in Blocks tool to handle corrupt op mode files. + - Autonomous op modes should no longer get switched back to tele-op after re-opening them to be edited. + - The system can now detect type mismatches during runtime and alert the user with a message on the Driver Station. + * Updated javadoc documentation for setPower() method to reflect correct range of values (-1 to +1). + * Modified VuforiaLocalizerImpl to allow for user rendering of frames + - Added a user-overrideable onRenderFrame() method which gets called by the class's renderFrame() method. + +************************************************************************************** +# Release Information +************************************************************************************** + +Version 3.5 (built on 17.10.30) + +Changes with version 3.5 include: + * Introduced a fix to prevent random op mode stops, which can occur after the Robot Controller app has been paused and then resumed (for example, when a user temporarily turns off the display of the Robot Controller phone, and then turns the screen back on). + * Introduced a fix to prevent random op mode stops, which were previously caused by random peer disconnect events on the Driver Station. + * Fixes issue where log files would be closed on pause of the RC or DS, but not re-opened upon resume. + * Fixes issue with battery handler (voltage) start/stop race. + * Fixes issue where Android Studio generated op modes would disappear from available list in certain situations. + * Fixes problem where OnBot Java would not build on REV Robotics Control Hub. + * Fixes problem where OnBot Java would not build if the date and time on the Robot Controller device was "rewound" (set to an earlier date/time). + * Improved error message on OnBot Java that occurs when renaming a file fails. + * Removed unneeded resources from android.jar binaries used by OnBot Java to reduce final size of Robot Controller app. + * Added MR_ANALOG_TOUCH_SENSOR block to Blocks Programming Tool. + +************************************************************************************** +# Release Information +************************************************************************************** + +Version 3.4 (built on 17.09.06) + +Changes with version 3.4 include: + * Added telemetry.update() statement for BlankLinearOpMode template. + * Renamed sample Block op modes to be more consistent with Java samples. + * Added some additional sample Block op modes. + * Reworded OnBot Java readme slightly. + +************************************************************************************** + +Version 3.3 (built on 17.09.04) + +This version of the software includes improves for the FTC Blocks Programming Tool and the OnBot Java Programming Tool. + +Changes with verion 3.3 include: + * Android Studio ftc_app project has been updated to use Gradle Plugin 2.3.3. + * Android Studio ftc_app project is already using gradle 3.5 distribution. + * Robot Controller log has been renamed to /sdcard/RobotControllerLog.txt (note that this change was actually introduced w/ v3.2). + * Improvements in I2C reliability. + * Optimized I2C read for REV Expansion Hub, with v1.7 firmware or greater. + * Updated all external/samples (available through OnBot and in Android project folder). + * Vuforia + - Added support for VuMarks that will be used for the 2017-2018 season game. + * Blocks + - Update to latest Google Blockly release. + - Sample op modes can be selected as a template when creating new op mode. + - Fixed bug where the blocks would disappear temporarily when mouse button is held down. + - Added blocks for Range.clip and Range.scale. + - User can now disable/enable Block op modes. + - Fix to prevent occasional Blocks deadlock. + * OnBot Java + - Significant improvements with autocomplete function for OnBot Java editor. + - Sample op modes can be selected as a template when creating new op mode. + - Fixes and changes to complete hardware setup feature. + - Updated (and more useful) onBot welcome message. + +Known issues: + * Android Studio + - After updating to the new v3.3 Android Studio project folder, if you get error messages indicating "InvalidVirtualFileAccessException" then you might need to do a File->Invalidate Caches / Restart to clear the error. + * OnBot Java + - Sometimes when you push the build button to build all op modes, the RC returns an error message that the build failed. If you press the build button a second time, the build typically suceeds. + +************************************************************************************** + +Version 3.2 (built on 17.08.02) + +This version of the software introduces the "OnBot Java" Development Tool. Similar to the FTC Blocks Development Tool, the FTC OnBot Java Development Tool allows a user to create, edit and build op modes dynamically using only a Javascript-enabled web browser. + +The OnBot Java Development Tool is an integrated development environment (IDE) that is served up by the Robot Controller. Op modes are created and edited using a Javascript-enabled browser (Google Chromse is recommended). Op modes are saved on the Robot Controller Android device directly. + +The OnBot Java Development Tool provides a Java programming environment that does NOT need Android Studio. + + + +Changes with version 3.2 include: + * Enhanced web-based development tools + - Introduction of OnBot Java Development Tool. + - Web-based programming and management features are "always on" (user no longer needs to put Robot Controller into programming mode). + - Web-based management interface (where user can change Robot Controller name and also easily download Robot Controller log file). + - OnBot Java, Blocks and Management features available from web based interface. + +* Blocks Programming Development Tool: + - Changed "LynxI2cColorRangeSensor" block to "REV Color/range sensor" block. + - Fixed tooltip for ColorSensor.isLightOn block. + Added blocks for ColorSensor.getNormalizedColors and LynxI2cColorRangeSensor.getNormalizedColors. + +* Added example op modes for digital touch sensor and REV Robotics Color Distance sensor. +* User selectable color themes. +* Includes many minor enhancements and fixes (too numerous to list). + +Known issues: +* Auto complete function is incomplete and does not support the following (for now): + - Access via *this* keyword + - Access via *super* keyword + - Members of the super cloass, not overridden by the class + - Any methods provided in the current class + - Inner classes + - Can't handle casted objects + - Any objects coming from an parenthetically enclosed expression + +************************************************************************************** + +Version 3.10 (built on 17.05.09) + +This version of the software provides support for the REV Robotics Expansion Hub. This version also includes improvements in the USB communication layer in an effort to enhance system resiliency. If you were using a 2.x version of the software previously, updating to version 3.1 requires that you also update your Driver Station software in addition to updating the Robot Controller software. + +Also note that in version 3.10 software, the setMaxSpeed and getMaxSpeed methods are no longer available (not deprecated, they have been removed from the SDK). Also note that the the new 3.x software incorporates motor profiles that a user can select as he/she configures the robot. + +Changes include: + * Blocks changes + - Added VuforiaTrackableDefaultListener.getPose and Vuforia.trackPose blocks. + - Added optimized blocks support for Vuforia extended tracking. + - Added atan2 block to the math category. + - Added useCompetitionFieldTargetLocations parameter to Vuforia.initialize block. If set to false, the target locations are placed at (0,0,0) with target orientation as specified in https://github.com/gearsincorg/FTCVuforiaDemo/blob/master/Robot_Navigation.java tutorial op mode. + * Incorporates additional improvements to USB comm layer to improve system resiliency (to recover from a greater number of communication disruptions). + +************************************************************************************** + +Additional Notes Regarding Version 3.00 (built on 17.04.13) + +In addition to the release changes listed below (see section labeled "Version 3.00 (built on 17.04.013)"), version 3.00 has the following important changes: + +1. Version 3.00 software uses a new version of the FTC Robocol (robot protocol). If you upgrade to v3.0 on the Robot Controller and/or Android Studio side, you must also upgrade the Driver Station software to match the new Robocol. +2. Version 3.00 software removes the setMaxSpeed and getMaxSpeed methods from the DcMotor class. If you have an op mode that formerly used these methods, you will need to remove the references/calls to these methods. Instead, v3.0 provides the max speed information through the use of motor profiles that are selected by the user during robot configuration. +3. Version 3.00 software currently does not have a mechanism to disable extra i2c sensors. We hope to re-introduce this function with a release in the near future. + +************************************************************************************** + +Version 3.00 (built on 17.04.13) + +*** Use this version of the software at YOUR OWN RISK!!! *** + +This software is being released as an "alpha" version. Use this version at your own risk! + +This pre-release software contains SIGNIFICANT changes, including changes to the Wi-Fi Direct pairing mechanism, rewrites of the I2C sensor classes, changes to the USB/FTDI layer, and the introduction of support for the REV Robotics Expansion Hub and the REV Robotics color-range-light sensor. These changes were implemented to improve the reliability and resiliency of the FTC control system. + +Please note, however, that version 3.00 is considered "alpha" code. This code is being released so that the FIRST community will have an opportunity to test the new REV Expansion Hub electronics module when it becomes available in May. The developers do not recommend using this code for critical applications (i.e., competition use). + +*** Use this version of the software at YOUR OWN RISK!!! *** + +Changes include: + * Major rework of sensor-related infrastructure. Includes rewriting sensor classes to implement synchronous I2C communication. + * Fix to reset Autonomous timer back to 30 seconds. + * Implementation of specific motor profiles for approved 12V motors (includes Tetrix, AndyMark, Matrix and REV models). + * Modest improvements to enhance Wi-Fi P2P pairing. + * Fixes telemetry log addition race. + * Publishes all the sources (not just a select few). + * Includes Block programming improvements + - Addition of optimized Vuforia blocks. + - Auto scrollbar to projects and sounds pages. + - Fixed blocks paste bug. + - Blocks execute after while-opModeIsActive loop (to allow for cleanup before exiting op mode). + - Added gyro integratedZValue block. + - Fixes bug with projects page for Firefox browser. + - Added IsSpeaking block to AndroidTextToSpeech. + * Implements support for the REV Robotics Expansion Hub + - Implements support for integral REV IMU (physically installed on I2C bus 0, uses same Bosch BNO055 9 axis absolute orientation sensor as Adafruit 9DOF abs orientation sensor). - Implements support for REV color/range/light sensor. + - Provides support to update Expansion Hub firmware through FTC SDK. + - Detects REV firmware version and records in log file. + - Includes support for REV Control Hub (note that the REV Control Hub is not yet approved for FTC use). + - Implements FTC Blocks programming support for REV Expansion Hub and sensor hardware. + - Detects and alerts when I2C device disconnect. + +************************************************************************************** + +Version 2.62 (built on 17.01.07) + * Added null pointer check before calling modeToByte() in finishModeSwitchIfNecessary method for ModernRoboticsUsbDcMotorController class. + * Changes to enhance Modern Robotics USB protocol robustness. + +************************************************************************************** + +Version 2.61 (released on 16.12.19) + * Blocks Programming mode changes: + - Fix to correct issue when an exception was thrown because an OpticalDistanceSensor object appears twice in the hardware map (the second time as a LightSensor). + +************************************************************************************** + +Version 2.6 (released on 16.12.16) + * Fixes for Gyro class: + - Improve (decrease) sensor refresh latency. + - fix isCalibrating issues. + * Blocks Programming mode changes: + - Blocks now ignores a device in the configuration xml if the name is empty. Other devices work in configuration work fine. + +************************************************************************************** + +Version 2.5 (internal release on released on 16.12.13) + * Blocks Programming mode changes: + - Added blocks support for AdafruitBNO055IMU. + - Added Download Op Mode button to FtcBocks.html. + - Added support for copying blocks in one OpMode and pasting them in an other OpMode. The clipboard content is stored on the phone, so the programming mode server must be running. + - Modified Utilities section of the toolbox. + - In Programming Mode, display information about the active connections. + - Fixed paste location when workspace has been scrolled. + - Added blocks support for the android Accelerometer. + - Fixed issue where Blocks Upload Op Mode truncated name at first dot. + - Added blocks support for Android SoundPool. + - Added type safety to blocks for Acceleration. + - Added type safety to blocks for AdafruitBNO055IMU.Parameters. + - Added type safety to blocks for AnalogInput. + - Added type safety to blocks for AngularVelocity. + - Added type safety to blocks for Color. + - Added type safety to blocks for ColorSensor. + - Added type safety to blocks for CompassSensor. + - Added type safety to blocks for CRServo. + - Added type safety to blocks for DigitalChannel. + - Added type safety to blocks for ElapsedTime. + - Added type safety to blocks for Gamepad. + - Added type safety to blocks for GyroSensor. + - Added type safety to blocks for IrSeekerSensor. + - Added type safety to blocks for LED. + - Added type safety to blocks for LightSensor. + - Added type safety to blocks for LinearOpMode. + - Added type safety to blocks for MagneticFlux. + - Added type safety to blocks for MatrixF. + - Added type safety to blocks for MrI2cCompassSensor. + - Added type safety to blocks for MrI2cRangeSensor. + - Added type safety to blocks for OpticalDistanceSensor. + - Added type safety to blocks for Orientation. + - Added type safety to blocks for Position. + - Added type safety to blocks for Quaternion. + - Added type safety to blocks for Servo. + - Added type safety to blocks for ServoController. + - Added type safety to blocks for Telemetry. + - Added type safety to blocks for Temperature. + - Added type safety to blocks for TouchSensor. + - Added type safety to blocks for UltrasonicSensor. + - Added type safety to blocks for VectorF. + - Added type safety to blocks for Velocity. + - Added type safety to blocks for VoltageSensor. + - Added type safety to blocks for VuforiaLocalizer.Parameters. + - Added type safety to blocks for VuforiaTrackable. + - Added type safety to blocks for VuforiaTrackables. + - Added type safety to blocks for enums in AdafruitBNO055IMU.Parameters. + - Added type safety to blocks for AndroidAccelerometer, AndroidGyroscope, AndroidOrientation, and AndroidTextToSpeech. + +************************************************************************************** + +Version 2.4 (released on 16.11.13) + * Fix to avoid crashing for nonexistent resources. + * Blocks Programming mode changes: + - Added blocks to support OpenGLMatrix, MatrixF, and VectorF. + - Added blocks to support AngleUnit, AxesOrder, AxesReference, CameraDirection, CameraMonitorFeedback, DistanceUnit, and TempUnit. + - Added blocks to support Acceleration. + - Added blocks to support LinearOpMode.getRuntime. + - Added blocks to support MagneticFlux and Position. + - Fixed typos. + - Made blocks for ElapsedTime more consistent with other objects. + - Added blocks to support Quaternion, Velocity, Orientation, AngularVelocity. + - Added blocks to support VuforiaTrackables, VuforiaTrackable, VuforiaLocalizer, VuforiaTrackableDefaultListener. + - Fixed a few blocks. + - Added type checking to new blocks. + - Updated to latest blockly. + - Added default variable blocks to navigation and matrix blocks. + - Fixed toolbox entry for openGLMatrix_rotation_withAxesArgs. + - When user downloads Blocks-generated op mode, only the .blk file is downloaded. + - When user uploads Blocks-generated op mode (.blk file), Javascript code is auto generated. + - Added DbgLog support. + - Added logging when a blocks file is read/written. + - Fixed bug to properly render blocks even if missing devices from configuration file. + - Added support for additional characters (not just alphanumeric) for the block file names (for download and upload). + - Added support for OpMode flavor (“Autonomous” or “TeleOp”) and group. + * Changes to Samples to prevent tutorial issues. + * Incorporated suggested changes from public pull 216 (“Replace .. paths”). + * Remove Servo Glitches when robot stopped. + * if user hits “Cancels” when editing a configuration file, clears the unsaved changes and reverts to original unmodified configuration. + * Added log info to help diagnose why the Robot Controller app was terminated (for example, by watch dog function). + * Added ability to transfer log from the controller. + * Fixed inconsistency for AngularVelocity + * Limit unbounded growth of data for telemetry. If user does not call telemetry.update() for LinearOpMode in a timely manner, data added for telemetry might get lost if size limit is exceeded. + +************************************************************************************** + +Version 2.35 (released on 16.10.06) + * Blockly programming mode - Removed unnecesary idle() call from blocks for new project. + +************************************************************************************** + +Version 2.30 (released on 16.10.05) + * Blockly programming mode: + - Mechanism added to save Blockly op modes from Programming Mode Server onto local device + - To avoid clutter, blocks are displayed in categorized folders + - Added support for DigitalChannel + - Added support for ModernRoboticsI2cCompassSensor + - Added support for ModernRoboticsI2cRangeSensor + - Added support for VoltageSensor + - Added support for AnalogInput + - Added support for AnalogOutput + - Fix for CompassSensor setMode block + * Vuforia + - Fix deadlock / make camera data available while Vuforia is running. + - Update to Vuforia 6.0.117 (recommended by Vuforia and Google to close security loophole). + * Fix for autonomous 30 second timer bug (where timer was in effect, even though it appeared to have timed out). + * opModeIsActive changes to allow cleanup after op mode is stopped (with enforced 2 second safety timeout). + * Fix to avoid reading i2c twice. + * Updated sample Op Modes. + * Improved logging and fixed intermittent freezing. + * Added digital I/O sample. + * Cleaned up device names in sample op modes to be consistent with Pushbot guide. + * Fix to allow use of IrSeekerSensorV3. + +************************************************************************************** + +Version 2.20 (released on 16.09.08) + * Support for Modern Robotics Compass Sensor. + * Support for Modern Robotics Range Sensor. + * Revise device names for Pushbot templates to match the names used in Pushbot guide. + * Fixed bug so that IrSeekerSensorV3 device is accessible as IrSeekerSensor in hardwareMap. + * Modified computer vision code to require an individual Vuforia license (per legal requirement from PTC). + * Minor fixes. + * Blockly enhancements: + - Support for Voltage Sensor. + - Support for Analog Input. + - Support for Analog Output. + - Support for Light Sensor. + - Support for Servo Controller. + +************************************************************************************** + +Version 2.10 (released on 16.09.03) + * Support for Adafruit IMU. + * Improvements to ModernRoboticsI2cGyro class + - Block on reset of z axis. + - isCalibrating() returns true while gyro is calibration. + * Updated sample gyro program. + * Blockly enhancements + - support for android.graphics.Color. + - added support for ElapsedTime. + - improved look and legibility of blocks. + - support for compass sensor. + - support for ultrasonic sensor. + - support for IrSeeker. + - support for LED. + - support for color sensor. + - support for CRServo + - prompt user to configure robot before using programming mode. + * Provides ability to disable audio cues. + * various bug fixes and improvements. + +************************************************************************************** + +Version 2.00 (released on 16.08.19) + * This is the new release for the upcoming 2016-2017 FIRST Tech Challenge Season. + * Channel change is enabled in the FTC Robot Controller app for Moto G 2nd and 3rd Gen phones. + * Users can now use annotations to register/disable their Op Modes. + * Changes in the Android SDK, JDK and build tool requirements (minsdk=19, java 1.7, build tools 23.0.3). + * Standardized units in analog input. + * Cleaned up code for existing analog sensor classes. + * setChannelMode and getChannelMode were REMOVED from the DcMotorController class. This is important - we no longer set the motor modes through the motor controller. + * setMode and getMode were added to the DcMotor class. + * ContinuousRotationServo class has been added to the FTC SDK. + * Range.clip() method has been overloaded so it can support this operation for int, short and byte integers. + * Some changes have been made (new methods added) on how a user can access items from the hardware map. + * Users can now set the zero power behavior for a DC motor so that the motor will brake or float when power is zero. + * Prototype Blockly Programming Mode has been added to FTC Robot Controller. Users can place the Robot Controller into this mode, and then use a device (such as a laptop) that has a Javascript enabled browser to write Blockly-based Op Modes directly onto the Robot Controller. + * Users can now configure the robot remotely through the FTC Driver Station app. + * Android Studio project supports Android Studio 2.1.x and compile SDK Version 23 (Marshmallow). + * Vuforia Computer Vision SDK integrated into FTC SDK. Users can use sample vision targets to get localization information on a standard FTC field. + * Project structure has been reorganized so that there is now a TeamCode package that users can use to place their local/custom Op Modes into this package. + * Inspection function has been integrated into the FTC Robot Controller and Driver Station Apps (Thanks Team HazMat… 9277 & 10650!). + * Audio cues have been incorporated into FTC SDK. + * Swap mechanism added to FTC Robot Controller configuration activity. For example, if you have two motor controllers on a robot, and you misidentified them in your configuration file, you can use the Swap button to swap the devices within the configuration file (so you do not have to manually re-enter in the configuration info for the two devices). + * Fix mechanism added to all user to replace an electronic module easily. For example, suppose a servo controller dies on your robot. You replace the broken module with a new module, which has a different serial number from the original servo controller. You can use the Fix button to automatically reconfigure your configuration file to use the serial number of the new module. + * Improvements made to fix resiliency and responsiveness of the system. + * For LinearOpMode the user now must for a telemetry.update() to update the telemetry data on the driver station. This update() mechanism ensures that the driver station gets the updated data properly and at the same time. + * The Auto Configure function of the Robot Controller is now template based. If there is a commonly used robot configuration, a template can be created so that the Auto Configure mechanism can be used to quickly configure a robot of this type. + * The logic to detect a runaway op mode (both in the LinearOpMode and OpMode types) and to abort the run, then auto recover has been improved/implemented. + * Fix has been incorporated so that Logitech F310 gamepad mappings will be correct for Marshmallow users. + +************************************************************************************** + +Release 16.07.08 + + * For the ftc_app project, the gradle files have been modified to support Android Studio 2.1.x. + + + +************************************************************************************** + +Release 16.03.30 + + * For the MIT App Inventor, the design blocks have new icons that better represent the function of each design component. + * Some changes were made to the shutdown logic to ensure the robust shutdown of some of our USB services. + * A change was made to LinearOpMode so as to allow a given instance to be executed more than once, which is required for the App Inventor. + * Javadoc improved/updated. + +************************************************************************************** + +Release 16.03.09 + + * Changes made to make the FTC SDK synchronous (significant change!) + - waitOneFullHardwareCycle() and waitForNextHardwareCycle() are no longer needed and have been deprecated. + - runOpMode() (for a LinearOpMode) is now decoupled from the system's hardware read/write thread. + - loop() (for an OpMode) is now decoupled from the system's hardware read/write thread. + - Methods are synchronous. + - For example, if you call setMode(DcMotorController.RunMode.RESET_ENCODERS) for a motor, the encoder is guaranteed to be reset when the method call is complete. + - For legacy module (NXT compatible), user no longer has to toggle between read and write modes when reading from or writing to a legacy device. + * Changes made to enhance reliability/robustness during ESD event. + * Changes made to make code thread safe. + * Debug keystore added so that user-generated robot controller APKs will all use the same signed key (to avoid conflicts if a team has multiple developer laptops for example). + * Firmware version information for Modern Robotics modules are now logged. + * Changes made to improve USB comm reliability and robustness. + * Added support for voltage indicator for legacy (NXT-compatible) motor controllers. + * Changes made to provide auto stop capabilities for op modes. + - A LinearOpMode class will stop when the statements in runOpMode() are complete. User does not have to push the stop button on the driver station. + - If an op mode is stopped by the driver station, but there is a run away/uninterruptible thread persisting, the app will log an error message then force itself to crash to stop the runaway thread. + * Driver Station UI modified to display lowest measured voltage below current voltage (12V battery). + * Driver Station UI modified to have color background for current voltage (green=good, yellow=caution, red=danger, extremely low voltage). + * javadoc improved (edits and additional classes). + * Added app build time to About activity for driver station and robot controller apps. + * Display local IP addresses on Driver Station About activity. + * Added I2cDeviceSynchImpl. + * Added I2cDeviceSync interface. + * Added seconds() and milliseconds() to ElapsedTime for clarity. + * Added getCallbackCount() to I2cDevice. + * Added missing clearI2cPortActionFlag. + * Added code to create log messages while waiting for LinearOpMode shutdown. + * Fix so Wifi Direct Config activity will no longer launch multiple times. + * Added the ability to specify an alternate i2c address in software for the Modern Robotics gyro. + +************************************************************************************** + +Release 16.02.09 + + * Improved battery checker feature so that voltage values get refreshed regularly (every 250 msec) on Driver Station (DS) user interface. + * Improved software so that Robot Controller (RC) is much more resilient and “self-healing” to USB disconnects: + - If user attempts to start/restart RC with one or more module missing, it will display a warning but still start up. + - When running an op mode, if one or more modules gets disconnected, the RC & DS will display warnings,and robot will keep on working in spite of the missing module(s). + - If a disconnected module gets physically reconnected the RC will auto detect the module and the user will regain control of the recently connected module. + - Warning messages are more helpful (identifies the type of module that’s missing plus its USB serial number). + * Code changes to fix the null gamepad reference when users try to reference the gamepads in the init() portion of their op mode. + * NXT light sensor output is now properly scaled. Note that teams might have to readjust their light threshold values in their op modes. + * On DS user interface, gamepad icon for a driver will disappear if the matching gamepad is disconnected or if that gamepad gets designated as a different driver. + * Robot Protocol (ROBOCOL) version number info is displayed in About screen on RC and DS apps. + * Incorporated a display filter on pairing screen to filter out devices that don’t use the “public class ClassManagerFactory
+extends java.lang.Object
+Constructor and Description | +
---|
ClassManagerFactory() |
+
Modifier and Type | +Method and Description | +
---|---|
static void |
+processAllClasses() |
+
static void |
+registerFilters()
+Register all them that wants to see the classes in our APK
+ |
+
static void |
+registerResourceFilters() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static void registerFilters()+
public static void registerResourceFilters()+
public static void processAllClasses()+
public static class CommandList.CmdPlaySound
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+Command |
+
java.lang.String |
+hashString |
+
int |
+loopControl |
+
long |
+msPresentationTime |
+
float |
+rate |
+
float |
+volume |
+
boolean |
+waitForNonLoopingSoundsToFinish |
+
Constructor and Description | +
---|
CmdPlaySound(long msPresentationTime,
+ java.lang.String hashString,
+ SoundPlayer.PlaySoundParams params) |
+
Modifier and Type | +Method and Description | +
---|---|
static CommandList.CmdPlaySound |
+deserialize(java.lang.String serialized) |
+
SoundPlayer.PlaySoundParams |
+getParams() |
+
java.lang.String |
+serialize() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String Command+
public final long msPresentationTime+
public final java.lang.String hashString+
public final boolean waitForNonLoopingSoundsToFinish+
public final float volume+
public final int loopControl+
public final float rate+
public CmdPlaySound(long msPresentationTime, + java.lang.String hashString, + SoundPlayer.PlaySoundParams params)+
public java.lang.String serialize()+
public static CommandList.CmdPlaySound deserialize(java.lang.String serialized)+
public SoundPlayer.PlaySoundParams getParams()+
public static class CommandList.CmdRequestSound
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+Command |
+
java.lang.String |
+hashString |
+
int |
+port |
+
Constructor and Description | +
---|
CmdRequestSound(java.lang.String hashString,
+ int port) |
+
Modifier and Type | +Method and Description | +
---|---|
static CommandList.CmdRequestSound |
+deserialize(java.lang.String serialized) |
+
java.lang.String |
+serialize() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String Command+
public final java.lang.String hashString+
public final int port+
public CmdRequestSound(java.lang.String hashString, + int port)+
public java.lang.String serialize()+
public static CommandList.CmdRequestSound deserialize(java.lang.String serialized)+
public static class CommandList.CmdStopPlayingSounds
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+Command |
+
SoundPlayer.StopWhat |
+stopWhat |
+
Constructor and Description | +
---|
CmdStopPlayingSounds(SoundPlayer.StopWhat stopWhat) |
+
Modifier and Type | +Method and Description | +
---|---|
static CommandList.CmdStopPlayingSounds |
+deserialize(java.lang.String serialized) |
+
java.lang.String |
+serialize() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String Command+
public final SoundPlayer.StopWhat stopWhat+
public CmdStopPlayingSounds(SoundPlayer.StopWhat stopWhat)+
public java.lang.String serialize()+
public static CommandList.CmdStopPlayingSounds deserialize(java.lang.String serialized)+
public static class CommandList.CmdVisuallyIdentify
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+Command |
+
SerialNumber |
+serialNumber |
+
boolean |
+shouldIdentify |
+
Constructor and Description | +
---|
CmdVisuallyIdentify(SerialNumber serialNumber,
+ boolean shouldIdentify) |
+
Modifier and Type | +Method and Description | +
---|---|
static CommandList.CmdVisuallyIdentify |
+deserialize(java.lang.String serialized) |
+
java.lang.String |
+serialize() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String Command+
public final SerialNumber serialNumber+
public final boolean shouldIdentify+
public CmdVisuallyIdentify(SerialNumber serialNumber, + boolean shouldIdentify)+
public java.lang.String serialize()+
public static CommandList.CmdVisuallyIdentify deserialize(java.lang.String serialized)+
public static class CommandList.LynxAddressChangeRequest.AddressChange
+extends java.lang.Object
+Constructor and Description | +
---|
AddressChange() |
+
public static class CommandList.LynxAddressChangeRequest
+extends java.lang.Object
+Modifier and Type | +Class and Description | +
---|---|
static class |
+CommandList.LynxAddressChangeRequest.AddressChange |
+
Constructor and Description | +
---|
LynxAddressChangeRequest() |
+
Modifier and Type | +Method and Description | +
---|---|
static CommandList.LynxAddressChangeRequest |
+deserialize(java.lang.String serialized) |
+
java.lang.String |
+serialize() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public LynxAddressChangeRequest()+
public java.lang.String serialize()+
public static CommandList.LynxAddressChangeRequest deserialize(java.lang.String serialized)+
public static class CommandList.LynxFirmwareImagesResp
+extends java.lang.Object
+Constructor and Description | +
---|
LynxFirmwareImagesResp() |
+
Modifier and Type | +Method and Description | +
---|---|
static CommandList.LynxFirmwareImagesResp |
+deserialize(java.lang.String serialized) |
+
java.lang.String |
+serialize() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public LynxFirmwareImagesResp()+
public java.lang.String serialize()+
public static CommandList.LynxFirmwareImagesResp deserialize(java.lang.String serialized)+
public static class CommandList.LynxFirmwareUpdate
+extends java.lang.Object
+Constructor and Description | +
---|
LynxFirmwareUpdate() |
+
Modifier and Type | +Method and Description | +
---|---|
static CommandList.LynxFirmwareUpdate |
+deserialize(java.lang.String serialized) |
+
java.lang.String |
+serialize() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public java.lang.String serialize()+
public static CommandList.LynxFirmwareUpdate deserialize(java.lang.String serialized)+
public static class CommandList.LynxFirmwareUpdateResp
+extends java.lang.Object
+Constructor and Description | +
---|
LynxFirmwareUpdateResp() |
+
Modifier and Type | +Method and Description | +
---|---|
static CommandList.LynxFirmwareUpdateResp |
+deserialize(java.lang.String serialized) |
+
java.lang.String |
+serialize() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public LynxFirmwareUpdateResp()+
public java.lang.String serialize()+
public static CommandList.LynxFirmwareUpdateResp deserialize(java.lang.String serialized)+
public static class CommandList.USBAccessibleLynxModulesRequest
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
boolean |
+forFirmwareUpdate |
+
Constructor and Description | +
---|
USBAccessibleLynxModulesRequest() |
+
Modifier and Type | +Method and Description | +
---|---|
static CommandList.USBAccessibleLynxModulesRequest |
+deserialize(java.lang.String serialized) |
+
java.lang.String |
+serialize() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public USBAccessibleLynxModulesRequest()+
public java.lang.String serialize()+
public static CommandList.USBAccessibleLynxModulesRequest deserialize(java.lang.String serialized)+
public static class CommandList.USBAccessibleLynxModulesResp
+extends java.lang.Object
+Constructor and Description | +
---|
USBAccessibleLynxModulesResp() |
+
Modifier and Type | +Method and Description | +
---|---|
static CommandList.USBAccessibleLynxModulesResp |
+deserialize(java.lang.String serialized) |
+
java.lang.String |
+serialize() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public USBAccessibleLynxModulesResp()+
public java.lang.String serialize()+
public static CommandList.USBAccessibleLynxModulesResp deserialize(java.lang.String serialized)+
public class CommandList
+extends RobotCoreCommandList
+Modifier and Type | +Class and Description | +
---|---|
static class |
+CommandList.CmdPlaySound |
+
static class |
+CommandList.CmdRequestSound |
+
static class |
+CommandList.CmdStopPlayingSounds |
+
static class |
+CommandList.CmdVisuallyIdentify |
+
static class |
+CommandList.LynxAddressChangeRequest |
+
static class |
+CommandList.LynxFirmwareImagesResp |
+
static class |
+CommandList.LynxFirmwareUpdate |
+
static class |
+CommandList.LynxFirmwareUpdateResp |
+
static class |
+CommandList.USBAccessibleLynxModulesRequest |
+
static class |
+CommandList.USBAccessibleLynxModulesResp |
+
Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+CMD_ACTIVATE_CONFIGURATION |
+
static java.lang.String |
+CMD_DELETE_CONFIGURATION |
+
static java.lang.String |
+CMD_DISCOVER_LYNX_MODULES |
+
static java.lang.String |
+CMD_DISCOVER_LYNX_MODULES_RESP |
+
static java.lang.String |
+CMD_GET_CANDIDATE_LYNX_FIRMWARE_IMAGES |
+
static java.lang.String |
+CMD_GET_CANDIDATE_LYNX_FIRMWARE_IMAGES_RESP |
+
static java.lang.String |
+CMD_GET_USB_ACCESSIBLE_LYNX_MODULES |
+
static java.lang.String |
+CMD_GET_USB_ACCESSIBLE_LYNX_MODULES_RESP |
+
static java.lang.String |
+CMD_INIT_OP_MODE |
+
static java.lang.String |
+CMD_LYNX_ADDRESS_CHANGE |
+
static java.lang.String |
+CMD_LYNX_FIRMWARE_UPDATE |
+
static java.lang.String |
+CMD_LYNX_FIRMWARE_UPDATE_RESP |
+
static java.lang.String |
+CMD_PROGRAMMING_MODE_LOG_NOTIFICATION
+Notification that a message was logged during programming mode (blocks).
+ |
+
static java.lang.String |
+CMD_PROGRAMMING_MODE_PING_NOTIFICATION
+Notification that the programming mode (blocks) server received a ping request.
+ |
+
static java.lang.String |
+CMD_REQUEST_CONFIGURATION_TEMPLATES |
+
static java.lang.String |
+CMD_REQUEST_CONFIGURATION_TEMPLATES_RESP |
+
static java.lang.String |
+CMD_REQUEST_CONFIGURATIONS |
+
static java.lang.String |
+CMD_REQUEST_CONFIGURATIONS_RESP |
+
static java.lang.String |
+CMD_REQUEST_PARTICULAR_CONFIGURATION |
+
static java.lang.String |
+CMD_REQUEST_PARTICULAR_CONFIGURATION_RESP |
+
static java.lang.String |
+CMD_REQUEST_REMEMBERED_GROUPS |
+
static java.lang.String |
+CMD_REQUEST_REMEMBERED_GROUPS_RESP |
+
static java.lang.String |
+CMD_RESTART_ROBOT |
+
static java.lang.String |
+CMD_RUN_OP_MODE |
+
static java.lang.String |
+CMD_SAVE_CONFIGURATION |
+
static java.lang.String |
+CMD_SCAN |
+
static java.lang.String |
+CMD_SCAN_RESP |
+
static java.lang.String |
+CMD_SET_MATCH_NUMBER |
+
static java.lang.String |
+CMD_START_DS_PROGRAM_AND_MANAGE |
+
static java.lang.String |
+CMD_START_DS_PROGRAM_AND_MANAGE_RESP |
+
static java.lang.String |
+CMD_START_PROGRAMMING_MODE
+Command to start programming mode (blocks).
+ |
+
static java.lang.String |
+CMD_START_PROGRAMMING_MODE_RESP
+Response to a command to start programming mode (blocks).
+ |
+
static java.lang.String |
+CMD_STOP_PROGRAMMING_MODE
+Command to stop programming mode (blocks).
+ |
+
Constructor and Description | +
---|
CommandList() |
+
public static final java.lang.String CMD_INIT_OP_MODE+
public static final java.lang.String CMD_RUN_OP_MODE+
public static final java.lang.String CMD_RESTART_ROBOT+
public static final java.lang.String CMD_SCAN+
public static final java.lang.String CMD_SCAN_RESP+
public static final java.lang.String CMD_REQUEST_CONFIGURATIONS+
public static final java.lang.String CMD_REQUEST_CONFIGURATIONS_RESP+
public static final java.lang.String CMD_REQUEST_CONFIGURATION_TEMPLATES+
public static final java.lang.String CMD_REQUEST_CONFIGURATION_TEMPLATES_RESP+
public static final java.lang.String CMD_REQUEST_PARTICULAR_CONFIGURATION+
public static final java.lang.String CMD_REQUEST_PARTICULAR_CONFIGURATION_RESP+
public static final java.lang.String CMD_ACTIVATE_CONFIGURATION+
public static final java.lang.String CMD_SAVE_CONFIGURATION+
public static final java.lang.String CMD_DELETE_CONFIGURATION+
public static final java.lang.String CMD_DISCOVER_LYNX_MODULES+
public static final java.lang.String CMD_DISCOVER_LYNX_MODULES_RESP+
public static final java.lang.String CMD_REQUEST_REMEMBERED_GROUPS+
public static final java.lang.String CMD_REQUEST_REMEMBERED_GROUPS_RESP+
public static final java.lang.String CMD_START_PROGRAMMING_MODE+
public static final java.lang.String CMD_START_DS_PROGRAM_AND_MANAGE+
public static final java.lang.String CMD_START_PROGRAMMING_MODE_RESP+
public static final java.lang.String CMD_START_DS_PROGRAM_AND_MANAGE_RESP+
public static final java.lang.String CMD_PROGRAMMING_MODE_LOG_NOTIFICATION+
public static final java.lang.String CMD_PROGRAMMING_MODE_PING_NOTIFICATION+
public static final java.lang.String CMD_STOP_PROGRAMMING_MODE+
public static final java.lang.String CMD_SET_MATCH_NUMBER+
public static final java.lang.String CMD_GET_CANDIDATE_LYNX_FIRMWARE_IMAGES+
public static final java.lang.String CMD_GET_CANDIDATE_LYNX_FIRMWARE_IMAGES_RESP+
public static final java.lang.String CMD_GET_USB_ACCESSIBLE_LYNX_MODULES+
public static final java.lang.String CMD_GET_USB_ACCESSIBLE_LYNX_MODULES_RESP+
public static final java.lang.String CMD_LYNX_FIRMWARE_UPDATE+
public static final java.lang.String CMD_LYNX_FIRMWARE_UPDATE_RESP+
public static final java.lang.String CMD_LYNX_ADDRESS_CHANGE+
public static enum ConfigWifiDirectActivity.Flag +extends java.lang.Enum<ConfigWifiDirectActivity.Flag>+
Enum Constant and Description | +
---|
NONE |
+
WIFI_DIRECT_DEVICE_NAME_INVALID |
+
WIFI_DIRECT_FIX_CONFIG |
+
Modifier and Type | +Method and Description | +
---|---|
static ConfigWifiDirectActivity.Flag |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static ConfigWifiDirectActivity.Flag[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final ConfigWifiDirectActivity.Flag NONE+
public static final ConfigWifiDirectActivity.Flag WIFI_DIRECT_FIX_CONFIG+
public static final ConfigWifiDirectActivity.Flag WIFI_DIRECT_DEVICE_NAME_INVALID+
public static ConfigWifiDirectActivity.Flag[] values()+
+for (ConfigWifiDirectActivity.Flag c : ConfigWifiDirectActivity.Flag.values()) + System.out.println(c); +
public static ConfigWifiDirectActivity.Flag valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic class ConfigWifiDirectActivity
+extends ThemedActivity
+Modifier and Type | +Class and Description | +
---|---|
static class |
+ConfigWifiDirectActivity.Flag |
+
Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+TAG |
+
Constructor and Description | +
---|
ConfigWifiDirectActivity() |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+getTag() |
+
static void |
+launch(android.content.Context context) |
+
static void |
+launch(android.content.Context context,
+ ConfigWifiDirectActivity.Flag flag) |
+
protected void |
+onCreate(android.os.Bundle savedInstanceState) |
+
protected void |
+onPause() |
+
protected void |
+onResume() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String TAG+
public ConfigWifiDirectActivity()+
public java.lang.String getTag()+
protected void onCreate(android.os.Bundle savedInstanceState)+
protected void onResume()+
protected void onPause()+
public static void launch(android.content.Context context)+
public static void launch(android.content.Context context, + ConfigWifiDirectActivity.Flag flag)+
public static class FtcAboutActivity.AboutFragment
+extends android.preference.PreferenceFragment
+android.preference.PreferenceFragment.OnPreferenceStartFragmentCallback
android.app.Fragment.InstantiationException, android.app.Fragment.SavedState
Modifier and Type | +Field and Description | +
---|---|
protected boolean |
+remoteConfigure |
+
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
Constructor and Description | +
---|
AboutFragment() |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+onCreate(android.os.Bundle savedInstanceState) |
+
void |
+refreshAllUnavailable() |
+
void |
+refreshLocal(RobotCoreCommandList.AboutInfo aboutInfo) |
+
void |
+refreshRemote(RobotCoreCommandList.AboutInfo aboutInfo) |
+
protected void |
+setPreferenceSummary(int idPref,
+ java.lang.String value) |
+
protected void |
+setPreferenceSummary(java.lang.String prefName,
+ java.lang.String value) |
+
addPreferencesFromIntent, addPreferencesFromResource, findPreference, getPreferenceManager, getPreferenceScreen, onActivityCreated, onActivityResult, onCreateView, onDestroy, onDestroyView, onPreferenceTreeClick, onSaveInstanceState, onStart, onStop, setPreferenceScreen
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, hashCode, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isRemoving, isResumed, isVisible, onAttach, onAttach, onConfigurationChanged, onContextItemSelected, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroyOptionsMenu, onDetach, onHiddenChanged, onInflate, onInflate, onInflate, onLowMemory, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPrepareOptionsMenu, onRequestPermissionsResult, onResume, onTrimMemory, onViewCreated, onViewStateRestored, registerForContextMenu, requestPermissions, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, toString, unregisterForContextMenu
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
public void refreshLocal(RobotCoreCommandList.AboutInfo aboutInfo)+
public void refreshRemote(RobotCoreCommandList.AboutInfo aboutInfo)+
public void refreshAllUnavailable()+
public void onCreate(android.os.Bundle savedInstanceState)+
onCreate
in class android.preference.PreferenceFragment
protected void setPreferenceSummary(int idPref, + java.lang.String value)+
protected void setPreferenceSummary(java.lang.String prefName, + java.lang.String value)+
public class FtcAboutActivity
+extends ThemedActivity
+Modifier and Type | +Class and Description | +
---|---|
static class |
+FtcAboutActivity.AboutFragment |
+
Modifier and Type | +Field and Description | +
---|---|
protected FtcAboutActivity.AboutFragment |
+aboutFragment |
+
protected android.content.Context |
+context |
+
protected java.util.concurrent.Future |
+refreshFuture |
+
protected boolean |
+remoteConfigure |
+
static java.lang.String |
+TAG |
+
Constructor and Description | +
---|
FtcAboutActivity() |
+
Modifier and Type | +Method and Description | +
---|---|
protected static java.lang.String |
+getAppVersion() |
+
protected static java.lang.String |
+getBuildTime()
+https://code.google.com/p/android/issues/detail?id=220039
+ |
+
static com.qualcomm.ftccommon.CommandList.AboutInfo |
+getLocalAboutInfo() |
+
java.lang.String |
+getTag() |
+
protected void |
+onCreate(android.os.Bundle savedInstanceState) |
+
protected void |
+onDestroy() |
+
protected void |
+onPause() |
+
protected void |
+onResume() |
+
protected void |
+refresh() |
+
protected void |
+refreshRemote(RobotCoreCommandList.AboutInfo aboutInfo) |
+
protected void |
+startRefreshing() |
+
protected void |
+stopRefreshing() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String TAG+
protected final android.content.Context context+
protected final boolean remoteConfigure+
protected FtcAboutActivity.AboutFragment aboutFragment+
protected java.util.concurrent.Future refreshFuture+
public java.lang.String getTag()+
public static com.qualcomm.ftccommon.CommandList.AboutInfo getLocalAboutInfo()+
protected static java.lang.String getAppVersion()+
protected static java.lang.String getBuildTime()+
protected void startRefreshing()+
protected void stopRefreshing()+
protected void refreshRemote(RobotCoreCommandList.AboutInfo aboutInfo)+
protected void refresh()+
protected void onCreate(android.os.Bundle savedInstanceState)+
protected void onResume()+
protected void onPause()+
protected void onDestroy()+
public static class FtcAdvancedRCSettingsActivity.SettingsFragment
+extends android.preference.PreferenceFragment
+android.preference.PreferenceFragment.OnPreferenceStartFragmentCallback
android.app.Fragment.InstantiationException, android.app.Fragment.SavedState
Modifier and Type | +Field and Description | +
---|---|
protected boolean |
+clientConnected |
+
protected PreferencesHelper |
+preferencesHelper |
+
protected boolean |
+remoteConfigure |
+
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
Constructor and Description | +
---|
SettingsFragment() |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+onCreate(android.os.Bundle savedInstanceState) |
+
addPreferencesFromIntent, addPreferencesFromResource, findPreference, getPreferenceManager, getPreferenceScreen, onActivityCreated, onActivityResult, onCreateView, onDestroy, onDestroyView, onPreferenceTreeClick, onSaveInstanceState, onStart, onStop, setPreferenceScreen
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, hashCode, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isRemoving, isResumed, isVisible, onAttach, onAttach, onConfigurationChanged, onContextItemSelected, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroyOptionsMenu, onDetach, onHiddenChanged, onInflate, onInflate, onInflate, onLowMemory, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPrepareOptionsMenu, onRequestPermissionsResult, onResume, onTrimMemory, onViewCreated, onViewStateRestored, registerForContextMenu, requestPermissions, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, toString, unregisterForContextMenu
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
public class FtcAdvancedRCSettingsActivity
+extends ThemedActivity
+FtcAdvancedRCSettingsActivity
manages the editing of advanced RC settingsModifier and Type | +Class and Description | +
---|---|
static class |
+FtcAdvancedRCSettingsActivity.SettingsFragment |
+
Modifier and Type | +Field and Description | +
---|---|
protected static java.lang.String |
+CLIENT_CONNECTED |
+
static java.lang.String |
+TAG |
+
Constructor and Description | +
---|
FtcAdvancedRCSettingsActivity() |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+getTag() |
+
protected void |
+onCreate(android.os.Bundle savedInstanceState) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String TAG+
protected static final java.lang.String CLIENT_CONNECTED+
public class FtcEventLoop.DefaultUsbModuleAttachmentHandler +extends java.lang.Object +implements UsbModuleAttachmentHandler+
Constructor and Description | +
---|
DefaultUsbModuleAttachmentHandler() |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+handleUsbModuleAttach(RobotUsbModule module)
+One of the hardware modules in the current robot configuration (such as a Modern Robotics
+ DC Motor Controller, a Modern Robotics Legacy Module, etc) is now newly attached to the
+ system (or so we think).
+ |
+
void |
+handleUsbModuleDetach(RobotUsbModule module)
+One of the hardware modules in the current robot configuration (such as a Modern Robotics
+ DC Motor Controller, a Modern Robotics Legacy Module, etc) has been disconnected from the
+ system.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public DefaultUsbModuleAttachmentHandler()+
public void handleUsbModuleAttach(RobotUsbModule module) + throws RobotCoreException, + java.lang.InterruptedException+
UsbModuleAttachmentHandler
handleUsbModuleAttach
in interface UsbModuleAttachmentHandler
module
- the module which is newly attachedRobotCoreException
java.lang.InterruptedException
public void handleUsbModuleDetach(RobotUsbModule module) + throws RobotCoreException, + java.lang.InterruptedException+
UsbModuleAttachmentHandler
handleUsbModuleDetach
in interface UsbModuleAttachmentHandler
module
- the module which has become disconnectedRobotCoreException
java.lang.InterruptedException
public class FtcEventLoop +extends FtcEventLoopBase+
+ Modify this class with your own code, or create your own event loop by + implementing EventLoop.
Modifier and Type | +Class and Description | +
---|---|
class |
+FtcEventLoop.DefaultUsbModuleAttachmentHandler |
+
FtcEventLoopBase.LynxUsbDeviceContainer
Modifier and Type | +Field and Description | +
---|---|
protected OpModeManagerImpl |
+opModeManager |
+
protected java.util.concurrent.atomic.AtomicReference<OpMode> |
+opModeStopRequested |
+
protected java.util.Map<java.lang.String,java.lang.Long> |
+recentlyAttachedUsbDevices |
+
protected UsbModuleAttachmentHandler |
+usbModuleAttachmentHandler |
+
protected Utility |
+utility |
+
activityContext, ftcEventLoopHandler, networkConnectionHandler, programmingModeController, registeredOpModes, robotCfgFileMgr, runningOnDriverStation, TAG, usbScanManager, userOpmodeRegister
TELEMETRY_DEFAULT_INTERVAL
Constructor and Description | +
---|
FtcEventLoop(HardwareFactory hardwareFactory,
+ OpModeRegister userOpmodeRegister,
+ UpdateUI.Callback callback,
+ android.app.Activity activityContext,
+ ProgrammingModeController programmingModeController) |
+
Modifier and Type | +Method and Description | +
---|---|
protected static OpModeManagerImpl |
+createOpModeManager(android.app.Activity activityContext) |
+
OpModeManagerImpl |
+getOpModeManager()
+Returns the OpModeManager associated with this event loop
+ |
+
protected SerialNumber |
+getSerialNumberOfUsbDevice(android.hardware.usb.UsbDevice usbDevice) |
+
UsbModuleAttachmentHandler |
+getUsbModuleAttachmentHandler() |
+
protected void |
+handleCommandDiscoverLynxModules(java.lang.String extra) |
+
protected void |
+handleCommandInitOpMode(java.lang.String extra) |
+
protected void |
+handleCommandRunOpMode(java.lang.String extra) |
+
protected void |
+handleCommandScan(java.lang.String extra) |
+
protected void |
+handleCommandSetMatchNumber(java.lang.String extra) |
+
void |
+handleUsbModuleAttach(RobotUsbModule module)
+Process the fact that (we believe) that the indicated module has now reappeared after a
+ previously observed detachment.
+ |
+
void |
+handleUsbModuleDetach(RobotUsbModule module)
+Process the fact that a usb module has now become detached from the system.
+ |
+
void |
+init(EventLoopManager eventLoopManager)
+Init method
+ |
+
void |
+loop()
+Loop method, this will be called repeatedly while the robot is running.
+ |
+
void |
+onUsbDeviceAttached(android.hardware.usb.UsbDevice usbDevice)
+Deal with the fact that a UsbDevice has recently attached to the system
+ |
+
void |
+pendUsbDeviceAttachment(SerialNumber serialNumber,
+ long time,
+ java.util.concurrent.TimeUnit unit) |
+
CallbackResult |
+processCommand(Command command)
+If the driver station sends over a command, it will be routed to this method.
+ |
+
void |
+processedRecentlyAttachedUsbDevices()
+Process any usb devices that might have recently attached.
+ |
+
void |
+refreshUserTelemetry(TelemetryMessage telemetry,
+ double sInterval)
+Update's the user portion of the driver station screen with the contents of the telemetry object
+ here provided if a sufficiently long duration has passed since the last update.
+ |
+
void |
+requestOpModeStop(OpMode opModeToStopIfActive)
+Requests that an OpMode be stopped if it's the currently active one
+ |
+
protected void |
+sendUIState()
+The driver station is requesting our opmode list/ UI state.
+ |
+
void |
+setUsbModuleAttachmentHandler(UsbModuleAttachmentHandler handler) |
+
void |
+teardown()
+Teardown method
+ |
+
checkForChangedOpModes, enterFirmwareUpdateMode, getLynxUsbDeviceForFirmwareUpdate, getUSBAccessibleLynxDevices, handleCommandActivateConfiguration, handleCommandClearRememberedGroups, handleCommandDeleteConfiguration, handleCommandDisconnectWifiDirect, handleCommandDismissAllDialogs, handleCommandDismissDialog, handleCommandDismissProgress, handleCommandGetCandidateLynxFirmwareImages, handleCommandGetUSBAccessibleLynxModules, handleCommandLynxChangeModuleAddresses, handleCommandLynxFirmwareUpdate, handleCommandRequestAboutInfo, handleCommandRequestConfigurations, handleCommandRequestConfigurationTemplates, handleCommandRequestInspectionReport, handleCommandRequestParticularConfiguration, handleCommandRequestRememberedGroups, handleCommandRestartRobot, handleCommandSaveConfiguration, handleCommandShowDialog, handleCommandShowProgress, handleCommandShowToast, handleCommandStartDriverStationProgramAndManage, handleCommandStartProgrammingMode, handleCommandStopProgrammingMode, handleCommandVisuallyConfirmWifiReset, handleCommandVisuallyIdentify, startUsbScanMangerIfNecessary, talkToParentLynxModule, updateFirmwareOnce, updateLynxFirmware
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected final Utility utility+
protected final OpModeManagerImpl opModeManager+
protected UsbModuleAttachmentHandler usbModuleAttachmentHandler+
protected final java.util.Map<java.lang.String,java.lang.Long> recentlyAttachedUsbDevices+
protected final java.util.concurrent.atomic.AtomicReference<OpMode> opModeStopRequested+
public FtcEventLoop(HardwareFactory hardwareFactory, + OpModeRegister userOpmodeRegister, + UpdateUI.Callback callback, + android.app.Activity activityContext, + ProgrammingModeController programmingModeController)+
protected static OpModeManagerImpl createOpModeManager(android.app.Activity activityContext)+
public OpModeManagerImpl getOpModeManager()+
EventLoop
public UsbModuleAttachmentHandler getUsbModuleAttachmentHandler()+
public void setUsbModuleAttachmentHandler(UsbModuleAttachmentHandler handler)+
public void init(EventLoopManager eventLoopManager) + throws RobotCoreException, + java.lang.InterruptedException+
+ This code will run when the robot first starts up. Place any initialization code in this + method. +
+ It is important to save a copy of the event loop manager from this method, as that is how + you'll get access to the gamepad. +
+ If an Exception is thrown then the event loop manager will not start the robot. +
+ Caller synchronizes: called on RobotSetupRunnable.run() thread
init
in interface EventLoop
init
in class FtcEventLoopBase
eventLoopManager
- event loop manager that is responsible for this event loopRobotCoreException
- if a RobotCoreException is thrown, it will be handled
+ by the event loop manager. The manager will report that the robot failed
+ to start.java.lang.InterruptedException
public void loop() + throws RobotCoreException+
RobotCoreException
- if a RobotCoreException is thrown, it will be handled
+ by the event loop manager. The manager may decide to either stop processing
+ this iteration of the loop, or it may decide to shut down the robot.
+ Caller synchronizes: called on EventLoopRunnable.run() thread.
public void refreshUserTelemetry(TelemetryMessage telemetry, + double sInterval)+
EventLoop
telemetry
- the telemetry object to sendsInterval
- the required minimum interval. NaN indicates that a system default interval should be used.public void teardown() + throws RobotCoreException, + java.lang.InterruptedException+
+ This method will be called when the robot is being shut down. This method should stop the robot. There will be no more changes to write + to the hardware after this method is called. +
+ If an exception is thrown, then the event loop manager will attempt to shut down the robot + without the benefit of this method. +
teardown
in interface EventLoop
teardown
in class FtcEventLoopBase
RobotCoreException
- if a RobotCoreException is thrown, it will be handled by the event
+ loop manager. The manager will then attempt to shut down the robot without the benefit
+ of the teardown method.java.lang.InterruptedException
+ Caller synchronizes: called on EventLoopRunnable.run() thread.
public CallbackResult processCommand(Command command) + throws java.lang.InterruptedException, + RobotCoreException+
+ Called on RecvRunnable.run() thread. Method is thread safe, non-interfering
processCommand
in interface EventLoop
processCommand
in class FtcEventLoopBase
command
- command to processjava.lang.InterruptedException
RobotCoreException
protected void handleCommandScan(java.lang.String extra) + throws RobotCoreException, + java.lang.InterruptedException+
RobotCoreException
java.lang.InterruptedException
FtcConfigurationActivity#doUSBScanAndUpdateUI()
protected void handleCommandDiscoverLynxModules(java.lang.String extra) + throws RobotCoreException, + java.lang.InterruptedException+
RobotCoreException
java.lang.InterruptedException
protected void sendUIState()+
sendUIState
in class FtcEventLoopBase
protected void handleCommandSetMatchNumber(java.lang.String extra)+
protected void handleCommandInitOpMode(java.lang.String extra)+
protected void handleCommandRunOpMode(java.lang.String extra)+
public void requestOpModeStop(OpMode opModeToStopIfActive)+
EventLoop
opModeToStopIfActive
- the OpMode to stop if it's currently activepublic void onUsbDeviceAttached(android.hardware.usb.UsbDevice usbDevice)+
usbDevice
- EventLoop.processedRecentlyAttachedUsbDevices()
protected SerialNumber getSerialNumberOfUsbDevice(android.hardware.usb.UsbDevice usbDevice)+
public void pendUsbDeviceAttachment(SerialNumber serialNumber, + long time, + java.util.concurrent.TimeUnit unit)+
public void processedRecentlyAttachedUsbDevices() + throws RobotCoreException, + java.lang.InterruptedException+
RobotCoreException
java.lang.InterruptedException
EventLoop.handleUsbModuleDetach(RobotUsbModule)
,
+EventLoop.onUsbDeviceAttached(UsbDevice)
public void handleUsbModuleDetach(RobotUsbModule module) + throws RobotCoreException, + java.lang.InterruptedException+
EventLoop
RobotCoreException
java.lang.InterruptedException
EventLoop.processedRecentlyAttachedUsbDevices()
public void handleUsbModuleAttach(RobotUsbModule module) + throws RobotCoreException, + java.lang.InterruptedException+
EventLoop
RobotCoreException
java.lang.InterruptedException
protected static class FtcEventLoopBase.LynxUsbDeviceContainer
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
protected LynxUsbDeviceImpl |
+lynxUsbDevice |
+
protected RobotUsbDevice |
+robotUsbDevice |
+
protected SerialNumber |
+serialNumber |
+
Constructor and Description | +
---|
LynxUsbDeviceContainer(LynxUsbDeviceImpl lynxUsbDevice,
+ SerialNumber serialNumber) |
+
LynxUsbDeviceContainer(RobotUsbDevice robotUsbDevice,
+ SerialNumber serialNumber) |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close() |
+
void |
+disengage() |
+
void |
+engage() |
+
RobotUsbDevice |
+getRobotUsbDevice() |
+
SerialNumber |
+getSerialNumber() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected final LynxUsbDeviceImpl lynxUsbDevice+
protected final RobotUsbDevice robotUsbDevice+
protected final SerialNumber serialNumber+
public LynxUsbDeviceContainer(LynxUsbDeviceImpl lynxUsbDevice, + SerialNumber serialNumber)+
public LynxUsbDeviceContainer(RobotUsbDevice robotUsbDevice, + SerialNumber serialNumber)+
public void close()+
public void disengage()+
public void engage()+
public RobotUsbDevice getRobotUsbDevice()+
public SerialNumber getSerialNumber()+
public abstract class FtcEventLoopBase +extends java.lang.Object +implements EventLoop+
FtcEventLoopBase
is an abstract base that handles defines core event processing
+ logic that's available whether or not a Robot is currently extant or notModifier and Type | +Class and Description | +
---|---|
protected static class |
+FtcEventLoopBase.LynxUsbDeviceContainer
+abstracts whether we've got a live LynxUsbDeviceImpl or we just opened something locally ourselves.
+ |
+
Modifier and Type | +Field and Description | +
---|---|
protected android.app.Activity |
+activityContext |
+
protected FtcEventLoopHandler |
+ftcEventLoopHandler |
+
protected NetworkConnectionHandler |
+networkConnectionHandler |
+
protected ProgrammingModeController |
+programmingModeController |
+
protected RegisteredOpModes |
+registeredOpModes |
+
protected RobotConfigFileManager |
+robotCfgFileMgr |
+
protected boolean |
+runningOnDriverStation |
+
static java.lang.String |
+TAG |
+
protected USBScanManager |
+usbScanManager |
+
protected OpModeRegister |
+userOpmodeRegister |
+
TELEMETRY_DEFAULT_INTERVAL
Modifier | +Constructor and Description | +
---|---|
protected |
+FtcEventLoopBase(HardwareFactory hardwareFactory,
+ OpModeRegister userOpmodeRegister,
+ UpdateUI.Callback callback,
+ android.app.Activity activityContext,
+ ProgrammingModeController programmingModeController) |
+
Modifier and Type | +Method and Description | +
---|---|
protected void |
+checkForChangedOpModes() |
+
protected boolean |
+enterFirmwareUpdateMode(RobotUsbDevice robotUsbDevice) |
+
protected FtcEventLoopBase.LynxUsbDeviceContainer |
+getLynxUsbDeviceForFirmwareUpdate(SerialNumber serialNumber) |
+
protected java.util.List<USBAccessibleLynxModule> |
+getUSBAccessibleLynxDevices(boolean forFirmwareUpdate) |
+
protected void |
+handleCommandActivateConfiguration(java.lang.String data) |
+
protected void |
+handleCommandClearRememberedGroups()
+Clear the list of remembered groups
+ |
+
protected void |
+handleCommandDeleteConfiguration(java.lang.String fileInfo) |
+
protected void |
+handleCommandDisconnectWifiDirect() |
+
protected void |
+handleCommandDismissAllDialogs(Command command) |
+
protected void |
+handleCommandDismissDialog(Command command) |
+
protected void |
+handleCommandDismissProgress(Command command) |
+
protected void |
+handleCommandGetCandidateLynxFirmwareImages(Command commandRequest) |
+
protected void |
+handleCommandGetUSBAccessibleLynxModules(Command commandRequest) |
+
protected void |
+handleCommandLynxChangeModuleAddresses(Command commandRequest) |
+
protected void |
+handleCommandLynxFirmwareUpdate(Command commandRequest)
+Update the firmware of the device indicated in the command.
+ |
+
protected void |
+handleCommandRequestAboutInfo(Command command) |
+
protected void |
+handleCommandRequestConfigurations()
+Serialize the entire list of config file metadata and send to the driver station
+ |
+
protected void |
+handleCommandRequestConfigurationTemplates()
+Serialize the entire list of config file metadata and send to the driver station
+ |
+
protected void |
+handleCommandRequestInspectionReport()
+Return an inspection report of this (robot controller) device back to the caller
+ |
+
protected void |
+handleCommandRequestParticularConfiguration(java.lang.String data) |
+
protected void |
+handleCommandRequestRememberedGroups()
+Serialize the list of remembered Wifi Direct groups and send it to the driver station
+ |
+
protected void |
+handleCommandRestartRobot() |
+
protected void |
+handleCommandSaveConfiguration(java.lang.String fileInfo) |
+
protected void |
+handleCommandShowDialog(Command command) |
+
protected void |
+handleCommandShowProgress(Command command) |
+
protected void |
+handleCommandShowToast(Command command) |
+
protected void |
+handleCommandStartDriverStationProgramAndManage() |
+
protected void |
+handleCommandStartProgrammingMode()
+Starts programming mode on the robot controller, as requested by driver station.
+ |
+
protected void |
+handleCommandStopProgrammingMode()
+Stops programming mode on the robot controller, as requested by driver station.
+ |
+
protected CallbackResult |
+handleCommandVisuallyConfirmWifiReset() |
+
protected CallbackResult |
+handleCommandVisuallyIdentify(Command command) |
+
void |
+init(EventLoopManager eventLoopManager)
+Init method, this will be called before the first call to loop.
+ |
+
CallbackResult |
+processCommand(Command command)
+Process command method, this will be called if the event loop manager receives a user defined
+ command.
+ |
+
protected void |
+sendUIState() |
+
protected USBScanManager |
+startUsbScanMangerIfNecessary() |
+
protected void |
+talkToParentLynxModule(DeviceManager deviceManager,
+ LynxUsbDevice lynxUsbDevice,
+ int moduleAddress,
+ Consumer<LynxModule> consumer) |
+
void |
+teardown()
+Teardown method, this will be called after the last call to loop.
+ |
+
protected boolean |
+updateFirmwareOnce(FtcEventLoopBase.LynxUsbDeviceContainer lynxUsbDevice,
+ java.lang.String imageFileName,
+ byte[] firmwareImage,
+ SerialNumber serialNumber) |
+
protected boolean |
+updateLynxFirmware(SerialNumber serialNumber,
+ com.qualcomm.ftccommon.CommandList.FWImage imageFileName)
+Updates the firmware of the Expansion Hub in the indicated USB-attached device
+ to be the indicated firmware.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getOpModeManager, handleUsbModuleAttach, handleUsbModuleDetach, loop, onUsbDeviceAttached, pendUsbDeviceAttachment, processedRecentlyAttachedUsbDevices, refreshUserTelemetry, requestOpModeStop
public static final java.lang.String TAG+
protected NetworkConnectionHandler networkConnectionHandler+
protected android.app.Activity activityContext+
protected RobotConfigFileManager robotCfgFileMgr+
protected FtcEventLoopHandler ftcEventLoopHandler+
protected boolean runningOnDriverStation+
protected final ProgrammingModeController programmingModeController+
protected USBScanManager usbScanManager+
protected final OpModeRegister userOpmodeRegister+
protected final RegisteredOpModes registeredOpModes+
protected FtcEventLoopBase(HardwareFactory hardwareFactory, + OpModeRegister userOpmodeRegister, + UpdateUI.Callback callback, + android.app.Activity activityContext, + ProgrammingModeController programmingModeController)+
protected USBScanManager startUsbScanMangerIfNecessary() + throws RobotCoreException+
RobotCoreException
public void teardown() + throws RobotCoreException, + java.lang.InterruptedException+
EventLoop
teardown
in interface EventLoop
RobotCoreException
- if a RobotCoreException is thrown, it will be handled by the event
+ loop manager. The manager will then attempt to shut down the robot without the benefit
+ of the teardown method.java.lang.InterruptedException
public CallbackResult processCommand(Command command) + throws java.lang.InterruptedException, + RobotCoreException+
EventLoop
processCommand
in interface EventLoop
command
- command to processjava.lang.InterruptedException
RobotCoreException
protected void handleCommandActivateConfiguration(java.lang.String data)+
protected void sendUIState()+
protected void checkForChangedOpModes()+
public void init(EventLoopManager eventLoopManager) + throws RobotCoreException, + java.lang.InterruptedException+
EventLoop
init
in interface EventLoop
eventLoopManager
- event loop manager that is responsible for this event loopRobotCoreException
- if a RobotCoreException is thrown, it will be handled
+ by the event loop manager. The manager will report that the robot failed
+ to start.java.lang.InterruptedException
protected void handleCommandRestartRobot()+
protected void handleCommandRequestParticularConfiguration(java.lang.String data)+
protected void handleCommandDeleteConfiguration(java.lang.String fileInfo)+
protected void handleCommandSaveConfiguration(java.lang.String fileInfo)+
protected void handleCommandRequestConfigurations()+
protected void handleCommandRequestRememberedGroups()+
protected void handleCommandClearRememberedGroups()+
protected void handleCommandLynxFirmwareUpdate(Command commandRequest)+
protected boolean updateLynxFirmware(SerialNumber serialNumber, + com.qualcomm.ftccommon.CommandList.FWImage imageFileName)+
protected boolean updateFirmwareOnce(FtcEventLoopBase.LynxUsbDeviceContainer lynxUsbDevice, + java.lang.String imageFileName, + byte[] firmwareImage, + SerialNumber serialNumber)+
protected boolean enterFirmwareUpdateMode(RobotUsbDevice robotUsbDevice)+
protected void handleCommandGetUSBAccessibleLynxModules(Command commandRequest)+
protected FtcEventLoopBase.LynxUsbDeviceContainer getLynxUsbDeviceForFirmwareUpdate(SerialNumber serialNumber)+
protected java.util.List<USBAccessibleLynxModule> getUSBAccessibleLynxDevices(boolean forFirmwareUpdate) + throws RobotCoreException+
RobotCoreException
protected void handleCommandLynxChangeModuleAddresses(Command commandRequest)+
protected void talkToParentLynxModule(DeviceManager deviceManager, + LynxUsbDevice lynxUsbDevice, + int moduleAddress, + Consumer<LynxModule> consumer) + throws RobotCoreException, + java.lang.InterruptedException, + LynxNackException+
RobotCoreException
java.lang.InterruptedException
LynxNackException
protected void handleCommandGetCandidateLynxFirmwareImages(Command commandRequest)+
protected void handleCommandRequestConfigurationTemplates()+
protected void handleCommandStartProgrammingMode()+
protected void handleCommandStartDriverStationProgramAndManage()+
protected void handleCommandStopProgrammingMode()+
protected void handleCommandShowDialog(Command command)+
protected void handleCommandDismissDialog(Command command)+
protected void handleCommandDismissAllDialogs(Command command)+
protected void handleCommandShowProgress(Command command)+
protected void handleCommandDismissProgress(Command command)+
protected void handleCommandShowToast(Command command)+
protected void handleCommandRequestInspectionReport()+
protected void handleCommandRequestAboutInfo(Command command)+
protected void handleCommandDisconnectWifiDirect()+
protected CallbackResult handleCommandVisuallyIdentify(Command command)+
protected CallbackResult handleCommandVisuallyConfirmWifiReset()+
public class FtcEventLoopHandler
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
protected UpdateUI.Callback |
+callback |
+
protected static boolean |
+DEBUG |
+
protected EventLoopManager |
+eventLoopManager |
+
protected HardwareFactory |
+hardwareFactory |
+
protected HardwareMap |
+hardwareMap
+the actual hardware map seen by the user
+ |
+
protected HardwareMap |
+hardwareMapExtra
+the hardware map in which we keep any extra devices (ones not used by the user) we need to instantiate
+ |
+
static java.lang.String |
+NO_VOLTAGE_SENSOR
+This string is sent in the robot battery telemetry payload to identify
+ that no voltage sensor is available on the robot.
+ |
+
protected java.lang.Object |
+refreshUserTelemetryLock |
+
protected double |
+robotBatteryInterval |
+
protected double |
+robotBatteryLoggingInterval |
+
protected ElapsedTime |
+robotBatteryLoggingTimer |
+
protected MovingStatistics |
+robotBatteryStatistics |
+
protected ElapsedTime |
+robotBatteryTimer |
+
protected BatteryChecker |
+robotControllerBatteryChecker |
+
protected double |
+robotControllerBatteryCheckerInterval |
+
protected android.content.Context |
+robotControllerContext |
+
static java.lang.String |
+TAG |
+
protected double |
+updateUIInterval |
+
protected ElapsedTime |
+updateUITimer |
+
protected double |
+userTelemetryInterval |
+
protected ElapsedTime |
+userTelemetryTimer |
+
Constructor and Description | +
---|
FtcEventLoopHandler(HardwareFactory hardwareFactory,
+ UpdateUI.Callback callback,
+ android.content.Context robotControllerContext) |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close() |
+
protected static void |
+closeAutoCloseOnTeardown(HardwareMap hardwareMap) |
+
protected void |
+closeBatteryMonitoring() |
+
protected static void |
+closeHardwareMap(HardwareMap hardwareMap) |
+
protected static void |
+closeMotorControllers(HardwareMap hardwareMap) |
+
protected static void |
+closeServoControllers(HardwareMap hardwareMap) |
+
void |
+displayGamePadInfo(java.lang.String activeOpModeName) |
+
EventLoopManager |
+getEventLoopManager() |
+
java.util.List<LynxUsbDeviceImpl> |
+getExtantLynxDeviceImpls() |
+
Gamepad[] |
+getGamepads() |
+
<T> T |
+getHardwareDevice(java.lang.Class<? extends T> classOrInterface,
+ SerialNumber serialNumber,
+ <any> usbScanManagerSupplier)
+Returns the device whose serial number is the one indicated, from the hardware map if possible
+ but instantiating / opening it if necessary.
+ |
+
HardwareMap |
+getHardwareMap() |
+
java.lang.String |
+getOpMode(java.lang.String extra) |
+
void |
+init(EventLoopManager eventLoopManager) |
+
void |
+refreshUserTelemetry(TelemetryMessage telemetry,
+ double requestedInterval)
+Updates the (indicated) user's telemetry: the telemetry is transmitted if a sufficient
+ interval has passed since the last transmission.
+ |
+
void |
+restartRobot() |
+
void |
+sendBatteryInfo()
+Send robot phone power % and robot battery voltage level to Driver station
+ |
+
void |
+sendTelemetry(java.lang.String tag,
+ java.lang.String msg) |
+
void |
+updateBatteryStatus(BatteryChecker.BatteryStatus status) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String TAG+
public static final java.lang.String NO_VOLTAGE_SENSOR+
protected static final boolean DEBUG+
protected final UpdateUI.Callback callback+
protected final HardwareFactory hardwareFactory+
protected final android.content.Context robotControllerContext+
protected EventLoopManager eventLoopManager+
protected BatteryChecker robotControllerBatteryChecker+
protected double robotControllerBatteryCheckerInterval+
protected ElapsedTime robotBatteryTimer+
protected double robotBatteryInterval+
protected MovingStatistics robotBatteryStatistics+
protected ElapsedTime robotBatteryLoggingTimer+
protected double robotBatteryLoggingInterval+
protected ElapsedTime userTelemetryTimer+
protected double userTelemetryInterval+
protected final java.lang.Object refreshUserTelemetryLock+
protected ElapsedTime updateUITimer+
protected double updateUIInterval+
protected HardwareMap hardwareMap+
protected HardwareMap hardwareMapExtra+
public FtcEventLoopHandler(HardwareFactory hardwareFactory, + UpdateUI.Callback callback, + android.content.Context robotControllerContext)+
public void init(EventLoopManager eventLoopManager)+
public void close()+
protected static void closeHardwareMap(HardwareMap hardwareMap)+
public EventLoopManager getEventLoopManager()+
public HardwareMap getHardwareMap() + throws RobotCoreException, + java.lang.InterruptedException+
RobotCoreException
java.lang.InterruptedException
public java.util.List<LynxUsbDeviceImpl> getExtantLynxDeviceImpls()+
public <T> T getHardwareDevice(java.lang.Class<? extends T> classOrInterface, + SerialNumber serialNumber, + <any> usbScanManagerSupplier)+
classOrInterface
- the interface to retrieve on the returned objectserialNumber
- the serial number of the object to retrieveusbScanManagerSupplier
- how to get a USBScanManager
if it ends up we need onepublic void displayGamePadInfo(java.lang.String activeOpModeName)+
public Gamepad[] getGamepads()+
public void refreshUserTelemetry(TelemetryMessage telemetry, + double requestedInterval)+
telemetry
- the telemetry data to sendrequestedInterval
- the minimum interval (s) since the last transmission. NaN indicates
+ that a default transmission interval should be usedEventLoop.TELEMETRY_DEFAULT_INTERVAL
public void sendBatteryInfo()+
public void sendTelemetry(java.lang.String tag, + java.lang.String msg)+
protected static void closeMotorControllers(HardwareMap hardwareMap)+
protected static void closeServoControllers(HardwareMap hardwareMap)+
protected static void closeAutoCloseOnTeardown(HardwareMap hardwareMap)+
protected void closeBatteryMonitoring()+
public void restartRobot()+
public java.lang.String getOpMode(java.lang.String extra)+
public void updateBatteryStatus(BatteryChecker.BatteryStatus status)+
public class FtcEventLoopIdle +extends FtcEventLoopBase+
FtcEventLoopIdle
is an eventloop that runs whenever a full FtcEventLoop
+ is inappropriate.
+
+ This event loop should be robust in the face of errors and exceptions, staying up until
+ it's explicitly shut down.FtcEventLoopBase.LynxUsbDeviceContainer
Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+TAG |
+
activityContext, ftcEventLoopHandler, networkConnectionHandler, programmingModeController, registeredOpModes, robotCfgFileMgr, runningOnDriverStation, usbScanManager, userOpmodeRegister
TELEMETRY_DEFAULT_INTERVAL
Constructor and Description | +
---|
FtcEventLoopIdle(HardwareFactory hardwareFactory,
+ OpModeRegister userOpmodeRegister,
+ UpdateUI.Callback callback,
+ android.app.Activity activityContext,
+ ProgrammingModeController programmingModeController) |
+
Modifier and Type | +Method and Description | +
---|---|
OpModeManagerImpl |
+getOpModeManager()
+Returns the OpModeManager associated with this event loop
+ |
+
void |
+handleUsbModuleAttach(RobotUsbModule module)
+Process the fact that (we believe) that the indicated module has now reappeared after a
+ previously observed detachment.
+ |
+
void |
+handleUsbModuleDetach(RobotUsbModule module)
+Process the fact that a usb module has now become detached from the system.
+ |
+
void |
+init(EventLoopManager eventLoopManager)
+Init method, this will be called before the first call to loop.
+ |
+
void |
+loop()
+This method will be repeatedly called by the event loop manager.
+ |
+
void |
+onUsbDeviceAttached(android.hardware.usb.UsbDevice usbDevice)
+Notifies the event loop that a UsbDevice has just been attached to the system.
+ |
+
void |
+pendUsbDeviceAttachment(SerialNumber serialNumber,
+ long time,
+ java.util.concurrent.TimeUnit unit) |
+
void |
+processedRecentlyAttachedUsbDevices()
+Process the batch of newly arrived USB devices.
+ |
+
void |
+refreshUserTelemetry(TelemetryMessage telemetry,
+ double sInterval)
+Update's the user portion of the driver station screen with the contents of the telemetry object
+ here provided if a sufficiently long duration has passed since the last update.
+ |
+
void |
+requestOpModeStop(OpMode opModeToStopIfActive)
+Requests that an OpMode be stopped if it's the currently active one
+ |
+
void |
+teardown()
+Teardown method, this will be called after the last call to loop.
+ |
+
checkForChangedOpModes, enterFirmwareUpdateMode, getLynxUsbDeviceForFirmwareUpdate, getUSBAccessibleLynxDevices, handleCommandActivateConfiguration, handleCommandClearRememberedGroups, handleCommandDeleteConfiguration, handleCommandDisconnectWifiDirect, handleCommandDismissAllDialogs, handleCommandDismissDialog, handleCommandDismissProgress, handleCommandGetCandidateLynxFirmwareImages, handleCommandGetUSBAccessibleLynxModules, handleCommandLynxChangeModuleAddresses, handleCommandLynxFirmwareUpdate, handleCommandRequestAboutInfo, handleCommandRequestConfigurations, handleCommandRequestConfigurationTemplates, handleCommandRequestInspectionReport, handleCommandRequestParticularConfiguration, handleCommandRequestRememberedGroups, handleCommandRestartRobot, handleCommandSaveConfiguration, handleCommandShowDialog, handleCommandShowProgress, handleCommandShowToast, handleCommandStartDriverStationProgramAndManage, handleCommandStartProgrammingMode, handleCommandStopProgrammingMode, handleCommandVisuallyConfirmWifiReset, handleCommandVisuallyIdentify, processCommand, sendUIState, startUsbScanMangerIfNecessary, talkToParentLynxModule, updateFirmwareOnce, updateLynxFirmware
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String TAG+
public FtcEventLoopIdle(HardwareFactory hardwareFactory, + OpModeRegister userOpmodeRegister, + UpdateUI.Callback callback, + android.app.Activity activityContext, + ProgrammingModeController programmingModeController)+
public void init(EventLoopManager eventLoopManager) + throws RobotCoreException, + java.lang.InterruptedException+
EventLoop
init
in interface EventLoop
init
in class FtcEventLoopBase
eventLoopManager
- event loop manager that is responsible for this event loopRobotCoreException
- if a RobotCoreException is thrown, it will be handled
+ by the event loop manager. The manager will report that the robot failed
+ to start.java.lang.InterruptedException
public void loop() + throws RobotCoreException, + java.lang.InterruptedException+
EventLoop
RobotCoreException
- if a RobotCoreException is thrown, it will be handled
+ by the event loop manager. The manager may decide to either stop processing
+ this iteration of the loop, or it may decide to shut down the robot.java.lang.InterruptedException
public void refreshUserTelemetry(TelemetryMessage telemetry, + double sInterval)+
EventLoop
telemetry
- the telemetry object to sendsInterval
- the required minimum interval. NaN indicates that a system default interval should be used.public void teardown() + throws RobotCoreException, + java.lang.InterruptedException+
EventLoop
teardown
in interface EventLoop
teardown
in class FtcEventLoopBase
RobotCoreException
- if a RobotCoreException is thrown, it will be handled by the event
+ loop manager. The manager will then attempt to shut down the robot without the benefit
+ of the teardown method.java.lang.InterruptedException
public void pendUsbDeviceAttachment(SerialNumber serialNumber, + long time, + java.util.concurrent.TimeUnit unit)+
public void onUsbDeviceAttached(android.hardware.usb.UsbDevice usbDevice)+
EventLoop
+ Implementations of this method should avoid doing significant processing during this notification. + Rather, they should squirrel the device away for processing during a later processedRecentlyAttachedUsbDevices + call. +
usbDevice
- the newly arrived deviceEventLoop.processedRecentlyAttachedUsbDevices()
public void processedRecentlyAttachedUsbDevices() + throws RobotCoreException, + java.lang.InterruptedException+
EventLoop
RobotCoreException
java.lang.InterruptedException
EventLoop.handleUsbModuleDetach(RobotUsbModule)
,
+EventLoop.onUsbDeviceAttached(UsbDevice)
public void handleUsbModuleDetach(RobotUsbModule module) + throws RobotCoreException, + java.lang.InterruptedException+
EventLoop
RobotCoreException
java.lang.InterruptedException
EventLoop.processedRecentlyAttachedUsbDevices()
public void handleUsbModuleAttach(RobotUsbModule module) + throws RobotCoreException, + java.lang.InterruptedException+
EventLoop
RobotCoreException
java.lang.InterruptedException
public OpModeManagerImpl getOpModeManager()+
EventLoop
protected static enum FtcLynxFirmwareUpdateActivity.FwResponseStatus +extends java.lang.Enum<FtcLynxFirmwareUpdateActivity.FwResponseStatus>+
Enum Constant and Description | +
---|
Cancelled |
+
Succeeded |
+
TimedOut |
+
Modifier and Type | +Method and Description | +
---|---|
static FtcLynxFirmwareUpdateActivity.FwResponseStatus |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static FtcLynxFirmwareUpdateActivity.FwResponseStatus[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final FtcLynxFirmwareUpdateActivity.FwResponseStatus Succeeded+
public static final FtcLynxFirmwareUpdateActivity.FwResponseStatus TimedOut+
public static final FtcLynxFirmwareUpdateActivity.FwResponseStatus Cancelled+
public static FtcLynxFirmwareUpdateActivity.FwResponseStatus[] values()+
+for (FtcLynxFirmwareUpdateActivity.FwResponseStatus c : FtcLynxFirmwareUpdateActivity.FwResponseStatus.values()) + System.out.println(c); +
public static FtcLynxFirmwareUpdateActivity.FwResponseStatus valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullprotected class FtcLynxFirmwareUpdateActivity.ReceiveLoopCallback
+extends RecvLoopRunnable.DegenerateCallback
+Modifier | +Constructor and Description | +
---|---|
protected |
+ReceiveLoopCallback() |
+
Modifier and Type | +Method and Description | +
---|---|
CallbackResult |
+commandEvent(Command command) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public CallbackResult commandEvent(Command command) + throws RobotCoreException+
RobotCoreException
public class FtcLynxFirmwareUpdateActivity
+extends ThemedActivity
+FtcLynxFirmwareUpdateActivity
manages the updating of the firmware on
+ all available attached lynx modules.Modifier and Type | +Class and Description | +
---|---|
protected static class |
+FtcLynxFirmwareUpdateActivity.FwResponseStatus |
+
protected class |
+FtcLynxFirmwareUpdateActivity.ReceiveLoopCallback |
+
Modifier and Type | +Field and Description | +
---|---|
protected java.util.concurrent.BlockingQueue<CommandList.LynxFirmwareUpdateResp> |
+availableFWUpdateResps |
+
protected java.util.concurrent.BlockingQueue<CommandList.LynxFirmwareImagesResp> |
+availableLynxImages |
+
protected java.util.concurrent.BlockingQueue<CommandList.USBAccessibleLynxModulesResp> |
+availableLynxModules |
+
protected boolean |
+cancelUpdate |
+
protected boolean |
+enableUpdateButton |
+
protected FWImage |
+firmwareImageFile |
+
protected java.util.List<USBAccessibleLynxModule> |
+modulesToUpdate |
+
protected int |
+msResponseWait |
+
protected NetworkConnectionHandler |
+networkConnectionHandler |
+
protected RecvLoopRunnable.RecvLoopCallback |
+recvLoopCallback |
+
protected boolean |
+remoteConfigure |
+
static java.lang.String |
+TAG |
+
Constructor and Description | +
---|
FtcLynxFirmwareUpdateActivity() |
+
Modifier and Type | +Method and Description | +
---|---|
protected <T> T |
+awaitResponse(java.util.concurrent.BlockingQueue<T> queue,
+ T defaultResponse) |
+
protected <T> T |
+awaitResponse(java.util.concurrent.BlockingQueue<T> queue,
+ T defaultResponse,
+ long time,
+ java.util.concurrent.TimeUnit timeUnit,
+ <any> status) |
+
protected CommandList.LynxFirmwareImagesResp |
+getCandidateLynxFirmwareImages() |
+
protected java.util.List<USBAccessibleLynxModule> |
+getLynxModulesForFirmwareUpdate() |
+
java.lang.String |
+getTag() |
+
static void |
+initializeDirectories() |
+
protected void |
+onCreate(android.os.Bundle savedInstanceState) |
+
protected void |
+onDestroy() |
+
protected void |
+onPause() |
+
protected void |
+onStart() |
+
protected void |
+onStop() |
+
void |
+onUpdateLynxFirmwareClicked(android.view.View view) |
+
protected void |
+sendOrInject(Command cmd) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String TAG+
protected NetworkConnectionHandler networkConnectionHandler+
protected RecvLoopRunnable.RecvLoopCallback recvLoopCallback+
protected boolean remoteConfigure+
protected int msResponseWait+
protected FWImage firmwareImageFile+
protected java.util.List<USBAccessibleLynxModule> modulesToUpdate+
protected boolean enableUpdateButton+
protected boolean cancelUpdate+
protected java.util.concurrent.BlockingQueue<CommandList.LynxFirmwareImagesResp> availableLynxImages+
protected java.util.concurrent.BlockingQueue<CommandList.USBAccessibleLynxModulesResp> availableLynxModules+
protected java.util.concurrent.BlockingQueue<CommandList.LynxFirmwareUpdateResp> availableFWUpdateResps+
public FtcLynxFirmwareUpdateActivity()+
public java.lang.String getTag()+
public static void initializeDirectories()+
protected void onCreate(android.os.Bundle savedInstanceState)+
protected void onStart()+
protected void onDestroy()+
public void onUpdateLynxFirmwareClicked(android.view.View view)+
protected void onPause()+
protected void onStop()+
protected CommandList.LynxFirmwareImagesResp getCandidateLynxFirmwareImages()+
protected java.util.List<USBAccessibleLynxModule> getLynxModulesForFirmwareUpdate()+
protected void sendOrInject(Command cmd)+
protected <T> T awaitResponse(java.util.concurrent.BlockingQueue<T> queue, + T defaultResponse)+
protected <T> T awaitResponse(java.util.concurrent.BlockingQueue<T> queue, + T defaultResponse, + long time, + java.util.concurrent.TimeUnit timeUnit, + <any> status)+
protected class FtcLynxModuleAddressUpdateActivity.AddressAndDisplayName +extends java.lang.Object +implements java.lang.Comparable<FtcLynxModuleAddressUpdateActivity.AddressAndDisplayName>+
Modifier and Type | +Field and Description | +
---|---|
int |
+address |
+
java.lang.String |
+displayName |
+
Constructor and Description | +
---|
AddressAndDisplayName(int address,
+ boolean changeable) |
+
Modifier and Type | +Method and Description | +
---|---|
int |
+compareTo(FtcLynxModuleAddressUpdateActivity.AddressAndDisplayName another) |
+
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public final java.lang.String displayName+
public final int address+
public AddressAndDisplayName(int address, + boolean changeable)+
public java.lang.String toString()+
toString
in class java.lang.Object
public int compareTo(FtcLynxModuleAddressUpdateActivity.AddressAndDisplayName another)+
compareTo
in interface java.lang.Comparable<FtcLynxModuleAddressUpdateActivity.AddressAndDisplayName>
protected class FtcLynxModuleAddressUpdateActivity.AddressConfiguration
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
protected java.util.Map<SerialNumber,java.lang.Integer> |
+current |
+
protected java.util.Map<SerialNumber,java.lang.Integer> |
+starting |
+
Constructor and Description | +
---|
AddressConfiguration() |
+
AddressConfiguration(java.util.List<USBAccessibleLynxModule> modules) |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+containsCurrentAddress(int address) |
+
SerialNumber |
+findByCurrentAddress(int address) |
+
int |
+getCurrentAddress(SerialNumber serialNumber) |
+
int |
+getStartingAddress(SerialNumber serialNumber) |
+
void |
+putCurrentAddress(SerialNumber serialNumber,
+ int address) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected java.util.Map<SerialNumber,java.lang.Integer> starting+
protected java.util.Map<SerialNumber,java.lang.Integer> current+
public AddressConfiguration()+
public AddressConfiguration(java.util.List<USBAccessibleLynxModule> modules)+
public int getStartingAddress(SerialNumber serialNumber)+
public boolean containsCurrentAddress(int address)+
public void putCurrentAddress(SerialNumber serialNumber, + int address)+
public int getCurrentAddress(SerialNumber serialNumber)+
public SerialNumber findByCurrentAddress(int address)+
protected class FtcLynxModuleAddressUpdateActivity.DisplayedModule
+extends java.lang.Object
+Constructor and Description | +
---|
DisplayedModule(android.view.View view) |
+
Modifier and Type | +Method and Description | +
---|---|
int |
+getCurrentAddress() |
+
protected FtcLynxModuleAddressUpdateActivity.AddressAndDisplayName |
+getItem(int position) |
+
SerialNumber |
+getSerialNumber() |
+
int |
+getStartingAddress() |
+
void |
+initialize(USBAccessibleLynxModule module,
+ java.util.List<java.lang.Integer> addresses) |
+
protected void |
+initializeSpinnerList(android.widget.Spinner spinner,
+ java.util.List<java.lang.Integer> addresses,
+ boolean changeable) |
+
protected void |
+selectNoChange() |
+
void |
+setNewAddress(int newAddress) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public DisplayedModule(android.view.View view)+
public SerialNumber getSerialNumber()+
public void initialize(USBAccessibleLynxModule module, + java.util.List<java.lang.Integer> addresses)+
public void setNewAddress(int newAddress)+
protected void selectNoChange()+
protected FtcLynxModuleAddressUpdateActivity.AddressAndDisplayName getItem(int position)+
public int getCurrentAddress()+
public int getStartingAddress()+
protected void initializeSpinnerList(android.widget.Spinner spinner, + java.util.List<java.lang.Integer> addresses, + boolean changeable)+
protected class FtcLynxModuleAddressUpdateActivity.DisplayedModuleList
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
protected FtcLynxModuleAddressUpdateActivity.AddressConfiguration |
+currentAddressConfiguration |
+
protected int |
+lastModuleAddressChoice |
+
protected android.view.ViewGroup |
+moduleList |
+
Modifier | +Constructor and Description | +
---|---|
protected |
+DisplayedModuleList() |
+
Modifier and Type | +Method and Description | +
---|---|
protected void |
+add(USBAccessibleLynxModule module,
+ java.util.List<java.lang.Integer> addresses) |
+
void |
+changeAddress(SerialNumber serialNumber,
+ int newAddress) |
+
protected int |
+findUnusedAddress() |
+
protected FtcLynxModuleAddressUpdateActivity.DisplayedModule |
+from(SerialNumber serialNumber) |
+
void |
+initialize(java.util.List<USBAccessibleLynxModule> modules) |
+
protected int |
+size() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected int lastModuleAddressChoice+
protected FtcLynxModuleAddressUpdateActivity.AddressConfiguration currentAddressConfiguration+
protected android.view.ViewGroup moduleList+
public void initialize(java.util.List<USBAccessibleLynxModule> modules)+
protected int size()+
protected void add(USBAccessibleLynxModule module, + java.util.List<java.lang.Integer> addresses)+
protected FtcLynxModuleAddressUpdateActivity.DisplayedModule from(SerialNumber serialNumber)+
public void changeAddress(SerialNumber serialNumber, + int newAddress)+
protected int findUnusedAddress()+
protected class FtcLynxModuleAddressUpdateActivity.ReceiveLoopCallback
+extends RecvLoopRunnable.DegenerateCallback
+Modifier | +Constructor and Description | +
---|---|
protected |
+ReceiveLoopCallback() |
+
Modifier and Type | +Method and Description | +
---|---|
CallbackResult |
+commandEvent(Command command) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public CallbackResult commandEvent(Command command) + throws RobotCoreException+
RobotCoreException
public class FtcLynxModuleAddressUpdateActivity
+extends EditActivity
+FtcLynxModuleAddressUpdateActivity
provides a means by which users can update
+ the (persistently stored) address of a Lynx ModuleModifier and Type | +Class and Description | +
---|---|
protected class |
+FtcLynxModuleAddressUpdateActivity.AddressAndDisplayName |
+
protected class |
+FtcLynxModuleAddressUpdateActivity.AddressConfiguration |
+
protected class |
+FtcLynxModuleAddressUpdateActivity.DisplayedModule |
+
protected class |
+FtcLynxModuleAddressUpdateActivity.DisplayedModuleList |
+
protected class |
+FtcLynxModuleAddressUpdateActivity.ReceiveLoopCallback |
+
Modifier and Type | +Field and Description | +
---|---|
protected java.util.concurrent.BlockingQueue<CommandList.USBAccessibleLynxModulesResp> |
+availableLynxModules |
+
protected java.util.List<USBAccessibleLynxModule> |
+currentModules |
+
protected FtcLynxModuleAddressUpdateActivity.DisplayedModuleList |
+displayedModuleList |
+
protected int |
+msResponseWait |
+
protected NetworkConnectionHandler |
+networkConnectionHandler |
+
protected RecvLoopRunnable.RecvLoopCallback |
+recvLoopCallback |
+
static java.lang.String |
+TAG |
+
Constructor and Description | +
---|
FtcLynxModuleAddressUpdateActivity() |
+
Modifier and Type | +Method and Description | +
---|---|
protected <T> T |
+awaitResponse(java.util.concurrent.BlockingQueue<T> queue,
+ T defaultResponse) |
+
protected <T> T |
+awaitResponse(java.util.concurrent.BlockingQueue<T> queue,
+ T defaultResponse,
+ long time,
+ java.util.concurrent.TimeUnit timeUnit) |
+
protected void |
+doBackOrCancel() |
+
java.lang.String |
+getTag() |
+
protected java.util.List<USBAccessibleLynxModule> |
+getUSBAccessibleLynxModules() |
+
protected boolean |
+isDirty() |
+
void |
+onBackPressed() |
+
void |
+onCancelButtonPressed(android.view.View view) |
+
protected void |
+onCreate(android.os.Bundle savedInstanceState) |
+
protected void |
+onDestroy() |
+
void |
+onDoneButtonPressed(android.view.View view) |
+
protected void |
+onStart() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String TAG+
protected NetworkConnectionHandler networkConnectionHandler+
protected RecvLoopRunnable.RecvLoopCallback recvLoopCallback+
protected int msResponseWait+
protected java.util.concurrent.BlockingQueue<CommandList.USBAccessibleLynxModulesResp> availableLynxModules+
protected java.util.List<USBAccessibleLynxModule> currentModules+
protected FtcLynxModuleAddressUpdateActivity.DisplayedModuleList displayedModuleList+
public FtcLynxModuleAddressUpdateActivity()+
public java.lang.String getTag()+
protected void onCreate(android.os.Bundle savedInstanceState)+
protected void onStart()+
protected void onDestroy()+
protected boolean isDirty()+
public void onDoneButtonPressed(android.view.View view)+
public void onCancelButtonPressed(android.view.View view)+
public void onBackPressed()+
protected void doBackOrCancel()+
protected java.util.List<USBAccessibleLynxModule> getUSBAccessibleLynxModules()+
protected <T> T awaitResponse(java.util.concurrent.BlockingQueue<T> queue, + T defaultResponse)+
protected <T> T awaitResponse(java.util.concurrent.BlockingQueue<T> queue, + T defaultResponse, + long time, + java.util.concurrent.TimeUnit timeUnit)+
public class FtcRobotControllerService.FtcRobotControllerBinder
+extends android.os.Binder
+android.os.IBinder.DeathRecipient
DUMP_TRANSACTION, FIRST_CALL_TRANSACTION, FLAG_ONEWAY, INTERFACE_TRANSACTION, LAST_CALL_TRANSACTION, LIKE_TRANSACTION, PING_TRANSACTION, TWEET_TRANSACTION
Constructor and Description | +
---|
FtcRobotControllerBinder() |
+
Modifier and Type | +Method and Description | +
---|---|
FtcRobotControllerService |
+getService() |
+
attachInterface, clearCallingIdentity, dump, dump, dumpAsync, finalize, flushPendingCommands, getCallingPid, getCallingUid, getCallingUserHandle, getInterfaceDescriptor, isBinderAlive, joinThreadPool, linkToDeath, onTransact, pingBinder, queryLocalInterface, restoreCallingIdentity, transact, unlinkToDeath
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public FtcRobotControllerBinder()+
public FtcRobotControllerService getService()+
public class FtcRobotControllerService +extends android.app.Service +implements EventLoopManagerClient+
Modifier and Type | +Class and Description | +
---|---|
class |
+FtcRobotControllerService.FtcRobotControllerBinder |
+
Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+TAG |
+
START_CONTINUATION_MASK, START_FLAG_REDELIVERY, START_FLAG_RETRY, START_NOT_STICKY, START_REDELIVER_INTENT, START_STICKY, START_STICKY_COMPATIBILITY
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APP_OPS_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, FINGERPRINT_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MIDI_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_STATS_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, STORAGE_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
Constructor and Description | +
---|
FtcRobotControllerService() |
+
Modifier and Type | +Method and Description | +
---|---|
NetworkConnection |
+getNetworkConnection() |
+
NetworkConnection.NetworkEvent |
+getNetworkConnectionStatus() |
+
Robot |
+getRobot() |
+
RobotStatus |
+getRobotStatus() |
+
WebServer |
+getWebServer() |
+
android.os.IBinder |
+onBind(android.content.Intent intent) |
+
void |
+onCreate() |
+
void |
+onDestroy() |
+
CallbackResult |
+onNetworkConnectionEvent(NetworkConnection.NetworkEvent event) |
+
void |
+onReceive(android.content.Context context,
+ android.content.Intent intent) |
+
int |
+onStartCommand(android.content.Intent intent,
+ int flags,
+ int startId) |
+
boolean |
+onUnbind(android.content.Intent intent) |
+
void |
+setCallback(UpdateUI.Callback callback) |
+
void |
+setupRobot(EventLoop eventLoop,
+ EventLoop idleEventLoop,
+ java.lang.Runnable runOnComplete) |
+
void |
+shutdownRobot() |
+
protected void |
+startLEDS() |
+
protected void |
+stopLEDS() |
+
dump, getApplication, onConfigurationChanged, onLowMemory, onRebind, onStart, onTaskRemoved, onTrimMemory, startForeground, stopForeground, stopSelf, stopSelf, stopSelfResult
attachBaseContext, bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, clearWallpaper, createConfigurationContext, createDisplayContext, createPackageContext, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDatabasePath, getDir, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getFileStreamPath, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getSystemService, getSystemServiceName, getTheme, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isRestricted, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setTheme, setWallpaper, setWallpaper, startActivities, startActivities, startActivity, startActivity, startInstrumentation, startIntentSender, startIntentSender, startService, stopService, unbindService, unregisterReceiver
getColor, getColorStateList, getDrawable, getString, getString, getSystemService, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, unregisterComponentCallbacks
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String TAG+
public FtcRobotControllerService()+
public void onReceive(android.content.Context context, + android.content.Intent intent)+
public NetworkConnection getNetworkConnection()+
public NetworkConnection.NetworkEvent getNetworkConnectionStatus()+
public RobotStatus getRobotStatus()+
public Robot getRobot()+
public WebServer getWebServer()+
getWebServer
in interface EventLoopManagerClient
public void onCreate()+
onCreate
in class android.app.Service
public int onStartCommand(android.content.Intent intent, + int flags, + int startId)+
onStartCommand
in class android.app.Service
public android.os.IBinder onBind(android.content.Intent intent)+
onBind
in class android.app.Service
public boolean onUnbind(android.content.Intent intent)+
onUnbind
in class android.app.Service
public void onDestroy()+
onDestroy
in class android.app.Service
protected void startLEDS()+
protected void stopLEDS()+
public void setCallback(UpdateUI.Callback callback)+
public void setupRobot(EventLoop eventLoop, + EventLoop idleEventLoop, + java.lang.Runnable runOnComplete)+
public void shutdownRobot()+
public CallbackResult onNetworkConnectionEvent(NetworkConnection.NetworkEvent event)+
public static class FtcRobotControllerSettingsActivity.SettingsFragment
+extends android.preference.PreferenceFragment
+android.preference.PreferenceFragment.OnPreferenceStartFragmentCallback
android.app.Fragment.InstantiationException, android.app.Fragment.SavedState
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
Constructor and Description | +
---|
SettingsFragment() |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+onActivityResult(int request,
+ int result,
+ android.content.Intent intent) |
+
void |
+onCreate(android.os.Bundle savedInstanceState) |
+
addPreferencesFromIntent, addPreferencesFromResource, findPreference, getPreferenceManager, getPreferenceScreen, onActivityCreated, onCreateView, onDestroy, onDestroyView, onPreferenceTreeClick, onSaveInstanceState, onStart, onStop, setPreferenceScreen
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, hashCode, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isRemoving, isResumed, isVisible, onAttach, onAttach, onConfigurationChanged, onContextItemSelected, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroyOptionsMenu, onDetach, onHiddenChanged, onInflate, onInflate, onInflate, onLowMemory, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPrepareOptionsMenu, onRequestPermissionsResult, onResume, onTrimMemory, onViewCreated, onViewStateRestored, registerForContextMenu, requestPermissions, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, toString, unregisterForContextMenu
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
public void onCreate(android.os.Bundle savedInstanceState)+
onCreate
in class android.preference.PreferenceFragment
public void onActivityResult(int request, + int result, + android.content.Intent intent)+
onActivityResult
in class android.preference.PreferenceFragment
public class FtcRobotControllerSettingsActivity
+extends ThemedActivity
+Modifier and Type | +Class and Description | +
---|---|
static class |
+FtcRobotControllerSettingsActivity.SettingsFragment |
+
Constructor and Description | +
---|
FtcRobotControllerSettingsActivity() |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+getTag() |
+
protected void |
+onCreate(android.os.Bundle savedInstanceState) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected class FtcWifiDirectChannelSelectorActivity.WifiChannelItemAdapter
+extends android.widget.ArrayAdapter<WifiDirectChannelAndDescription>
+IGNORE_ITEM_VIEW_TYPE, NO_SELECTION
Constructor and Description | +
---|
WifiChannelItemAdapter(android.content.Context context,
+ int resource,
+ WifiDirectChannelAndDescription[] objects) |
+
Modifier and Type | +Method and Description | +
---|---|
android.view.View |
+getView(int position,
+ android.view.View convertView,
+ android.view.ViewGroup parent) |
+
add, addAll, addAll, clear, createFromResource, getContext, getCount, getDropDownView, getDropDownViewTheme, getFilter, getItem, getItemId, getPosition, insert, notifyDataSetChanged, remove, setDropDownViewResource, setDropDownViewTheme, setNotifyOnChange, sort
areAllItemsEnabled, getItemViewType, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetInvalidated, registerDataSetObserver, unregisterDataSetObserver
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getItemViewType, getViewTypeCount, hasStableIds, isEmpty, registerDataSetObserver, unregisterDataSetObserver
public WifiChannelItemAdapter(android.content.Context context, + int resource, + WifiDirectChannelAndDescription[] objects)+
public android.view.View getView(int position, + android.view.View convertView, + android.view.ViewGroup parent)+
getView
in interface android.widget.Adapter
getView
in class android.widget.ArrayAdapter<WifiDirectChannelAndDescription>
public class FtcWifiDirectChannelSelectorActivity
+extends ThemedActivity
+implements android.widget.AdapterView.OnItemClickListener
+Modifier and Type | +Class and Description | +
---|---|
protected class |
+FtcWifiDirectChannelSelectorActivity.WifiChannelItemAdapter |
+
Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+TAG |
+
Constructor and Description | +
---|
FtcWifiDirectChannelSelectorActivity() |
+
Modifier and Type | +Method and Description | +
---|---|
protected android.widget.ArrayAdapter<WifiDirectChannelAndDescription> |
+getAdapter(android.widget.AdapterView<?> av) |
+
java.lang.String |
+getTag() |
+
protected void |
+loadAdapter(android.widget.ListView itemsListView) |
+
protected void |
+onCreate(android.os.Bundle savedInstanceState) |
+
protected void |
+onDestroy() |
+
void |
+onItemClick(android.widget.AdapterView<?> parent,
+ android.view.View view,
+ int position,
+ long id) |
+
protected void |
+onStart() |
+
void |
+onWifiSettingsClicked(android.view.View view) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String TAG+
public FtcWifiDirectChannelSelectorActivity()+
public java.lang.String getTag()+
protected void onCreate(android.os.Bundle savedInstanceState)+
protected void onStart()+
protected void onDestroy()+
protected android.widget.ArrayAdapter<WifiDirectChannelAndDescription> getAdapter(android.widget.AdapterView<?> av)+
protected void loadAdapter(android.widget.ListView itemsListView)+
public void onItemClick(android.widget.AdapterView<?> parent, + android.view.View view, + int position, + long id)+
onItemClick
in interface android.widget.AdapterView.OnItemClickListener
public void onWifiSettingsClicked(android.view.View view)+
protected class FtcWifiDirectRememberedGroupsActivity.RecvLoopCallback
+extends RecvLoopRunnable.DegenerateCallback
+Modifier | +Constructor and Description | +
---|---|
protected |
+RecvLoopCallback() |
+
Modifier and Type | +Method and Description | +
---|---|
CallbackResult |
+commandEvent(Command command) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected class FtcWifiDirectRememberedGroupsActivity.WifiP2pGroupItemAdapter
+extends android.widget.ArrayAdapter<WifiDirectGroupName>
+IGNORE_ITEM_VIEW_TYPE, NO_SELECTION
Constructor and Description | +
---|
WifiP2pGroupItemAdapter(android.content.Context context,
+ int resource,
+ java.util.List<WifiDirectGroupName> objects) |
+
add, addAll, addAll, clear, createFromResource, getContext, getCount, getDropDownView, getDropDownViewTheme, getFilter, getItem, getItemId, getPosition, getView, insert, notifyDataSetChanged, remove, setDropDownViewResource, setDropDownViewTheme, setNotifyOnChange, sort
areAllItemsEnabled, getItemViewType, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetInvalidated, registerDataSetObserver, unregisterDataSetObserver
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getItemViewType, getViewTypeCount, hasStableIds, isEmpty, registerDataSetObserver, unregisterDataSetObserver
public class FtcWifiDirectRememberedGroupsActivity
+extends ThemedActivity
+Modifier and Type | +Class and Description | +
---|---|
protected class |
+FtcWifiDirectRememberedGroupsActivity.RecvLoopCallback |
+
protected class |
+FtcWifiDirectRememberedGroupsActivity.WifiP2pGroupItemAdapter |
+
Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+TAG |
+
Constructor and Description | +
---|
FtcWifiDirectRememberedGroupsActivity() |
+
Modifier and Type | +Method and Description | +
---|---|
protected java.util.List<WifiDirectGroupName> |
+getLocalGroupList() |
+
java.lang.String |
+getTag() |
+
protected CallbackResult |
+handleCommandRequestRememberedGroupsResp(java.lang.String extra) |
+
protected CallbackResult |
+handleRememberedGroupsChanged() |
+
protected void |
+loadGroupList(java.util.List<WifiDirectGroupName> names) |
+
protected void |
+loadLocalGroups() |
+
void |
+onClearRememberedGroupsClicked(android.view.View view) |
+
protected void |
+onCreate(android.os.Bundle savedInstanceState) |
+
protected void |
+onDestroy() |
+
protected void |
+onStart() |
+
protected void |
+requestRememberedGroups() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String TAG+
public FtcWifiDirectRememberedGroupsActivity()+
public java.lang.String getTag()+
protected void onCreate(android.os.Bundle savedInstanceState)+
protected void onStart()+
protected void onDestroy()+
protected void loadLocalGroups()+
protected void requestRememberedGroups()+
protected CallbackResult handleCommandRequestRememberedGroupsResp(java.lang.String extra) + throws RobotCoreException+
RobotCoreException
protected CallbackResult handleRememberedGroupsChanged()+
protected java.util.List<WifiDirectGroupName> getLocalGroupList()+
protected void loadGroupList(java.util.List<WifiDirectGroupName> names)+
public void onClearRememberedGroupsClicked(android.view.View view)+
public static enum LaunchActivityConstantsList.RequestCode +extends java.lang.Enum<LaunchActivityConstantsList.RequestCode>+
Enum Constant and Description | +
---|
CONFIGURE_DRIVER_STATION |
+
CONFIGURE_ROBOT_CONTROLLER |
+
INSPECTIONS |
+
PROGRAM_AND_MANAGE |
+
PROGRAMMING_MODE |
+
SETTINGS_DRIVER_STATION |
+
SETTINGS_ROBOT_CONTROLLER |
+
UNKNOWN |
+
Modifier and Type | +Method and Description | +
---|---|
static LaunchActivityConstantsList.RequestCode |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static LaunchActivityConstantsList.RequestCode[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final LaunchActivityConstantsList.RequestCode UNKNOWN+
public static final LaunchActivityConstantsList.RequestCode CONFIGURE_ROBOT_CONTROLLER+
public static final LaunchActivityConstantsList.RequestCode CONFIGURE_DRIVER_STATION+
public static final LaunchActivityConstantsList.RequestCode PROGRAMMING_MODE+
public static final LaunchActivityConstantsList.RequestCode PROGRAM_AND_MANAGE+
public static final LaunchActivityConstantsList.RequestCode SETTINGS_DRIVER_STATION+
public static final LaunchActivityConstantsList.RequestCode SETTINGS_ROBOT_CONTROLLER+
public static final LaunchActivityConstantsList.RequestCode INSPECTIONS+
public static LaunchActivityConstantsList.RequestCode[] values()+
+for (LaunchActivityConstantsList.RequestCode c : LaunchActivityConstantsList.RequestCode.values()) + System.out.println(c); +
public static LaunchActivityConstantsList.RequestCode valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic class LaunchActivityConstantsList
+extends java.lang.Object
+Modifier and Type | +Class and Description | +
---|---|
static class |
+LaunchActivityConstantsList.RequestCode
+Used internally to distinguish the results coming back from various launched
+ (sub)activities
+ |
+
Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+PROGRAMMING_MODE_ACTIVITY_PROGRAMMING_WEB_HANDLERS
+Used to pass in ProgrammingWebHandlers to a local activity
+ |
+
static java.lang.String |
+RC_WEB_INFO
+The intent extra name for JSON encoded
+org.firstinspires.ftc.robotcore.internal.webserver.RobotControllerWebInfo used when launching
+ RemoteProgrammingModeActivity on the driver station. |
+
static java.lang.String |
+VIEW_LOGS_ACTIVITY_FILENAME |
+
static java.lang.String |
+ZTE_WIFI_CHANNEL_EDITOR_PACKAGE |
+
Constructor and Description | +
---|
LaunchActivityConstantsList() |
+
public static final java.lang.String ZTE_WIFI_CHANNEL_EDITOR_PACKAGE+
public static final java.lang.String VIEW_LOGS_ACTIVITY_FILENAME+
public static final java.lang.String RC_WEB_INFO+
org.firstinspires.ftc.robotcore.internal.webserver.RobotControllerWebInfo
used when launching
+ RemoteProgrammingModeActivity on the driver station.public static final java.lang.String PROGRAMMING_MODE_ACTIVITY_PROGRAMMING_WEB_HANDLERS+
public interface ProgrammingModeController
+Modifier and Type | +Method and Description | +
---|---|
boolean |
+isActive()
+Returns true if programming mode is active; false otherwise.
+ |
+
void |
+startProgrammingMode(FtcEventLoopHandler ftcEventLoopHandler)
+Starts programming mode.
+ |
+
void |
+stopProgrammingMode()
+Stops programming mode.
+ |
+
boolean isActive()+
void startProgrammingMode(FtcEventLoopHandler ftcEventLoopHandler)+
void stopProgrammingMode()+
public interface Restarter
+Modifier and Type | +Method and Description | +
---|---|
void |
+requestRestart() |
+
protected static class SoundPlayer.CurrentlyPlaying
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
protected int |
+loopControl |
+
protected long |
+msFinish |
+
protected java.lang.Runnable |
+runWhenFinished |
+
protected int |
+streamId |
+
Modifier | +Constructor and Description | +
---|---|
protected |
+CurrentlyPlaying() |
+
Modifier and Type | +Method and Description | +
---|---|
protected boolean |
+isLooping() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected static class SoundPlayer.InstanceHolder
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
static SoundPlayer |
+theInstance |
+
Modifier | +Constructor and Description | +
---|---|
protected |
+InstanceHolder() |
+
public static SoundPlayer theInstance+
protected class SoundPlayer.LoadedSoundCache
+extends java.lang.Object
+SoundPlayer.LoadedSoundCache
keeps track of loaded sounds, mapping sound resource id to loaded
+ sound id. It keeps track of which sounds have been recently used, and unloads neglected
+ songs when a configured capacity of loaded sounds has been reached.Modifier and Type | +Method and Description | +
---|---|
SoundPlayer.SoundInfo |
+getFile(java.io.File file) |
+
SoundPlayer.SoundInfo |
+getHash(java.lang.String hashString) |
+
SoundPlayer.SoundInfo |
+getResource(int resourceId) |
+
void |
+noteSoundUsage(SoundPlayer.SoundInfo info)
+update the fact that this sound has been just used, again
+ |
+
void |
+putFile(java.io.File file,
+ SoundPlayer.SoundInfo info) |
+
void |
+putResource(int resourceId,
+ SoundPlayer.SoundInfo info) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public SoundPlayer.SoundInfo getResource(int resourceId)+
public SoundPlayer.SoundInfo getFile(java.io.File file)+
public SoundPlayer.SoundInfo getHash(java.lang.String hashString)+
public void putResource(int resourceId, + SoundPlayer.SoundInfo info)+
public void putFile(java.io.File file, + SoundPlayer.SoundInfo info)+
public void noteSoundUsage(SoundPlayer.SoundInfo info)+
public static class SoundPlayer.PlaySoundParams
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
int |
+loopControl
+-1 means playing loops forever, 0 is play once, 1 is play twice, etc
+ |
+
float |
+rate
+playback rate (1.0 = normal playback, range 0.5 to 2.0)
+ |
+
float |
+volume
+an additional volume scaling that will be applied to this particular play action
+ |
+
boolean |
+waitForNonLoopingSoundsToFinish
+whether to wait for any currently-playing non-looping sound to finish before playing
+ |
+
Constructor and Description | +
---|
PlaySoundParams() |
+
PlaySoundParams(boolean wait) |
+
PlaySoundParams(SoundPlayer.PlaySoundParams them) |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+isLooping() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public float volume+
public boolean waitForNonLoopingSoundsToFinish+
public int loopControl+
public float rate+
public PlaySoundParams()+
public PlaySoundParams(boolean wait)+
public PlaySoundParams(SoundPlayer.PlaySoundParams them)+
protected static interface SoundPlayer.SoundFromFile
+Modifier and Type | +Method and Description | +
---|---|
SoundPlayer.SoundInfo |
+apply(java.io.File file) |
+
SoundPlayer.SoundInfo apply(java.io.File file)+
protected class SoundPlayer.SoundInfo
+extends RefCounted
+Modifier and Type | +Field and Description | +
---|---|
int |
+cbSize |
+
android.content.Context |
+context |
+
java.io.File |
+file |
+
java.lang.String |
+hashString |
+
long |
+msDuration |
+
long |
+msLastPlay |
+
int |
+resourceId |
+
int |
+sampleId |
+
Constructor and Description | +
---|
SoundInfo(android.content.Context context,
+ int resourceId,
+ int msDuration) |
+
SoundInfo(java.io.File file,
+ int msDuration) |
+
Modifier and Type | +Method and Description | +
---|---|
protected java.lang.String |
+computeHash() |
+
protected void |
+destructor() |
+
java.io.InputStream |
+getInputStream() |
+
java.lang.Object |
+getKey() |
+
void |
+initialize(int sampleId) |
+
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public final android.content.Context context+
public final int resourceId+
public final java.io.File file+
public final long msDuration+
public int sampleId+
public java.lang.String hashString+
public int cbSize+
public long msLastPlay+
public SoundInfo(android.content.Context context, + int resourceId, + int msDuration)+
public SoundInfo(java.io.File file, + int msDuration)+
public java.lang.String toString()+
public void initialize(int sampleId)+
protected void destructor()+
public java.io.InputStream getInputStream()+
protected java.lang.String computeHash()+
public java.lang.Object getKey()+
protected static enum SoundPlayer.StopWhat +extends java.lang.Enum<SoundPlayer.StopWhat>+
Enum Constant and Description | +
---|
All |
+
Loops |
+
Modifier and Type | +Method and Description | +
---|---|
static SoundPlayer.StopWhat |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static SoundPlayer.StopWhat[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final SoundPlayer.StopWhat All+
public static final SoundPlayer.StopWhat Loops+
public static SoundPlayer.StopWhat[] values()+
+for (SoundPlayer.StopWhat c : SoundPlayer.StopWhat.values()) + System.out.println(c); +
public static SoundPlayer.StopWhat valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic class SoundPlayer
+extends java.lang.Object
+implements android.media.SoundPool.OnLoadCompleteListener
+SoundPlayer
is a simple utility class that plays sounds on the phone. The class
+ is used through its singleton instance.startPlaying(android.content.Context, int)
Modifier and Type | +Class and Description | +
---|---|
protected static class |
+SoundPlayer.CurrentlyPlaying |
+
protected static class |
+SoundPlayer.InstanceHolder |
+
protected class |
+SoundPlayer.LoadedSoundCache
+SoundPlayer.LoadedSoundCache keeps track of loaded sounds, mapping sound resource id to loaded
+ sound id. |
+
static class |
+SoundPlayer.PlaySoundParams |
+
protected static interface |
+SoundPlayer.SoundFromFile |
+
protected class |
+SoundPlayer.SoundInfo |
+
protected static class |
+SoundPlayer.StopWhat |
+
Modifier and Type | +Field and Description | +
---|---|
protected SoundPlayer.SoundInfo |
+currentlyLoadingInfo |
+
protected java.util.concurrent.CountDownLatch |
+currentlyLoadingLatch |
+
protected java.util.Set<SoundPlayer.CurrentlyPlaying> |
+currentlyPlayingSounds |
+
protected boolean |
+isRobotController |
+
protected SoundPlayer.LoadedSoundCache |
+loadedSounds |
+
protected java.lang.Object |
+lock |
+
protected float |
+masterVolume |
+
protected android.media.MediaPlayer |
+mediaSizer |
+
static int |
+msSoundTransmissionFreshness |
+
protected java.util.concurrent.ScheduledExecutorService |
+scheduledThreadPool |
+
protected android.content.SharedPreferences |
+sharedPreferences |
+
protected float |
+soundOffVolume |
+
protected float |
+soundOnVolume |
+
protected android.media.SoundPool |
+soundPool |
+
static java.lang.String |
+TAG |
+
protected java.util.concurrent.ExecutorService |
+threadPool |
+
static boolean |
+TRACE |
+
protected Tracer |
+tracer |
+
Constructor and Description | +
---|
SoundPlayer(int simultaneousStreams,
+ int cacheSize)
+Instantiates a new sound player.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
static SoundPlayer.SoundInfo |
+addRef(SoundPlayer.SoundInfo soundInfo) |
+
void |
+close() |
+
protected static void |
+copy(java.io.InputStream inputStream,
+ java.io.OutputStream outputStream,
+ int cbToCopy) |
+
protected void |
+ensureCached(android.content.Context context,
+ int resId)
+Ensures this local sound is also in the local cache.
+ |
+
protected SoundPlayer.SoundInfo |
+ensureCached(java.lang.String hashString,
+ SoundPlayer.SoundFromFile ifAbsent)
+returns a new ref on the returned
+SoundPlayer.SoundInfo ; caller must releaseRef() |
+
protected SoundPlayer.SoundInfo |
+ensureLoaded(android.content.Context context,
+ java.io.File file) |
+
protected SoundPlayer.SoundInfo |
+ensureLoaded(android.content.Context context,
+ int resourceId) |
+
protected SoundPlayer.SoundInfo |
+ensureLoaded(java.lang.String hashString,
+ SoundPlayer.SoundFromFile ifAbsent)
+returns a new ref on the returned
+SoundPlayer.SoundInfo ; caller must releaseRef() |
+
static SoundPlayer |
+getInstance() |
+
float |
+getMasterVolume()
+Returns the master volume control that is applied to all played sounds
+ |
+
protected int |
+getMsDuration(android.content.Context context,
+ java.io.File file) |
+
protected int |
+getMsDuration(android.content.Context context,
+ int resourceId) |
+
protected long |
+getMsNow() |
+
CallbackResult |
+handleCommandPlaySound(java.lang.String extra) |
+
CallbackResult |
+handleCommandRequestSound(Command requestSoundCommand) |
+
CallbackResult |
+handleCommandStopPlayingSounds(Command stopPlayingSoundsCommand) |
+
protected void |
+internalStopPlaying(SoundPlayer.StopWhat stopWhat) |
+
boolean |
+isLocalSoundOn() |
+
protected void |
+loadAndStartPlaying(android.content.Context context,
+ java.io.File file,
+ SoundPlayer.PlaySoundParams params,
+ <any> runWhenStarted,
+ java.lang.Runnable runWhenFinished) |
+
protected void |
+loadAndStartPlaying(android.content.Context context,
+ int resourceId,
+ SoundPlayer.PlaySoundParams params,
+ <any> runWhenStarted,
+ java.lang.Runnable runWhenFinished) |
+
void |
+onLoadComplete(android.media.SoundPool soundPool,
+ int sampleId,
+ int status) |
+
void |
+play(android.content.Context context,
+ java.io.File file,
+ float volume,
+ int loop,
+ float rate) |
+
void |
+play(android.content.Context context,
+ int resId)
+Deprecated.
+
+use
+startPlaying(Context, int) instead |
+
void |
+play(android.content.Context context,
+ int resId,
+ boolean waitForCompletion)
+Deprecated.
+
+use
+#startPlaying(Context, int, PlaySoundParams, Consumer, Runnable) instead |
+
void |
+prefillSoundCache(int... resourceIds)
+Ensures that these local sounds are also in the local cache
+ |
+
boolean |
+preload(android.content.Context context,
+ java.io.File file)
+Preloads the sound so as to to reduce delays if the sound is subsequently played.
+ |
+
boolean |
+preload(android.content.Context context,
+ int resourceId)
+Preloads the sound so as to to reduce delays if the sound is subsequently played.
+ |
+
static void |
+releaseRef(SoundPlayer.SoundInfo soundInfo) |
+
protected void |
+safeClose(java.lang.Object closeable) |
+
void |
+setMasterVolume(float masterVolume)
+Sets the master volume control that is applied to all played sounds
+ |
+
void |
+startPlaying(android.content.Context context,
+ java.io.File file) |
+
void |
+startPlaying(android.content.Context context,
+ java.io.File file,
+ SoundPlayer.PlaySoundParams params,
+ <any> runWhenStarted,
+ java.lang.Runnable runWhenFinished) |
+
void |
+startPlaying(android.content.Context context,
+ int resId)
+Asynchronously loads the indicated sound from its resource (if not already loaded), then
+ initiates its play once any current non-looping sound is finished playing.
+ |
+
void |
+startPlaying(android.content.Context context,
+ int resId,
+ SoundPlayer.PlaySoundParams params,
+ <any> runWhenStarted,
+ java.lang.Runnable runWhenFinished)
+Asynchronously loads the indicated sound from its resource (if not already loaded), then
+ initiates its play, optionally waiting for any currently non-looping playing sounds to finish first.
+ |
+
protected void |
+startPlayingLoadedSound(SoundPlayer.SoundInfo soundInfo,
+ SoundPlayer.PlaySoundParams paramsIn,
+ <any> runWhenStarted,
+ java.lang.Runnable runWhenFinished) |
+
void |
+stopPlayingAll()
+Stops playing all sounds that are currently playing
+ |
+
void |
+stopPlayingLoops()
+Stops playing all sounds that are currently playing in a loop
+ |
+
protected void |
+waitForLoadCompletion() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String TAG+
public static boolean TRACE+
protected Tracer tracer+
public static final int msSoundTransmissionFreshness+
protected final java.lang.Object lock+
protected final boolean isRobotController+
protected android.media.SoundPool soundPool+
protected java.util.concurrent.CountDownLatch currentlyLoadingLatch+
protected SoundPlayer.SoundInfo currentlyLoadingInfo+
protected SoundPlayer.LoadedSoundCache loadedSounds+
protected java.util.concurrent.ExecutorService threadPool+
protected java.util.concurrent.ScheduledExecutorService scheduledThreadPool+
protected android.content.SharedPreferences sharedPreferences+
protected float soundOnVolume+
protected float soundOffVolume+
protected float masterVolume+
protected android.media.MediaPlayer mediaSizer+
protected java.util.Set<SoundPlayer.CurrentlyPlaying> currentlyPlayingSounds+
public SoundPlayer(int simultaneousStreams, + int cacheSize)+
simultaneousStreams
- the number of sounds that can simultaneously play from this player.
+ If one, then playing any new sound interrupts the playing of a
+ a previous soundcacheSize
- the maximum size of the cache of loaded sounds.public static SoundPlayer getInstance()+
public void close()+
public void prefillSoundCache(int... resourceIds)+
public void startPlaying(android.content.Context context, + int resId)+
context
- the context in which resId is to be interpretedresId
- the resource id of the raw resource containing the sound.public void startPlaying(android.content.Context context, + java.io.File file)+
public void startPlaying(android.content.Context context, + int resId, + SoundPlayer.PlaySoundParams params, + <any> runWhenStarted, + java.lang.Runnable runWhenFinished)+
context
- the context in which resId is to be interpretedresId
- the resource id of the raw resource containing the sound.params
- controls how the playback proceedsrunWhenStarted
- executed when the stream starts to playrunWhenFinished
- executed when the stream finishes playingpublic void startPlaying(android.content.Context context, + java.io.File file, + SoundPlayer.PlaySoundParams params, + <any> runWhenStarted, + java.lang.Runnable runWhenFinished)+
public void stopPlayingAll()+
public void stopPlayingLoops()+
protected void internalStopPlaying(SoundPlayer.StopWhat stopWhat)+
public boolean preload(android.content.Context context, + int resourceId)+
public boolean preload(android.content.Context context, + java.io.File file)+
public void setMasterVolume(float masterVolume)+
getMasterVolume()
public float getMasterVolume()+
setMasterVolume(float)
@Deprecated +public void play(android.content.Context context, + int resId)+
startPlaying(Context, int)
instead@Deprecated +public void play(android.content.Context context, + int resId, + boolean waitForCompletion)+
#startPlaying(Context, int, PlaySoundParams, Consumer, Runnable)
insteadprotected void loadAndStartPlaying(android.content.Context context, + int resourceId, + SoundPlayer.PlaySoundParams params, + <any> runWhenStarted, + java.lang.Runnable runWhenFinished)+
protected void loadAndStartPlaying(android.content.Context context, + java.io.File file, + SoundPlayer.PlaySoundParams params, + <any> runWhenStarted, + java.lang.Runnable runWhenFinished)+
protected SoundPlayer.SoundInfo ensureLoaded(android.content.Context context, + int resourceId)+
protected SoundPlayer.SoundInfo ensureLoaded(android.content.Context context, + java.io.File file)+
public boolean isLocalSoundOn()+
protected void startPlayingLoadedSound(SoundPlayer.SoundInfo soundInfo, + SoundPlayer.PlaySoundParams paramsIn, + <any> runWhenStarted, + java.lang.Runnable runWhenFinished)+
protected int getMsDuration(android.content.Context context, + int resourceId)+
protected int getMsDuration(android.content.Context context, + java.io.File file)+
protected void waitForLoadCompletion()+
public void onLoadComplete(android.media.SoundPool soundPool, + int sampleId, + int status)+
onLoadComplete
in interface android.media.SoundPool.OnLoadCompleteListener
protected long getMsNow()+
protected SoundPlayer.SoundInfo ensureLoaded(java.lang.String hashString, + SoundPlayer.SoundFromFile ifAbsent)+
SoundPlayer.SoundInfo
; caller must releaseRef()protected void ensureCached(android.content.Context context, + int resId)+
protected SoundPlayer.SoundInfo ensureCached(java.lang.String hashString, + SoundPlayer.SoundFromFile ifAbsent)+
SoundPlayer.SoundInfo
; caller must releaseRef()public CallbackResult handleCommandPlaySound(java.lang.String extra)+
public CallbackResult handleCommandStopPlayingSounds(Command stopPlayingSoundsCommand)+
protected static void copy(java.io.InputStream inputStream, + java.io.OutputStream outputStream, + int cbToCopy) + throws java.io.IOException+
java.io.IOException
public CallbackResult handleCommandRequestSound(Command requestSoundCommand)+
protected void safeClose(java.lang.Object closeable)+
public static SoundPlayer.SoundInfo addRef(SoundPlayer.SoundInfo soundInfo)+
public static void releaseRef(SoundPlayer.SoundInfo soundInfo)+
public void play(android.content.Context context, + java.io.File file, + float volume, + int loop, + float rate)+
public final class USBAccessibleLynxModule
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
protected java.lang.String |
+firmwareVersionString |
+
protected int |
+moduleAddress |
+
protected boolean |
+moduleAddressChangeable |
+
protected SerialNumber |
+serialNumber |
+
Constructor and Description | +
---|
USBAccessibleLynxModule(SerialNumber serialNumber) |
+
USBAccessibleLynxModule(SerialNumber serialNumber,
+ boolean moduleAddressChangeable) |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+getFinishedFirmwareVersionString() |
+
java.lang.String |
+getFirmwareVersionString() |
+
int |
+getModuleAddress() |
+
SerialNumber |
+getSerialNumber() |
+
boolean |
+isModuleAddressChangeable() |
+
void |
+setFirmwareVersionString(java.lang.String firmwareVersionString) |
+
void |
+setModuleAddress(int moduleAddress) |
+
void |
+setModuleAddressChangeable(boolean moduleAddressChangeable) |
+
void |
+setSerialNumber(SerialNumber serialNumber) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected SerialNumber serialNumber+
protected int moduleAddress+
protected boolean moduleAddressChangeable+
protected java.lang.String firmwareVersionString+
public USBAccessibleLynxModule(SerialNumber serialNumber)+
public USBAccessibleLynxModule(SerialNumber serialNumber, + boolean moduleAddressChangeable)+
public SerialNumber getSerialNumber()+
public void setSerialNumber(SerialNumber serialNumber)+
public int getModuleAddress()+
public void setModuleAddress(int moduleAddress)+
public boolean isModuleAddressChangeable()+
public void setModuleAddressChangeable(boolean moduleAddressChangeable)+
public java.lang.String getFirmwareVersionString()+
public java.lang.String getFinishedFirmwareVersionString()+
public void setFirmwareVersionString(java.lang.String firmwareVersionString)+
protected class UpdateUI.Callback.DeviceNameManagerCallback
+extends java.lang.Object
+Modifier | +Constructor and Description | +
---|---|
protected |
+DeviceNameManagerCallback() |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+onDeviceNameChanged(java.lang.String newDeviceName) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public class UpdateUI.Callback
+extends java.lang.Object
+Modifier and Type | +Class and Description | +
---|---|
protected class |
+UpdateUI.Callback.DeviceNameManagerCallback |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close() |
+
protected void |
+displayDeviceName(java.lang.String name) |
+
RobotStateMonitor |
+getStateMonitor() |
+
void |
+networkConnectionUpdate(NetworkConnection.NetworkEvent event) |
+
void |
+refreshErrorTextOnUiThread() |
+
protected void |
+refreshStateStatus() |
+
void |
+restartRobot()
+callback method to restart the robot
+ |
+
void |
+setStateMonitor(RobotStateMonitor stateMonitor) |
+
void |
+updateNetworkConnectionStatus(NetworkStatus networkStatus) |
+
void |
+updateNetworkConnectionStatus(NetworkStatus networkStatus,
+ java.lang.String extra) |
+
void |
+updatePeerStatus(PeerStatus peerStatus) |
+
void |
+updateRobotState(RobotState state) |
+
void |
+updateRobotStatus(RobotStatus status) |
+
void |
+updateUi(java.lang.String opModeName,
+ Gamepad[] gamepads) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public void close()+
public RobotStateMonitor getStateMonitor()+
public void setStateMonitor(RobotStateMonitor stateMonitor)+
public void restartRobot()+
public void updateUi(java.lang.String opModeName, + Gamepad[] gamepads)+
public void networkConnectionUpdate(NetworkConnection.NetworkEvent event)+
protected void displayDeviceName(java.lang.String name)+
public void updateNetworkConnectionStatus(NetworkStatus networkStatus)+
public void updateNetworkConnectionStatus(NetworkStatus networkStatus, + java.lang.String extra)+
public void updatePeerStatus(PeerStatus peerStatus)+
public void updateRobotStatus(RobotStatus status)+
public void updateRobotState(RobotState state)+
protected void refreshStateStatus()+
public void refreshErrorTextOnUiThread()+
public class UpdateUI
+extends java.lang.Object
+Modifier and Type | +Class and Description | +
---|---|
class |
+UpdateUI.Callback |
+
Modifier and Type | +Field and Description | +
---|---|
static boolean |
+DEBUG |
+
protected NetworkStatus |
+networkStatus |
+
protected java.lang.String |
+networkStatusExtra |
+
protected java.lang.String |
+networkStatusMessage |
+
protected PeerStatus |
+peerStatus |
+
protected RobotState |
+robotState |
+
protected RobotStatus |
+robotStatus |
+
protected java.lang.String |
+stateStatusMessage |
+
protected android.widget.TextView |
+textDeviceName |
+
protected android.widget.TextView |
+textErrorMessage |
+
protected int |
+textErrorMessageOriginalColor |
+
protected android.widget.TextView[] |
+textGamepad |
+
protected android.widget.TextView |
+textNetworkConnectionStatus |
+
protected android.widget.TextView |
+textOpMode |
+
protected android.widget.TextView |
+textRobotStatus |
+
Constructor and Description | +
---|
UpdateUI(android.app.Activity activity,
+ Dimmer dimmer) |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+setControllerService(FtcRobotControllerService controllerService) |
+
void |
+setRestarter(Restarter restarter) |
+
protected void |
+setText(android.widget.TextView textView,
+ java.lang.String message) |
+
void |
+setTextViews(android.widget.TextView textWifiDirectStatus,
+ android.widget.TextView textRobotStatus,
+ android.widget.TextView[] textGamepad,
+ android.widget.TextView textOpMode,
+ android.widget.TextView textErrorMessage,
+ android.widget.TextView textDeviceName) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final boolean DEBUG+
protected android.widget.TextView textDeviceName+
protected android.widget.TextView textNetworkConnectionStatus+
protected android.widget.TextView textRobotStatus+
protected android.widget.TextView[] textGamepad+
protected android.widget.TextView textOpMode+
protected android.widget.TextView textErrorMessage+
protected int textErrorMessageOriginalColor+
protected RobotState robotState+
protected RobotStatus robotStatus+
protected NetworkStatus networkStatus+
protected java.lang.String networkStatusExtra+
protected PeerStatus peerStatus+
protected java.lang.String networkStatusMessage+
protected java.lang.String stateStatusMessage+
public UpdateUI(android.app.Activity activity, + Dimmer dimmer)+
public void setTextViews(android.widget.TextView textWifiDirectStatus, + android.widget.TextView textRobotStatus, + android.widget.TextView[] textGamepad, + android.widget.TextView textOpMode, + android.widget.TextView textErrorMessage, + android.widget.TextView textDeviceName)+
protected void setText(android.widget.TextView textView, + java.lang.String message)+
public void setControllerService(FtcRobotControllerService controllerService)+
public void setRestarter(Restarter restarter)+
public interface UsbModuleAttachmentHandler
+Modifier and Type | +Method and Description | +
---|---|
void |
+handleUsbModuleAttach(RobotUsbModule module)
+One of the hardware modules in the current robot configuration (such as a Modern Robotics
+ DC Motor Controller, a Modern Robotics Legacy Module, etc) is now newly attached to the
+ system (or so we think).
+ |
+
void |
+handleUsbModuleDetach(RobotUsbModule module)
+One of the hardware modules in the current robot configuration (such as a Modern Robotics
+ DC Motor Controller, a Modern Robotics Legacy Module, etc) has been disconnected from the
+ system.
+ |
+
void handleUsbModuleAttach(RobotUsbModule module) + throws RobotCoreException, + java.lang.InterruptedException+
module
- the module which is newly attachedRobotCoreException
java.lang.InterruptedException
void handleUsbModuleDetach(RobotUsbModule module) + throws RobotCoreException, + java.lang.InterruptedException+
module
- the module which has become disconnectedRobotCoreException
java.lang.InterruptedException
public class ViewLogsActivity
+extends ThemedActivity
+Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+FILENAME |
+
Constructor and Description | +
---|
ViewLogsActivity() |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+getTag() |
+
protected void |
+onCreate(android.os.Bundle savedInstanceState) |
+
protected void |
+onStart() |
+
java.lang.String |
+readNLines(int n) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String FILENAME+
public java.lang.String getTag()+
protected void onCreate(android.os.Bundle savedInstanceState)+
protected void onStart()+
public java.lang.String readNLines(int n) + throws java.io.IOException+
java.io.IOException
Interface | +Description | +
---|---|
ProgrammingModeController | +
+ Declares the interface for starting and stopping programming mode when requested from the driver
+ station.
+ |
+
Restarter | ++ |
SoundPlayer.SoundFromFile | ++ |
UsbModuleAttachmentHandler | +
+ UsbModuleAttachmentHandler is a notification interface through which policies for dealing
+ with the attachment and detachment can be provided.
+ |
+
Class | +Description | +
---|---|
ClassManagerFactory | +
+ A helper for classes that want to inspect the list of classes packaged with an APK.
+ |
+
CommandList | +
+ List of RobotCore Robocol commands used by the FIRST apps
+ |
+
CommandList.CmdPlaySound | ++ |
CommandList.CmdRequestSound | ++ |
CommandList.CmdStopPlayingSounds | ++ |
CommandList.CmdVisuallyIdentify | ++ |
CommandList.LynxAddressChangeRequest | ++ |
CommandList.LynxAddressChangeRequest.AddressChange | ++ |
CommandList.LynxFirmwareImagesResp | ++ |
CommandList.LynxFirmwareUpdate | ++ |
CommandList.LynxFirmwareUpdateResp | ++ |
CommandList.USBAccessibleLynxModulesRequest | ++ |
CommandList.USBAccessibleLynxModulesResp | ++ |
ConfigWifiDirectActivity | +
+ This activity is used to correct any problems detected with the current
+ Wifi Direct settings.
+ |
+
FtcAboutActivity | ++ |
FtcAboutActivity.AboutFragment | ++ |
FtcAdvancedRCSettingsActivity | +
+FtcAdvancedRCSettingsActivity manages the editing of advanced RC settings |
+
FtcAdvancedRCSettingsActivity.SettingsFragment | ++ |
FtcEventLoop | +
+ Main event loop to control the robot
+ |
+
FtcEventLoopBase | +
+FtcEventLoopBase is an abstract base that handles defines core event processing
+ logic that's available whether or not a Robot is currently extant or not |
+
FtcEventLoopBase.LynxUsbDeviceContainer | +
+ abstracts whether we've got a live LynxUsbDeviceImpl or we just opened something locally ourselves.
+ |
+
FtcEventLoopHandler | ++ |
FtcEventLoopIdle | +
+FtcEventLoopIdle is an eventloop that runs whenever a full FtcEventLoop
+ is inappropriate. |
+
FtcLynxFirmwareUpdateActivity | +
+FtcLynxFirmwareUpdateActivity manages the updating of the firmware on
+ all available attached lynx modules. |
+
FtcLynxModuleAddressUpdateActivity | +
+FtcLynxModuleAddressUpdateActivity provides a means by which users can update
+ the (persistently stored) address of a Lynx Module |
+
FtcRobotControllerService | ++ |
FtcRobotControllerSettingsActivity | ++ |
FtcRobotControllerSettingsActivity.SettingsFragment | ++ |
FtcWifiDirectChannelSelectorActivity | ++ |
FtcWifiDirectRememberedGroupsActivity | ++ |
LaunchActivityConstantsList | +
+ List of RobotCore Robocol commands used by the FIRST apps
+ |
+
SoundPlayer | +
+SoundPlayer is a simple utility class that plays sounds on the phone. |
+
SoundPlayer.CurrentlyPlaying | ++ |
SoundPlayer.InstanceHolder | ++ |
SoundPlayer.PlaySoundParams | ++ |
UpdateUI | ++ |
USBAccessibleLynxModule | +
+ A simple utility class holding the serial number of a USB accessible lynx module and (optionally) its module address
+ |
+
ViewLogsActivity | ++ |
Enum | +Description | +
---|---|
ConfigWifiDirectActivity.Flag | ++ |
FtcLynxFirmwareUpdateActivity.FwResponseStatus | ++ |
LaunchActivityConstantsList.RequestCode | +
+ Used internally to distinguish the results coming back from various launched
+ (sub)activities
+ |
+
SoundPlayer.StopWhat | ++ |
public interface EventLoop
++ Event loops need to implement this interface. Contains methods for managing the life cycle of your robot.
Modifier and Type | +Field and Description | +
---|---|
static double |
+TELEMETRY_DEFAULT_INTERVAL
+The value to pass to
+refreshUserTelemetry(TelemetryMessage, double) as the time interval
+ parameter in order to cause a system default interval to be used. |
+
Modifier and Type | +Method and Description | +
---|---|
OpModeManagerImpl |
+getOpModeManager()
+Returns the OpModeManager associated with this event loop
+ |
+
void |
+handleUsbModuleAttach(RobotUsbModule module)
+Process the fact that (we believe) that the indicated module has now reappeared after a
+ previously observed detachment.
+ |
+
void |
+handleUsbModuleDetach(RobotUsbModule module)
+Process the fact that a usb module has now become detached from the system.
+ |
+
void |
+init(EventLoopManager eventLoopManager)
+Init method, this will be called before the first call to loop.
+ |
+
void |
+loop()
+This method will be repeatedly called by the event loop manager.
+ |
+
void |
+onUsbDeviceAttached(android.hardware.usb.UsbDevice usbDevice)
+Notifies the event loop that a UsbDevice has just been attached to the system.
+ |
+
void |
+pendUsbDeviceAttachment(SerialNumber serialNumber,
+ long time,
+ java.util.concurrent.TimeUnit unit) |
+
CallbackResult |
+processCommand(Command command)
+Process command method, this will be called if the event loop manager receives a user defined
+ command.
+ |
+
void |
+processedRecentlyAttachedUsbDevices()
+Process the batch of newly arrived USB devices.
+ |
+
void |
+refreshUserTelemetry(TelemetryMessage telemetry,
+ double sInterval)
+Update's the user portion of the driver station screen with the contents of the telemetry object
+ here provided if a sufficiently long duration has passed since the last update.
+ |
+
void |
+requestOpModeStop(OpMode opModeToStopIfActive)
+Requests that an OpMode be stopped if it's the currently active one
+ |
+
void |
+teardown()
+Teardown method, this will be called after the last call to loop.
+ |
+
static final double TELEMETRY_DEFAULT_INTERVAL+
refreshUserTelemetry(TelemetryMessage, double)
as the time interval
+ parameter in order to cause a system default interval to be used.void init(EventLoopManager eventLoopManager) + throws RobotCoreException, + java.lang.InterruptedException+
eventLoopManager
- event loop manager that is responsible for this event loopRobotCoreException
- if a RobotCoreException is thrown, it will be handled
+ by the event loop manager. The manager will report that the robot failed
+ to start.java.lang.InterruptedException
void loop() + throws RobotCoreException, + java.lang.InterruptedException+
RobotCoreException
- if a RobotCoreException is thrown, it will be handled
+ by the event loop manager. The manager may decide to either stop processing
+ this iteration of the loop, or it may decide to shut down the robot.java.lang.InterruptedException
void refreshUserTelemetry(TelemetryMessage telemetry, + double sInterval)+
telemetry
- the telemetry object to sendsInterval
- the required minimum interval. NaN indicates that a system default interval should be used.void teardown() + throws RobotCoreException, + java.lang.InterruptedException+
RobotCoreException
- if a RobotCoreException is thrown, it will be handled by the event
+ loop manager. The manager will then attempt to shut down the robot without the benefit
+ of the teardown method.java.lang.InterruptedException
void onUsbDeviceAttached(android.hardware.usb.UsbDevice usbDevice)+
+ Implementations of this method should avoid doing significant processing during this notification. + Rather, they should squirrel the device away for processing during a later processedRecentlyAttachedUsbDevices + call. +
usbDevice
- the newly arrived deviceprocessedRecentlyAttachedUsbDevices()
void pendUsbDeviceAttachment(SerialNumber serialNumber, + long time, + java.util.concurrent.TimeUnit unit)+
void processedRecentlyAttachedUsbDevices() + throws RobotCoreException, + java.lang.InterruptedException+
RobotCoreException
java.lang.InterruptedException
handleUsbModuleDetach(RobotUsbModule)
,
+onUsbDeviceAttached(UsbDevice)
void handleUsbModuleDetach(RobotUsbModule module) + throws RobotCoreException, + java.lang.InterruptedException+
module
- RobotCoreException
java.lang.InterruptedException
processedRecentlyAttachedUsbDevices()
void handleUsbModuleAttach(RobotUsbModule module) + throws RobotCoreException, + java.lang.InterruptedException+
module
- RobotCoreException
java.lang.InterruptedException
CallbackResult processCommand(Command command) + throws java.lang.InterruptedException, + RobotCoreException+
command
- command to processjava.lang.InterruptedException
RobotCoreException
OpModeManagerImpl getOpModeManager()+
void requestOpModeStop(OpMode opModeToStopIfActive)+
opModeToStopIfActive
- the OpMode to stop if it's currently activepublic static interface EventLoopManager.EventLoopMonitor
+Modifier and Type | +Method and Description | +
---|---|
void |
+onPeerConnected() |
+
void |
+onPeerDisconnected() |
+
void |
+onStateChange(RobotState state) |
+
void |
+onTelemetryTransmitted() |
+
public class EventLoopManager +extends java.lang.Object +implements SyncdDevice.Manager+
+ Takes RobocolDatagram messages, converts them into the appropriate data type, and then passes it + to the current EventLoop.
Modifier and Type | +Class and Description | +
---|---|
static interface |
+EventLoopManager.EventLoopMonitor
+Callback to monitor when event loop changes state
+ |
+
Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+RC_BATTERY_STATUS_KEY |
+
static java.lang.String |
+ROBOT_BATTERY_LEVEL_KEY |
+
RobotState |
+state |
+
static java.lang.String |
+SYSTEM_ERROR_KEY |
+
static java.lang.String |
+SYSTEM_NONE_KEY |
+
static java.lang.String |
+SYSTEM_WARNING_KEY |
+
static java.lang.String |
+TAG |
+
Constructor and Description | +
---|
EventLoopManager(android.content.Context context,
+ EventLoopManagerClient eventLoopManagerClient,
+ EventLoop idleEventLoop)
+Constructor
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+buildAndSendTelemetry(java.lang.String tag,
+ java.lang.String msg) |
+
void |
+close() |
+
CallbackResult |
+commandEvent(Command command) |
+
CallbackResult |
+emptyEvent(RobocolDatagram packet) |
+
CallbackResult |
+gamepadEvent(RobocolDatagram packet) |
+
EventLoop |
+getEventLoop()
+Get the current event loop
+ |
+
Gamepad |
+getGamepad(int port)
+Get the gamepad connected to a particular user
+ |
+
Gamepad[] |
+getGamepads()
+Get the gamepads
+ |
+
Heartbeat |
+getHeartbeat()
+Get the current heartbeat state
+ |
+
EventLoopManager.EventLoopMonitor |
+getMonitor()
+return any event loop monitor previously set
+ |
+
WebServer |
+getWebServer() |
+
CallbackResult |
+heartbeatEvent(RobocolDatagram packet,
+ long tReceived) |
+
CallbackResult |
+onNetworkConnectionEvent(NetworkConnection.NetworkEvent event) |
+
void |
+onPeerConnected() |
+
void |
+onPeerDisconnected() |
+
CallbackResult |
+packetReceived(RobocolDatagram packet) |
+
CallbackResult |
+peerDiscoveryEvent(RobocolDatagram packet) |
+
void |
+refreshSystemTelemetry()
+Do our best to maintain synchrony of the system error / warning state between applications
+ without incurring undo overhead.
+ |
+
void |
+refreshSystemTelemetryNow()
+Forces an immediate refresh of the system telemetry
+ |
+
void |
+registerSyncdDevice(SyncdDevice device)
+Register a sync'd device
+ |
+
CallbackResult |
+reportGlobalError(java.lang.String error,
+ boolean recoverable) |
+
void |
+sendTelemetryData(TelemetryMessage telemetry)
+Send telemetry data
+ |
+
void |
+setEventLoop(EventLoop eventLoop)
+Replace the current event loop with a new event loop
+ |
+
void |
+setMonitor(EventLoopManager.EventLoopMonitor monitor)
+Set a monitor for this event loop, which will immediately have the appropriate method called to
+ indicate the current peer status.
+ |
+
void |
+shutdown()
+Performs the logical inverse of
+start(EventLoop) . |
+
void |
+start(EventLoop eventLoop)
+Starts up the
+EventLoopManager . |
+
CallbackResult |
+telemetryEvent(RobocolDatagram packet) |
+
void |
+unregisterSyncdDevice(SyncdDevice device)
+Unregisters a device from this event loop.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String TAG+
public static final java.lang.String SYSTEM_NONE_KEY+
public static final java.lang.String SYSTEM_ERROR_KEY+
public static final java.lang.String SYSTEM_WARNING_KEY+
public static final java.lang.String ROBOT_BATTERY_LEVEL_KEY+
public static final java.lang.String RC_BATTERY_STATUS_KEY+
public RobotState state+
public EventLoopManager(android.content.Context context, + EventLoopManagerClient eventLoopManagerClient, + EventLoop idleEventLoop)+
public WebServer getWebServer()+
public void setMonitor(EventLoopManager.EventLoopMonitor monitor)+
monitor
- event loop monitorpublic EventLoopManager.EventLoopMonitor getMonitor()+
public EventLoop getEventLoop()+
public Gamepad getGamepad(int port)+
port
- user 0 and 1 are validpublic Gamepad[] getGamepads()+
+ Array index will match the user number
public Heartbeat getHeartbeat()+
public CallbackResult telemetryEvent(RobocolDatagram packet)+
public CallbackResult reportGlobalError(java.lang.String error, + boolean recoverable)+
public CallbackResult packetReceived(RobocolDatagram packet)+
public void refreshSystemTelemetryNow()+
public void refreshSystemTelemetry()+
public CallbackResult onNetworkConnectionEvent(NetworkConnection.NetworkEvent event)+
public void start(EventLoop eventLoop) + throws RobotCoreException+
EventLoopManager
. This mostly involves setting up the network
+ connections and listeners and senders, then getting the event loop thread going.
+
+ Note that shutting down the EventLoopManager
does not do a full
+ complete inverse. Rather, it leaves the underlying network connection alive and
+ running, as this, among other things, helps remote toasts to continue to function
+ correctly. Thus, we must be aware of that possibility here as we start.RobotCoreException
shutdown()
public void shutdown()+
start(EventLoop)
.start(EventLoop)
public void close()+
public void registerSyncdDevice(SyncdDevice device)+
registerSyncdDevice
in interface SyncdDevice.Manager
device
- sync'd deviceunregisterSyncdDevice(SyncdDevice)
public void unregisterSyncdDevice(SyncdDevice device)+
unregisterSyncdDevice
in interface SyncdDevice.Manager
device
- the device to be unregistered. May not be null.registerSyncdDevice(SyncdDevice)
public void setEventLoop(EventLoop eventLoop) + throws RobotCoreException+
eventLoop
- new event loopRobotCoreException
- if event loop fails to initpublic void sendTelemetryData(TelemetryMessage telemetry)+
+ Send the telemetry data, and then clear the sent data
telemetry
- telemetry datapublic CallbackResult gamepadEvent(RobocolDatagram packet) + throws RobotCoreException+
RobotCoreException
public CallbackResult heartbeatEvent(RobocolDatagram packet, + long tReceived) + throws RobotCoreException+
RobotCoreException
public void onPeerConnected()+
public void onPeerDisconnected()+
public CallbackResult peerDiscoveryEvent(RobocolDatagram packet) + throws RobotCoreException+
RobotCoreException
public CallbackResult commandEvent(Command command) + throws RobotCoreException+
RobotCoreException
public CallbackResult emptyEvent(RobocolDatagram packet)+
public void buildAndSendTelemetry(java.lang.String tag, + java.lang.String msg)+
public static interface SyncdDevice.Manager
+Modifier and Type | +Method and Description | +
---|---|
void |
+registerSyncdDevice(SyncdDevice device) |
+
void |
+unregisterSyncdDevice(SyncdDevice device) |
+
void registerSyncdDevice(SyncdDevice device)+
void unregisterSyncdDevice(SyncdDevice device)+
public static enum SyncdDevice.ShutdownReason +extends java.lang.Enum<SyncdDevice.ShutdownReason>+
SyncdDevice.ShutdownReason
indicates the health of the shutdown of the device.Enum Constant and Description | +
---|
ABNORMAL
+The device shutdown abnormally, and we don't know anything about when it might
+ be useful to try to communicate with it again.
+ |
+
ABNORMAL_ATTEMPT_REOPEN
+The device shutdown abnormally, but due to a temporary circumstance (such as ESD)
+ that we believe might be recoverable from after a brief interval
+ |
+
NORMAL
+The device shutdown normally
+ |
+
Modifier and Type | +Method and Description | +
---|---|
static SyncdDevice.ShutdownReason |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static SyncdDevice.ShutdownReason[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final SyncdDevice.ShutdownReason NORMAL+
public static final SyncdDevice.ShutdownReason ABNORMAL+
public static final SyncdDevice.ShutdownReason ABNORMAL_ATTEMPT_REOPEN+
SyncdDevice.msAbnormalReopenInterval
public static SyncdDevice.ShutdownReason[] values()+
+for (SyncdDevice.ShutdownReason c : SyncdDevice.ShutdownReason.values()) + System.out.println(c); +
public static SyncdDevice.ShutdownReason valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static interface SyncdDevice.Syncable
+Modifier and Type | +Method and Description | +
---|---|
void |
+setSyncDeviceManager(SyncdDevice.Manager manager) |
+
void setSyncDeviceManager(SyncdDevice.Manager manager)+
public interface SyncdDevice
+SyncdDevice
is for a device that wants to be in sync with the event loop. If there is sync'd
+ device registered with the event loop manager then the event loop manager will run the event
+ loop in this manner:
+ SyncdDevice
per se now lies in the dustbin of time.
+ However, this self-same object and its associated registration mechanism is also used as part
+ of logic used to deal with abnormal device shutdown (e.g.: USB disconnects) and the processing
+ thereof. The interface thus probably now deserves a better name.Modifier and Type | +Interface and Description | +
---|---|
static interface |
+SyncdDevice.Manager |
+
static class |
+SyncdDevice.ShutdownReason
+SyncdDevice.ShutdownReason indicates the health of the shutdown of the device. |
+
static interface |
+SyncdDevice.Syncable |
+
Modifier and Type | +Field and Description | +
---|---|
static int |
+msAbnormalReopenInterval
+When a device shuts down with
+SyncdDevice.ShutdownReason.ABNORMAL_ATTEMPT_REOPEN , this is
+ the recommended duration of time to wait before attempting reopen. |
+
Modifier and Type | +Method and Description | +
---|---|
RobotUsbModule |
+getOwner()
+Retrieves the owning module of this sync'd device.
+ |
+
SyncdDevice.ShutdownReason |
+getShutdownReason()
+Has this device shutdown abnormally? Note that even if this method returns true that
+ a close() will still be necessary to fully clean up associated resources.
+ |
+
void |
+setOwner(RobotUsbModule owner)
+Records the owning module of this sync'd device.
+ |
+
static final int msAbnormalReopenInterval+
SyncdDevice.ShutdownReason.ABNORMAL_ATTEMPT_REOPEN
, this is
+ the recommended duration of time to wait before attempting reopen. It was only heuristically
+ determined, and might thus perhaps be shortenedSyncdDevice.ShutdownReason getShutdownReason()+
void setOwner(RobotUsbModule owner)+
getOwner()
RobotUsbModule getOwner()+
RobotUsbModule
which is the owner of this devicesetOwner(RobotUsbModule)
public interface AnnotatedOpModeManager +extends OpModeManager+
OpModeManager
,
+OpModeRegistrar
DEFAULT_OP_MODE_NAME
Modifier and Type | +Method and Description | +
---|---|
void |
+register(java.lang.Class opModeClass)
+Register a class for display on the driver station and availability for game play.
+ |
+
void register(java.lang.Class opModeClass)+
TeleOp
or Autonomous
annotation on the
+ class itself (any Disabled
attribute which may also be present is ignored).
+ If the class lacks both a TeleOp
and a Autonomous
annotation, then
+ no registration takes place.opModeClass
- the class of the OpMode to createTeleOp
,
+Autonomous
,
+OpModeManager.register(String, Class)
@Deprecated
+public class AnnotatedOpModeRegistrar
+extends java.lang.Object
+Autonomous
,
+TeleOp
Constructor and Description | +
---|
AnnotatedOpModeRegistrar()
+Deprecated.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
static void |
+register(OpModeManager manager)
+Deprecated.
+
+functionality now automatically called by the system
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public AnnotatedOpModeRegistrar()+
@Deprecated +public static void register(OpModeManager manager)+
@Documented
+ @Target(value=TYPE)
+ @Retention(value=RUNTIME)
+public @interface Autonomous
+Autonomous
annotation on
+ your autonomous OpModes that you want to show up in the driver station display.
+
+ If you want to temporarily disable an opmode, then set then also add
+ a Disabled
annotation to it.TeleOp
,
+Disabled
,
+OpModeRegistrar
Modifier and Type | +Optional Element and Description | +
---|---|
java.lang.String |
+group
+Optionally indicates a group of other OpModes with which the annotated
+ OpMode should be sorted on the driver station OpMode list.
+ |
+
java.lang.String |
+name
+The name to be used on the driver station display.
+ |
+
public abstract java.lang.String name+
public abstract java.lang.String group+
@Documented
+ @Target(value=TYPE)
+ @Retention(value=RUNTIME)
+public @interface Disabled
+Autonomous
or TeleOp
from showing up
+ on the driver station OpMode list.Autonomous
,
+TeleOp
public interface EventLoopManagerClient
+Modifier and Type | +Method and Description | +
---|---|
WebServer |
+getWebServer() |
+
public interface FtcRobotControllerServiceState +extends EventLoopManagerClient+
Modifier and Type | +Method and Description | +
---|---|
EventLoopManager |
+getEventLoopManager() |
+
getWebServer
EventLoopManager getEventLoopManager()+
protected class LinearOpMode.LinearOpModeHelper
+extends java.lang.Object
+implements java.lang.Runnable
+Modifier and Type | +Field and Description | +
---|---|
protected java.lang.RuntimeException |
+exception |
+
protected boolean |
+isShutdown |
+
Constructor and Description | +
---|
LinearOpModeHelper() |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.RuntimeException |
+getRuntimeException() |
+
boolean |
+hasRuntimeException() |
+
boolean |
+isShutdown() |
+
void |
+run() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected java.lang.RuntimeException exception+
protected boolean isShutdown+
public void run()+
run
in interface java.lang.Runnable
public boolean hasRuntimeException()+
public java.lang.RuntimeException getRuntimeException()+
public boolean isShutdown()+
public abstract class LinearOpMode +extends OpMode+
+ This class derives from OpMode, but you should not override the methods from + OpMode.
Modifier and Type | +Class and Description | +
---|---|
protected class |
+LinearOpMode.LinearOpModeHelper |
+
gamepad1, gamepad2, hardwareMap, internalOpModeServices, msStuckDetectInit, msStuckDetectInitLoop, msStuckDetectLoop, msStuckDetectStart, msStuckDetectStop, telemetry, time
Constructor and Description | +
---|
LinearOpMode() |
+
Modifier and Type | +Method and Description | +
---|---|
protected void |
+handleLoop() |
+
void |
+idle()
+Puts the current thread to sleep for a bit as it has nothing better to do.
+ |
+
void |
+init_loop()
+From the non-linear OpMode; do not override
+ |
+
void |
+init()
+From the non-linear OpMode; do not override
+ |
+
void |
+internalPostInitLoop()
+automatically update telemetry in a non-linear opmode
+ |
+
void |
+internalPostLoop()
+automatically update telemetry in a non-linear opmode
+ |
+
boolean |
+isStarted()
+Has the opMode been started?
+ |
+
boolean |
+isStopRequested()
+Has the the stopping of the opMode been requested?
+ |
+
void |
+loop()
+From the non-linear OpMode; do not override
+ |
+
boolean |
+opModeIsActive()
+Answer as to whether this opMode is active and the robot should continue onwards.
+ |
+
abstract void |
+runOpMode()
+Override this method and place your code here.
+ |
+
void |
+sleep(long milliseconds)
+Sleeps for the given amount of milliseconds, or until the thread is interrupted.
+ |
+
void |
+start()
+From the non-linear OpMode; do not override
+ |
+
void |
+stop()
+From the non-linear OpMode; do not override
+ |
+
void |
+waitForNextHardwareCycle()
+Deprecated.
+
+The need for user code to synchronize with the loop() thread has been
+ obviated by improvements in the modern motor and servo controller implementations.
+ Remaining uses of this API are likely unncessarily wasting cycles. If a simple non-zero
+ delay is required, the
+sleep() method is a better choice.
+ If one simply wants to allow other threads to run, idle() is a good choice. |
+
void |
+waitForStart()
+Pauses the Linear Op Mode until start has been pressed or until the current thread
+ is interrupted.
+ |
+
void |
+waitOneFullHardwareCycle()
+Deprecated.
+
+The need for user code to synchronize with the loop() thread has been
+ obviated by improvements in the modern motor and servo controller implementations.
+ Remaining uses of this API are likely unncessarily wasting cycles. If a simple non-zero
+ delay is required, the
+sleep() method is a better choice.
+ If one simply wants to allow other threads to run, idle() is a good choice. |
+
getRuntime, internalPreInit, internalUpdateTelemetryNow, requestOpModeStop, resetStartTime, updateTelemetry
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public abstract void runOpMode() + throws java.lang.InterruptedException+
+ Please do not swallow the InterruptedException, as it is used in cases + where the op mode needs to be terminated early.
java.lang.InterruptedException
public void waitForStart()+
@Deprecated +public void waitOneFullHardwareCycle() + throws java.lang.InterruptedException+
sleep()
method is a better choice.
+ If one simply wants to allow other threads to run, idle()
is a good choice.+ Each cycle of the hardware your commands are sent out to the hardware; and + the latest data is read back in. +
+ This method has a strong guarantee to wait for at least one + full hardware hardware cycle.
java.lang.InterruptedException
Thread.sleep(long)
,
+idle()
,
+waitForNextHardwareCycle()
@Deprecated +public void waitForNextHardwareCycle() + throws java.lang.InterruptedException+
sleep()
method is a better choice.
+ If one simply wants to allow other threads to run, idle()
is a good choice.+ Each cycle of the hardware your commands are sent out to the hardware; and + the latest data is read back in. +
+ This method will wait for the current hardware cycle to finish, which is + also the start of the next hardware cycle.
java.lang.InterruptedException
Thread.sleep(long)
,
+idle()
,
+waitOneFullHardwareCycle()
public final void idle()+
One can use this method when you have nothing better to do in your code as you await state + managed by other threads to change. Calling idle() is entirely optional: it just helps make + the system a little more responsive and a little more efficient.
+ +idle()
is conceptually related to waitOneFullHardwareCycle(), but makes no
+ guarantees as to completing any particular number of hardware cycles, if any.
opModeIsActive()
,
+waitOneFullHardwareCycle()
public final void sleep(long milliseconds)+
sleep()
method.milliseconds
- amount of time to sleep, in millisecondsThread.sleep(long)
public final boolean opModeIsActive()+
Note that internally this method calls idle()
runOpMode()
method and return to its caller.runOpMode()
,
+isStarted()
,
+isStopRequested()
public final boolean isStarted()+
opModeIsActive()
,
+isStopRequested()
public final boolean isStopRequested()+
opModeIsActive()
,
+isStarted()
public final void init()+
public final void init_loop()+
public final void start()+
public final void loop()+
public final void stop()+
protected void handleLoop()+
public void internalPostInitLoop()+
OpMode
internalPostInitLoop
in class OpMode
public void internalPostLoop()+
OpMode
internalPostLoop
in class OpMode
public abstract class OpMode
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
Gamepad |
+gamepad1
+Gamepad 1
+ |
+
Gamepad |
+gamepad2
+Gamepad 2
+ |
+
HardwareMap |
+hardwareMap
+Hardware Mappings
+ |
+
OpModeServices |
+internalOpModeServices
+this is logically an internal field.
+ |
+
int |
+msStuckDetectInit |
+
int |
+msStuckDetectInitLoop |
+
int |
+msStuckDetectLoop |
+
int |
+msStuckDetectStart |
+
int |
+msStuckDetectStop |
+
Telemetry |
+telemetry
+The
+telemetry field contains an object in which a user may accumulate data which
+ is to be transmitted to the driver station. |
+
double |
+time
+number of seconds this op mode has been running, this is
+ updated before every call to loop.
+ |
+
Constructor and Description | +
---|
OpMode()
+OpMode constructor
+ |
+
Modifier and Type | +Method and Description | +
---|---|
double |
+getRuntime()
+Get the number of seconds this op mode has been running
+ |
+
void |
+init_loop()
+User defined init_loop method
+ |
+
abstract void |
+init()
+User defined init method
+ |
+
void |
+internalPostInitLoop()
+automatically update telemetry in a non-linear opmode
+ |
+
void |
+internalPostLoop()
+automatically update telemetry in a non-linear opmode
+ |
+
void |
+internalPreInit() |
+
void |
+internalUpdateTelemetryNow(TelemetryMessage telemetry)
+This is an internal SDK method, not intended for use by user opmodes.
+ |
+
abstract void |
+loop()
+User defined loop method
+ |
+
void |
+requestOpModeStop()
+Requests that this OpMode be shut down if it the currently active opMode, much as if the stop
+ button had been pressed on the driver station; if this is not the currently active OpMode,
+ then this function has no effect.
+ |
+
void |
+resetStartTime()
+Reset the start time to zero.
+ |
+
void |
+start()
+User defined start method.
+ |
+
void |
+stop()
+User defined stop method
+ |
+
void |
+updateTelemetry(Telemetry telemetry)
+Refreshes the user's telemetry on the driver station with the contents of the provided telemetry
+ object if a nominal amount of time has passed since the last telemetry transmission.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public Gamepad gamepad1+
public Gamepad gamepad2+
public Telemetry telemetry+
telemetry
field contains an object in which a user may accumulate data which
+ is to be transmitted to the driver station. This data is automatically transmitted to the
+ driver station on a regular, periodic basis.public HardwareMap hardwareMap+
public double time+
public int msStuckDetectInit+
public int msStuckDetectInitLoop+
public int msStuckDetectStart+
public int msStuckDetectLoop+
public int msStuckDetectStop+
public OpModeServices internalOpModeServices+
public OpMode()+
+ The op mode name should be unique. It will be the name displayed on the driver station. If + multiple op modes have the same name, only one will be available.
public abstract void init()+
+ This method will be called once when the INIT button is pressed.
public void init_loop()+
+ This method will be called repeatedly when the INIT button is pressed. + This method is optional. By default this method takes no action.
public void start()+
+ This method will be called once when the PLAY button is first pressed. + This method is optional. By default this method takes not action. + Example usage: Starting another thread.
public abstract void loop()+
+ This method will be called repeatedly in a loop while this op mode is running
public void stop()+
+ This method will be called when this op mode is first disabled + + The stop method is optional. By default this method takes no action.
public final void requestOpModeStop()+
stop()
+ method will be called, as that is part of the usual shutdown logic. Note that requestOpModeStop()
+ may be called from any thread.stop()
public double getRuntime()+
+ This method has sub millisecond accuracy.
public void resetStartTime()+
public void updateTelemetry(Telemetry telemetry)+
telemetry
- the telemetry data to transmittelemetry
,
+Telemetry.update()
public void internalPreInit()+
public void internalPostInitLoop()+
public void internalPostLoop()+
public final void internalUpdateTelemetryNow(TelemetryMessage telemetry)+
telemetry
- the telemetry data to transmittelemetry
,
+Telemetry.update()
public interface OpModeManager
+AnnotatedOpModeManager
Modifier and Type | +Field and Description | +
---|---|
static java.lang.String |
+DEFAULT_OP_MODE_NAME
+DEFAULT_OP_MODE_NAME is the (non-localized) name of the default opmode, the one that
+ automatically runs whenever no user opmode is running.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+register(OpModeMeta name,
+ java.lang.Class<? extends OpMode> opModeClass)
+Registers a class for display on the driver station and availability for game play.
+ |
+
void |
+register(OpModeMeta name,
+ OpMode opModeInstance)
+Register an *instance* of a class for display on the driver station and availability
+ for game play.
+ |
+
void |
+register(java.lang.String name,
+ java.lang.Class<? extends OpMode> opModeClass)
+Registers a class for display on the driver station and availability for game play.
+ |
+
void |
+register(java.lang.String name,
+ OpMode opModeInstance)
+Register an *instance* of a class for display on the driver station and availability
+ for game play.
+ |
+
static final java.lang.String DEFAULT_OP_MODE_NAME+
void register(java.lang.String name, + java.lang.Class<? extends OpMode> opModeClass)+
name
- the name to show on the driver station menuopModeClass
- the class of the OpMode to createvoid register(OpModeMeta name, + java.lang.Class<? extends OpMode> opModeClass)+
name
- metadata regarding the class, including the name to show on the DS menuopModeClass
- the class of the OpMode to createvoid register(java.lang.String name, + OpMode opModeInstance)+
name
- the name to show on the driver station menuopModeInstance
- the object instance to use for that menu itemvoid register(OpModeMeta name, + OpMode opModeInstance)+
name
- metadata regarding the opmode, including the name to show on the driver station menuopModeInstance
- the object instance to use for that menu itempublic static interface OpModeManagerNotifier.Notifications
+OpModeManagerNotifier.Notifications
can be used to receive notifications of the comings
+ and goings of opmodes in the system. These notifications are sent to any
+ HardwareDevice
in the hardware map that additional implements the
+ OpModeManagerNotifier.Notifications
interface. Notifications may also be received by objects
+ that register themselves with the OpMode manager.Modifier and Type | +Method and Description | +
---|---|
void |
+onOpModePostStop(OpMode opMode)
+The indicated opmode has just been stopped.
+ |
+
void |
+onOpModePreInit(OpMode opMode)
+The indicated opmode is just about to be initialized.
+ |
+
void |
+onOpModePreStart(OpMode opMode)
+The indicated opmode is just about to be started.
+ |
+
void onOpModePreInit(OpMode opMode)+
void onOpModePreStart(OpMode opMode)+
void onOpModePostStop(OpMode opMode)+
public interface OpModeManagerNotifier
+OpModeManagerNotifier.Notifications
is an interface by which interested
+ parties can receive notification of the coming and going of opmodes.OpModeManagerImpl#getOpModeManagerOfActivity(Activity)
Modifier and Type | +Interface and Description | +
---|---|
static interface |
+OpModeManagerNotifier.Notifications
+OpModeManagerNotifier.Notifications can be used to receive notifications of the comings
+ and goings of opmodes in the system. |
+
Modifier and Type | +Method and Description | +
---|---|
OpMode |
+registerListener(OpModeManagerNotifier.Notifications listener)
+Registers an object as explicitly interested in receiving notifications as
+ to the coming and going of opmodes.
+ |
+
void |
+unregisterListener(OpModeManagerNotifier.Notifications listener)
+Unregisters a previously registered listener.
+ |
+
OpMode registerListener(OpModeManagerNotifier.Notifications listener)+
listener
- the object which is to receive notificationsunregisterListener(Notifications)
void unregisterListener(OpModeManagerNotifier.Notifications listener)+
listener
- the listener to be unregistered.public interface OpModeRegister
+Modifier and Type | +Method and Description | +
---|---|
void |
+register(OpModeManager manager)
+The Op Mode Manager will call this method when it wants a list of all
+ available op modes.
+ |
+
void register(OpModeManager manager)+
manager
- op mode manager@Documented
+ @Target(value=METHOD)
+ @Retention(value=RUNTIME)
+public @interface OpModeRegistrar
+Autonomous
and TeleOp
annotations
+ can be placed on your *own* classes to register them, to register classes found
+ in libraries *other* than your own it is best to use a mechanism that does not require
+ that you modify source code in that other library. OpModeRegistar provides such a
+ mechanism.
+ Place an OpModeRegistrar annotation on a static method in your code, and that + method will be automatically called at the right time to register classes. Inside + the method, call opModeManager.register() methods, just as you would had you been + registering methods by putting your code inside the FtcOpModeRegister.register() + method as the robot controller runtime suggests.
@Documented
+ @Target(value=TYPE)
+ @Retention(value=RUNTIME)
+public @interface TeleOp
+TeleOp
annotation on
+ your teleop OpModes that you want to show up in the driver station display.
+
+ If you want to temporarily disable an opmode from showing up, then set then also add
+ a Disabled
annotation to it.Autonomous
,
+Disabled
Modifier and Type | +Optional Element and Description | +
---|---|
java.lang.String |
+group
+Optionally indicates a group of other OpModes with which the annotated
+ OpMode should be sorted on the driver station OpMode list.
+ |
+
java.lang.String |
+name
+The name to be used on the driver station display.
+ |
+
public abstract java.lang.String name+
public abstract java.lang.String group+
Interface | +Description | +
---|---|
AnnotatedOpModeManager | +
+ OpModeManager instances are used as part of a decentralized OpMode registration
+ mechanism.
+ |
+
EventLoopManagerClient | +
+ Provides certain functionality to the EventLoopManager from its client
+ |
+
FtcRobotControllerServiceState | +
+ Created by David on 7/7/2017.
+ |
+
OpModeManager | +
+ OpModeManager instances are used to register opmodes for use.
+ |
+
OpModeManagerNotifier | +
+OpModeManagerNotifier.Notifications is an interface by which interested
+ parties can receive notification of the coming and going of opmodes. |
+
OpModeManagerNotifier.Notifications | +
+OpModeManagerNotifier.Notifications can be used to receive notifications of the comings
+ and goings of opmodes in the system. |
+
OpModeRegister | +
+ Register Op Modes
+ |
+
Class | +Description | +
---|---|
AnnotatedOpModeRegistrar | +Deprecated
+ The function formerly performed by this class is now automatically executed by the system
+ |
+
LinearOpMode | +
+ Base class for user defined linear operation modes (op modes).
+ |
+
OpMode | +
+ Base class for user defined operation modes (op modes).
+ |
+
Annotation Type | +Description | +
---|---|
Autonomous | +
+ Provides an easy and non-centralized way of determining the OpMode list
+ shown on an FTC Driver Station.
+ |
+
Disabled | +
+ Provides a way to temporarily disable an OpMode annotated with
+
+Autonomous or TeleOp from showing up
+ on the driver station OpMode list. |
+
OpModeRegistrar | +
+ Provides an easy and non-centralized way of contributing to the OpMode list
+ shown on an FTC Driver Station.
+ |
+
TeleOp | +
+ Provides an easy and non-centralized way of determining the OpMode list
+ shown on an FTC Driver Station.
+ |
+
Interface | +Description | +
---|---|
EventLoop | +
+ Event loop interface
+ |
+
EventLoopManager.EventLoopMonitor | +
+ Callback to monitor when event loop changes state
+ |
+
SyncdDevice | +
+SyncdDevice is for a device that wants to be in sync with the event loop. |
+
SyncdDevice.Manager | ++ |
SyncdDevice.Syncable | ++ |
Class | +Description | +
---|---|
EventLoopManager | +
+ Event Loop Manager
+ |
+
Enum | +Description | +
---|---|
SyncdDevice.ShutdownReason | +
+SyncdDevice.ShutdownReason indicates the health of the shutdown of the device. |
+
+ If you would like to create your own custom event loop, see EventLoop
.
public class DuplicateNameException
+extends java.lang.RuntimeException
+Constructor and Description | +
---|
DuplicateNameException(java.lang.String message) |
+
DuplicateNameException(java.lang.String format,
+ java.lang.Object... args) |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public class RobotCoreException
+extends java.lang.Exception
+Constructor and Description | +
---|
RobotCoreException(java.lang.String message) |
+
RobotCoreException(java.lang.String format,
+ java.lang.Object... args) |
+
RobotCoreException(java.lang.String message,
+ java.lang.Throwable cause) |
+
Modifier and Type | +Method and Description | +
---|---|
static RobotCoreException |
+createChained(java.lang.Exception e,
+ java.lang.String format,
+ java.lang.Object... args) |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public RobotCoreException(java.lang.String message)+
public RobotCoreException(java.lang.String message, + java.lang.Throwable cause)+
public RobotCoreException(java.lang.String format, + java.lang.Object... args)+
public static RobotCoreException createChained(java.lang.Exception e, + java.lang.String format, + java.lang.Object... args)+
public class RobotProtocolException
+extends java.lang.Exception
+Constructor and Description | +
---|
RobotProtocolException(java.lang.String message) |
+
RobotProtocolException(java.lang.String format,
+ java.lang.Object... args) |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public class TargetPositionNotSetException
+extends java.lang.RuntimeException
+Constructor and Description | +
---|
TargetPositionNotSetException() |
+
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Exception | +Description | +
---|---|
DuplicateNameException | +
+ Created by bob on 2016-04-20.
+ |
+
RobotCoreException | ++ |
RobotProtocolException | ++ |
TargetPositionNotSetException | ++ |
public interface AccelerationSensor +extends HardwareDevice+
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
Acceleration |
+getAcceleration()
+Acceleration, measured in g's
+ |
+
java.lang.String |
+status()
+Status of this sensor, in string form
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
Acceleration getAcceleration()+
java.lang.String status()+
public class AnalogInput +extends java.lang.Object +implements HardwareDevice+
HardwareDevice.Manufacturer
Constructor and Description | +
---|
AnalogInput(AnalogInputController controller,
+ int channel)
+Constructor
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close()
+Closes this device
+ |
+
java.lang.String |
+getConnectionInfo()
+Get connection information about this device in a human readable format
+ |
+
java.lang.String |
+getDeviceName()
+Returns a string suitable for display to the user as to the type of device.
+ |
+
HardwareDevice.Manufacturer |
+getManufacturer()
+Returns an indication of the manufacturer of this device.
+ |
+
double |
+getMaxVoltage()
+Returns the maximum value that getVoltage() is capable of reading
+ |
+
int |
+getVersion()
+Version
+ |
+
double |
+getVoltage()
+Returns the current voltage of this input.
+ |
+
void |
+resetDeviceConfigurationForOpMode()
+Resets the device's configuration to that which is expected at the beginning of an OpMode.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public AnalogInput(AnalogInputController controller, + int channel)+
controller
- AnalogInput controller this channel is attached tochannel
- channel on the analog input controllerpublic HardwareDevice.Manufacturer getManufacturer()+
HardwareDevice
getManufacturer
in interface HardwareDevice
public double getVoltage()+
public double getMaxVoltage()+
getVoltage()
public java.lang.String getDeviceName()+
HardwareDevice
getDeviceName
in interface HardwareDevice
public java.lang.String getConnectionInfo()+
HardwareDevice
getConnectionInfo
in interface HardwareDevice
public int getVersion()+
HardwareDevice
getVersion
in interface HardwareDevice
public void resetDeviceConfigurationForOpMode()+
HardwareDevice
resetDeviceConfigurationForOpMode
in interface HardwareDevice
public void close()+
HardwareDevice
close
in interface HardwareDevice
public interface AnalogInputController +extends HardwareDevice+
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
double |
+getAnalogInputVoltage(int channel)
+Get the value of this analog input
+
+ Return the current ADC results from the A0-A7 channel input pins.
+ |
+
double |
+getMaxAnalogInputVoltage()
+Returns the maximum value that getAnalogInputVoltage() is capable of reading
+ |
+
SerialNumber |
+getSerialNumber()
+Serial Number
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
double getAnalogInputVoltage(int channel)+
channel
- which analog channel to readdouble getMaxAnalogInputVoltage()+
getAnalogInputVoltage(int)
SerialNumber getSerialNumber()+
public class AnalogOutput +extends java.lang.Object +implements HardwareDevice+
HardwareDevice.Manufacturer
Constructor and Description | +
---|
AnalogOutput(AnalogOutputController controller,
+ int channel)
+Constructor
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close()
+Closes this device
+ |
+
java.lang.String |
+getConnectionInfo()
+Get connection information about this device in a human readable format
+ |
+
java.lang.String |
+getDeviceName()
+Returns a string suitable for display to the user as to the type of device.
+ |
+
HardwareDevice.Manufacturer |
+getManufacturer()
+Returns an indication of the manufacturer of this device.
+ |
+
int |
+getVersion()
+Version
+ |
+
void |
+resetDeviceConfigurationForOpMode()
+Resets the device's configuration to that which is expected at the beginning of an OpMode.
+ |
+
void |
+setAnalogOutputFrequency(int freq)
+Sets the channel output frequency in the range 1-5,000 Hz in mode 1, 2 or 3.
+ |
+
void |
+setAnalogOutputMode(byte mode)
+Sets the channel operating mode.
+ |
+
void |
+setAnalogOutputVoltage(int voltage)
+Sets the channel output voltage.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public AnalogOutput(AnalogOutputController controller, + int channel)+
controller
- AnalogOutput controller this channel is attached tochannel
- channel on the analog output controllerpublic void setAnalogOutputVoltage(int voltage)+
voltage
- voltage value in the correct range.public void setAnalogOutputFrequency(int freq)+
freq
- output frequency in the range1-5,000Hzpublic void setAnalogOutputMode(byte mode)+
mode
- voltage, sine, square, or trianglepublic HardwareDevice.Manufacturer getManufacturer()+
HardwareDevice
getManufacturer
in interface HardwareDevice
public java.lang.String getDeviceName()+
HardwareDevice
getDeviceName
in interface HardwareDevice
public java.lang.String getConnectionInfo()+
HardwareDevice
getConnectionInfo
in interface HardwareDevice
public int getVersion()+
HardwareDevice
getVersion
in interface HardwareDevice
public void resetDeviceConfigurationForOpMode()+
HardwareDevice
resetDeviceConfigurationForOpMode
in interface HardwareDevice
public void close()+
HardwareDevice
close
in interface HardwareDevice
public interface AnalogOutputController +extends HardwareDevice+
+ Different analog input controllers will implement this interface.
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
SerialNumber |
+getSerialNumber()
+Serial Number
+ |
+
void |
+setAnalogOutputFrequency(int port,
+ int freq)
+Sets the channel output frequency in the range 1-5,000 Hz in mode 1, 2 or 3.
+ |
+
void |
+setAnalogOutputMode(int port,
+ byte mode)
+Sets the channel operating mode.
+ |
+
void |
+setAnalogOutputVoltage(int port,
+ int voltage)
+Sets the channel output voltage.
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
SerialNumber getSerialNumber()+
void setAnalogOutputVoltage(int port, + int voltage)+
port
- channel 0 or 1voltage
- voltage value in the correct range.void setAnalogOutputFrequency(int port, + int freq)+
port
- 1 or 0freq
- output frequency in the range1-5,000Hzvoid setAnalogOutputMode(int port, + byte mode)+
port
- 0 or 1mode
- voltage, sine, square, or trianglepublic interface AnalogSensor
+Modifier and Type | +Method and Description | +
---|---|
double |
+readRawVoltage()
+Returns the sensor's current value as a raw voltage level.
+ |
+
double readRawVoltage()+
public static class Blinker.Step
+extends java.lang.Object
+Blinker.Step
represents a particular color held for a particular length of time.Modifier and Type | +Field and Description | +
---|---|
protected int |
+color |
+
protected int |
+msDuration |
+
Constructor and Description | +
---|
Step() |
+
Step(int color,
+ long duration,
+ java.util.concurrent.TimeUnit unit) |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+equals(Blinker.Step step) |
+
boolean |
+equals(java.lang.Object them) |
+
int |
+getColor() |
+
int |
+getDurationMs() |
+
int |
+hashCode() |
+
boolean |
+isLit() |
+
static Blinker.Step |
+nullStep() |
+
void |
+setColor(int color) |
+
void |
+setDuration(long duration,
+ java.util.concurrent.TimeUnit unit) |
+
void |
+setLit(boolean isEnabled) |
+
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
protected int color+
protected int msDuration+
public Step()+
public Step(int color, + long duration, + java.util.concurrent.TimeUnit unit)+
public static Blinker.Step nullStep()+
public boolean equals(java.lang.Object them)+
equals
in class java.lang.Object
public boolean equals(Blinker.Step step)+
public int hashCode()+
hashCode
in class java.lang.Object
public boolean isLit()+
public void setLit(boolean isEnabled)+
public int getColor()+
public void setColor(int color)+
public int getDurationMs()+
public void setDuration(long duration, + java.util.concurrent.TimeUnit unit)+
public interface Blinker
+Blinker
provides the means to control an LED or a light that can be illuminated in a
+ sequenced pattern of colors and durations.Modifier and Type | +Interface and Description | +
---|---|
static class |
+Blinker.Step
+Blinker.Step represents a particular color held for a particular length of time. |
+
Modifier and Type | +Method and Description | +
---|---|
int |
+getBlinkerPatternMaxLength()
+Returns the maximum number of
+Blinker.Step s that can be present in a pattern |
+
java.util.Collection<Blinker.Step> |
+getPattern()
+Returns the current blinking pattern
+ |
+
boolean |
+patternStackNotEmpty()
+Returns whether the pattern stack is currently nonempty.
+ |
+
boolean |
+popPattern()
+Pops the next pattern off of the stack of saved patterns, if any.
+ |
+
void |
+pushPattern(java.util.Collection<Blinker.Step> steps)
+Saves the existing pattern such that it can be later restored, then calls setPattern().
+ |
+
void |
+setConstant(int color)
+Sets the blinker pattern to be a single, unchanging color
+ |
+
void |
+setPattern(java.util.Collection<Blinker.Step> steps)
+Sets the pattern with which this LED or light should illuminate.
+ |
+
void |
+stopBlinking()
+Sets the blinker to constant black and frees any internal resources
+ |
+
void setPattern(java.util.Collection<Blinker.Step> steps)+
steps
- the pattern of colors and durations that the LED or light should illuminate itself withjava.util.Collection<Blinker.Step> getPattern()+
void pushPattern(java.util.Collection<Blinker.Step> steps)+
steps
- the new pattern to be displayedboolean patternStackNotEmpty()+
boolean popPattern()+
void setConstant(int color)+
color
- the color with which the LED or light should be illuminatedvoid stopBlinking()+
int getBlinkerPatternMaxLength()+
Blinker.Step
s that can be present in a patternBlinker.Step
s that can be present in a patternpublic interface CRServo +extends DcMotorSimple+
DcMotorSimple.Direction
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
ServoController |
+getController()
+Returns the underlying servo controller on which this servo is situated.
+ |
+
int |
+getPortNumber()
+Returns the port number on the underlying servo controller on which this motor is situated.
+ |
+
getDirection, getPower, setDirection, setPower
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
ServoController getController()+
getPortNumber()
int getPortNumber()+
getController()
public class CRServoImpl +extends java.lang.Object +implements CRServo+
DcMotorSimple.Direction
HardwareDevice.Manufacturer
Modifier and Type | +Field and Description | +
---|---|
protected static double |
+apiPowerMax |
+
protected static double |
+apiPowerMin |
+
protected static double |
+apiServoPositionMax |
+
protected static double |
+apiServoPositionMin |
+
protected ServoController |
+controller |
+
protected DcMotorSimple.Direction |
+direction |
+
protected int |
+portNumber |
+
Constructor and Description | +
---|
CRServoImpl(ServoController controller,
+ int portNumber)
+Constructor
+ |
+
CRServoImpl(ServoController controller,
+ int portNumber,
+ DcMotorSimple.Direction direction)
+Constructor
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close()
+Closes this device
+ |
+
java.lang.String |
+getConnectionInfo()
+Get connection information about this device in a human readable format
+ |
+
ServoController |
+getController()
+Returns the underlying servo controller on which this servo is situated.
+ |
+
java.lang.String |
+getDeviceName()
+Returns a string suitable for display to the user as to the type of device.
+ |
+
DcMotorSimple.Direction |
+getDirection()
+Returns the current logical direction in which this motor is set as operating.
+ |
+
HardwareDevice.Manufacturer |
+getManufacturer()
+Returns an indication of the manufacturer of this device.
+ |
+
int |
+getPortNumber()
+Returns the port number on the underlying servo controller on which this motor is situated.
+ |
+
double |
+getPower()
+Returns the current configured power level of the motor.
+ |
+
int |
+getVersion()
+Version
+ |
+
void |
+resetDeviceConfigurationForOpMode()
+Resets the device's configuration to that which is expected at the beginning of an OpMode.
+ |
+
void |
+setDirection(DcMotorSimple.Direction direction)
+Sets the logical direction in which this motor operates.
+ |
+
void |
+setPower(double power)
+Sets the power level of the motor, expressed as a fraction of the maximum
+ possible power / speed supported according to the run mode in which the
+ motor is operating.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected ServoController controller+
protected int portNumber+
protected DcMotorSimple.Direction direction+
protected static final double apiPowerMin+
protected static final double apiPowerMax+
protected static final double apiServoPositionMin+
protected static final double apiServoPositionMax+
public CRServoImpl(ServoController controller, + int portNumber)+
controller
- Servo controller that this servo is attached toportNumber
- physical port number on the servo controllerpublic CRServoImpl(ServoController controller, + int portNumber, + DcMotorSimple.Direction direction)+
controller
- Servo controller that this servo is attached toportNumber
- physical port number on the servo controllerdirection
- FORWARD for normal operation, REVERSE to reverse operationpublic HardwareDevice.Manufacturer getManufacturer()+
HardwareDevice
getManufacturer
in interface HardwareDevice
public java.lang.String getDeviceName()+
HardwareDevice
getDeviceName
in interface HardwareDevice
public java.lang.String getConnectionInfo()+
HardwareDevice
getConnectionInfo
in interface HardwareDevice
public int getVersion()+
HardwareDevice
getVersion
in interface HardwareDevice
public void resetDeviceConfigurationForOpMode()+
HardwareDevice
resetDeviceConfigurationForOpMode
in interface HardwareDevice
public void close()+
HardwareDevice
close
in interface HardwareDevice
public ServoController getController()+
CRServo
getController
in interface CRServo
CRServo.getPortNumber()
public int getPortNumber()+
CRServo
getPortNumber
in interface CRServo
CRServo.getController()
public void setDirection(DcMotorSimple.Direction direction)+
DcMotorSimple
setDirection
in interface DcMotorSimple
direction
- the direction to set for this motorDcMotorSimple.getDirection()
public DcMotorSimple.Direction getDirection()+
DcMotorSimple
getDirection
in interface DcMotorSimple
DcMotorSimple.setDirection(Direction)
public void setPower(double power)+
DcMotorSimple
Setting a power level of zero will brake the motor
setPower
in interface DcMotorSimple
power
- the new power level of the motor, a value in the interval [-1.0, 1.0]DcMotorSimple.getPower()
,
+DcMotor.setMode(DcMotor.RunMode)
,
+DcMotor.setPowerFloat()
public double getPower()+
DcMotorSimple
getPower
in interface DcMotorSimple
DcMotorSimple.setPower(double)
public class CRServoImplEx +extends CRServoImpl +implements PwmControl+
CRServo
and PwmControl
interfaces.PwmControl.PwmRange
DcMotorSimple.Direction
HardwareDevice.Manufacturer
Modifier and Type | +Field and Description | +
---|---|
protected ServoControllerEx |
+controllerEx |
+
apiPowerMax, apiPowerMin, apiServoPositionMax, apiServoPositionMin, controller, direction, portNumber
Constructor and Description | +
---|
CRServoImplEx(ServoControllerEx controller,
+ int portNumber,
+ DcMotorSimple.Direction direction,
+ ServoConfigurationType servoType) |
+
CRServoImplEx(ServoControllerEx controller,
+ int portNumber,
+ ServoConfigurationType servoType) |
+
Modifier and Type | +Method and Description | +
---|---|
PwmControl.PwmRange |
+getPwmRange()
+Returns the current PWM range limits for the servo
+ |
+
boolean |
+isPwmEnabled()
+Returns whether the PWM is energized for this particular servo
+ |
+
void |
+setPwmDisable()
+Individually denergizes the PWM for this particular servo
+ |
+
void |
+setPwmEnable()
+Individually energizes the PWM for this particular servo.
+ |
+
void |
+setPwmRange(PwmControl.PwmRange range)
+Sets the PWM range limits for the servo
+ |
+
close, getConnectionInfo, getController, getDeviceName, getDirection, getManufacturer, getPortNumber, getPower, getVersion, resetDeviceConfigurationForOpMode, setDirection, setPower
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected ServoControllerEx controllerEx+
public CRServoImplEx(ServoControllerEx controller, + int portNumber, + ServoConfigurationType servoType)+
public CRServoImplEx(ServoControllerEx controller, + int portNumber, + DcMotorSimple.Direction direction, + ServoConfigurationType servoType)+
public void setPwmRange(PwmControl.PwmRange range)+
PwmControl
setPwmRange
in interface PwmControl
range
- the new PWM range limits for the servoPwmControl.getPwmRange()
public PwmControl.PwmRange getPwmRange()+
PwmControl
getPwmRange
in interface PwmControl
PwmControl.setPwmRange(PwmRange)
public void setPwmEnable()+
PwmControl
setPwmEnable
in interface PwmControl
PwmControl.setPwmDisable()
,
+PwmControl.isPwmEnabled()
public void setPwmDisable()+
PwmControl
setPwmDisable
in interface PwmControl
PwmControl.setPwmEnable()
public boolean isPwmEnabled()+
PwmControl
isPwmEnabled
in interface PwmControl
PwmControl.setPwmEnable()
public interface ColorSensor +extends HardwareDevice+
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
int |
+alpha()
+Get the amount of light detected by the sensor as an int.
+ |
+
int |
+argb()
+Get the "hue"
+ |
+
int |
+blue()
+Get the Blue values detected by the sensor as an int.
+ |
+
void |
+enableLed(boolean enable)
+Enable the LED light
+ |
+
I2cAddr |
+getI2cAddress()
+Get the current I2C Address of this object.
+ |
+
int |
+green()
+Get the Green values detected by the sensor as an int.
+ |
+
int |
+red()
+Get the Red values detected by the sensor as an int.
+ |
+
void |
+setI2cAddress(I2cAddr newAddress)
+Set the I2C address to a new value.
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
int red()+
int green()+
int blue()+
int alpha()+
int argb()+
void enableLed(boolean enable)+
enable
- true to enable; false to disablevoid setI2cAddress(I2cAddr newAddress)+
I2cAddr getI2cAddress()+
public static enum CompassSensor.CompassMode +extends java.lang.Enum<CompassSensor.CompassMode>+
Enum Constant and Description | +
---|
CALIBRATION_MODE |
+
MEASUREMENT_MODE |
+
Modifier and Type | +Method and Description | +
---|---|
static CompassSensor.CompassMode |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static CompassSensor.CompassMode[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final CompassSensor.CompassMode MEASUREMENT_MODE+
public static final CompassSensor.CompassMode CALIBRATION_MODE+
public static CompassSensor.CompassMode[] values()+
+for (CompassSensor.CompassMode c : CompassSensor.CompassMode.values()) + System.out.println(c); +
public static CompassSensor.CompassMode valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic interface CompassSensor +extends HardwareDevice+
Modifier and Type | +Interface and Description | +
---|---|
static class |
+CompassSensor.CompassMode |
+
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
boolean |
+calibrationFailed()
+Check to see whether calibration was successful.
+ |
+
double |
+getDirection()
+Get the current direction, in degrees, in the range [0, 360).
+ |
+
void |
+setMode(CompassSensor.CompassMode mode)
+Change to calibration or measurement mode
+ |
+
java.lang.String |
+status()
+Status of this sensor, in string form
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
double getDirection()+
java.lang.String status()+
void setMode(CompassSensor.CompassMode mode)+
boolean calibrationFailed()+
public enum ControlSystem +extends java.lang.Enum<ControlSystem>+
Enum Constant and Description | +
---|
MODERN_ROBOTICS |
+
REV_HUB |
+
Modifier and Type | +Method and Description | +
---|---|
static ControlSystem |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static ControlSystem[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final ControlSystem MODERN_ROBOTICS+
public static final ControlSystem REV_HUB+
public static ControlSystem[] values()+
+for (ControlSystem c : ControlSystem.values()) + System.out.println(c); +
public static ControlSystem valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static enum DcMotor.RunMode +extends java.lang.Enum<DcMotor.RunMode>+
DcMotor.RunMode
controls how the motor interprets the
+ it's parameter settings passed through power- and encoder-related methods.
+ Some of these modes internally use PID
+ control to achieve their function, while others do not. Those that do are referred
+ to as "PID modes".Enum Constant and Description | +
---|
RESET_ENCODERS
+Deprecated.
+
+Use
+STOP_AND_RESET_ENCODER instead |
+
RUN_TO_POSITION
+The motor is to attempt to rotate in whatever direction is necessary to cause the
+ encoder reading to advance or retreat from its current setting to the setting which
+ has been provided through the
+setTargetPosition() method. |
+
RUN_USING_ENCODER
+The motor is to do its best to run at targeted velocity.
+ |
+
RUN_USING_ENCODERS
+Deprecated.
+
+Use
+RUN_USING_ENCODER instead |
+
RUN_WITHOUT_ENCODER
+The motor is simply to run at whatever velocity is achieved by apply a particular
+ power level to the motor.
+ |
+
RUN_WITHOUT_ENCODERS
+Deprecated.
+
+Use
+RUN_WITHOUT_ENCODER instead |
+
STOP_AND_RESET_ENCODER
+The motor is to set the current encoder position to zero.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+isPIDMode()
+Returns whether this RunMode is a PID-controlled mode or not
+ |
+
DcMotor.RunMode |
+migrate()
+Deprecated.
+
+Replace use of old constants with new
+ |
+
static DcMotor.RunMode |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static DcMotor.RunMode[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final DcMotor.RunMode RUN_WITHOUT_ENCODER+
public static final DcMotor.RunMode RUN_USING_ENCODER+
public static final DcMotor.RunMode RUN_TO_POSITION+
setTargetPosition()
method.
+ An encoder must be affixed to this motor in order to use this mode. This is a PID mode.public static final DcMotor.RunMode STOP_AND_RESET_ENCODER+
RUN_TO_POSITION
,
+ the motor is not rotated in order to achieve this; rather, the current rotational
+ position of the motor is simply reinterpreted as the new zero value. However, as
+ a side effect of placing a motor in this mode, power is removed from the motor, causing
+ it to stop, though it is unspecified whether the motor enters brake or float mode.
+
+ Further, it should be noted that setting a motor toSTOP_AND_RESET_ENCODER
may or may not be a transient state: motors connected to some motor
+ controllers will remain in this mode until explicitly transitioned to a different one, while
+ motors connected to other motor controllers will automatically transition to a different
+ mode after the reset of the encoder is complete.@Deprecated +public static final DcMotor.RunMode RUN_WITHOUT_ENCODERS+
RUN_WITHOUT_ENCODER
instead@Deprecated +public static final DcMotor.RunMode RUN_USING_ENCODERS+
RUN_USING_ENCODER
instead@Deprecated +public static final DcMotor.RunMode RESET_ENCODERS+
STOP_AND_RESET_ENCODER
insteadpublic static DcMotor.RunMode[] values()+
+for (DcMotor.RunMode c : DcMotor.RunMode.values()) + System.out.println(c); +
public static DcMotor.RunMode valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null@Deprecated +public DcMotor.RunMode migrate()+
public boolean isPIDMode()+
public static enum DcMotor.ZeroPowerBehavior +extends java.lang.Enum<DcMotor.ZeroPowerBehavior>+
Enum Constant and Description | +
---|
BRAKE
+The motor stops and then brakes, actively resisting any external force which attempts
+ to turn the motor.
+ |
+
FLOAT
+The motor stops and then floats: an external force attempting to turn the motor is not
+ met with active resistence.
+ |
+
UNKNOWN
+The behavior of the motor when zero power is applied is not currently known.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
static DcMotor.ZeroPowerBehavior |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static DcMotor.ZeroPowerBehavior[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final DcMotor.ZeroPowerBehavior UNKNOWN+
DcMotor.setZeroPowerBehavior(ZeroPowerBehavior)
and will never be returned from
+ DcMotor.getZeroPowerBehavior()
public static final DcMotor.ZeroPowerBehavior BRAKE+
public static final DcMotor.ZeroPowerBehavior FLOAT+
public static DcMotor.ZeroPowerBehavior[] values()+
+for (DcMotor.ZeroPowerBehavior c : DcMotor.ZeroPowerBehavior.values()) + System.out.println(c); +
public static DcMotor.ZeroPowerBehavior valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic interface DcMotor +extends DcMotorSimple+
Modifier and Type | +Interface and Description | +
---|---|
static class |
+DcMotor.RunMode
+The run mode of a motor
+DcMotor.RunMode controls how the motor interprets the
+ it's parameter settings passed through power- and encoder-related methods. |
+
static class |
+DcMotor.ZeroPowerBehavior
+ZeroPowerBehavior provides an indication as to a motor's behavior when a power level of zero
+ is applied.
+ |
+
DcMotorSimple.Direction
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
DcMotorController |
+getController()
+Returns the underlying motor controller on which this motor is situated.
+ |
+
int |
+getCurrentPosition()
+Returns the current reading of the encoder for this motor.
+ |
+
DcMotor.RunMode |
+getMode()
+Returns the current run mode for this motor
+ |
+
MotorConfigurationType |
+getMotorType()
+Returns the assigned type for this motor.
+ |
+
int |
+getPortNumber()
+Returns the port number on the underlying motor controller on which this motor is situated.
+ |
+
boolean |
+getPowerFloat()
+Returns whether the motor is currently in a float power level.
+ |
+
int |
+getTargetPosition()
+Returns the current target encoder position for this motor.
+ |
+
DcMotor.ZeroPowerBehavior |
+getZeroPowerBehavior()
+Returns the current behavior of the motor were a power level of zero to be applied.
+ |
+
boolean |
+isBusy()
+Returns true if the motor is currently advancing or retreating to a target position.
+ |
+
void |
+setMode(DcMotor.RunMode mode)
+Sets the current run mode for this motor
+ |
+
void |
+setMotorType(MotorConfigurationType motorType)
+Sets the assigned type of this motor.
+ |
+
void |
+setPowerFloat()
+Deprecated.
+
+This method is deprecated in favor of direct use of
+
+setZeroPowerBehavior() and
+ setPower() . |
+
void |
+setTargetPosition(int position)
+Sets the desired encoder target position to which the motor should advance or retreat
+ and then actively hold thereat.
+ |
+
void |
+setZeroPowerBehavior(DcMotor.ZeroPowerBehavior zeroPowerBehavior)
+Sets the behavior of the motor when a power level of zero is applied.
+ |
+
getDirection, getPower, setDirection, setPower
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
MotorConfigurationType getMotorType()+
MotorConfigurationType#getUnspecifiedMotorType()
will be returned.
+ Note that the motor type for a given motor is initially assigned in the robot
+ configuration user interface, though it may subsequently be modified using methods herein.void setMotorType(MotorConfigurationType motorType)+
motorType
- the new assigned type for this motorgetMotorType()
DcMotorController getController()+
getPortNumber()
int getPortNumber()+
getController()
void setZeroPowerBehavior(DcMotor.ZeroPowerBehavior zeroPowerBehavior)+
zeroPowerBehavior
- the new behavior of the motor when a power level of zero is applied.DcMotor.ZeroPowerBehavior
,
+DcMotorSimple.setPower(double)
DcMotor.ZeroPowerBehavior getZeroPowerBehavior()+
@Deprecated +void setPowerFloat()+
setZeroPowerBehavior()
and
+ setPower()
.FLOAT
, then
+ applies zero power to that motor.
+
+ Note that the change of the zero power behavior to FLOAT
+ remains in effect even following the return of this method. This is a breaking
+ change in behavior from previous releases of the SDK. Consider, for example, the
+ following code sequence:
+ motor.setZeroPowerBehavior(ZeroPowerBehavior.BRAKE); // method not available in previous releases + motor.setPowerFloat(); + motor.setPower(0.0); ++ +
Starting from this release, this sequence of code will leave the motor floating. Previously, + the motor would have been left braked.
boolean getPowerFloat()+
setPowerFloat()
void setTargetPosition(int position)+
isBusy()
will return true.
+
+ Note that adjustment to a target position is only effective when the motor is in
+ RUN_TO_POSITION
+ RunMode. Note further that, clearly, the motor must be equipped with an encoder in order
+ for this mode to function properly.
position
- the desired encoder target positiongetCurrentPosition()
,
+setMode(RunMode)
,
+DcMotor.RunMode.RUN_TO_POSITION
,
+getTargetPosition()
,
+isBusy()
int getTargetPosition()+
setTargetPosition(int)
boolean isBusy()+
setTargetPosition(int)
int getCurrentPosition()+
getTargetPosition()
,
+DcMotor.RunMode.STOP_AND_RESET_ENCODER
void setMode(DcMotor.RunMode mode)+
mode
- the new current run mode for this motorDcMotor.RunMode
,
+getMode()
DcMotor.RunMode getMode()+
DcMotor.RunMode
,
+setMode(RunMode)
public interface DcMotorController +extends HardwareDevice+
+ Different DC motor controllers will implement this interface.
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
int |
+getMotorCurrentPosition(int motor)
+Get the current motor position
+ |
+
DcMotor.RunMode |
+getMotorMode(int motor)
+Get the current motor mode.
+ |
+
double |
+getMotorPower(int motor)
+Get the current motor power
+ |
+
boolean |
+getMotorPowerFloat(int motor)
+Is motor power set to float?
+ |
+
int |
+getMotorTargetPosition(int motor)
+Get the current motor target position
+ |
+
MotorConfigurationType |
+getMotorType(int motor)
+Retrieves the motor type configured for this motor
+ |
+
DcMotor.ZeroPowerBehavior |
+getMotorZeroPowerBehavior(int motor)
+Returns the current zero power behavior of the motor.
+ |
+
boolean |
+isBusy(int motor)
+Is the motor busy?
+ |
+
void |
+resetDeviceConfigurationForOpMode(int motor)
+Reset the state we hold for the given motor so that it's clean at the start of an opmode
+ |
+
void |
+setMotorMode(int motor,
+ DcMotor.RunMode mode)
+Set the current motor mode.
+ |
+
void |
+setMotorPower(int motor,
+ double power)
+Set the current motor power
+ |
+
void |
+setMotorTargetPosition(int motor,
+ int position)
+Set the motor target position.
+ |
+
void |
+setMotorType(int motor,
+ MotorConfigurationType motorType)
+Informs the motor controller of the type of a particular motor.
+ |
+
void |
+setMotorZeroPowerBehavior(int motor,
+ DcMotor.ZeroPowerBehavior zeroPowerBehavior)
+Sets the behavior of the motor when zero power is applied.
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
void setMotorType(int motor, + MotorConfigurationType motorType)+
motor
- port of the motor in questionmotorType
- the motor type.MotorConfigurationType getMotorType(int motor)+
motor
- the motor in questionMotorConfigurationType#getUnspecifiedMotorType()
+ if no type has been configuredvoid setMotorMode(int motor, + DcMotor.RunMode mode)+
DcMotor.RunMode
motor
- port of motormode
- run modeDcMotor.RunMode getMotorMode(int motor)+
motor
- port of motorvoid setMotorPower(int motor, + double power)+
motor
- port of motorpower
- from -1.0 to 1.0double getMotorPower(int motor)+
motor
- port of motorboolean isBusy(int motor)+
motor
- port of motorvoid setMotorZeroPowerBehavior(int motor, + DcMotor.ZeroPowerBehavior zeroPowerBehavior)+
zeroPowerBehavior
- the behavior of the motor when zero power is applied.DcMotor.ZeroPowerBehavior getMotorZeroPowerBehavior(int motor)+
boolean getMotorPowerFloat(int motor)+
motor
- port of motorvoid setMotorTargetPosition(int motor, + int position)+
motor
- port of motorposition
- range from Integer.MIN_VALUE to Integer.MAX_VALUEint getMotorTargetPosition(int motor)+
motor
- port of motorint getMotorCurrentPosition(int motor)+
motor
- port of motorvoid resetDeviceConfigurationForOpMode(int motor)+
motor
- public interface DcMotorControllerEx +extends DcMotorController+
DcMotorEx
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
double |
+getMotorVelocity(int motor)
+Returns the velocity of the indicated motor in ticks per second.
+ |
+
double |
+getMotorVelocity(int motor,
+ AngleUnit unit)
+Returns the velocity of the indicated motor.
+ |
+
PIDCoefficients |
+getPIDCoefficients(int motor,
+ DcMotor.RunMode mode)
+Deprecated.
+
+Use
+getPIDFCoefficients(int, DcMotor.RunMode) instead |
+
PIDFCoefficients |
+getPIDFCoefficients(int motor,
+ DcMotor.RunMode mode)
+Returns the coefficients used for PIDF control on the indicated motor when in the indicated mode
+ |
+
boolean |
+isMotorEnabled(int motor)
+Returns whether a particular motor on the controller is energized
+ |
+
void |
+setMotorDisable(int motor)
+Individually denergizes a particular motor
+ |
+
void |
+setMotorEnable(int motor)
+Individually energizes a particular motor
+ |
+
void |
+setMotorTargetPosition(int motor,
+ int position,
+ int tolerance)
+Sets the target position and tolerance for a 'run to position' operation.
+ |
+
void |
+setMotorVelocity(int motor,
+ double ticksPerSecond)
+Sets the target velocity of the indicated motor.
+ |
+
void |
+setMotorVelocity(int motor,
+ double angularRate,
+ AngleUnit unit)
+Sets the target velocity of the indicated motor.
+ |
+
void |
+setPIDCoefficients(int motor,
+ DcMotor.RunMode mode,
+ PIDCoefficients pidCoefficients)
+Deprecated.
+
+
+ |
+
void |
+setPIDFCoefficients(int motor,
+ DcMotor.RunMode mode,
+ PIDFCoefficients pidfCoefficients)
+Sets the coefficients used for PIDF control on the indicated motor when in the indicated mode
+ |
+
getMotorCurrentPosition, getMotorMode, getMotorPower, getMotorPowerFloat, getMotorTargetPosition, getMotorType, getMotorZeroPowerBehavior, isBusy, resetDeviceConfigurationForOpMode, setMotorMode, setMotorPower, setMotorTargetPosition, setMotorType, setMotorZeroPowerBehavior
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
void setMotorEnable(int motor)+
motor
- the port number of the motor on this controllersetMotorDisable(int)
,
+isMotorEnabled(int)
void setMotorDisable(int motor)+
motor
- the port number of the motor on this controllersetMotorEnable(int)
,
+isMotorEnabled(int)
boolean isMotorEnabled(int motor)+
motor
- the port number of the motor on this controllersetMotorEnable(int)
,
+setMotorDisable(int)
void setMotorVelocity(int motor, + double ticksPerSecond)+
motor
- the port number of the motor on this controllerticksPerSecond
- the new target rate for that motor, in ticks per secondvoid setMotorVelocity(int motor, + double angularRate, + AngleUnit unit)+
motor
- motor whose velocity is to be adjustedangularRate
- the new target rate for that motor, in 'unit's per secondunit
- the unit inw which angularRate is expressed.DcMotorEx.setVelocity(double, AngleUnit)
double getMotorVelocity(int motor)+
motor
- the motor whose velocity is desireddouble getMotorVelocity(int motor, + AngleUnit unit)+
motor
- the motor whose velocity is desiredunit
- the angular unit in which the velocity is to be expressedDcMotorEx.getVelocity(AngleUnit)
@Deprecated +void setPIDCoefficients(int motor, + DcMotor.RunMode mode, + PIDCoefficients pidCoefficients)+
setPIDFCoefficients(int, DcMotor.RunMode, PIDFCoefficients)
insteadmotor
- the motor whose PID coefficients are to be setmode
- the mode on that motor whose coefficients are to be setpidCoefficients
- the new coefficients to setDcMotorEx.setPIDCoefficients(DcMotor.RunMode, PIDCoefficients)
,
+getPIDCoefficients(int, DcMotor.RunMode)
void setPIDFCoefficients(int motor, + DcMotor.RunMode mode, + PIDFCoefficients pidfCoefficients) + throws java.lang.UnsupportedOperationException+
motor
- the motor whose PIDF coefficients are to be setmode
- the mode on that motor whose coefficients are to be setpidfCoefficients
- the new coefficients to setjava.lang.UnsupportedOperationException
DcMotorEx.setPIDFCoefficients(DcMotor.RunMode, PIDFCoefficients)
,
+getPIDFCoefficients(int, DcMotor.RunMode)
@Deprecated +PIDCoefficients getPIDCoefficients(int motor, + DcMotor.RunMode mode)+
getPIDFCoefficients(int, DcMotor.RunMode)
insteadmotor
- the motor whose PID coefficients are desiredmode
- the mode on that motor whose coefficients are to be queriedDcMotorEx.getPIDCoefficients(DcMotor.RunMode)
,
+setPIDCoefficients(int, DcMotor.RunMode, PIDCoefficients)
PIDFCoefficients getPIDFCoefficients(int motor, + DcMotor.RunMode mode)+
motor
- the motor whose PIDF coefficients are desiredmode
- the mode on that motor whose coefficients are to be queriedDcMotorEx.getPIDCoefficients(DcMotor.RunMode)
,
+setPIDFCoefficients(int, DcMotor.RunMode, PIDFCoefficients)
void setMotorTargetPosition(int motor, + int position, + int tolerance)+
motor
- the motor number to be affectedposition
- the desired target position, in encoder tickstolerance
- the tolerance of the desired target position, in encoder tickspublic interface DcMotorEx +extends DcMotor+
PwmControl
DcMotor.RunMode, DcMotor.ZeroPowerBehavior
DcMotorSimple.Direction
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
PIDCoefficients |
+getPIDCoefficients(DcMotor.RunMode mode)
+Deprecated.
+
+Use
+#getPIDFCoefficients(RunMode) instead |
+
PIDFCoefficients |
+getPIDFCoefficients(DcMotor.RunMode mode)
+Returns the PIDF control coefficients used when running in the indicated mode
+ on this motor.
+ |
+
int |
+getTargetPositionTolerance()
+Returns the current target positioning tolerance of this motor
+ |
+
double |
+getVelocity()
+Returns the current velocity of the motor, in ticks per second
+ |
+
double |
+getVelocity(AngleUnit unit)
+Returns the current velocity of the motor, in angular units per second
+ |
+
boolean |
+isMotorEnabled()
+Returns whether this motor is energized
+ |
+
void |
+setMotorDisable()
+Individually de-energizes this particular motor
+ |
+
void |
+setMotorEnable()
+Individually energizes this particular motor
+ |
+
void |
+setPIDCoefficients(DcMotor.RunMode mode,
+ PIDCoefficients pidCoefficients)
+Deprecated.
+
+Use
+#setPIDFCoefficients(RunMode, PIDFCoefficients) instead |
+
void |
+setPIDFCoefficients(DcMotor.RunMode mode,
+ PIDFCoefficients pidfCoefficients)
+
+ |
+
void |
+setPositionPIDFCoefficients(double p)
+A shorthand for setting the PIDF coefficients for the
+DcMotor.RunMode.RUN_TO_POSITION
+ mode. |
+
void |
+setTargetPositionTolerance(int tolerance)
+Sets the target positioning tolerance of this motor
+ |
+
void |
+setVelocity(double angularRate)
+Sets the velocity of the motor
+ |
+
void |
+setVelocity(double angularRate,
+ AngleUnit unit)
+Sets the velocity of the motor
+ |
+
void |
+setVelocityPIDFCoefficients(double p,
+ double i,
+ double d,
+ double f)
+A shorthand for setting the PIDF coefficients for the
+DcMotor.RunMode.RUN_USING_ENCODER
+ mode. |
+
getController, getCurrentPosition, getMode, getMotorType, getPortNumber, getPowerFloat, getTargetPosition, getZeroPowerBehavior, isBusy, setMode, setMotorType, setPowerFloat, setTargetPosition, setZeroPowerBehavior
getDirection, getPower, setDirection, setPower
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
void setMotorEnable()+
setMotorDisable()
,
+isMotorEnabled()
void setMotorDisable()+
setMotorEnable()
,
+isMotorEnabled()
boolean isMotorEnabled()+
setMotorEnable()
,
+setMotorDisable()
void setVelocity(double angularRate)+
angularRate
- the desired ticks per secondvoid setVelocity(double angularRate, + AngleUnit unit)+
angularRate
- the desired angular rate, in units per secondunit
- the units in which angularRate is expressedgetVelocity(AngleUnit)
double getVelocity()+
double getVelocity(AngleUnit unit)+
unit
- the units in which the angular rate is desiredsetVelocity(double, AngleUnit)
@Deprecated +void setPIDCoefficients(DcMotor.RunMode mode, + PIDCoefficients pidCoefficients)+
#setPIDFCoefficients(RunMode, PIDFCoefficients)
insteadmode
- either RunMode#RUN_USING_ENCODER
or RunMode#RUN_TO_POSITION
pidCoefficients
- the new coefficients to use when in that mode on this motor#getPIDCoefficients(RunMode)
void setPIDFCoefficients(DcMotor.RunMode mode, + PIDFCoefficients pidfCoefficients) + throws java.lang.UnsupportedOperationException+
setPIDFCoefficients(com.qualcomm.robotcore.hardware.DcMotor.RunMode, com.qualcomm.robotcore.hardware.PIDFCoefficients)
is a superset enhancement to setPIDCoefficients(com.qualcomm.robotcore.hardware.DcMotor.RunMode, com.qualcomm.robotcore.hardware.PIDCoefficients)
. In addition
+ to the proportional, integral, and derivative coefficients previously supported, a feed-forward
+ coefficient may also be specified. Further, a selection of motor control algorithms is offered:
+ the originally-shipped Legacy PID algorithm, and a PIDF algorithm which avails itself of the
+ feed-forward coefficient. Note that the feed-forward coefficient is not used by the Legacy PID
+ algorithm; thus, the feed-forward coefficient must be indicated as zero if the Legacy PID
+ algorithm is used. Also: the internal implementation of these algorithms may be different: it
+ is not the case that the use of PIDF with the F term as zero necessarily exhibits exactly the
+ same behavior as the use of the LegacyPID algorithm, though in practice they will be quite close.
+
+ Readers are reminded that DcMotor.RunMode.RUN_TO_POSITION
mode makes use of both
+ the coefficients set for RUN_TO_POSITION and the coefficients set for RUN_WITH_ENCODER,
+ due to the fact that internally the RUN_TO_POSITION logic calculates an on-the-fly velocity goal
+ on each control cycle, then (logically) runs the RUN_WITH_ENCODER logic. Because of that double-
+ layering, only the proportional ('p') coefficient makes logical sense for use in the RUN_TO_POSITION
+ coefficients.java.lang.UnsupportedOperationException
setVelocityPIDFCoefficients(double, double, double, double)
,
+setPositionPIDFCoefficients(double)
,
+#getPIDFCoefficients(RunMode)
void setVelocityPIDFCoefficients(double p, + double i, + double d, + double f)+
DcMotor.RunMode.RUN_USING_ENCODER
+ mode. MotorControlAlgorithm.PIDF
is used.#setPIDFCoefficients(RunMode, PIDFCoefficients)
void setPositionPIDFCoefficients(double p)+
DcMotor.RunMode.RUN_TO_POSITION
+ mode. MotorControlAlgorithm.PIDF
is used.
+
+ Readers are reminded that DcMotor.RunMode.RUN_TO_POSITION
mode makes use of both
+ the coefficients set for RUN_TO_POSITION and the coefficients set for RUN_WITH_ENCODER,
+ due to the fact that internally the RUN_TO_POSITION logic calculates an on-the-fly velocity goal
+ on each control cycle, then (logically) runs the RUN_WITH_ENCODER logic. Because of that double-
+ layering, only the proportional ('p') coefficient makes logical sense for use in the RUN_TO_POSITION
+ coefficients.setVelocityPIDFCoefficients(double, double, double, double)
,
+#setPIDFCoefficients(RunMode, PIDFCoefficients)
@Deprecated +PIDCoefficients getPIDCoefficients(DcMotor.RunMode mode)+
#getPIDFCoefficients(RunMode)
insteadmode
- either RunMode#RUN_USING_ENCODER
or RunMode#RUN_TO_POSITION
PIDFCoefficients getPIDFCoefficients(DcMotor.RunMode mode)+
mode
- either RunMode#RUN_USING_ENCODER
or RunMode#RUN_TO_POSITION
#setPIDFCoefficients(RunMode, PIDFCoefficients)
void setTargetPositionTolerance(int tolerance)+
tolerance
- the desired tolerance, in encoder ticksDcMotor.setTargetPosition(int)
int getTargetPositionTolerance()+
public class DcMotorImpl +extends java.lang.Object +implements DcMotor+
DcMotorController
DcMotor.RunMode, DcMotor.ZeroPowerBehavior
DcMotorSimple.Direction
HardwareDevice.Manufacturer
Modifier and Type | +Field and Description | +
---|---|
protected DcMotorController |
+controller |
+
protected DcMotorSimple.Direction |
+direction |
+
protected MotorConfigurationType |
+motorType |
+
protected int |
+portNumber |
+
Constructor and Description | +
---|
DcMotorImpl(DcMotorController controller,
+ int portNumber)
+Constructor
+ |
+
DcMotorImpl(DcMotorController controller,
+ int portNumber,
+ DcMotorSimple.Direction direction)
+Constructor
+ |
+
DcMotorImpl(DcMotorController controller,
+ int portNumber,
+ DcMotorSimple.Direction direction,
+ MotorConfigurationType motorType)
+Constructor
+ |
+
Modifier and Type | +Method and Description | +
---|---|
protected int |
+adjustPosition(int position) |
+
protected double |
+adjustPower(double power) |
+
void |
+close()
+Closes this device
+ |
+
java.lang.String |
+getConnectionInfo()
+Get connection information about this device in a human readable format
+ |
+
DcMotorController |
+getController()
+Get DC motor controller
+ |
+
int |
+getCurrentPosition()
+Get the current encoder value, accommodating the configured directionality of the motor.
+ |
+
java.lang.String |
+getDeviceName()
+Returns a string suitable for display to the user as to the type of device.
+ |
+
DcMotorSimple.Direction |
+getDirection()
+Get the direction
+ |
+
HardwareDevice.Manufacturer |
+getManufacturer()
+Returns an indication of the manufacturer of this device.
+ |
+
DcMotor.RunMode |
+getMode()
+Get the current mode
+ |
+
MotorConfigurationType |
+getMotorType()
+Returns the assigned type for this motor.
+ |
+
protected DcMotorSimple.Direction |
+getOperationalDirection() |
+
int |
+getPortNumber()
+Get port number
+ |
+
double |
+getPower()
+Get the current motor power
+ |
+
boolean |
+getPowerFloat()
+Is motor power set to float?
+ |
+
int |
+getTargetPosition()
+Get the current motor target position.
+ |
+
int |
+getVersion()
+Version
+ |
+
DcMotor.ZeroPowerBehavior |
+getZeroPowerBehavior()
+Returns the current behavior of the motor were a power level of zero to be applied.
+ |
+
protected void |
+internalSetMode(DcMotor.RunMode mode) |
+
protected void |
+internalSetPower(double power) |
+
protected void |
+internalSetTargetPosition(int position) |
+
boolean |
+isBusy()
+Is the motor busy?
+ |
+
void |
+resetDeviceConfigurationForOpMode()
+Resets the device's configuration to that which is expected at the beginning of an OpMode.
+ |
+
void |
+setDirection(DcMotorSimple.Direction direction)
+Set the direction
+ |
+
void |
+setMode(DcMotor.RunMode mode)
+Set the current mode
+ |
+
void |
+setMotorType(MotorConfigurationType motorType)
+Sets the assigned type of this motor.
+ |
+
void |
+setPower(double power)
+Set the current motor power
+ |
+
void |
+setPowerFloat()
+Deprecated.
+ |
+
void |
+setTargetPosition(int position)
+Set the motor target position, using an integer.
+ |
+
void |
+setZeroPowerBehavior(DcMotor.ZeroPowerBehavior zeroPowerBehavior)
+Sets the behavior of the motor when a power level of zero is applied.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected DcMotorController controller+
protected int portNumber+
protected DcMotorSimple.Direction direction+
protected MotorConfigurationType motorType+
public DcMotorImpl(DcMotorController controller, + int portNumber)+
controller
- DC motor controller this motor is attached toportNumber
- portNumber position on the controllerpublic DcMotorImpl(DcMotorController controller, + int portNumber, + DcMotorSimple.Direction direction)+
controller
- DC motor controller this motor is attached toportNumber
- portNumber port number on the controllerdirection
- direction this motor should spinpublic DcMotorImpl(DcMotorController controller, + int portNumber, + DcMotorSimple.Direction direction, + MotorConfigurationType motorType)+
controller
- DC motor controller this motor is attached toportNumber
- portNumber port number on the controllerdirection
- direction this motor should spinmotorType
- the type we know this motor to bepublic HardwareDevice.Manufacturer getManufacturer()+
HardwareDevice
getManufacturer
in interface HardwareDevice
public java.lang.String getDeviceName()+
HardwareDevice
getDeviceName
in interface HardwareDevice
public java.lang.String getConnectionInfo()+
HardwareDevice
getConnectionInfo
in interface HardwareDevice
public int getVersion()+
HardwareDevice
getVersion
in interface HardwareDevice
public void resetDeviceConfigurationForOpMode()+
HardwareDevice
resetDeviceConfigurationForOpMode
in interface HardwareDevice
public void close()+
HardwareDevice
close
in interface HardwareDevice
public MotorConfigurationType getMotorType()+
DcMotor
MotorConfigurationType#getUnspecifiedMotorType()
will be returned.
+ Note that the motor type for a given motor is initially assigned in the robot
+ configuration user interface, though it may subsequently be modified using methods herein.getMotorType
in interface DcMotor
public void setMotorType(MotorConfigurationType motorType)+
DcMotor
setMotorType
in interface DcMotor
motorType
- the new assigned type for this motorDcMotor.getMotorType()
public DcMotorController getController()+
getController
in interface DcMotor
DcMotor.getPortNumber()
public void setDirection(DcMotorSimple.Direction direction)+
setDirection
in interface DcMotorSimple
direction
- directionDcMotorSimple.getDirection()
public DcMotorSimple.Direction getDirection()+
getDirection
in interface DcMotorSimple
DcMotorSimple.setDirection(Direction)
public int getPortNumber()+
getPortNumber
in interface DcMotor
DcMotor.getController()
public void setPower(double power)+
setPower
in interface DcMotorSimple
power
- from -1.0 to 1.0DcMotorSimple.getPower()
,
+DcMotor.setMode(DcMotor.RunMode)
,
+DcMotor.setPowerFloat()
protected void internalSetPower(double power)+
public double getPower()+
getPower
in interface DcMotorSimple
DcMotorSimple.setPower(double)
public boolean isBusy()+
isBusy
in interface DcMotor
DcMotor.setTargetPosition(int)
public void setZeroPowerBehavior(DcMotor.ZeroPowerBehavior zeroPowerBehavior)+
DcMotor
setZeroPowerBehavior
in interface DcMotor
zeroPowerBehavior
- the new behavior of the motor when a power level of zero is applied.DcMotor.ZeroPowerBehavior
,
+DcMotorSimple.setPower(double)
public DcMotor.ZeroPowerBehavior getZeroPowerBehavior()+
DcMotor
getZeroPowerBehavior
in interface DcMotor
@Deprecated +public void setPowerFloat()+
setPowerFloat
in interface DcMotor
DcMotorSimple.setPower(double)
,
+DcMotor.getPowerFloat()
,
+DcMotor.setZeroPowerBehavior(ZeroPowerBehavior)
public boolean getPowerFloat()+
getPowerFloat
in interface DcMotor
DcMotor.setPowerFloat()
public void setTargetPosition(int position)+
setTargetPosition
in interface DcMotor
position
- range from Integer.MIN_VALUE to Integer.MAX_VALUEDcMotor.getCurrentPosition()
,
+DcMotor.setMode(RunMode)
,
+DcMotor.RunMode.RUN_TO_POSITION
,
+DcMotor.getTargetPosition()
,
+DcMotor.isBusy()
protected void internalSetTargetPosition(int position)+
public int getTargetPosition()+
getTargetPosition
in interface DcMotor
DcMotor.setTargetPosition(int)
public int getCurrentPosition()+
getCurrentPosition
in interface DcMotor
DcMotor.getTargetPosition()
,
+DcMotor.RunMode.STOP_AND_RESET_ENCODER
protected int adjustPosition(int position)+
protected double adjustPower(double power)+
protected DcMotorSimple.Direction getOperationalDirection()+
public void setMode(DcMotor.RunMode mode)+
setMode
in interface DcMotor
mode
- run modeDcMotor.RunMode
,
+DcMotor.getMode()
protected void internalSetMode(DcMotor.RunMode mode)+
public DcMotor.RunMode getMode()+
getMode
in interface DcMotor
DcMotor.RunMode
,
+DcMotor.setMode(RunMode)
public class DcMotorImplEx +extends DcMotorImpl +implements DcMotorEx+ +
DcMotor.RunMode, DcMotor.ZeroPowerBehavior
DcMotorSimple.Direction
HardwareDevice.Manufacturer
controller, direction, motorType, portNumber
Constructor and Description | +
---|
DcMotorImplEx(DcMotorController controller,
+ int portNumber) |
+
DcMotorImplEx(DcMotorController controller,
+ int portNumber,
+ DcMotorSimple.Direction direction) |
+
DcMotorImplEx(DcMotorController controller,
+ int portNumber,
+ DcMotorSimple.Direction direction,
+ MotorConfigurationType motorType) |
+
Modifier and Type | +Method and Description | +
---|---|
protected double |
+adjustAngularRate(double angularRate) |
+
PIDCoefficients |
+getPIDCoefficients(DcMotor.RunMode mode)
+Returns the PID control coefficients used when running in the indicated mode
+ on this motor.
+ |
+
PIDFCoefficients |
+getPIDFCoefficients(DcMotor.RunMode mode)
+Returns the PIDF control coefficients used when running in the indicated mode
+ on this motor.
+ |
+
int |
+getTargetPositionTolerance()
+Returns the current target positioning tolerance of this motor
+ |
+
double |
+getVelocity()
+Returns the current velocity of the motor, in ticks per second
+ |
+
double |
+getVelocity(AngleUnit unit)
+Returns the current velocity of the motor, in angular units per second
+ |
+
protected void |
+internalSetTargetPosition(int position) |
+
boolean |
+isMotorEnabled()
+Returns whether this motor is energized
+ |
+
void |
+setMotorDisable()
+Individually de-energizes this particular motor
+ |
+
void |
+setMotorEnable()
+Individually energizes this particular motor
+ |
+
void |
+setPIDCoefficients(DcMotor.RunMode mode,
+ PIDCoefficients pidCoefficients)
+Sets the PID control coefficients for one of the PID modes of this motor.
+ |
+
void |
+setPIDFCoefficients(DcMotor.RunMode mode,
+ PIDFCoefficients pidfCoefficients)
+
+ |
+
void |
+setPositionPIDFCoefficients(double p)
+A shorthand for setting the PIDF coefficients for the
+DcMotor.RunMode.RUN_TO_POSITION
+ mode. |
+
void |
+setTargetPositionTolerance(int tolerance)
+Sets the target positioning tolerance of this motor
+ |
+
void |
+setVelocity(double angularRate)
+Sets the velocity of the motor
+ |
+
void |
+setVelocity(double angularRate,
+ AngleUnit unit)
+Sets the velocity of the motor
+ |
+
void |
+setVelocityPIDFCoefficients(double p,
+ double i,
+ double d,
+ double f)
+A shorthand for setting the PIDF coefficients for the
+DcMotor.RunMode.RUN_USING_ENCODER
+ mode. |
+
adjustPosition, adjustPower, close, getConnectionInfo, getController, getCurrentPosition, getDeviceName, getDirection, getManufacturer, getMode, getMotorType, getOperationalDirection, getPortNumber, getPower, getPowerFloat, getTargetPosition, getVersion, getZeroPowerBehavior, internalSetMode, internalSetPower, isBusy, resetDeviceConfigurationForOpMode, setDirection, setMode, setMotorType, setPower, setPowerFloat, setTargetPosition, setZeroPowerBehavior
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getController, getCurrentPosition, getMode, getMotorType, getPortNumber, getPowerFloat, getTargetPosition, getZeroPowerBehavior, isBusy, setMode, setMotorType, setPowerFloat, setTargetPosition, setZeroPowerBehavior
getDirection, getPower, setDirection, setPower
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
public DcMotorImplEx(DcMotorController controller, + int portNumber)+
public DcMotorImplEx(DcMotorController controller, + int portNumber, + DcMotorSimple.Direction direction)+
public DcMotorImplEx(DcMotorController controller, + int portNumber, + DcMotorSimple.Direction direction, + MotorConfigurationType motorType)+
public void setMotorEnable()+
DcMotorEx
setMotorEnable
in interface DcMotorEx
DcMotorEx.setMotorDisable()
,
+DcMotorEx.isMotorEnabled()
public void setMotorDisable()+
DcMotorEx
setMotorDisable
in interface DcMotorEx
DcMotorEx.setMotorEnable()
,
+DcMotorEx.isMotorEnabled()
public boolean isMotorEnabled()+
DcMotorEx
isMotorEnabled
in interface DcMotorEx
DcMotorEx.setMotorEnable()
,
+DcMotorEx.setMotorDisable()
public void setVelocity(double angularRate)+
DcMotorEx
setVelocity
in interface DcMotorEx
angularRate
- the desired ticks per secondpublic void setVelocity(double angularRate, + AngleUnit unit)+
DcMotorEx
setVelocity
in interface DcMotorEx
angularRate
- the desired angular rate, in units per secondunit
- the units in which angularRate is expressedDcMotorEx.getVelocity(AngleUnit)
public double getVelocity()+
DcMotorEx
getVelocity
in interface DcMotorEx
public double getVelocity(AngleUnit unit)+
DcMotorEx
getVelocity
in interface DcMotorEx
unit
- the units in which the angular rate is desiredDcMotorEx.setVelocity(double, AngleUnit)
protected double adjustAngularRate(double angularRate)+
public void setPIDCoefficients(DcMotor.RunMode mode, + PIDCoefficients pidCoefficients)+
DcMotorEx
setPIDCoefficients
in interface DcMotorEx
mode
- either RunMode#RUN_USING_ENCODER
or RunMode#RUN_TO_POSITION
pidCoefficients
- the new coefficients to use when in that mode on this motor#getPIDCoefficients(RunMode)
public void setPIDFCoefficients(DcMotor.RunMode mode, + PIDFCoefficients pidfCoefficients)+
DcMotorEx
DcMotorEx.setPIDFCoefficients(com.qualcomm.robotcore.hardware.DcMotor.RunMode, com.qualcomm.robotcore.hardware.PIDFCoefficients)
is a superset enhancement to DcMotorEx.setPIDCoefficients(com.qualcomm.robotcore.hardware.DcMotor.RunMode, com.qualcomm.robotcore.hardware.PIDCoefficients)
. In addition
+ to the proportional, integral, and derivative coefficients previously supported, a feed-forward
+ coefficient may also be specified. Further, a selection of motor control algorithms is offered:
+ the originally-shipped Legacy PID algorithm, and a PIDF algorithm which avails itself of the
+ feed-forward coefficient. Note that the feed-forward coefficient is not used by the Legacy PID
+ algorithm; thus, the feed-forward coefficient must be indicated as zero if the Legacy PID
+ algorithm is used. Also: the internal implementation of these algorithms may be different: it
+ is not the case that the use of PIDF with the F term as zero necessarily exhibits exactly the
+ same behavior as the use of the LegacyPID algorithm, though in practice they will be quite close.
+
+ Readers are reminded that DcMotor.RunMode.RUN_TO_POSITION
mode makes use of both
+ the coefficients set for RUN_TO_POSITION and the coefficients set for RUN_WITH_ENCODER,
+ due to the fact that internally the RUN_TO_POSITION logic calculates an on-the-fly velocity goal
+ on each control cycle, then (logically) runs the RUN_WITH_ENCODER logic. Because of that double-
+ layering, only the proportional ('p') coefficient makes logical sense for use in the RUN_TO_POSITION
+ coefficients.setPIDFCoefficients
in interface DcMotorEx
DcMotorEx.setVelocityPIDFCoefficients(double, double, double, double)
,
+DcMotorEx.setPositionPIDFCoefficients(double)
,
+#getPIDFCoefficients(RunMode)
public void setVelocityPIDFCoefficients(double p, + double i, + double d, + double f)+
DcMotorEx
DcMotor.RunMode.RUN_USING_ENCODER
+ mode. MotorControlAlgorithm.PIDF
is used.setVelocityPIDFCoefficients
in interface DcMotorEx
#setPIDFCoefficients(RunMode, PIDFCoefficients)
public void setPositionPIDFCoefficients(double p)+
DcMotorEx
DcMotor.RunMode.RUN_TO_POSITION
+ mode. MotorControlAlgorithm.PIDF
is used.
+
+ Readers are reminded that DcMotor.RunMode.RUN_TO_POSITION
mode makes use of both
+ the coefficients set for RUN_TO_POSITION and the coefficients set for RUN_WITH_ENCODER,
+ due to the fact that internally the RUN_TO_POSITION logic calculates an on-the-fly velocity goal
+ on each control cycle, then (logically) runs the RUN_WITH_ENCODER logic. Because of that double-
+ layering, only the proportional ('p') coefficient makes logical sense for use in the RUN_TO_POSITION
+ coefficients.setPositionPIDFCoefficients
in interface DcMotorEx
DcMotorEx.setVelocityPIDFCoefficients(double, double, double, double)
,
+#setPIDFCoefficients(RunMode, PIDFCoefficients)
public PIDCoefficients getPIDCoefficients(DcMotor.RunMode mode)+
DcMotorEx
getPIDCoefficients
in interface DcMotorEx
mode
- either RunMode#RUN_USING_ENCODER
or RunMode#RUN_TO_POSITION
public PIDFCoefficients getPIDFCoefficients(DcMotor.RunMode mode)+
DcMotorEx
getPIDFCoefficients
in interface DcMotorEx
mode
- either RunMode#RUN_USING_ENCODER
or RunMode#RUN_TO_POSITION
#setPIDFCoefficients(RunMode, PIDFCoefficients)
public int getTargetPositionTolerance()+
DcMotorEx
getTargetPositionTolerance
in interface DcMotorEx
public void setTargetPositionTolerance(int tolerance)+
DcMotorEx
setTargetPositionTolerance
in interface DcMotorEx
tolerance
- the desired tolerance, in encoder ticksDcMotor.setTargetPosition(int)
protected void internalSetTargetPosition(int position)+
internalSetTargetPosition
in class DcMotorImpl
public static enum DcMotorSimple.Direction +extends java.lang.Enum<DcMotorSimple.Direction>+
At the start of an OpMode, motors are guaranteed to be in the forward direction.
DcMotorSimple.setDirection(Direction)
Enum Constant and Description | +
---|
FORWARD |
+
REVERSE |
+
Modifier and Type | +Method and Description | +
---|---|
DcMotorSimple.Direction |
+inverted() |
+
static DcMotorSimple.Direction |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static DcMotorSimple.Direction[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final DcMotorSimple.Direction FORWARD+
public static final DcMotorSimple.Direction REVERSE+
public static DcMotorSimple.Direction[] values()+
+for (DcMotorSimple.Direction c : DcMotorSimple.Direction.values()) + System.out.println(c); +
public static DcMotorSimple.Direction valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic DcMotorSimple.Direction inverted()+
public interface DcMotorSimple +extends HardwareDevice+
Modifier and Type | +Interface and Description | +
---|---|
static class |
+DcMotorSimple.Direction
+DcMotors can be configured to internally reverse the values
+ to which, e.g., their motor power is set.
+ |
+
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
DcMotorSimple.Direction |
+getDirection()
+Returns the current logical direction in which this motor is set as operating.
+ |
+
double |
+getPower()
+Returns the current configured power level of the motor.
+ |
+
void |
+setDirection(DcMotorSimple.Direction direction)
+Sets the logical direction in which this motor operates.
+ |
+
void |
+setPower(double power)
+Sets the power level of the motor, expressed as a fraction of the maximum
+ possible power / speed supported according to the run mode in which the
+ motor is operating.
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
void setDirection(DcMotorSimple.Direction direction)+
direction
- the direction to set for this motorgetDirection()
DcMotorSimple.Direction getDirection()+
setDirection(Direction)
void setPower(double power)+
Setting a power level of zero will brake the motor
power
- the new power level of the motor, a value in the interval [-1.0, 1.0]getPower()
,
+DcMotor.setMode(DcMotor.RunMode)
,
+DcMotor.setPowerFloat()
double getPower()+
setPower(double)
public interface DeviceInterfaceModule +extends DigitalChannelController, AnalogInputController, PWMOutputController, I2cController, AnalogOutputController+
DigitalChannelController.Mode
I2cController.I2cPortReadyBeginEndNotifications, I2cController.I2cPortReadyCallback
HardwareDevice.Manufacturer
I2C_BUFFER_START_ADDRESS
Modifier and Type | +Method and Description | +
---|---|
int |
+getDigitalInputStateByte()
+A byte containing the current logic levels present in the D7-D0 channel pins.
+ |
+
byte |
+getDigitalIOControlByte()
+Get the digital IO control byte
+ |
+
byte |
+getDigitalOutputStateByte()
+The D7-D0 output set field is a byte containing the required I/O output of the D7-D0
+ channel pins.
+ |
+
boolean |
+getLEDState(int channel)
+Indicates whether the LED on the given channel is on or not
+ |
+
void |
+setDigitalIOControlByte(byte input)
+If a particular bit is set to one, the corresponding channel pin will be in output mode.
+ |
+
void |
+setDigitalOutputByte(byte input)
+If a a particular control field bit is set to one, the channel pin will be in output mode and
+ will reflect the value of the corresponding field bit.
+ |
+
void |
+setLED(int channel,
+ boolean state)
+Turn on or off a particular LED
+ |
+
getDigitalChannelMode, getDigitalChannelState, getSerialNumber, setDigitalChannelMode, setDigitalChannelMode, setDigitalChannelState
getAnalogInputVoltage, getMaxAnalogInputVoltage, getSerialNumber
getPulseWidthOutputTime, getPulseWidthPeriod, getSerialNumber, setPulseWidthOutputTime, setPulseWidthPeriod
clearI2cPortActionFlag, copyBufferIntoWriteBuffer, deregisterForPortReadyBeginEndCallback, deregisterForPortReadyCallback, enableI2cReadMode, enableI2cWriteMode, getCopyOfReadBuffer, getCopyOfWriteBuffer, getI2cPortReadyCallback, getI2cReadCache, getI2cReadCacheLock, getI2cReadCacheTimeWindow, getI2cWriteCache, getI2cWriteCacheLock, getMaxI2cWriteLatency, getPortReadyBeginEndCallback, getSerialNumber, isArmed, isI2cPortActionFlagSet, isI2cPortInReadMode, isI2cPortInWriteMode, isI2cPortReady, readI2cCacheFromController, readI2cCacheFromModule, registerForI2cPortReadyCallback, registerForPortReadyBeginEndCallback, setI2cPortActionFlag, writeI2cCacheToController, writeI2cCacheToModule, writeI2cPortFlagOnlyToController, writeI2cPortFlagOnlyToModule
getSerialNumber, setAnalogOutputFrequency, setAnalogOutputMode, setAnalogOutputVoltage
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
int getDigitalInputStateByte()+
void setDigitalIOControlByte(byte input)+
input
- - the desired setting for each channel pin.byte getDigitalIOControlByte()+
void setDigitalOutputByte(byte input)+
input
- with output state of the digital pins.byte getDigitalOutputStateByte()+
boolean getLEDState(int channel)+
void setLED(int channel, + boolean state)+
channel
- - int indicating the ID of the LED.state
- - byte containing the desired setting.public static enum DeviceManager.UsbDeviceType +extends java.lang.Enum<DeviceManager.UsbDeviceType>+
Enum Constant and Description | +
---|
FTDI_USB_UNKNOWN_DEVICE |
+
LYNX_USB_DEVICE |
+
MODERN_ROBOTICS_USB_DC_MOTOR_CONTROLLER |
+
MODERN_ROBOTICS_USB_DEVICE_INTERFACE_MODULE |
+
MODERN_ROBOTICS_USB_LEGACY_MODULE |
+
MODERN_ROBOTICS_USB_SENSOR_MUX |
+
MODERN_ROBOTICS_USB_SERVO_CONTROLLER |
+
MODERN_ROBOTICS_USB_UNKNOWN_DEVICE |
+
UNKNOWN_DEVICE |
+
WEBCAM
+a camera managed by
+CameraManager . |
+
Modifier and Type | +Method and Description | +
---|---|
static DeviceManager.UsbDeviceType |
+from(java.lang.String string) |
+
static DeviceManager.UsbDeviceType |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static DeviceManager.UsbDeviceType[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final DeviceManager.UsbDeviceType FTDI_USB_UNKNOWN_DEVICE+
public static final DeviceManager.UsbDeviceType MODERN_ROBOTICS_USB_UNKNOWN_DEVICE+
public static final DeviceManager.UsbDeviceType MODERN_ROBOTICS_USB_DC_MOTOR_CONTROLLER+
public static final DeviceManager.UsbDeviceType MODERN_ROBOTICS_USB_SERVO_CONTROLLER+
public static final DeviceManager.UsbDeviceType MODERN_ROBOTICS_USB_LEGACY_MODULE+
public static final DeviceManager.UsbDeviceType MODERN_ROBOTICS_USB_DEVICE_INTERFACE_MODULE+
public static final DeviceManager.UsbDeviceType MODERN_ROBOTICS_USB_SENSOR_MUX+
public static final DeviceManager.UsbDeviceType LYNX_USB_DEVICE+
public static final DeviceManager.UsbDeviceType WEBCAM+
CameraManager
. See WebcamName
public static final DeviceManager.UsbDeviceType UNKNOWN_DEVICE+
public static DeviceManager.UsbDeviceType[] values()+
+for (DeviceManager.UsbDeviceType c : DeviceManager.UsbDeviceType.values()) + System.out.println(c); +
public static DeviceManager.UsbDeviceType valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static DeviceManager.UsbDeviceType from(java.lang.String string)+
public interface DeviceManager
+Modifier and Type | +Interface and Description | +
---|---|
static class |
+DeviceManager.UsbDeviceType
+Enum of known USB Device Types
+ |
+
Modifier and Type | +Method and Description | +
---|---|
ColorSensor |
+createAdafruitI2cColorSensor(I2cController controller,
+ DeviceConfiguration.I2cChannel channel,
+ java.lang.String name)
+Create an instance of a ColorSensor
+ |
+
ColorSensor |
+createAdafruitI2cColorSensor(RobotCoreLynxModule module,
+ DeviceConfiguration.I2cChannel channel,
+ java.lang.String name) |
+
AnalogOutput |
+createAnalogOutputDevice(AnalogOutputController controller,
+ int channel,
+ java.lang.String name) |
+
HardwareDevice |
+createAnalogSensor(AnalogInputController controller,
+ int channel,
+ AnalogSensorConfigurationType type) |
+
CRServo |
+createCRServo(ServoController controller,
+ int portNumber,
+ java.lang.String name) |
+
CRServo |
+createCRServoEx(ServoControllerEx controller,
+ int portNumber,
+ java.lang.String name,
+ ServoConfigurationType servoType) |
+
HardwareDevice |
+createCustomServoDevice(ServoController controller,
+ int portNumber,
+ ServoConfigurationType servoConfigurationType) |
+
DcMotor |
+createDcMotor(DcMotorController controller,
+ int portNumber,
+ MotorConfigurationType motorType,
+ java.lang.String name)
+Create an instance of a DcMotor
+ |
+
DcMotor |
+createDcMotorEx(DcMotorController controller,
+ int portNumber,
+ MotorConfigurationType motorType,
+ java.lang.String name) |
+
DeviceInterfaceModule |
+createDeviceInterfaceModule(SerialNumber serialNumber,
+ java.lang.String name) |
+
HardwareDevice |
+createDigitalDevice(DigitalChannelController controller,
+ int channel,
+ DigitalIoDeviceConfigurationType type) |
+
AccelerationSensor |
+createHTAccelerationSensor(LegacyModule legacyModule,
+ int physicalPort,
+ java.lang.String name)
+Create an instance of a AccelerationSensor
+ |
+
ColorSensor |
+createHTColorSensor(LegacyModule controller,
+ int channel,
+ java.lang.String name)
+Create an instance of a ColorSensor
+ |
+
CompassSensor |
+createHTCompassSensor(LegacyModule legacyModule,
+ int physicalPort,
+ java.lang.String name)
+Create an instance of a NxtCompassSensor
+ |
+
DcMotorController |
+createHTDcMotorController(LegacyModule legacyModule,
+ int physicalPort,
+ java.lang.String name)
+Create an instance of an NXT DcMotorController
+ |
+
GyroSensor |
+createHTGyroSensor(LegacyModule legacyModule,
+ int physicalPort,
+ java.lang.String name)
+Create an instance of a GyroSensor
+ |
+
IrSeekerSensor |
+createHTIrSeekerSensor(LegacyModule legacyModule,
+ int physicalPort,
+ java.lang.String name)
+Create an instance of a IrSeekerSensor
+ |
+
LightSensor |
+createHTLightSensor(LegacyModule legacyModule,
+ int physicalPort,
+ java.lang.String name)
+Create an instance of a LightSensor
+ |
+
ServoController |
+createHTServoController(LegacyModule legacyModule,
+ int physicalPort,
+ java.lang.String name)
+Create an instance of an NXT ServoController
+ |
+
TouchSensorMultiplexer |
+createHTTouchSensorMultiplexer(LegacyModule legacyModule,
+ int port,
+ java.lang.String name) |
+
I2cDevice |
+createI2cDevice(I2cController controller,
+ DeviceConfiguration.I2cChannel channel,
+ java.lang.String name) |
+
I2cDeviceSynch |
+createI2cDeviceSynch(RobotCoreLynxModule module,
+ DeviceConfiguration.I2cChannel channel,
+ java.lang.String name) |
+
LED |
+createLED(DigitalChannelController controller,
+ int channel,
+ java.lang.String name)
+Create an instance of an LED
+ |
+
ColorSensor |
+createLynxColorRangeSensor(RobotCoreLynxModule module,
+ DeviceConfiguration.I2cChannel channel,
+ java.lang.String name) |
+
HardwareDevice |
+createLynxCustomServoDevice(ServoControllerEx controller,
+ int portNumber,
+ ServoConfigurationType servoConfigurationType) |
+
RobotCoreLynxModule |
+createLynxModule(RobotCoreLynxUsbDevice lynxUsbDevice,
+ int moduleAddress,
+ boolean isParent,
+ java.lang.String name)
+Creates an instance of a LynxModule
+ |
+
RobotCoreLynxUsbDevice |
+createLynxUsbDevice(SerialNumber serialNumber,
+ java.lang.String name)
+Creates an instance of a Lynx USB device
+ |
+
ColorSensor |
+createModernRoboticsI2cColorSensor(I2cController controller,
+ DeviceConfiguration.I2cChannel channel,
+ java.lang.String name)
+Create an instance of a ColorSensor
+ |
+
ColorSensor |
+createModernRoboticsI2cColorSensor(RobotCoreLynxModule module,
+ DeviceConfiguration.I2cChannel channel,
+ java.lang.String name) |
+
GyroSensor |
+createModernRoboticsI2cGyroSensor(I2cController i2cController,
+ DeviceConfiguration.I2cChannel channel,
+ java.lang.String name)
+Create an instance of a GyroSensor
+ |
+
GyroSensor |
+createModernRoboticsI2cGyroSensor(RobotCoreLynxModule module,
+ DeviceConfiguration.I2cChannel channel,
+ java.lang.String name) |
+
TouchSensor |
+createMRDigitalTouchSensor(DigitalChannelController digitalController,
+ int physicalPort,
+ java.lang.String name)
+Create an instance of a Modern Robotics TouchSensor on a digital controller
+ |
+
IrSeekerSensor |
+createMRI2cIrSeekerSensorV3(I2cController i2cController,
+ DeviceConfiguration.I2cChannel channel,
+ java.lang.String name)
+Create an instance of a IrSeekerSensorV3
+ |
+
IrSeekerSensor |
+createMRI2cIrSeekerSensorV3(RobotCoreLynxModule module,
+ DeviceConfiguration.I2cChannel channel,
+ java.lang.String name) |
+
TouchSensor |
+createNxtTouchSensor(LegacyModule legacyModule,
+ int physicalPort,
+ java.lang.String name) |
+
UltrasonicSensor |
+createNxtUltrasonicSensor(LegacyModule legacyModule,
+ int physicalPort,
+ java.lang.String name)
+Create an instance of an UltrasonicSensor
+ |
+
PWMOutput |
+createPwmOutputDevice(PWMOutputController controller,
+ int channel,
+ java.lang.String name) |
+
Servo |
+createServo(ServoController controller,
+ int portNumber,
+ java.lang.String name)
+Create an instance of a Servo
+ |
+
Servo |
+createServoEx(ServoControllerEx controller,
+ int portNumber,
+ java.lang.String name,
+ ServoConfigurationType servoType) |
+
DcMotorController |
+createUsbDcMotorController(SerialNumber serialNumber,
+ java.lang.String name)
+Create an instance of a DcMotorController
+ |
+
LegacyModule |
+createUsbLegacyModule(SerialNumber serialNumber,
+ java.lang.String name)
+Create an instance of a LegacyModule
+ |
+
ServoController |
+createUsbServoController(SerialNumber serialNumber,
+ java.lang.String name)
+Create an instance of a ServoController
+ |
+
HardwareDevice |
+createUserI2cDevice(I2cController controller,
+ DeviceConfiguration.I2cChannel channel,
+ I2cDeviceConfigurationType type,
+ java.lang.String name)
+Returns a new instance of a user-defined sensor type.
+ |
+
HardwareDevice |
+createUserI2cDevice(RobotCoreLynxModule lynxModule,
+ DeviceConfiguration.I2cChannel channel,
+ I2cDeviceConfigurationType type,
+ java.lang.String name) |
+
WebcamName |
+createWebcamName(SerialNumber serialNumber,
+ java.lang.String name)
+Creates a
+WebcamName from the indicated serialized contents |
+
ScannedDevices |
+scanForUsbDevices()
+Get a listing of currently connected USB devices
+ |
+
ScannedDevices scanForUsbDevices() + throws RobotCoreException+
+ This method will attempt to open all USB devices that are using an FTDI USB chipset. It will + then probe the device to determine if it is a Modern Robotics device. Finally, it will close the + device. +
+ Because of the opening and closing of devices, it is recommended that this method is not called + while any FTDI devices are in use.
RobotCoreException
- if unable to open a deviceDcMotorController createUsbDcMotorController(SerialNumber serialNumber, + java.lang.String name) + throws RobotCoreException, + java.lang.InterruptedException+
serialNumber
- serial number of controllerRobotCoreException
- if unable to create instancejava.lang.InterruptedException
DcMotor createDcMotor(DcMotorController controller, + int portNumber, + MotorConfigurationType motorType, + java.lang.String name)+
controller
- DC Motor controller this motor is attached toportNumber
- physical port number on the controllermotorType
- the optional type we know of for this motorDcMotor createDcMotorEx(DcMotorController controller, + int portNumber, + MotorConfigurationType motorType, + java.lang.String name)+
ServoController createUsbServoController(SerialNumber serialNumber, + java.lang.String name) + throws RobotCoreException, + java.lang.InterruptedException+
serialNumber
- serial number of controllerRobotCoreException
- if unable to create instancejava.lang.InterruptedException
Servo createServo(ServoController controller, + int portNumber, + java.lang.String name)+
controller
- Servo controller this servo is attached toportNumber
- physical port number on the controllerServo createServoEx(ServoControllerEx controller, + int portNumber, + java.lang.String name, + ServoConfigurationType servoType)+
CRServo createCRServo(ServoController controller, + int portNumber, + java.lang.String name)+
CRServo createCRServoEx(ServoControllerEx controller, + int portNumber, + java.lang.String name, + ServoConfigurationType servoType)+
HardwareDevice createCustomServoDevice(ServoController controller, + int portNumber, + ServoConfigurationType servoConfigurationType)+
HardwareDevice createLynxCustomServoDevice(ServoControllerEx controller, + int portNumber, + ServoConfigurationType servoConfigurationType)+
LegacyModule createUsbLegacyModule(SerialNumber serialNumber, + java.lang.String name) + throws RobotCoreException, + java.lang.InterruptedException+
serialNumber
- serial number of legacy moduleRobotCoreException
- if unable to create instancejava.lang.InterruptedException
DeviceInterfaceModule createDeviceInterfaceModule(SerialNumber serialNumber, + java.lang.String name) + throws RobotCoreException, + java.lang.InterruptedException+
serialNumber
- serial number of Core Device Interface moduleRobotCoreException
- if unable to create instancejava.lang.InterruptedException
TouchSensor createNxtTouchSensor(LegacyModule legacyModule, + int physicalPort, + java.lang.String name)+
legacyModule
- the Legacy Module this sensor is attached tophysicalPort
- port number on Legacy Module it's connected toTouchSensorMultiplexer createHTTouchSensorMultiplexer(LegacyModule legacyModule, + int port, + java.lang.String name)+
legacyModule
- the Legacy Module this sensor is attached toport
- port number on Legacy Module this sensor is connected to.HardwareDevice createAnalogSensor(AnalogInputController controller, + int channel, + AnalogSensorConfigurationType type)+
controller
- Analog Input Controller Module this device is connected toAnalogOutput createAnalogOutputDevice(AnalogOutputController controller, + int channel, + java.lang.String name)+
controller
- Analog Output Controller Module this device is connected toHardwareDevice createDigitalDevice(DigitalChannelController controller, + int channel, + DigitalIoDeviceConfigurationType type)+
controller
- Device Interface Module this device is connected totype
- PWMOutput createPwmOutputDevice(PWMOutputController controller, + int channel, + java.lang.String name)+
controller
- PWM Output Controller Module this device is connected toI2cDevice createI2cDevice(I2cController controller, + DeviceConfiguration.I2cChannel channel, + java.lang.String name)+
controller
- I2c Controller Module this device is conneced tochannel
- the channel it's connected to on the ControllerI2cDeviceSynch createI2cDeviceSynch(RobotCoreLynxModule module, + DeviceConfiguration.I2cChannel channel, + java.lang.String name)+
HardwareDevice createUserI2cDevice(I2cController controller, + DeviceConfiguration.I2cChannel channel, + I2cDeviceConfigurationType type, + java.lang.String name)+
HardwareDevice createUserI2cDevice(RobotCoreLynxModule lynxModule, + DeviceConfiguration.I2cChannel channel, + I2cDeviceConfigurationType type, + java.lang.String name)+
DcMotorController createHTDcMotorController(LegacyModule legacyModule, + int physicalPort, + java.lang.String name)+
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected toRobotCoreLynxUsbDevice createLynxUsbDevice(SerialNumber serialNumber, + java.lang.String name) + throws RobotCoreException, + java.lang.InterruptedException+
serialNumber
- RobotCoreException
java.lang.InterruptedException
RobotCoreLynxModule createLynxModule(RobotCoreLynxUsbDevice lynxUsbDevice, + int moduleAddress, + boolean isParent, + java.lang.String name)+
lynxUsbDevice
- moduleAddress
- WebcamName createWebcamName(SerialNumber serialNumber, + java.lang.String name) + throws RobotCoreException, + java.lang.InterruptedException+
WebcamName
from the indicated serialized contentsRobotCoreException
java.lang.InterruptedException
ServoController createHTServoController(LegacyModule legacyModule, + int physicalPort, + java.lang.String name)+
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected toCompassSensor createHTCompassSensor(LegacyModule legacyModule, + int physicalPort, + java.lang.String name)+
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected toTouchSensor createMRDigitalTouchSensor(DigitalChannelController digitalController, + int physicalPort, + java.lang.String name)+
digitalController
- controller this device is connected tophysicalPort
- the port number of the device on that controllername
- the name of this device in the hardware mapAccelerationSensor createHTAccelerationSensor(LegacyModule legacyModule, + int physicalPort, + java.lang.String name)+
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected toLightSensor createHTLightSensor(LegacyModule legacyModule, + int physicalPort, + java.lang.String name)+
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected toIrSeekerSensor createHTIrSeekerSensor(LegacyModule legacyModule, + int physicalPort, + java.lang.String name)+
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected toIrSeekerSensor createMRI2cIrSeekerSensorV3(I2cController i2cController, + DeviceConfiguration.I2cChannel channel, + java.lang.String name)+
i2cController
- the I2cController
this device is connected tochannel
- port number on the Device Interface Module this device is connected toIrSeekerSensor createMRI2cIrSeekerSensorV3(RobotCoreLynxModule module, + DeviceConfiguration.I2cChannel channel, + java.lang.String name)+
UltrasonicSensor createNxtUltrasonicSensor(LegacyModule legacyModule, + int physicalPort, + java.lang.String name)+
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected toGyroSensor createHTGyroSensor(LegacyModule legacyModule, + int physicalPort, + java.lang.String name)+
legacyModule
- Legacy Module this device is connected tophysicalPort
- port number on the Legacy Module this device is connected toGyroSensor createModernRoboticsI2cGyroSensor(I2cController i2cController, + DeviceConfiguration.I2cChannel channel, + java.lang.String name)+
i2cController
- module this device is connected tochannel
- i2c connection channelGyroSensor createModernRoboticsI2cGyroSensor(RobotCoreLynxModule module, + DeviceConfiguration.I2cChannel channel, + java.lang.String name)+
ColorSensor createAdafruitI2cColorSensor(I2cController controller, + DeviceConfiguration.I2cChannel channel, + java.lang.String name)+
controller
- Device Interface Module this sensor is connected tochannel
- the I2C port on the Device Interface this module is connected toColorSensor createAdafruitI2cColorSensor(RobotCoreLynxModule module, + DeviceConfiguration.I2cChannel channel, + java.lang.String name)+
ColorSensor createLynxColorRangeSensor(RobotCoreLynxModule module, + DeviceConfiguration.I2cChannel channel, + java.lang.String name)+
ColorSensor createHTColorSensor(LegacyModule controller, + int channel, + java.lang.String name)+
controller
- Legacy Module this sensor is attached tochannel
- the I2C port it's connected toColorSensor createModernRoboticsI2cColorSensor(I2cController controller, + DeviceConfiguration.I2cChannel channel, + java.lang.String name)+
controller
- Device Interface Module this sensor is attached tochannel
- the I2C port it's connected toColorSensor createModernRoboticsI2cColorSensor(RobotCoreLynxModule module, + DeviceConfiguration.I2cChannel channel, + java.lang.String name)+
LED createLED(DigitalChannelController controller, + int channel, + java.lang.String name)+
controller
- Digital Channel Controller this LED is connected tochannel
- the digital port it's connected topublic static enum DigitalChannel.Mode +extends java.lang.Enum<DigitalChannel.Mode>+
Enum Constant and Description | +
---|
INPUT |
+
OUTPUT |
+
Modifier and Type | +Method and Description | +
---|---|
static DigitalChannel.Mode |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static DigitalChannel.Mode[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final DigitalChannel.Mode INPUT+
public static final DigitalChannel.Mode OUTPUT+
public static DigitalChannel.Mode[] values()+
+for (DigitalChannel.Mode c : DigitalChannel.Mode.values()) + System.out.println(c); +
public static DigitalChannel.Mode valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic interface DigitalChannel +extends HardwareDevice+
DigitalChannel
is an interface by which digital channels can be controlled.
+ Such channels have a boolean state, and are modal as to direction, being either input
+ channels or output channels.Modifier and Type | +Interface and Description | +
---|---|
static class |
+DigitalChannel.Mode
+Digital channel mode - input or output
+ |
+
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
DigitalChannel.Mode |
+getMode()
+Returns whether the channel is in input or output mode
+ |
+
boolean |
+getState()
+Returns the current state of the channel
+ |
+
void |
+setMode(DigitalChannel.Mode mode)
+Changes whether the channel is in input or output mode
+ |
+
void |
+setMode(DigitalChannelController.Mode mode)
+Deprecated.
+
+use
+setMode(Mode) instead |
+
void |
+setState(boolean state)
+Sets the current state of the channel
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
DigitalChannel.Mode getMode()+
setMode(Mode)
void setMode(DigitalChannel.Mode mode)+
mode
- whether the channel is in input or output modeboolean getState()+
void setState(boolean state)+
state
- the new state of the channel@Deprecated +void setMode(DigitalChannelController.Mode mode)+
setMode(Mode)
insteadDigitalChannel.Mode
instead@Deprecated +public static enum DigitalChannelController.Mode +extends java.lang.Enum<DigitalChannelController.Mode>+
Enum Constant and Description | +
---|
INPUT
+Deprecated.
+ |
+
OUTPUT
+Deprecated.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
DigitalChannel.Mode |
+migrate()
+Deprecated.
+ |
+
static DigitalChannelController.Mode |
+valueOf(java.lang.String name)
+Deprecated.
+Returns the enum constant of this type with the specified name.
+ |
+
static DigitalChannelController.Mode[] |
+values()
+Deprecated.
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final DigitalChannelController.Mode INPUT+
public static final DigitalChannelController.Mode OUTPUT+
public static DigitalChannelController.Mode[] values()+
+for (DigitalChannelController.Mode c : DigitalChannelController.Mode.values()) + System.out.println(c); +
public static DigitalChannelController.Mode valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic DigitalChannel.Mode migrate()+
public interface DigitalChannelController +extends HardwareDevice+
+ Different digital channel controllers will implement this interface.
Modifier and Type | +Interface and Description | +
---|---|
static class |
+DigitalChannelController.Mode
+Deprecated.
+
+use
+DigitalChannel.Mode instead |
+
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
DigitalChannel.Mode |
+getDigitalChannelMode(int channel)
+Get the mode of a digital channel
+ |
+
boolean |
+getDigitalChannelState(int channel)
+Get the state of a digital channel
+ If it's in OUTPUT mode, this will return the output bit.
+ |
+
SerialNumber |
+getSerialNumber()
+Serial Number
+ |
+
void |
+setDigitalChannelMode(int channel,
+ DigitalChannel.Mode mode)
+Set the mode of a digital channel
+ |
+
void |
+setDigitalChannelMode(int channel,
+ DigitalChannelController.Mode mode)
+Deprecated.
+
+use
+setDigitalChannelMode(int, DigitalChannel.Mode) instead |
+
void |
+setDigitalChannelState(int channel,
+ boolean state)
+Set the state of a digital channel
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
SerialNumber getSerialNumber()+
DigitalChannel.Mode getDigitalChannelMode(int channel)+
channel
- channelvoid setDigitalChannelMode(int channel, + DigitalChannel.Mode mode)+
channel
- channelmode
- INPUT or OUTPUT@Deprecated +void setDigitalChannelMode(int channel, + DigitalChannelController.Mode mode)+
setDigitalChannelMode(int, DigitalChannel.Mode)
insteadboolean getDigitalChannelState(int channel)+
channel
- channelvoid setDigitalChannelState(int channel, + boolean state)+
+ The behavior of this method is undefined for digital channels in INPUT mode.
channel
- channelstate
- true to set; false to unsetpublic class DigitalChannelImpl +extends java.lang.Object +implements DigitalChannel+
DigitalChannel.Mode
HardwareDevice.Manufacturer
Constructor and Description | +
---|
DigitalChannelImpl(DigitalChannelController controller,
+ int channel)
+Constructor
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close()
+Closes this device
+ |
+
java.lang.String |
+getConnectionInfo()
+Get connection information about this device in a human readable format
+ |
+
java.lang.String |
+getDeviceName()
+Returns a string suitable for display to the user as to the type of device.
+ |
+
HardwareDevice.Manufacturer |
+getManufacturer()
+Returns an indication of the manufacturer of this device.
+ |
+
DigitalChannel.Mode |
+getMode()
+Get the channel mode
+ |
+
boolean |
+getState()
+Get the channel state
+ |
+
int |
+getVersion()
+Version
+ |
+
void |
+resetDeviceConfigurationForOpMode()
+Resets the device's configuration to that which is expected at the beginning of an OpMode.
+ |
+
void |
+setMode(DigitalChannel.Mode mode)
+Set the channel mode
+ |
+
void |
+setMode(DigitalChannelController.Mode mode)
+Deprecated.
+ |
+
void |
+setState(boolean state)
+Set the channel state
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public DigitalChannelImpl(DigitalChannelController controller, + int channel)+
controller
- Digital channel controller this channel is attached tochannel
- channel on the digital channel controllerpublic DigitalChannel.Mode getMode()+
getMode
in interface DigitalChannel
DigitalChannel.setMode(Mode)
public void setMode(DigitalChannel.Mode mode)+
setMode
in interface DigitalChannel
mode
- @Deprecated +public void setMode(DigitalChannelController.Mode mode)+
setMode
in interface DigitalChannel
public boolean getState()+
getState
in interface DigitalChannel
public void setState(boolean state)+
+ The behavior of this method is undefined for INPUT digital channels.
setState
in interface DigitalChannel
state
- public HardwareDevice.Manufacturer getManufacturer()+
HardwareDevice
getManufacturer
in interface HardwareDevice
public java.lang.String getDeviceName()+
HardwareDevice
getDeviceName
in interface HardwareDevice
public java.lang.String getConnectionInfo()+
HardwareDevice
getConnectionInfo
in interface HardwareDevice
public int getVersion()+
HardwareDevice
getVersion
in interface HardwareDevice
public void resetDeviceConfigurationForOpMode()+
HardwareDevice
resetDeviceConfigurationForOpMode
in interface HardwareDevice
public void close()+
HardwareDevice
close
in interface HardwareDevice
public interface DistanceSensor +extends HardwareDevice+
DistanceSensor
may be found on hardware sensors which measure distance
+ by one means or another.HardwareDevice.Manufacturer
Modifier and Type | +Field and Description | +
---|---|
static double |
+distanceOutOfRange
+The value returned when a distance reading is not in fact available.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
double |
+getDistance(DistanceUnit unit)
+Returns the current distance in the indicated distance units
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
static final double distanceOutOfRange+
double getDistance(DistanceUnit unit)+
unit
- the unit of distance in which the result should be returneddistanceOutOfRange
is
+ returned;public interface Engagable
+Modifier and Type | +Method and Description | +
---|---|
void |
+disengage()
+Disengage the object from underlying services it uses to render its function.
+ |
+
void |
+engage()
+(Re)enage the object with its underlying services.
+ |
+
boolean |
+isEngaged()
+Returns whether the object is currently in the engaged state.
+ |
+
void disengage()+
void engage()+
boolean isEngaged()+
public static interface Gamepad.GamepadCallback
+Modifier and Type | +Method and Description | +
---|---|
void |
+gamepadChanged(Gamepad gamepad)
+This method will be called whenever the gamepad state has changed due to either a KeyEvent
+ or a MotionEvent.
+ |
+
public class Gamepad
+extends RobocolParsableBase
++ The buttons, analog sticks, and triggers are represented a public + member variables that can be read from or written to directly. +
+ Analog sticks are represented as floats that range from -1.0 to +1.0. They will be 0.0 while at + rest. The horizontal axis is labeled x, and the vertical axis is labeled y. +
+ Triggers are represented as floats that range from 0.0 to 1.0. They will be at 0.0 while at + rest. +
+ Buttons are boolean values. They will be true if the button is pressed, otherwise they will be + false. +
+ The codes KEYCODE_BUTTON_SELECT and KEYCODE_BACK are both be handled as a "back" button event. + Older Android devices (Kit Kat) map a Logitech F310 "back" button press to a KEYCODE_BUTTON_SELECT event. + Newer Android devices (Marshmallow or greater) map this "back" button press to a KEYCODE_BACK event. + Also, the REV Robotics Gamepad (REV-31-1159) has a "select" button instead of a "back" button on the gamepad. +
+ The dpad is represented as 4 buttons, dpad_up, dpad_down, dpad_left, and dpad_right
Modifier and Type | +Class and Description | +
---|---|
static interface |
+Gamepad.GamepadCallback
+Optional callback interface for monitoring changes due to MotionEvents and KeyEvents.
+ |
+
Modifier and Type | +Field and Description | +
---|---|
boolean |
+a
+button a
+ |
+
boolean |
+b
+button b
+ |
+
boolean |
+back
+button back
+ |
+
boolean |
+dpad_down
+dpad down
+ |
+
boolean |
+dpad_left
+dpad left
+ |
+
boolean |
+dpad_right
+dpad right
+ |
+
boolean |
+dpad_up
+dpad up
+ |
+
protected float |
+dpadThreshold
+DPAD button will be considered pressed when the movement crosses this
+ threshold
+ |
+
boolean |
+guide
+button guide - often the large button in the middle of the controller.
+ |
+
int |
+id
+ID assigned to this gamepad by the OS.
+ |
+
static int |
+ID_SYNTHETIC
+A gamepad with a phantom id a synthetic one made up by the system
+ |
+
static int |
+ID_UNASSOCIATED
+A gamepad with an ID equal to ID_UNASSOCIATED has not been associated with any device.
+ |
+
protected float |
+joystickDeadzone
+If the motion value is less than the threshold, the controller will be
+ considered at rest
+ |
+
boolean |
+left_bumper
+button left bumper
+ |
+
boolean |
+left_stick_button
+left stick button
+ |
+
float |
+left_stick_x
+left analog stick horizontal axis
+ |
+
float |
+left_stick_y
+left analog stick vertical axis
+ |
+
float |
+left_trigger
+left trigger
+ |
+
boolean |
+right_bumper
+button right bumper
+ |
+
boolean |
+right_stick_button
+right stick button
+ |
+
float |
+right_stick_x
+right analog stick horizontal axis
+ |
+
float |
+right_stick_y
+right analog stick vertical axis
+ |
+
float |
+right_trigger
+right trigger
+ |
+
boolean |
+start
+button start
+ |
+
long |
+timestamp
+Relative timestamp of the last time an event was detected
+ |
+
boolean |
+x
+button x
+ |
+
boolean |
+y
+button y
+ |
+
Constructor and Description | +
---|
Gamepad() |
+
Gamepad(Gamepad.GamepadCallback callback) |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+atRest()
+Are all analog sticks and triggers in their rest position?
+ |
+
protected void |
+callCallback() |
+
protected float |
+cleanMotionValues(float number) |
+
static void |
+clearWhitelistFilter()
+Clear the device whitelist filter.
+ |
+
void |
+copy(Gamepad gamepad)
+Copy the state of a gamepad into this gamepad
+ |
+
static void |
+enableWhitelistFilter(int vendorId,
+ int productId)
+Add a whitelist filter for a specific device vendor/product ID.
+ |
+
void |
+fromByteArray(byte[] byteArray) |
+
int |
+getGamepadId() |
+
MsgType |
+getRobocolMsgType() |
+
GamepadUser |
+getUser() |
+
static boolean |
+isGamepadDevice(int deviceId)
+Does this device ID belong to a gamepad device?
+ |
+
protected boolean |
+pressed(android.view.KeyEvent event) |
+
void |
+refreshTimestamp()
+Refreshes the Gamepad's timestamp to be the current time.
+ |
+
void |
+reset()
+Reset this gamepad into its initial state
+ |
+
void |
+setGamepadId(int id) |
+
void |
+setJoystickDeadzone(float deadzone)
+Set the joystick deadzone.
+ |
+
void |
+setTimestamp(long timestamp)
+Sets the time at which this Gamepad last changed its state,
+ in the
+SystemClock.uptimeMillis() time base. |
+
void |
+setUser(GamepadUser user) |
+
byte[] |
+toByteArray() |
+
java.lang.String |
+toString()
+Display a summary of this gamepad, including the state of all buttons, analog sticks, and triggers
+ |
+
java.lang.String |
+type()
+Get the type of gamepad as a String.
+ |
+
void |
+update(android.view.KeyEvent event)
+Update the gamepad based on a KeyEvent
+ |
+
void |
+update(android.view.MotionEvent event)
+Update the gamepad based on a MotionEvent
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public static final int ID_UNASSOCIATED+
public static final int ID_SYNTHETIC+
public float left_stick_x+
public float left_stick_y+
public float right_stick_x+
public float right_stick_y+
public boolean dpad_up+
public boolean dpad_down+
public boolean dpad_left+
public boolean dpad_right+
public boolean a+
public boolean b+
public boolean x+
public boolean y+
public boolean guide+
public boolean start+
public boolean back+
public boolean left_bumper+
public boolean right_bumper+
public boolean left_stick_button+
public boolean right_stick_button+
public float left_trigger+
public float right_trigger+
public int id+
public long timestamp+
protected float dpadThreshold+
protected float joystickDeadzone+
public Gamepad()+
public Gamepad(Gamepad.GamepadCallback callback)+
public GamepadUser getUser()+
public void setUser(GamepadUser user)+
public void setGamepadId(int id)+
public int getGamepadId()+
public void setTimestamp(long timestamp)+
SystemClock.uptimeMillis()
time base.public void refreshTimestamp()+
public void copy(Gamepad gamepad) + throws RobotCoreException+
gamepad
- state to be copied fromRobotCoreException
- if the copy fails - gamepad will be in an unknown
+ state if this exception is thrownpublic void reset()+
public void setJoystickDeadzone(float deadzone)+
deadzone
- amount of joystick deadzonepublic void update(android.view.MotionEvent event)+
event
- motion eventpublic void update(android.view.KeyEvent event)+
event
- key eventpublic MsgType getRobocolMsgType()+
public byte[] toByteArray() + throws RobotCoreException+
RobotCoreException
public void fromByteArray(byte[] byteArray) + throws RobotCoreException+
RobotCoreException
public boolean atRest()+
public java.lang.String type()+
public java.lang.String toString()+
protected float cleanMotionValues(float number)+
protected boolean pressed(android.view.KeyEvent event)+
protected void callCallback()+
public static void enableWhitelistFilter(int vendorId, + int productId)+
+ This adds a whitelist to the gamepad detection method. If a device has been added to the + whitelist, then only devices that match the given vendor ID and product ID will be considered + gamepads. This method can be called multiple times to add multiple devices to the whitelist. +
+ If no whitelist entries have been added, then the default OS detection methods will be used.
vendorId
- the vendor IDproductId
- the product IDpublic static void clearWhitelistFilter()+
public static boolean isGamepadDevice(int deviceId)+
deviceId
- device IDpublic interface GyroSensor +extends HardwareDevice+
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
void |
+calibrate()
+Calibrate the gyro.
+ |
+
int |
+getHeading()
+Return the integrated Z axis as a cartesian heading.
+ |
+
double |
+getRotationFraction()
+Return the rotation of this sensor expressed as a fraction of the maximum possible reportable rotation
+ |
+
boolean |
+isCalibrating()
+Is the gyro performing a calibration operation?
+ |
+
int |
+rawX()
+Return the gyro's raw X value.
+ |
+
int |
+rawY()
+Return the gyro's raw Y value.
+ |
+
int |
+rawZ()
+Return the gyro's raw Z value.
+ |
+
void |
+resetZAxisIntegrator()
+Set the integrated Z axis to zero.
+ |
+
java.lang.String |
+status()
+Status of this sensor, in string form
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
void calibrate()+
java.lang.UnsupportedOperationException
- if unsupported; not all gyro devices support this featureboolean isCalibrating()+
java.lang.UnsupportedOperationException
- if unsupported; not all gyro devices support this featureint getHeading()+
java.lang.UnsupportedOperationException
- if unsupported; not all gyro devices support this featuredouble getRotationFraction()+
java.lang.UnsupportedOperationException
- if unsupported; not all gyro devices support this featureint rawX()+
java.lang.UnsupportedOperationException
- if unsupported; not all gyro devices support this featureint rawY()+
java.lang.UnsupportedOperationException
- if unsupported; not all gyro devices support this featureint rawZ()+
java.lang.UnsupportedOperationException
- if unsupported; not all gyro devices support this featurevoid resetZAxisIntegrator()+
java.lang.UnsupportedOperationException
- if unsupported; not all gyro devices support this featurejava.lang.String status()+
public interface Gyroscope
+Gyroscope
interface exposes core, fundamental functionality that
+ is applicable to all gyroscopes: that of reporting angular rotation rate.Modifier and Type | +Method and Description | +
---|---|
AngularVelocity |
+getAngularVelocity(AngleUnit unit)
+Returns the angular rotation rate across all the axes measured by the gyro.
+ |
+
java.util.Set<Axis> |
+getAngularVelocityAxes()
+Returns the axes on which the gyroscope measures angular velocity.
+ |
+
java.util.Set<Axis> getAngularVelocityAxes()+
getAngularVelocity(AngleUnit)
.getAngularVelocity(AngleUnit)
AngularVelocity getAngularVelocity(AngleUnit unit)+
unit
- the unit in which the rotation rates are to be returned (the time
+ dimension is always inverse-seconds).getAngularVelocityAxes()
public static enum HardwareDevice.Manufacturer +extends java.lang.Enum<HardwareDevice.Manufacturer>+
Enum Constant and Description | +
---|
Adafruit |
+
AMS |
+
HiTechnic |
+
Lego |
+
Lynx |
+
Matrix |
+
ModernRobotics |
+
Other |
+
STMicroelectronics |
+
Unknown |
+
Modifier and Type | +Method and Description | +
---|---|
static HardwareDevice.Manufacturer |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static HardwareDevice.Manufacturer[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final HardwareDevice.Manufacturer Unknown+
public static final HardwareDevice.Manufacturer Other+
public static final HardwareDevice.Manufacturer Lego+
public static final HardwareDevice.Manufacturer HiTechnic+
public static final HardwareDevice.Manufacturer ModernRobotics+
public static final HardwareDevice.Manufacturer Adafruit+
public static final HardwareDevice.Manufacturer Matrix+
public static final HardwareDevice.Manufacturer Lynx+
public static final HardwareDevice.Manufacturer AMS+
public static final HardwareDevice.Manufacturer STMicroelectronics+
public static HardwareDevice.Manufacturer[] values()+
+for (HardwareDevice.Manufacturer c : HardwareDevice.Manufacturer.values()) + System.out.println(c); +
public static HardwareDevice.Manufacturer valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic interface HardwareDevice
+Modifier and Type | +Interface and Description | +
---|---|
static class |
+HardwareDevice.Manufacturer |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close()
+Closes this device
+ |
+
java.lang.String |
+getConnectionInfo()
+Get connection information about this device in a human readable format
+ |
+
java.lang.String |
+getDeviceName()
+Returns a string suitable for display to the user as to the type of device.
+ |
+
HardwareDevice.Manufacturer |
+getManufacturer()
+Returns an indication of the manufacturer of this device.
+ |
+
int |
+getVersion()
+Version
+ |
+
void |
+resetDeviceConfigurationForOpMode()
+Resets the device's configuration to that which is expected at the beginning of an OpMode.
+ |
+
HardwareDevice.Manufacturer getManufacturer()+
java.lang.String getDeviceName()+
java.lang.String getConnectionInfo()+
int getVersion()+
void resetDeviceConfigurationForOpMode()+
void close()+
public interface HardwareDeviceCloseOnTearDown
+HardwareDeviceCloseOnTearDown
are those which should be
+ automatically closed when we we 'teardown' a robotModifier and Type | +Method and Description | +
---|---|
void |
+close() |
+
public static enum HardwareDeviceHealth.HealthStatus +extends java.lang.Enum<HardwareDeviceHealth.HealthStatus>+
Enum Constant and Description | +
---|
CLOSED |
+
HEALTHY
+The device appears to be operating successfully
+ |
+
UNHEALTHY
+Experiencing problems of an unspecified nature
+ |
+
UNKNOWN |
+
Modifier and Type | +Method and Description | +
---|---|
static HardwareDeviceHealth.HealthStatus |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static HardwareDeviceHealth.HealthStatus[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final HardwareDeviceHealth.HealthStatus UNKNOWN+
public static final HardwareDeviceHealth.HealthStatus HEALTHY+
public static final HardwareDeviceHealth.HealthStatus UNHEALTHY+
public static final HardwareDeviceHealth.HealthStatus CLOSED+
public static HardwareDeviceHealth.HealthStatus[] values()+
+for (HardwareDeviceHealth.HealthStatus c : HardwareDeviceHealth.HealthStatus.values()) + System.out.println(c); +
public static HardwareDeviceHealth.HealthStatus valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic interface HardwareDeviceHealth
+HardwareDeviceHealth
provides an indication of the perceived health of a hardware deviceHardwareDevice
Modifier and Type | +Interface and Description | +
---|---|
static class |
+HardwareDeviceHealth.HealthStatus |
+
Modifier and Type | +Method and Description | +
---|---|
HardwareDeviceHealth.HealthStatus |
+getHealthStatus() |
+
void |
+setHealthStatus(HardwareDeviceHealth.HealthStatus status) |
+
void setHealthStatus(HardwareDeviceHealth.HealthStatus status)+
HardwareDeviceHealth.HealthStatus getHealthStatus()+
public class HardwareDeviceHealthImpl +extends java.lang.Object +implements HardwareDeviceHealth+
HardwareDeviceHealthImpl
provides a delegatable-to implemenatation of HardwareDeviceHealthHardwareDeviceHealth.HealthStatus
Modifier and Type | +Field and Description | +
---|---|
protected HardwareDeviceHealth.HealthStatus |
+healthStatus |
+
protected java.util.concurrent.Callable<HardwareDeviceHealth.HealthStatus> |
+override |
+
protected java.lang.String |
+tag |
+
Constructor and Description | +
---|
HardwareDeviceHealthImpl(java.lang.String tag) |
+
HardwareDeviceHealthImpl(java.lang.String tag,
+ java.util.concurrent.Callable<HardwareDeviceHealth.HealthStatus> override) |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close() |
+
HardwareDeviceHealth.HealthStatus |
+getHealthStatus() |
+
void |
+setHealthStatus(HardwareDeviceHealth.HealthStatus status) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected java.lang.String tag+
protected HardwareDeviceHealth.HealthStatus healthStatus+
protected java.util.concurrent.Callable<HardwareDeviceHealth.HealthStatus> override+
public HardwareDeviceHealthImpl(java.lang.String tag)+
public HardwareDeviceHealthImpl(java.lang.String tag, + java.util.concurrent.Callable<HardwareDeviceHealth.HealthStatus> override)+
public void close()+
public void setHealthStatus(HardwareDeviceHealth.HealthStatus status)+
setHealthStatus
in interface HardwareDeviceHealth
public HardwareDeviceHealth.HealthStatus getHealthStatus()+
getHealthStatus
in interface HardwareDeviceHealth
DEVICE_TYPE
- public class HardwareMap.DeviceMapping<DEVICE_TYPE extends HardwareDevice>
+extends java.lang.Object
+implements java.lang.Iterable<DEVICE_TYPE>
+HardwareMap
+ comprised of all the devices of a particular device typeget(String)
,
+get(String)
Constructor and Description | +
---|
DeviceMapping(java.lang.Class<DEVICE_TYPE> deviceTypeClass) |
+
Modifier and Type | +Method and Description | +
---|---|
DEVICE_TYPE |
+cast(java.lang.Object obj)
+A small utility that assists in keeping the Java generics type system happy
+ |
+
boolean |
+contains(java.lang.String deviceName)
+Returns whether a device of the indicated name is contained within this mapping
+ |
+
java.util.Set<java.util.Map.Entry<java.lang.String,DEVICE_TYPE>> |
+entrySet()
+Returns a collection of all the (name, device) pairs in this DeviceMapping.
+ |
+
DEVICE_TYPE |
+get(java.lang.String deviceName) |
+
java.lang.Class<DEVICE_TYPE> |
+getDeviceTypeClass()
+Returns the runtime device type for this mapping
+ |
+
protected void |
+internalPut(SerialNumber serialNumber,
+ java.lang.String deviceName,
+ DEVICE_TYPE device) |
+
java.util.Iterator<DEVICE_TYPE> |
+iterator()
+Returns an iterator over all the devices in this DeviceMapping.
+ |
+
void |
+put(SerialNumber serialNumber,
+ java.lang.String deviceName,
+ DEVICE_TYPE device)
+(Advanced) Registers a new device in this DeviceMapping under the indicated name.
+ |
+
void |
+put(java.lang.String deviceName,
+ DEVICE_TYPE device)
+Registers a new device in this DeviceMapping under the indicated name.
+ |
+
void |
+putLocal(java.lang.String deviceName,
+ DEVICE_TYPE device) |
+
boolean |
+remove(SerialNumber serialNumber,
+ java.lang.String deviceName)
+(Advanced) Removes the device with the indicated name (if any) from this DeviceMapping.
+ |
+
boolean |
+remove(java.lang.String deviceName)
+(Advanced) Removes the device with the indicated name (if any) from this DeviceMapping.
+ |
+
int |
+size()
+Returns the number of devices currently in this DeviceMapping
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public DeviceMapping(java.lang.Class<DEVICE_TYPE> deviceTypeClass)+
public java.lang.Class<DEVICE_TYPE> getDeviceTypeClass()+
public DEVICE_TYPE cast(java.lang.Object obj)+
public DEVICE_TYPE get(java.lang.String deviceName)+
public void put(java.lang.String deviceName, + DEVICE_TYPE device)+
deviceName
- the name by which the new device is to be known (case sensitive)device
- the new device to be namedHardwareMap.put(String, HardwareDevice)
public void put(SerialNumber serialNumber, + java.lang.String deviceName, + DEVICE_TYPE device)+
serialNumber
- the serial number of the devicedeviceName
- the name by which the new device is to be known (case sensitive)device
- the new device to be namedHardwareMap.put(String, HardwareDevice)
protected void internalPut(SerialNumber serialNumber, + java.lang.String deviceName, + DEVICE_TYPE device)+
public void putLocal(java.lang.String deviceName, + DEVICE_TYPE device)+
public boolean contains(java.lang.String deviceName)+
deviceName
- the name soughtpublic boolean remove(java.lang.String deviceName)+
deviceName
- the name of the device to remove.HardwareMap.remove(java.lang.String, com.qualcomm.robotcore.hardware.HardwareDevice)
public boolean remove(SerialNumber serialNumber, + java.lang.String deviceName)+
serialNumber
- (optional) the serial number of the device to removedeviceName
- the name of the device to remove.HardwareMap.remove(java.lang.String, com.qualcomm.robotcore.hardware.HardwareDevice)
public java.util.Iterator<DEVICE_TYPE> iterator()+
iterator
in interface java.lang.Iterable<DEVICE_TYPE extends HardwareDevice>
public java.util.Set<java.util.Map.Entry<java.lang.String,DEVICE_TYPE>> entrySet()+
public int size()+
public class HardwareMap +extends java.lang.Object +implements java.lang.Iterable<HardwareDevice>+
A HardwareMap also contains an associated application context in which it was instantiated.
+ Through their hardwareMap
, this
+ provides access to a Context
for OpModes, as such an appropriate instance is needed
+ by various system APIs.
Modifier and Type | +Class and Description | +
---|---|
class |
+HardwareMap.DeviceMapping<DEVICE_TYPE extends HardwareDevice>
+A DeviceMapping contains a subcollection of the devices registered in a
+HardwareMap
+ comprised of all the devices of a particular device type |
+
Constructor and Description | +
---|
HardwareMap(android.content.Context appContext) |
+
Modifier and Type | +Method and Description | +
---|---|
<T> T |
+get(java.lang.Class<? extends T> classOrInterface,
+ SerialNumber serialNumber)
+(Advanced) Returns the device with the indicated
+SerialNumber , if it exists,
+ cast to the indicated class or interface; otherwise, null. |
+
<T> T |
+get(java.lang.Class<? extends T> classOrInterface,
+ java.lang.String deviceName)
+Retrieves the (first) device with the indicated name which is also an instance of the
+ indicated class or interface.
+ |
+
HardwareDevice |
+get(java.lang.String deviceName)
+Returns the (first) device with the indicated name.
+ |
+
<T> java.util.List<T> |
+getAll(java.lang.Class<? extends T> classOrInterface)
+Returns all the devices which are instances of the indicated class or interface.
+ |
+
java.util.Set<java.lang.String> |
+getNamesOf(HardwareDevice device)
+Returns all the names by which the device is known.
+ |
+
protected void |
+internalPut(SerialNumber serialNumber,
+ java.lang.String deviceName,
+ HardwareDevice device) |
+
java.util.Iterator<HardwareDevice> |
+iterator()
+Returns an iterator of all the devices in the HardwareMap.
+ |
+
void |
+logDevices() |
+
void |
+put(SerialNumber serialNumber,
+ java.lang.String deviceName,
+ HardwareDevice device)
+(Advanced) Puts a device in the overall map without having it also reside in a type-specific DeviceMapping.
+ |
+
void |
+put(java.lang.String deviceName,
+ HardwareDevice device)
+Puts a device in the overall map without having it also reside in a type-specific DeviceMapping.
+ |
+
protected void |
+rebuildDeviceNamesIfNecessary() |
+
protected void |
+recordDeviceName(java.lang.String deviceName,
+ HardwareDevice device) |
+
boolean |
+remove(SerialNumber serialNumber,
+ java.lang.String deviceName,
+ HardwareDevice device)
+(Advanced) Removes a device from the overall map, if present.
+ |
+
boolean |
+remove(java.lang.String deviceName,
+ HardwareDevice device)
+(Advanced) Removes a device from the overall map, if present.
+ |
+
int |
+size()
+Returns the number of unique device objects currently found in this HardwareMap.
+ |
+
<T> T |
+tryGet(java.lang.Class<? extends T> classOrInterface,
+ java.lang.String deviceName)
+Retrieves the (first) device with the indicated name which is also an instance of the
+ indicated class or interface.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public HardwareMap.DeviceMapping<DcMotorController> dcMotorController+
public HardwareMap.DeviceMapping<DcMotor> dcMotor+
public HardwareMap.DeviceMapping<ServoController> servoController+
public HardwareMap.DeviceMapping<Servo> servo+
public HardwareMap.DeviceMapping<CRServo> crservo+
public HardwareMap.DeviceMapping<LegacyModule> legacyModule+
public HardwareMap.DeviceMapping<TouchSensorMultiplexer> touchSensorMultiplexer+
public HardwareMap.DeviceMapping<DeviceInterfaceModule> deviceInterfaceModule+
public HardwareMap.DeviceMapping<AnalogInput> analogInput+
public HardwareMap.DeviceMapping<DigitalChannel> digitalChannel+
public HardwareMap.DeviceMapping<OpticalDistanceSensor> opticalDistanceSensor+
public HardwareMap.DeviceMapping<TouchSensor> touchSensor+
public HardwareMap.DeviceMapping<PWMOutput> pwmOutput+
public HardwareMap.DeviceMapping<I2cDevice> i2cDevice+
public HardwareMap.DeviceMapping<I2cDeviceSynch> i2cDeviceSynch+
public HardwareMap.DeviceMapping<AnalogOutput> analogOutput+
public HardwareMap.DeviceMapping<ColorSensor> colorSensor+
public HardwareMap.DeviceMapping<LED> led+
public HardwareMap.DeviceMapping<AccelerationSensor> accelerationSensor+
public HardwareMap.DeviceMapping<CompassSensor> compassSensor+
public HardwareMap.DeviceMapping<GyroSensor> gyroSensor+
public HardwareMap.DeviceMapping<IrSeekerSensor> irSeekerSensor+
public HardwareMap.DeviceMapping<LightSensor> lightSensor+
public HardwareMap.DeviceMapping<UltrasonicSensor> ultrasonicSensor+
public HardwareMap.DeviceMapping<VoltageSensor> voltageSensor+
protected java.util.Map<java.lang.String,java.util.List<HardwareDevice>> allDevicesMap+
protected java.util.List<HardwareDevice> allDevicesList+
protected java.util.Map<HardwareDevice,java.util.Set<java.lang.String>> deviceNames+
protected java.util.Map<SerialNumber,HardwareDevice> serialNumberMap+
public final java.util.List<HardwareMap.DeviceMapping<? extends HardwareDevice>> allDeviceMappings+
public final android.content.Context appContext+
protected final java.lang.Object lock+
public HardwareMap(android.content.Context appContext)+
public <T> T get(java.lang.Class<? extends T> classOrInterface, + java.lang.String deviceName)+
+ DcMotor motorLeft = hardwareMap.get(DcMotor.class, "motorLeft"); + ColorSensor colorSensor = hardwareMap.get(ColorSensor.class, "myColorSensor"); +
classOrInterface
- the class or interface indicating the type of the device object to be retrieveddeviceName
- the name of the device object to be retrievedget(String)
,
+getAll(Class)
,
+HardwareMap.DeviceMapping.get(String)
,
+tryGet(Class, String)
public <T> T tryGet(java.lang.Class<? extends T> classOrInterface, + java.lang.String deviceName)+
get(java.lang.Class<? extends T>, java.lang.String)
is the usual method for retreiving items from
+ the map.get(Class, String)
public <T> T get(java.lang.Class<? extends T> classOrInterface, + SerialNumber serialNumber)+
SerialNumber
, if it exists,
+ cast to the indicated class or interface; otherwise, null.public HardwareDevice get(java.lang.String deviceName)+
HardwareDevice
,
+ which is usually not what is desired in user code. Thus, the programmer usually casts the
+ return type to the target type that the programmer knows the returned value to be:
+
+ + DcMotor motorLeft = (DcMotor)hardwareMap.get("motorLeft"); + ColorSensor colorSensor = (ColorSensor)hardwareMap.get("myColorSensor"); +
deviceName
- the name of the device object to be retrievedget(Class, String)
,
+HardwareMap.DeviceMapping.get(String)
public <T> java.util.List<T> getAll(java.lang.Class<? extends T> classOrInterface)+
classOrInterface
- the class or interface indicating the type of the device object to be retrievedget(Class, String)
public void put(java.lang.String deviceName, + HardwareDevice device)+
deviceName
- the name by which the device is to be known (case sensitive)device
- the device to be stored by that namepublic void put(SerialNumber serialNumber, + java.lang.String deviceName, + HardwareDevice device)+
serialNumber
- the SerialNumber
of the devicedeviceName
- the name by which the device is to be known (case sensitive)device
- the device to be stored by that nameprotected void internalPut(SerialNumber serialNumber, + java.lang.String deviceName, + HardwareDevice device)+
public boolean remove(java.lang.String deviceName, + HardwareDevice device)+
HardwareMap.DeviceMapping.remove(java.lang.String)
+ instead of calling this method.
+
+ This is normally called only by code in the SDK itself, not by user code.
deviceName
- the name of the device to removedevice
- the device to remove under that namepublic boolean remove(SerialNumber serialNumber, + java.lang.String deviceName, + HardwareDevice device)+
HardwareMap.DeviceMapping.remove(java.lang.String)
+ instead of calling this method.
+
+ This is normally called only by code in the SDK itself, not by user code.
serialNumber
- (optional) the serial number of the devicedeviceName
- the name of the device to removedevice
- the device to remove under that namepublic java.util.Set<java.lang.String> getNamesOf(HardwareDevice device)+
device
- the device whose names are desired.protected void recordDeviceName(java.lang.String deviceName, + HardwareDevice device)+
protected void rebuildDeviceNamesIfNecessary()+
public int size()+
iterator()
public java.util.Iterator<HardwareDevice> iterator()+
iterator
in interface java.lang.Iterable<HardwareDevice>
size()
public void logDevices()+
public final class I2cAddr
+extends java.lang.Object
+Constructor and Description | +
---|
I2cAddr(int i2cAddr7Bit) |
+
Modifier and Type | +Method and Description | +
---|---|
static I2cAddr |
+create7bit(int i2cAddr7Bit) |
+
static I2cAddr |
+create8bit(int i2cAddr8Bit) |
+
int |
+get7Bit() |
+
int |
+get8Bit() |
+
static I2cAddr |
+zero() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static I2cAddr zero()+
public static I2cAddr create7bit(int i2cAddr7Bit)+
public static I2cAddr create8bit(int i2cAddr8Bit)+
public int get8Bit()+
public int get7Bit()+
public interface I2cAddrConfig +extends I2cAddressableDevice+
I2cAddrConfig
allows the runtime I2C address used with a sensor to be changed
+ or queried. Note that this does not affect the address that the actual hardware
+ sensor responds to on the I2C bus; rather, it configures software to interact with a
+ a hardware sensor living at a different I2C address than the one at which the software
+ is configured to use by default.I2cAddressableDevice
Modifier and Type | +Method and Description | +
---|---|
void |
+setI2cAddress(I2cAddr newAddress)
+Configures a new I2C address to use
+ |
+
getI2cAddress
public interface I2cAddressableDevice
+I2cAddressableDevice
provides a means by which the address of a device
+ living on an I2C bus can be retrieved.I2cAddrConfig
Modifier and Type | +Method and Description | +
---|---|
I2cAddr |
+getI2cAddress()
+Returns the I2C address currently in use to communicate with an I2C hardware device
+ |
+
public static interface I2cController.I2cPortReadyBeginEndNotifications
+Modifier and Type | +Method and Description | +
---|---|
void |
+onPortIsReadyCallbacksBegin(int port) |
+
void |
+onPortIsReadyCallbacksEnd(int port) |
+
void onPortIsReadyCallbacksBegin(int port) + throws java.lang.InterruptedException+
java.lang.InterruptedException
void onPortIsReadyCallbacksEnd(int port) + throws java.lang.InterruptedException+
java.lang.InterruptedException
public static interface I2cController.I2cPortReadyCallback
+Modifier and Type | +Method and Description | +
---|---|
void |
+portIsReady(int port) |
+
public interface I2cController +extends HardwareDevice+
+ Different digital channel controllers will implement this interface.
Modifier and Type | +Interface and Description | +
---|---|
static interface |
+I2cController.I2cPortReadyBeginEndNotifications
+A callback interface through which a client can learn when portIsReady callbacks
+ begin and then later end.
+ |
+
static interface |
+I2cController.I2cPortReadyCallback
+Callback interface for I2C port ready notifications
+ |
+
HardwareDevice.Manufacturer
Modifier and Type | +Field and Description | +
---|---|
static byte |
+I2C_BUFFER_START_ADDRESS |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+clearI2cPortActionFlag(int port)
+Clears the port action flag, undoing the effect of previous setI2cPortActionFlag()
+ |
+
void |
+copyBufferIntoWriteBuffer(int physicalPort,
+ byte[] buffer)
+Copy a byte array into the buffer that is set to be written out to the device
+ |
+
void |
+deregisterForPortReadyBeginEndCallback(int port)
+Deregisters any existing notifications callback for the given port
+ |
+
void |
+deregisterForPortReadyCallback(int port)
+De-register for port ready notifications.
+ |
+
void |
+enableI2cReadMode(int physicalPort,
+ I2cAddr i2cAddress,
+ int memAddress,
+ int length)
+Enable read mode for a particular I2C device
+ |
+
void |
+enableI2cWriteMode(int physicalPort,
+ I2cAddr i2cAddress,
+ int memAddress,
+ int length)
+Enable write mode for a particular I2C device
+ |
+
byte[] |
+getCopyOfReadBuffer(int physicalPort)
+Get a copy of the most recent data read in from the device
+ |
+
byte[] |
+getCopyOfWriteBuffer(int physicalPort)
+Get a copy of the data that is set to be written out to the device
+ |
+
I2cController.I2cPortReadyCallback |
+getI2cPortReadyCallback(int port)
+Returns the callback currently registered to receive portIsReady notifications for the
+ indicated port
+ |
+
byte[] |
+getI2cReadCache(int port)
+Get direct access to the cache that I2C reads will be populated into
+ |
+
java.util.concurrent.locks.Lock |
+getI2cReadCacheLock(int port)
+Get access to the read cache lock.
+ |
+
TimeWindow |
+getI2cReadCacheTimeWindow(int port)
+Returns the time window object into which timestamps are placed as the read cache is populated
+ |
+
byte[] |
+getI2cWriteCache(int port)
+Get direct access to the cache that I2C writes will be populated into
+ |
+
java.util.concurrent.locks.Lock |
+getI2cWriteCacheLock(int port)
+Get access to the write cache lock.
+ |
+
int |
+getMaxI2cWriteLatency(int port)
+Returns the maximum interval, in milliseconds, from when the controller receives an I2c write
+ transmission over USB to when that write is actually issued to the I2c device.
+ |
+
I2cController.I2cPortReadyBeginEndNotifications |
+getPortReadyBeginEndCallback(int port)
+Returns the current callback registered for a given port
+ |
+
SerialNumber |
+getSerialNumber()
+Serial Number
+ |
+
boolean |
+isArmed()
+Returns whether, as of this instant, this controller is alive and operational in
+ its normally expected mode; that is, whether it is currently in communication
+ with its underlying hardware or whether it is in some other state
+ |
+
boolean |
+isI2cPortActionFlagSet(int port)
+Get the port action flag; this flag is set if the particular port is busy.
+ |
+
boolean |
+isI2cPortInReadMode(int port)
+Is the port in read mode?
+ |
+
boolean |
+isI2cPortInWriteMode(int port)
+Is the port in write mode?
+ |
+
boolean |
+isI2cPortReady(int port)
+Determine if a physical port is ready
+ |
+
void |
+readI2cCacheFromController(int port)
+Read the local cache in from the I2C Controller
+
+ NOTE: unless this method is called the internal cache isn't updated
+ |
+
void |
+readI2cCacheFromModule(int port)
+Deprecated.
+ |
+
void |
+registerForI2cPortReadyCallback(I2cController.I2cPortReadyCallback callback,
+ int port)
+Register to be notified when a given I2C port is ready.
+ |
+
void |
+registerForPortReadyBeginEndCallback(I2cController.I2cPortReadyBeginEndNotifications callback,
+ int port)
+Registers to be notification when portIsReady callbacks begin or cease
+ |
+
void |
+setI2cPortActionFlag(int port)
+Set the port action flag; this flag tells the controller to send the
+ current data in its buffer to the I2C device
+ |
+
void |
+writeI2cCacheToController(int port)
+Write the local cache to the I2C Controller
+
+ NOTE: unless this method is called the internal cache isn't updated
+ |
+
void |
+writeI2cCacheToModule(int port)
+Deprecated.
+ |
+
void |
+writeI2cPortFlagOnlyToController(int port)
+Write just the port action flag in the local cache to the I2C controller
+ |
+
void |
+writeI2cPortFlagOnlyToModule(int port)
+Deprecated.
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
static final byte I2C_BUFFER_START_ADDRESS+
SerialNumber getSerialNumber()+
void enableI2cReadMode(int physicalPort, + I2cAddr i2cAddress, + int memAddress, + int length)+
physicalPort
- the port the device is attached toi2cAddress
- the i2c address of the devicememAddress
- mem address at which to start readinglength
- number of bytes to readvoid enableI2cWriteMode(int physicalPort, + I2cAddr i2cAddress, + int memAddress, + int length)+
physicalPort
- the port the device is attached toi2cAddress
- the i2c address of the devicememAddress
- the memory address at which to start writinglength
- number of bytes to readbyte[] getCopyOfReadBuffer(int physicalPort)+
physicalPort
- the port the device is attached tobyte[] getCopyOfWriteBuffer(int physicalPort)+
physicalPort
- the port the device is attached tovoid copyBufferIntoWriteBuffer(int physicalPort, + byte[] buffer)+
physicalPort
- the port the device is attached tobuffer
- buffer to copyvoid setI2cPortActionFlag(int port)+
port
- physical port number on the deviceclearI2cPortActionFlag(int)
void clearI2cPortActionFlag(int port)+
port
- physical port number on the devicesetI2cPortActionFlag(int)
boolean isI2cPortActionFlagSet(int port)+
port
- physical port number on the devicevoid readI2cCacheFromController(int port)+
port
- physical port number on the devicevoid writeI2cCacheToController(int port)+
port
- physical port number on the devicevoid writeI2cPortFlagOnlyToController(int port)+
port
- physical port number on the deviceboolean isI2cPortInReadMode(int port)+
port
- physical port number on the deviceboolean isI2cPortInWriteMode(int port)+
port
- physical port number on the deviceboolean isI2cPortReady(int port)+
port
- physical port number on the devicejava.util.concurrent.locks.Lock getI2cReadCacheLock(int port)+
+ This is needed if you are accessing the read cache directly. The read + cache lock needs to be acquired before attempting to interact with the read cache
port
- physical port number on the devicejava.util.concurrent.locks.Lock getI2cWriteCacheLock(int port)+
+ This is needed if you are accessing the write cache directly. The write + cache lock needs to be acquired before attempting to interact with the + write cache
port
- physical port number on the devicebyte[] getI2cReadCache(int port)+
+ Please lock the cache before accessing it.
port
- physical port number on the deviceTimeWindow getI2cReadCacheTimeWindow(int port)+
port
- physical port number on the devicebyte[] getI2cWriteCache(int port)+
+ Please lock the cache before accessing it.
port
- physical port number on the deviceint getMaxI2cWriteLatency(int port)+
void registerForI2cPortReadyCallback(I2cController.I2cPortReadyCallback callback, + int port)+
callback
- register a callbackport
- port to be monitoredI2cController.I2cPortReadyCallback getI2cPortReadyCallback(int port)+
port
- the port of interestvoid deregisterForPortReadyCallback(int port)+
port
- port no longer being monitored.void registerForPortReadyBeginEndCallback(I2cController.I2cPortReadyBeginEndNotifications callback, + int port)+
callback
- the callback to registerport
- the port number to register the callback onI2cController.I2cPortReadyBeginEndNotifications getPortReadyBeginEndCallback(int port)+
port
- the port in questionvoid deregisterForPortReadyBeginEndCallback(int port)+
port
- the port in questionboolean isArmed()+
@Deprecated +void readI2cCacheFromModule(int port)+
port
- physical port number on the device@Deprecated +void writeI2cCacheToModule(int port)+
port
- physical port number on the device@Deprecated +void writeI2cPortFlagOnlyToModule(int port)+
port
- physical port number on the devicepublic interface I2cControllerPortDevice
+Modifier and Type | +Method and Description | +
---|---|
I2cController |
+getI2cController()
+Returns the controller associated with this device.
+ |
+
int |
+getPort()
+Returns the port on the associated controller that this device occupies.
+ |
+
I2cController getI2cController()+
int getPort()+
public abstract class I2cControllerPortDeviceImpl +extends java.lang.Object +implements I2cControllerPortDevice+
Modifier and Type | +Field and Description | +
---|---|
protected I2cController |
+controller |
+
protected int |
+physicalPort |
+
Modifier | +Constructor and Description | +
---|---|
protected |
+I2cControllerPortDeviceImpl(I2cController controller,
+ int physicalPort) |
+
Modifier and Type | +Method and Description | +
---|---|
protected void |
+controllerNowArmedOrPretending()
+intended as a subclass hook
+ |
+
protected void |
+controllerNowDisarmed()
+intended as a subclass hook
+ |
+
protected void |
+finishConstruction() |
+
I2cController |
+getI2cController()
+Returns the controller associated with this device.
+ |
+
int |
+getPort()
+Returns the port on the associated controller that this device occupies.
+ |
+
void |
+onModuleStateChange(RobotArmingStateNotifier module,
+ RobotArmingStateNotifier.ARMINGSTATE state) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected final I2cController controller+
protected final int physicalPort+
protected I2cControllerPortDeviceImpl(I2cController controller, + int physicalPort)+
protected void finishConstruction()+
protected void controllerNowArmedOrPretending()+
protected void controllerNowDisarmed()+
public void onModuleStateChange(RobotArmingStateNotifier module, + RobotArmingStateNotifier.ARMINGSTATE state)+
public I2cController getI2cController()+
I2cControllerPortDevice
getI2cController
in interface I2cControllerPortDevice
public int getPort()+
I2cControllerPortDevice
getPort
in interface I2cControllerPortDevice
public interface I2cDevice +extends I2cControllerPortDevice, HardwareDevice+
I2cDevice
interface abstracts the engine used to interact on with a specific I2c device
+ on a port of an I2cController
.I2cDeviceSynch
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
void |
+clearI2cPortActionFlag()
+Clears the flag that
+setI2cPortActionFlag() sets |
+
void |
+copyBufferIntoWriteBuffer(byte[] buffer)
+Atomically copies the provided buffer into the user portion of the write cache, beginning
+ immediately following the four-byte header.
+ |
+
void |
+deregisterForPortReadyBeginEndCallback()
+Unregisters any portIsReady() begin / end notifications object if any is present.
+ |
+
void |
+deregisterForPortReadyCallback()
+Unregisters any callback currently registered.
+ |
+
void |
+enableI2cReadMode(I2cAddr i2cAddr,
+ int register,
+ int count)
+Enable read mode for this I2C device.
+ |
+
void |
+enableI2cWriteMode(I2cAddr i2cAddr,
+ int register,
+ int count)
+Enable write mode for this I2C device.
+ |
+
int |
+getCallbackCount()
+Returns the number of callbacks ever experienced by this I2cDevice instance, whether or not
+ they were ever seen by a registered callback.
+ |
+
I2cController |
+getController()
+Deprecated.
+
+Use of
+I2cControllerPortDevice.getI2cController() is suggested instead |
+
byte[] |
+getCopyOfReadBuffer()
+Atomically returns a copy of that portion of the read-cache which does not include the
+ initial four-byte header section: that contains the read payload most recently read from
+ the controller.
+ |
+
byte[] |
+getCopyOfWriteBuffer()
+Atomically returns a copy that portion of the write-cache which does not include the
+ initial four-byte header section.
+ |
+
I2cController.I2cPortReadyCallback |
+getI2cPortReadyCallback()
+Returns the callback previously registered with
+registerForI2cPortReadyCallback(com.qualcomm.robotcore.hardware.I2cController.I2cPortReadyCallback) , or
+ null if no callback is currently registered. |
+
byte[] |
+getI2cReadCache()
+Returns access to the read-cache into which data from the controller is read.
+ |
+
java.util.concurrent.locks.Lock |
+getI2cReadCacheLock()
+Returns access to the lock controlling the read-cache.
+ |
+
TimeWindow |
+getI2cReadCacheTimeWindow()
+Returns the time window object into which time stamps are written when the read cache is updated
+ |
+
byte[] |
+getI2cWriteCache()
+Returns access to the write-cache from which data is written to the controller.
+ |
+
java.util.concurrent.locks.Lock |
+getI2cWriteCacheLock()
+Returns access to the lock controlling the write-cache.
+ |
+
int |
+getMaxI2cWriteLatency()
+Returns the maximum interval, in milliseconds, from when the controller receives an I2c write
+ transmission over USB to when that write is actually issued to the I2c device.
+ |
+
I2cController.I2cPortReadyBeginEndNotifications |
+getPortReadyBeginEndCallback()
+Returns the object, if any, currently registered for portIsReady() begin / end notifications
+ |
+
boolean |
+isArmed()
+Returns whether, as of this instant, this I2cDevice is alive and operational in
+ its normally expected mode; that is, whether it is currently in communication
+ with its underlying hardware or whether it is in some other state
+ |
+
boolean |
+isI2cPortActionFlagSet()
+Deprecated.
+
+this method returns a value that is rarely that which is expected
+ |
+
boolean |
+isI2cPortInReadMode()
+Queries whether or not the controller has reported that it is in read mode.
+ |
+
boolean |
+isI2cPortInWriteMode()
+Queries whether or not the controller has reported that it is in write mode.
+ |
+
boolean |
+isI2cPortReady()
+Returns whether the I2cDevice instance has experienced a callback since the last issuance
+ of work to the controller.
+ |
+
void |
+readI2cCacheFromController()
+Enqueue a request to the controller to read the range of data from the HW device that
+ was previously indicated in
+enableI2cReadMode(I2cAddr, int, int) and subsequently written
+ to the controller. |
+
void |
+readI2cCacheFromModule()
+Deprecated.
+
+Use of
+readI2cCacheFromController() is suggested instead |
+
void |
+registerForI2cPortReadyCallback(I2cController.I2cPortReadyCallback callback)
+Registers an object to get
+portIsReady()
+ callbacks at regular intervals from the I2cDevice . |
+
void |
+registerForPortReadyBeginEndCallback(I2cController.I2cPortReadyBeginEndNotifications callback)
+Register for notifications as to when
+portIsReady()
+ begin and end. |
+
void |
+setI2cPortActionFlag()
+Set the flag in the write cache that indicates that when the write cache is next transferred
+ to the controller an i2c transaction should take place.
+ |
+
void |
+writeI2cCacheToController()
+Enqueue a request to the controller to write the current contents of the write cache
+ to the HW device.
+ |
+
void |
+writeI2cCacheToModule()
+Deprecated.
+
+Use of
+writeI2cCacheToController() is suggested instead |
+
void |
+writeI2cPortFlagOnlyToController()
+Enqueue a request to the controller to reissue the previous i2c transaction to the HW device.
+ |
+
void |
+writeI2cPortFlagOnlyToModule()
+Deprecated.
+
+Use of
+writeI2cPortFlagOnlyToController() is suggested instead |
+
getI2cController, getPort
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
void enableI2cReadMode(I2cAddr i2cAddr, + int register, + int count)+
i2cAddr
- the address of the device on the I2c bus which should be readregister
- I2c register number within the device at which to start readingcount
- number of bytes to readwriteI2cCacheToController()
void enableI2cWriteMode(I2cAddr i2cAddr, + int register, + int count)+
i2cAddr
- the address of the device on the I2c bus which should be writtenregister
- mem address at which to start writingcount
- number of bytes to writewriteI2cCacheToController()
boolean isI2cPortInReadMode()+
boolean isI2cPortInWriteMode()+
void readI2cCacheFromController()+
enableI2cReadMode(I2cAddr, int, int)
and subsequently written
+ to the controller.void writeI2cCacheToController()+
void writeI2cPortFlagOnlyToController()+
void setI2cPortActionFlag()+
enableI2cReadMode(I2cAddr, int, int)
or
+ enableI2cWriteMode(I2cAddr, int, int)
has most recently been called.clearI2cPortActionFlag()
@Deprecated +boolean isI2cPortActionFlagSet()+
I2cDevice
client; it's use generally should be avoided.void clearI2cPortActionFlag()+
setI2cPortActionFlag()
setssetI2cPortActionFlag()
byte[] getI2cReadCache()+
getI2cReadCache()
need not be repeatedly
+ called. The lock returned by getI2cReadCacheLock()
must be held whenever the data
+ in the returned byte array is accessed. Note that the returned byte array contains an initial
+ header section, four bytes in size, which contains the information manipulated by
+ enableI2cReadMode(I2cAddr, int, int)
and enableI2cWriteMode(I2cAddr, int, int)
.getI2cReadCacheLock()
,
+getCopyOfReadBuffer()
TimeWindow getI2cReadCacheTimeWindow()+
getI2cReadCache()
java.util.concurrent.locks.Lock getI2cReadCacheLock()+
getI2cReadCache()
is accessed.byte[] getI2cWriteCache()+
getI2cWriteCache()
need not be repeatedly
+ called. The lock returned by getI2cWriteCacheLock()
must be held whenever the data
+ in the returned byte array is accessed or written. Note that the returned byte array contains
+ an inital header section, four bytes in size, which contains the information manipulated by
+ enableI2cReadMode(I2cAddr, int, int)
and enableI2cWriteMode(I2cAddr, int, int)
.getI2cWriteCacheLock()
,
+getCopyOfWriteBuffer()
java.util.concurrent.locks.Lock getI2cWriteCacheLock()+
getI2cWriteCache()
is accessedbyte[] getCopyOfReadBuffer()+
getI2cReadCache()
byte[] getCopyOfWriteBuffer()+
getI2cWriteCache()
void copyBufferIntoWriteBuffer(byte[] buffer)+
buffer
- the data to copy into the write cachegetI2cWriteCache()
int getMaxI2cWriteLatency()+
void registerForI2cPortReadyCallback(I2cController.I2cPortReadyCallback callback)+
portIsReady()
+ callbacks at regular intervals from the I2cDevice
. Only one object may be registered for a callback
+ with an I2cDevice
at any given time.callback
- getI2cPortReadyCallback()
,
+deregisterForPortReadyCallback()
I2cController.I2cPortReadyCallback getI2cPortReadyCallback()+
registerForI2cPortReadyCallback(com.qualcomm.robotcore.hardware.I2cController.I2cPortReadyCallback)
, or
+ null if no callback is currently registered.void deregisterForPortReadyCallback()+
int getCallbackCount()+
I2cDevice
instanceboolean isI2cPortReady()+
portIsReady()
+ callback and putting your processing logic there. Inside the callback, the port is, by definition, ready.
+ Alternately, consider using the I2cDeviceSynch
interface instead.I2cDeviceSynch
,
+registerForI2cPortReadyCallback(I2cController.I2cPortReadyCallback)
void registerForPortReadyBeginEndCallback(I2cController.I2cPortReadyBeginEndNotifications callback)+
portIsReady()
+ begin and end. Only one object may be registered for such notifications with an I2cDevice at
+ any given time.callback
- getPortReadyBeginEndCallback()
,
+deregisterForPortReadyBeginEndCallback()
I2cController.I2cPortReadyBeginEndNotifications getPortReadyBeginEndCallback()+
registerForPortReadyBeginEndCallback(I2cController.I2cPortReadyBeginEndNotifications)
void deregisterForPortReadyBeginEndCallback()+
boolean isArmed()+
@Deprecated +I2cController getController()+
I2cControllerPortDevice.getI2cController()
is suggested instead@Deprecated +void readI2cCacheFromModule()+
readI2cCacheFromController()
is suggested instead@Deprecated +void writeI2cCacheToModule()+
writeI2cCacheToController()
is suggested instead@Deprecated +void writeI2cPortFlagOnlyToModule()+
writeI2cPortFlagOnlyToController()
is suggested insteadpublic class I2cDeviceImpl +extends I2cControllerPortDeviceImpl +implements I2cDevice, HardwareDevice, I2cController.I2cPortReadyCallback+
HardwareDevice.Manufacturer
Modifier and Type | +Field and Description | +
---|---|
protected I2cController.I2cPortReadyCallback |
+callback |
+
protected java.util.concurrent.atomic.AtomicInteger |
+callbackCount |
+
controller, physicalPort
Constructor and Description | +
---|
I2cDeviceImpl(I2cController controller,
+ int port)
+Constructor
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+clearI2cPortActionFlag()
+Clears the flag that
+I2cDevice.setI2cPortActionFlag() sets |
+
void |
+close()
+Closes this device
+ |
+
protected void |
+controllerNowArmedOrPretending()
+intended as a subclass hook
+ |
+
void |
+copyBufferIntoWriteBuffer(byte[] buffer)
+Copy a byte array into the buffer that is set to be written out to the device
+ |
+
void |
+deregisterForPortReadyBeginEndCallback()
+deregister for port-ready begin and cessation notifications
+ |
+
void |
+deregisterForPortReadyCallback()
+Unregister for a port-ready callback
+ |
+
void |
+enableI2cReadMode(I2cAddr i2cAddr,
+ int memAddress,
+ int length)
+Deprecated.
+ |
+
void |
+enableI2cWriteMode(I2cAddr i2cAddr,
+ int memAddress,
+ int length)
+Deprecated.
+ |
+
int |
+getCallbackCount()
+Returns the number of callbacks ever experienced by this I2cDevice instance, whether or not
+ they were ever seen by a registered callback.
+ |
+
java.lang.String |
+getConnectionInfo()
+Get connection information about this device in a human readable format
+ |
+
I2cController |
+getController()
+returns the I2cController on which this device is found
+ |
+
byte[] |
+getCopyOfReadBuffer()
+Get a copy of the most recent data read in from the device
+ |
+
byte[] |
+getCopyOfWriteBuffer()
+Get a copy of the data that is set to be written out to the device
+ |
+
java.lang.String |
+getDeviceName()
+Returns a string suitable for display to the user as to the type of device.
+ |
+
I2cController.I2cPortReadyCallback |
+getI2cPortReadyCallback()
+returns the currently registered port-ready callback for this device
+ |
+
byte[] |
+getI2cReadCache()
+Get direct access to the read cache used by this I2C device
+ |
+
java.util.concurrent.locks.Lock |
+getI2cReadCacheLock()
+Get access to the read cache lock.
+ |
+
TimeWindow |
+getI2cReadCacheTimeWindow()
+Returns the time window object into which time stamps are written when the read cache is updated
+ |
+
byte[] |
+getI2cWriteCache()
+Get direct access to the write cache used by this I2C device
+ |
+
java.util.concurrent.locks.Lock |
+getI2cWriteCacheLock()
+Get access to the write cache lock.
+ |
+
HardwareDevice.Manufacturer |
+getManufacturer()
+Returns an indication of the manufacturer of this device.
+ |
+
int |
+getMaxI2cWriteLatency()
+Returns the maximum interval, in milliseconds, from when the controller receives an I2c write
+ transmission over USB to when that write is actually issued to the I2c device.
+ |
+
int |
+getPort()
+returns the port number on the controller on which this device is found
+ |
+
I2cController.I2cPortReadyBeginEndNotifications |
+getPortReadyBeginEndCallback()
+returns the currently registered callback that will receive begin and cessation notifications
+ |
+
int |
+getVersion()
+Version
+ |
+
boolean |
+isArmed()
+Returns whether, as of this instant, this I2cDevice is alive and operational in
+ its normally expected mode; that is, whether it is currently in communication
+ with its underlying hardware or whether it is in some other state
+ |
+
boolean |
+isI2cPortActionFlagSet()
+Check whether or not the action flag is set for this I2C port
+ |
+
boolean |
+isI2cPortInReadMode()
+Query whether or not the port is in Read mode
+ |
+
boolean |
+isI2cPortInWriteMode()
+Query whether or not this port is in write mode
+ |
+
boolean |
+isI2cPortReady()
+Query whether or not this I2c port is ready
+ |
+
void |
+portIsReady(int port) |
+
void |
+readI2cCacheFromController()
+Trigger a read of the I2C cache
+ |
+
void |
+readI2cCacheFromModule()
+Deprecated.
+ |
+
void |
+registerForI2cPortReadyCallback(I2cController.I2cPortReadyCallback callback)
+The method used to register for a port-ready callback
+ |
+
void |
+registerForPortReadyBeginEndCallback(I2cController.I2cPortReadyBeginEndNotifications callback)
+registers for notifications as to when port-ready callbacks begin or cease
+ |
+
void |
+resetDeviceConfigurationForOpMode()
+Resets the device's configuration to that which is expected at the beginning of an OpMode.
+ |
+
void |
+setI2cPortActionFlag()
+Set the port action flag; this flag tells the controller to send the
+ current data in its buffer to the I2C device
+ |
+
void |
+writeI2cCacheToController()
+Trigger a write of the I2C cache
+ |
+
void |
+writeI2cCacheToModule()
+Deprecated.
+ |
+
void |
+writeI2cPortFlagOnlyToController()
+Write only the action flag
+ |
+
void |
+writeI2cPortFlagOnlyToModule()
+Deprecated.
+ |
+
controllerNowDisarmed, finishConstruction, getI2cController, onModuleStateChange
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getI2cController
protected I2cController.I2cPortReadyCallback callback+
protected java.util.concurrent.atomic.AtomicInteger callbackCount+
public I2cDeviceImpl(I2cController controller, + int port)+
controller
- I2C controller this channel is attached toport
- port on the I2C controllerprotected void controllerNowArmedOrPretending()+
I2cControllerPortDeviceImpl
controllerNowArmedOrPretending
in class I2cControllerPortDeviceImpl
public I2cController getController()+
getController
in interface I2cDevice
public int getPort()+
getPort
in interface I2cControllerPortDevice
getPort
in class I2cControllerPortDeviceImpl
@Deprecated +public void enableI2cReadMode(I2cAddr i2cAddr, + int memAddress, + int length)+
enableI2cReadMode
in interface I2cDevice
memAddress
- mem address at which to start readinglength
- number of bytes to readi2cAddr
- the address of the device on the I2c bus which should be readI2cDevice.writeI2cCacheToController()
@Deprecated +public void enableI2cWriteMode(I2cAddr i2cAddr, + int memAddress, + int length)+
enableI2cWriteMode
in interface I2cDevice
memAddress
- mem address at which to start writinglength
- number of bytes to writei2cAddr
- the address of the device on the I2c bus which should be writtenI2cDevice.writeI2cCacheToController()
public byte[] getCopyOfReadBuffer()+
getCopyOfReadBuffer
in interface I2cDevice
I2cDevice.getI2cReadCache()
public byte[] getCopyOfWriteBuffer()+
getCopyOfWriteBuffer
in interface I2cDevice
I2cDevice.getI2cWriteCache()
public void copyBufferIntoWriteBuffer(byte[] buffer)+
copyBufferIntoWriteBuffer
in interface I2cDevice
buffer
- buffer to copyI2cDevice.getI2cWriteCache()
public void setI2cPortActionFlag()+
setI2cPortActionFlag
in interface I2cDevice
I2cDevice.clearI2cPortActionFlag()
public void clearI2cPortActionFlag()+
I2cDevice
I2cDevice.setI2cPortActionFlag()
setsclearI2cPortActionFlag
in interface I2cDevice
I2cDevice.setI2cPortActionFlag()
public boolean isI2cPortActionFlagSet()+
isI2cPortActionFlagSet
in interface I2cDevice
public void readI2cCacheFromController()+
readI2cCacheFromController
in interface I2cDevice
public void writeI2cCacheToController()+
writeI2cCacheToController
in interface I2cDevice
public void writeI2cPortFlagOnlyToController()+
writeI2cPortFlagOnlyToController
in interface I2cDevice
public boolean isI2cPortInReadMode()+
isI2cPortInReadMode
in interface I2cDevice
public boolean isI2cPortInWriteMode()+
isI2cPortInWriteMode
in interface I2cDevice
public boolean isI2cPortReady()+
isI2cPortReady
in interface I2cDevice
I2cDeviceSynch
,
+I2cDevice.registerForI2cPortReadyCallback(I2cController.I2cPortReadyCallback)
public java.util.concurrent.locks.Lock getI2cReadCacheLock()+
+ This is needed if you are accessing the read cache directly. The read + cache lock needs to be acquired before attempting to interact with the read cache
getI2cReadCacheLock
in interface I2cDevice
public java.util.concurrent.locks.Lock getI2cWriteCacheLock()+
+ This is needed if you ace accessing the write cache directly. The write + cache lock needs to be acquired before attempting to interact with the + write cache
getI2cWriteCacheLock
in interface I2cDevice
public byte[] getI2cReadCache()+
+ Please lock the cache before accessing it.
getI2cReadCache
in interface I2cDevice
I2cDevice.getI2cReadCacheLock()
,
+I2cDevice.getCopyOfReadBuffer()
public TimeWindow getI2cReadCacheTimeWindow()+
I2cDevice
getI2cReadCacheTimeWindow
in interface I2cDevice
I2cDevice.getI2cReadCache()
public byte[] getI2cWriteCache()+
+ Please lock the cache before accessing it.
getI2cWriteCache
in interface I2cDevice
I2cDevice.getI2cWriteCacheLock()
,
+I2cDevice.getCopyOfWriteBuffer()
public void portIsReady(int port)+
portIsReady
in interface I2cController.I2cPortReadyCallback
public int getMaxI2cWriteLatency()+
I2cDevice
getMaxI2cWriteLatency
in interface I2cDevice
public void registerForI2cPortReadyCallback(I2cController.I2cPortReadyCallback callback)+
registerForI2cPortReadyCallback
in interface I2cDevice
callback
- pass in the I2C callback that will be called when the device is readyI2cDevice.getI2cPortReadyCallback()
,
+I2cDevice.deregisterForPortReadyCallback()
public I2cController.I2cPortReadyCallback getI2cPortReadyCallback()+
getI2cPortReadyCallback
in interface I2cDevice
public void deregisterForPortReadyCallback()+
deregisterForPortReadyCallback
in interface I2cDevice
I2cDevice.registerForI2cPortReadyCallback(I2cController.I2cPortReadyCallback)
public int getCallbackCount()+
I2cDevice
getCallbackCount
in interface I2cDevice
I2cDevice
instancepublic void registerForPortReadyBeginEndCallback(I2cController.I2cPortReadyBeginEndNotifications callback)+
registerForPortReadyBeginEndCallback
in interface I2cDevice
callback
- the callback which will receive such notificationsI2cDevice.getPortReadyBeginEndCallback()
,
+I2cDevice.deregisterForPortReadyBeginEndCallback()
public I2cController.I2cPortReadyBeginEndNotifications getPortReadyBeginEndCallback()+
getPortReadyBeginEndCallback
in interface I2cDevice
I2cDevice.registerForPortReadyBeginEndCallback(I2cController.I2cPortReadyBeginEndNotifications)
public void deregisterForPortReadyBeginEndCallback()+
deregisterForPortReadyBeginEndCallback
in interface I2cDevice
I2cDevice.registerForPortReadyBeginEndCallback(I2cController.I2cPortReadyBeginEndNotifications)
public boolean isArmed()+
I2cDevice
public HardwareDevice.Manufacturer getManufacturer()+
HardwareDevice
getManufacturer
in interface HardwareDevice
public java.lang.String getDeviceName()+
HardwareDevice
getDeviceName
in interface HardwareDevice
public java.lang.String getConnectionInfo()+
HardwareDevice
getConnectionInfo
in interface HardwareDevice
public int getVersion()+
HardwareDevice
getVersion
in interface HardwareDevice
public void resetDeviceConfigurationForOpMode()+
HardwareDevice
resetDeviceConfigurationForOpMode
in interface HardwareDevice
public void close()+
HardwareDevice
close
in interface HardwareDevice
@Deprecated +public void readI2cCacheFromModule()+
readI2cCacheFromModule
in interface I2cDevice
@Deprecated +public void writeI2cCacheToModule()+
writeI2cCacheToModule
in interface I2cDevice
@Deprecated +public void writeI2cPortFlagOnlyToModule()+
writeI2cPortFlagOnlyToModule
in interface I2cDevice
public class I2cDeviceReader
+extends java.lang.Object
+Constructor and Description | +
---|
I2cDeviceReader(I2cDevice i2cDevice,
+ I2cAddr i2cAddress,
+ int memAddress,
+ int length)
+Constructor
+ |
+
Modifier and Type | +Method and Description | +
---|---|
byte[] |
+getReadBuffer()
+Get a copy of the most recent data read in from the I2C device
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static class I2cDeviceSynch.HeartbeatAction
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
I2cDeviceSynch.ReadWindow |
+heartbeatReadWindow
+Priority #3: explicitly read a given register window
+ |
+
boolean |
+rereadLastRead
+Priority #1: re-issue the last I2C read operation, if possible.
+ |
+
boolean |
+rewriteLastWritten
+Priority #2: re-issue the last I2C write operation, if possible.
+ |
+
Constructor and Description | +
---|
HeartbeatAction(boolean rereadLastRead,
+ boolean rewriteLastWritten,
+ I2cDeviceSynch.ReadWindow readWindow)
+instantiates a new HeartbeatAction.
+ |
+
public final boolean rereadLastRead+
public final boolean rewriteLastWritten+
public final I2cDeviceSynch.ReadWindow heartbeatReadWindow+
public HeartbeatAction(boolean rereadLastRead, + boolean rewriteLastWritten, + I2cDeviceSynch.ReadWindow readWindow)+
public static enum I2cDeviceSynch.ReadMode +extends java.lang.Enum<I2cDeviceSynch.ReadMode>+
I2cDeviceSynch.ReadMode
controls whether when asked to read we read only once or read multiple times.
+
+ In all modes, it is guaranteed that a read() which follows a write() operation will
+ see the state of the device after the write has had effect.Enum Constant and Description | +
---|
BALANCED
+Continuously issue I2C reads as in REPEAT when we can, but do not automatically
+ transition back to read-mode following a write operation in order to do so.
+ |
+
ONLY_ONCE
+Only issue a single I2C read, then set the read window to null to disable further reads.
+ |
+
REPEAT
+Continuously issue I2C reads whenever there's nothing else needing to be done.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
static I2cDeviceSynch.ReadMode |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static I2cDeviceSynch.ReadMode[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final I2cDeviceSynch.ReadMode REPEAT+
read()
will not necessarily execute an I2C transaction
+ for every call but might instead return data previously read from the I2C device.
+ This mode is most useful in a device that spends most of its time doing read operations
+ and only very infrequently writes, if ever.I2cDeviceSynchSimple.read(int, int)
public static final I2cDeviceSynch.ReadMode BALANCED+
REPEAT
, this mode might return data that was
+ previously read a short while ago.public static final I2cDeviceSynch.ReadMode ONLY_ONCE+
read()
in this mode will always get fresh data
+ from the I2C device.public static I2cDeviceSynch.ReadMode[] values()+
+for (I2cDeviceSynch.ReadMode c : I2cDeviceSynch.ReadMode.values()) + System.out.println(c); +
public static I2cDeviceSynch.ReadMode valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static class I2cDeviceSynch.ReadWindow
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
static int |
+READ_REGISTER_COUNT_MAX
+enableI2cReadMode and enableI2cWriteMode both impose a maximum length
+ on the size of data that can be read or written at one time.
+ |
+
static int |
+WRITE_REGISTER_COUNT_MAX |
+
Constructor and Description | +
---|
ReadWindow(int iregFirst,
+ int creg,
+ I2cDeviceSynch.ReadMode readMode)
+Create a new register window with the indicated starting register and register count
+ |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+canBeUsedToRead()
+Answers as to whether we're allowed to read using this window.
+ |
+
boolean |
+contains(I2cDeviceSynch.ReadWindow him)
+Answers as to whether the receiver wholly contains the indicated window.
+ |
+
boolean |
+contains(int ireg,
+ int creg)
+Answers as to whether the receiver wholly contains the indicated set of registers.
+ |
+
boolean |
+containsWithSameMode(I2cDeviceSynch.ReadWindow him)
+Answers as to whether the receiver wholly contains the indicated window
+ and also has the same modality.
+ |
+
I2cDeviceSynch.ReadMode |
+getReadMode()
+Returns the mode of the window
+ |
+
int |
+getRegisterCount()
+Returns the number of registers in the window
+ |
+
int |
+getRegisterFirst()
+Returns the first register in the window
+ |
+
int |
+getRegisterMax()
+Returns the first register NOT in the window
+ |
+
boolean |
+hasWindowBeenUsedForRead()
+Returns whether a read has ever been issued for this window or not
+ |
+
boolean |
+mayInitiateSwitchToReadMode()
+Answers as to whether this window in its present state ought to cause a transition
+ to read-mode when there's nothing else for the device to be doing.
+ |
+
void |
+noteWindowUsedForRead()
+Sets that a read has in fact been issued for this window
+ |
+
I2cDeviceSynch.ReadWindow |
+readableCopy()
+Returns a copy of this window but with the
+usedForRead flag clear |
+
boolean |
+sameAsIncludingMode(I2cDeviceSynch.ReadWindow him)
+Do the receiver and the indicated register window cover exactly the
+ same set of registers and have the same modality?
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final int READ_REGISTER_COUNT_MAX+
READ_REGISTER_COUNT_MAX
+ and WRITE_REGISTER_COUNT_MAX
indicate those maximum sizes.WRITE_REGISTER_COUNT_MAX
,
+Constant Field Valuespublic static final int WRITE_REGISTER_COUNT_MAX+
READ_REGISTER_COUNT_MAX
,
+Constant Field Valuespublic ReadWindow(int iregFirst, + int creg, + I2cDeviceSynch.ReadMode readMode)+
iregFirst
- the index of the first register to readcreg
- the number of registers to readreadMode
- whether to repeat-read or read only oncepublic int getRegisterFirst()+
public int getRegisterMax()+
public int getRegisterCount()+
public I2cDeviceSynch.ReadMode getReadMode()+
public boolean hasWindowBeenUsedForRead()+
public void noteWindowUsedForRead()+
public boolean canBeUsedToRead()+
noteWindowUsedForRead()
has been called on them.public boolean mayInitiateSwitchToReadMode()+
public I2cDeviceSynch.ReadWindow readableCopy()+
usedForRead
flag clearpublic boolean sameAsIncludingMode(I2cDeviceSynch.ReadWindow him)+
him
- the other window to compare topublic boolean contains(I2cDeviceSynch.ReadWindow him)+
him
- the window we wish to see whether we containcontains(int, int)
public boolean containsWithSameMode(I2cDeviceSynch.ReadWindow him)+
him
- the window we wish to see whether we containpublic boolean contains(int ireg, + int creg)+
ireg
- the first register of interestcreg
- the number of registers of interestpublic interface I2cDeviceSynch +extends I2cDeviceSynchSimple, Engagable+
I2cDeviceSynch
is an interface that exposes functionality for interacting with I2c
+ devices. Its methods are synchronous, in that they complete their action before returning to the
+ caller.
+
+ Methods are provided to read and write data simply and straightforwardly. Singleton bytes
+ or larger quantities of data can be read or written using read8()
and
+ write8()
or read()
and write()
+ respectively. No attention to 'read mode' or 'write mode' is required. Simply call reads
+ and writes as you need them, and the right thing happens.
+
+
For devices that automatically shutdown if no communication is received within a certain + duration, a heartbeat facility is optionally provided.
+ +On causality: regarding the sequencing of reads and writes, two important points are + worthy of mention. First, reads and writes are ultimately issued to the controller in the same + chronological order they were received by the device client instance. Second, even more + importantly, reads *always* see the effect of preceding writes on the controller. That is, + a read that follows a write will ensure that, first, the write gets issued to the controller, and + then, second, a read from the controller is subsequently issued. By contrast, absent such + constraints, a read might quickly return freshly-read data already present without having to + interact with the controller. Which brings us to...
+ +Reading data. The simplest way to read data is to call one of the variations of the
+ read()
method. This is always correct, and will return data as accessed
+ from the I2c device. However, in many situations, reads can be significantly optimized by use
+ of a read window. With a read window, a larger chunk of the device's I2c register space
+ can be automatically read even if only a portion of it is needed to service a particular read()
+ call; this can make subsequent read()s significantly faster. Further, depending on the mode
+ of ReadWindow
used, read
+ operations will occur in the background, and read()s will be serviced (subject to causality) out
+ of cached data updated and maintained by the background processing without any synchronous
+ communication with the I2c device itself. For sensors in particular, this mode of operation
+ can be particularly advantageous.
Three modes of ReadWindow
are
+ available:
REPEAT
. In this
+ mode, background reads are always scheduled and cached data updated whenever there's no other
+ (writing) work to do. This is the mode commonly used by sensors, who mostly execute reads
+ and only issue a write relatively infrequently.BALANCED
. In this
+ mode, background reads are also performed, but only if the user initiates a manual read first after
+ a write operation. The object does not automatically start background reads on its own, as the
+ transition from writing to reading can be a relatively expensive one. This mode can be useful
+ for objects like motor and servo controllers which exhibit a balanced mix of both write and
+ read operationsONLY_ONCE
. In this
+ mode, no background reading is performed; data is always retrieved with a synchronous
+ communication to the i2c device.An I2cDeviceSynch
has only one read window in effect at any particular time. This can
+ be updated with setReadWindow(ReadWindow)
or ensureReadWindow()
.
+ When a read() is made, if the registers requested therein are contained within the current
+ read window, then that whole window of data is read from the i2c device (if the cache is out
+ of date) and the appropriate portion thereof returned. In contrast, if the requested registers
+ are not so contained, then, in effect, a one-off ONLY_ONCE
+ is used without disturbing the window maintained by setReadWindow(ReadWindow)
.
+
Modifier and Type | +Interface and Description | +
---|---|
static class |
+I2cDeviceSynch.HeartbeatAction
+Instances of HeartBeatAction indicate what action to carry out to perform
+ a heartbeat should that become necessary.
+ |
+
static class |
+I2cDeviceSynch.ReadMode
+I2cDeviceSynch.ReadMode controls whether when asked to read we read only once or read multiple times. |
+
static class |
+I2cDeviceSynch.ReadWindow
+RegWindow is a utility class for managing the window of I2C register bytes that
+ are read from our I2C device on every hardware cycle
+ |
+
HardwareDeviceHealth.HealthStatus
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
void |
+ensureReadWindow(I2cDeviceSynch.ReadWindow windowNeeded,
+ I2cDeviceSynch.ReadWindow windowToSet)
+Ensure that the current register window covers the indicated set of registers.
+ |
+
I2cDeviceSynch.HeartbeatAction |
+getHeartbeatAction()
+Returns the current action, if any, to take upon expiration of the heartbeat interval.
+ |
+
int |
+getHeartbeatInterval()
+Returns the interval within which communication must be received by the I2C device lest
+ a timeout occur.
+ |
+
I2cDeviceSynch.ReadWindow |
+getReadWindow()
+Returns the current register window used for reading.
+ |
+
TimestampedData |
+readTimeStamped(int ireg,
+ int creg,
+ I2cDeviceSynch.ReadWindow readWindowNeeded,
+ I2cDeviceSynch.ReadWindow readWindowSet)
+Advanced: Atomically calls ensureReadWindow() with the last two parameters and then
+ readTimeStamped() with the first two without the possibility of a concurrent client
+ interrupting in the middle.
+ |
+
void |
+setHeartbeatAction(I2cDeviceSynch.HeartbeatAction action)
+Sets the action to take when the current heartbeat interval expires.
+ |
+
void |
+setHeartbeatInterval(int ms)
+Sets the interval within which communication must be received by the I2C device lest
+ a timeout may occur.
+ |
+
void |
+setReadWindow(I2cDeviceSynch.ReadWindow window)
+Set the set of registers that we will read and read and read again on every hardware cycle
+ |
+
enableWriteCoalescing, getI2cAddr, getLogging, getLoggingTag, isArmed, isWriteCoalescingEnabled, read, read8, readTimeStamped, setI2cAddr, setLogging, setLoggingTag, waitForWriteCompletions, write, write, write8, write8
getHealthStatus, setHealthStatus
setI2cAddress
getI2cAddress
getUserConfiguredName, setUserConfiguredName
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
void setReadWindow(I2cDeviceSynch.ReadWindow window)+
window
- the register window to read. May be null, indicating that no reads are to occur.getReadWindow()
I2cDeviceSynch.ReadWindow getReadWindow()+
setReadWindow(ReadWindow)
void ensureReadWindow(I2cDeviceSynch.ReadWindow windowNeeded, + I2cDeviceSynch.ReadWindow windowToSet)+
windowNeeded
- Test the current register window, if any, against this window
+ to see if an update to the current register window is needed in
+ order to cover it. May be null, indicating that an update to the
+ current register window is always neededwindowToSet
- If an update to the current register window is needed, then this
+ is the window to which it will be set. May be null.setReadWindow(ReadWindow)
,
+I2cDeviceSynchSimple.read8(int)
TimestampedData readTimeStamped(int ireg, + int creg, + I2cDeviceSynch.ReadWindow readWindowNeeded, + I2cDeviceSynch.ReadWindow readWindowSet)+
ireg
- the register number of the first byte register to readcreg
- the number of bytes / registers to readreadWindowNeeded
- the read window we requirereadWindowSet
- the read window to set if the required read window is not currentensureReadWindow(ReadWindow, ReadWindow)
,
+I2cDeviceSynchSimple.readTimeStamped(int, int)
void setHeartbeatInterval(int ms)+
ms
- the new hearbeat interval, in millisecondsgetHeartbeatInterval()
int getHeartbeatInterval()+
setHeartbeatInterval(int)
void setHeartbeatAction(I2cDeviceSynch.HeartbeatAction action)+
action
- the action to take at each heartbeat.getHeartbeatAction()
,
+setHeartbeatInterval(int)
I2cDeviceSynch.HeartbeatAction getHeartbeatAction()+
setHeartbeatAction(HeartbeatAction)
public abstract class I2cDeviceSynchDevice<DEVICE_CLIENT extends I2cDeviceSynchSimple> +extends java.lang.Object +implements HardwareDevice+
I2cDeviceSynchDevice
instances are I2c devices which are built on top of
+ I2cDeviceSynchSimple instances or subclasses thereof. The class provides common and
+ handy utility services for such devices.HardwareDevice.Manufacturer
Modifier and Type | +Field and Description | +
---|---|
protected DEVICE_CLIENT |
+deviceClient |
+
protected boolean |
+deviceClientIsOwned |
+
protected boolean |
+isInitialized |
+
Modifier | +Constructor and Description | +
---|---|
protected |
+I2cDeviceSynchDevice(DEVICE_CLIENT deviceClient,
+ boolean deviceClientIsOwned) |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close()
+Closes this device
+ |
+
protected void |
+disengage() |
+
protected abstract boolean |
+doInitialize()
+Actually carries out the initialization of the instance.
+ |
+
protected void |
+engage() |
+
java.lang.String |
+getConnectionInfo()
+Get connection information about this device in a human readable format
+ |
+
DEVICE_CLIENT |
+getDeviceClient() |
+
int |
+getVersion()
+Version
+ |
+
boolean |
+initialize() |
+
protected void |
+initializeIfNecessary() |
+
void |
+onModuleStateChange(RobotArmingStateNotifier module,
+ RobotArmingStateNotifier.ARMINGSTATE state) |
+
protected void |
+registerArmingStateCallback(boolean doInitialCallback) |
+
void |
+resetDeviceConfigurationForOpMode()
+Resets the device's configuration to that which is expected at the beginning of an OpMode.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDeviceName, getManufacturer
protected DEVICE_CLIENT extends I2cDeviceSynchSimple deviceClient+
protected boolean deviceClientIsOwned+
protected boolean isInitialized+
protected I2cDeviceSynchDevice(DEVICE_CLIENT deviceClient, + boolean deviceClientIsOwned)+
protected void registerArmingStateCallback(boolean doInitialCallback)+
protected void engage()+
protected void disengage()+
public DEVICE_CLIENT getDeviceClient()+
public void onModuleStateChange(RobotArmingStateNotifier module, + RobotArmingStateNotifier.ARMINGSTATE state)+
protected void initializeIfNecessary()+
public boolean initialize()+
protected abstract boolean doInitialize()+
public void resetDeviceConfigurationForOpMode()+
HardwareDevice
resetDeviceConfigurationForOpMode
in interface HardwareDevice
public void close()+
HardwareDevice
close
in interface HardwareDevice
public int getVersion()+
HardwareDevice
getVersion
in interface HardwareDevice
public java.lang.String getConnectionInfo()+
HardwareDevice
getConnectionInfo
in interface HardwareDevice
public abstract class I2cDeviceSynchDeviceWithParameters<DEVICE_CLIENT extends I2cDeviceSynchSimple,PARAMETERS> +extends I2cDeviceSynchDevice<DEVICE_CLIENT>+
I2cDeviceSynchDeviceWithParameters
adds to I2cDeviceSynchDevice
support for
+ sensors that can be publicly initialized with parameter block of a particular type.HardwareDevice.Manufacturer
Modifier and Type | +Field and Description | +
---|---|
protected PARAMETERS |
+parameters |
+
deviceClient, deviceClientIsOwned, isInitialized
Modifier | +Constructor and Description | +
---|---|
protected |
+I2cDeviceSynchDeviceWithParameters(DEVICE_CLIENT deviceClient,
+ boolean isOwned,
+ PARAMETERS parameters) |
+
Modifier and Type | +Method and Description | +
---|---|
protected boolean |
+doInitialize()
+Actually carries out the initialization of the instance.
+ |
+
PARAMETERS |
+getParameters()
+Returns the parameter block currently in use for this sensor
+ |
+
boolean |
+initialize(PARAMETERS parameters)
+Allows for external initialization with non-default parameters
+ |
+
protected abstract boolean |
+internalInitialize(PARAMETERS parameters)
+Actually attempts to carry out initialization with the indicated parameter block.
+ |
+
close, disengage, engage, getConnectionInfo, getDeviceClient, getVersion, initialize, initializeIfNecessary, onModuleStateChange, registerArmingStateCallback, resetDeviceConfigurationForOpMode
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDeviceName, getManufacturer
protected PARAMETERS parameters+
protected I2cDeviceSynchDeviceWithParameters(DEVICE_CLIENT deviceClient, + boolean isOwned, + PARAMETERS parameters)+
public PARAMETERS getParameters()+
protected boolean doInitialize()+
I2cDeviceSynchDevice
doInitialize
in class I2cDeviceSynchDevice<DEVICE_CLIENT extends I2cDeviceSynchSimple>
public boolean initialize(PARAMETERS parameters)+
parameters
- the parameters with which the sensor should be initializedprotected abstract boolean internalInitialize(PARAMETERS parameters)+
parameters
+ member variable.parameters
- the parameter block with which to initializeprotected static enum I2cDeviceSynchImpl.CONTROLLER_PORT_MODE +extends java.lang.Enum<I2cDeviceSynchImpl.CONTROLLER_PORT_MODE>+
Enum Constant and Description | +
---|
READ |
+
SWITCHINGTOREADMODE |
+
UNKNOWN |
+
WRITE |
+
Modifier and Type | +Method and Description | +
---|---|
static I2cDeviceSynchImpl.CONTROLLER_PORT_MODE |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static I2cDeviceSynchImpl.CONTROLLER_PORT_MODE[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final I2cDeviceSynchImpl.CONTROLLER_PORT_MODE UNKNOWN+
public static final I2cDeviceSynchImpl.CONTROLLER_PORT_MODE WRITE+
public static final I2cDeviceSynchImpl.CONTROLLER_PORT_MODE SWITCHINGTOREADMODE+
public static final I2cDeviceSynchImpl.CONTROLLER_PORT_MODE READ+
public static I2cDeviceSynchImpl.CONTROLLER_PORT_MODE[] values()+
+for (I2cDeviceSynchImpl.CONTROLLER_PORT_MODE c : I2cDeviceSynchImpl.CONTROLLER_PORT_MODE.values()) + System.out.println(c); +
public static I2cDeviceSynchImpl.CONTROLLER_PORT_MODE valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullprotected class I2cDeviceSynchImpl.Callback +extends java.lang.Object +implements I2cController.I2cPortReadyCallback, I2cController.I2cPortReadyBeginEndNotifications+
Modifier and Type | +Field and Description | +
---|---|
protected boolean |
+doModuleIsArmedWorkEnabledWrites |
+
protected boolean |
+enabledReadMode |
+
protected boolean |
+enabledWriteMode |
+
protected boolean |
+haveSeenModuleIsArmedWork |
+
protected boolean |
+heartbeatRequired |
+
protected I2cDeviceSynchImpl.READ_CACHE_STATUS |
+prevReadCacheStatus |
+
protected I2cDeviceSynchImpl.WRITE_CACHE_STATUS |
+prevWriteCacheStatus |
+
protected boolean |
+queueFullWrite |
+
protected boolean |
+queueRead |
+
protected boolean |
+setActionFlag |
+
Modifier | +Constructor and Description | +
---|---|
protected |
+Callback() |
+
Modifier and Type | +Method and Description | +
---|---|
protected void |
+doModuleIsArmedWork(boolean arming) |
+
protected void |
+issueWrite() |
+
void |
+onModuleStateChange(RobotArmingStateNotifier robotUsbModule,
+ RobotUsbModule.ARMINGSTATE armingstate) |
+
void |
+onPortIsReadyCallbacksBegin(int port) |
+
void |
+onPortIsReadyCallbacksEnd(int port) |
+
void |
+portIsReady(int port) |
+
protected void |
+startSwitchingToReadMode(I2cDeviceSynch.ReadWindow window) |
+
protected void |
+updateStateMachines() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected boolean setActionFlag+
protected boolean queueFullWrite+
protected boolean queueRead+
protected boolean heartbeatRequired+
protected boolean enabledReadMode+
protected boolean enabledWriteMode+
protected I2cDeviceSynchImpl.READ_CACHE_STATUS prevReadCacheStatus+
protected I2cDeviceSynchImpl.WRITE_CACHE_STATUS prevWriteCacheStatus+
protected boolean doModuleIsArmedWorkEnabledWrites+
protected boolean haveSeenModuleIsArmedWork+
public void portIsReady(int port)+
portIsReady
in interface I2cController.I2cPortReadyCallback
public void onModuleStateChange(RobotArmingStateNotifier robotUsbModule, + RobotUsbModule.ARMINGSTATE armingstate)+
public void onPortIsReadyCallbacksBegin(int port)+
onPortIsReadyCallbacksBegin
in interface I2cController.I2cPortReadyBeginEndNotifications
protected void doModuleIsArmedWork(boolean arming)+
public void onPortIsReadyCallbacksEnd(int port)+
onPortIsReadyCallbacksEnd
in interface I2cController.I2cPortReadyBeginEndNotifications
protected void startSwitchingToReadMode(I2cDeviceSynch.ReadWindow window)+
protected void issueWrite()+
protected void updateStateMachines()+
protected static enum I2cDeviceSynchImpl.READ_CACHE_STATUS +extends java.lang.Enum<I2cDeviceSynchImpl.READ_CACHE_STATUS>+
Enum Constant and Description | +
---|
IDLE |
+
QUEUE_COMPLETED |
+
QUEUED |
+
SWITCHINGTOREADMODE |
+
VALID_ONLYONCE |
+
VALID_QUEUED |
+
Modifier and Type | +Method and Description | +
---|---|
static I2cDeviceSynchImpl.READ_CACHE_STATUS |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static I2cDeviceSynchImpl.READ_CACHE_STATUS[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final I2cDeviceSynchImpl.READ_CACHE_STATUS IDLE+
public static final I2cDeviceSynchImpl.READ_CACHE_STATUS SWITCHINGTOREADMODE+
public static final I2cDeviceSynchImpl.READ_CACHE_STATUS QUEUED+
public static final I2cDeviceSynchImpl.READ_CACHE_STATUS QUEUE_COMPLETED+
public static final I2cDeviceSynchImpl.READ_CACHE_STATUS VALID_ONLYONCE+
public static final I2cDeviceSynchImpl.READ_CACHE_STATUS VALID_QUEUED+
public static I2cDeviceSynchImpl.READ_CACHE_STATUS[] values()+
+for (I2cDeviceSynchImpl.READ_CACHE_STATUS c : I2cDeviceSynchImpl.READ_CACHE_STATUS.values()) + System.out.println(c); +
public static I2cDeviceSynchImpl.READ_CACHE_STATUS valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullprotected static enum I2cDeviceSynchImpl.WRITE_CACHE_STATUS +extends java.lang.Enum<I2cDeviceSynchImpl.WRITE_CACHE_STATUS>+
Enum Constant and Description | +
---|
DIRTY |
+
IDLE |
+
QUEUED |
+
Modifier and Type | +Method and Description | +
---|---|
static I2cDeviceSynchImpl.WRITE_CACHE_STATUS |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static I2cDeviceSynchImpl.WRITE_CACHE_STATUS[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final I2cDeviceSynchImpl.WRITE_CACHE_STATUS IDLE+
public static final I2cDeviceSynchImpl.WRITE_CACHE_STATUS DIRTY+
public static final I2cDeviceSynchImpl.WRITE_CACHE_STATUS QUEUED+
public static I2cDeviceSynchImpl.WRITE_CACHE_STATUS[] values()+
+for (I2cDeviceSynchImpl.WRITE_CACHE_STATUS c : I2cDeviceSynchImpl.WRITE_CACHE_STATUS.values()) + System.out.println(c); +
public static I2cDeviceSynchImpl.WRITE_CACHE_STATUS valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullprotected class I2cDeviceSynchImpl.WriteCacheStatus
+extends java.lang.Object
+Modifier | +Constructor and Description | +
---|---|
protected |
+WriteCacheStatus() |
+
Modifier and Type | +Method and Description | +
---|---|
I2cDeviceSynchImpl.WRITE_CACHE_STATUS |
+getStatus() |
+
void |
+initStatus(I2cDeviceSynchImpl.WRITE_CACHE_STATUS status) |
+
void |
+setStatus(I2cDeviceSynchImpl.WRITE_CACHE_STATUS status) |
+
long |
+waitForIdle()
+Waits for the write cache to become idle.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public void setStatus(I2cDeviceSynchImpl.WRITE_CACHE_STATUS status)+
public void initStatus(I2cDeviceSynchImpl.WRITE_CACHE_STATUS status)+
public I2cDeviceSynchImpl.WRITE_CACHE_STATUS getStatus()+
public long waitForIdle() + throws java.lang.InterruptedException+
java.lang.InterruptedException
public final class I2cDeviceSynchImpl +extends I2cDeviceSynchReadHistoryImpl +implements I2cDeviceSynch, Engagable+
I2cDeviceSynchImpl
is a utility class that makes it easy to read or write data to
+ an instance of I2cDevice
. Its functionality is exposed through the I2cDeviceSynch
+ interface. Please see that interface, and the I2cDeviceSynchImpl
constructor here, for
+ further information.I2cDeviceSynchImpl(I2cDevice, I2cAddr, boolean)
,
+I2cDeviceSynch
,
+I2cDevice
Modifier and Type | +Class and Description | +
---|---|
protected class |
+I2cDeviceSynchImpl.Callback |
+
protected static class |
+I2cDeviceSynchImpl.CONTROLLER_PORT_MODE |
+
protected static class |
+I2cDeviceSynchImpl.READ_CACHE_STATUS |
+
protected static class |
+I2cDeviceSynchImpl.WRITE_CACHE_STATUS |
+
protected class |
+I2cDeviceSynchImpl.WriteCacheStatus |
+
I2cDeviceSynch.HeartbeatAction, I2cDeviceSynch.ReadMode, I2cDeviceSynch.ReadWindow
HardwareDeviceHealth.HealthStatus
HardwareDevice.Manufacturer
Modifier and Type | +Field and Description | +
---|---|
protected I2cDeviceSynchImpl.Callback |
+callback |
+
protected java.lang.Object |
+callbackLock |
+
protected java.lang.Object |
+concurrentClientLock |
+
protected I2cController |
+controller |
+
protected I2cDeviceSynchImpl.CONTROLLER_PORT_MODE |
+controllerPortMode |
+
protected int |
+cregWrite |
+
protected static int |
+dibCacheOverhead |
+
protected boolean |
+disableReadWindows |
+
protected java.lang.Object |
+engagementLock |
+
protected HardwareDeviceHealthImpl |
+hardwareDeviceHealth |
+
protected boolean |
+hasReadWindowChanged |
+
protected I2cDeviceSynch.HeartbeatAction |
+heartbeatAction |
+
protected java.util.concurrent.ExecutorService |
+heartbeatExecutor |
+
protected I2cAddr |
+i2cAddr |
+
protected I2cDevice |
+i2cDevice |
+
protected int |
+iregWriteFirst |
+
protected boolean |
+isClosing |
+
protected boolean |
+isControllerLegacy |
+
protected boolean |
+isEngaged |
+
protected boolean |
+isHooked |
+
protected boolean |
+isI2cDeviceOwned |
+
protected boolean |
+isReadWindowSentToControllerInitialized |
+
protected boolean |
+isWriteCoalescingEnabled |
+
protected boolean |
+loggingEnabled |
+
protected java.lang.String |
+loggingTag |
+
protected static int |
+msCallbackLockAbandon |
+
protected static int |
+msCallbackLockWaitQuantum |
+
protected int |
+msHeartbeatInterval |
+
protected java.lang.String |
+name |
+
protected long |
+nanoTimeReadCacheValid |
+
protected byte[] |
+readCache |
+
protected java.util.concurrent.locks.Lock |
+readCacheLock |
+
protected I2cDeviceSynchImpl.READ_CACHE_STATUS |
+readCacheStatus |
+
protected TimeWindow |
+readCacheTimeWindow |
+
protected java.util.concurrent.atomic.AtomicInteger |
+readerWriterCount |
+
protected java.util.concurrent.locks.ReadWriteLock |
+readerWriterGate |
+
protected java.util.concurrent.atomic.AtomicInteger |
+readerWriterPreventionCount |
+
protected I2cDeviceSynch.ReadWindow |
+readWindow |
+
protected I2cDeviceSynch.ReadWindow |
+readWindowActuallyRead |
+
protected I2cDeviceSynch.ReadWindow |
+readWindowSentToController |
+
protected RobotUsbModule |
+robotUsbModule |
+
protected ElapsedTime |
+timeSinceLastHeartbeat |
+
protected byte[] |
+writeCache |
+
protected java.util.concurrent.locks.Lock |
+writeCacheLock |
+
protected I2cDeviceSynchImpl.WriteCacheStatus |
+writeCacheStatus |
+
historyQueue, historyQueueCapacity, historyQueueLock
Constructor and Description | +
---|
I2cDeviceSynchImpl(I2cDevice i2cDevice,
+ boolean isI2cDeviceOwned)
+Instantiates an
+I2cDeviceSynchImpl instance on the indicated I2cDevice . |
+
I2cDeviceSynchImpl(I2cDevice i2cDevice,
+ I2cAddr i2cAddr,
+ boolean isI2cDeviceOwned)
+Instantiate an
+I2cDeviceSynchImpl instance on the indicated I2cDevice
+ using the indicated I2C address. |
+
Modifier and Type | +Method and Description | +
---|---|
protected void |
+acquireReaderLockShared() |
+
protected void |
+adjustHooking() |
+
protected void |
+assignReadWindow(I2cDeviceSynch.ReadWindow newWindow) |
+
void |
+close()
+Closes this device
+ |
+
protected static byte[] |
+concatenateByteArrays(byte[] left,
+ byte[] right) |
+
protected void |
+disableReadsAndWrites() |
+
void |
+disengage()
+Disengage the object from underlying services it uses to render its function.
+ |
+
protected void |
+enableReadsAndWrites() |
+
void |
+enableWriteCoalescing(boolean enable)
+Enables or disables an optimization wherein writes to two sets of adjacent register
+ ranges may be coalesced into a single I2c transaction if the second write comes along
+ while the first is still queued for writing.
+ |
+
void |
+engage()
+(Re)enage the object with its underlying services.
+ |
+
void |
+ensureReadWindow(I2cDeviceSynch.ReadWindow windowNeeded,
+ I2cDeviceSynch.ReadWindow windowToSet)
+Ensure that the current register window covers the indicated set of registers.
+ |
+
protected void |
+forceDrainReadersAndWriters() |
+
java.lang.String |
+getConnectionInfo()
+Get connection information about this device in a human readable format
+ |
+
java.lang.String |
+getDeviceName()
+Returns a string suitable for display to the user as to the type of device.
+ |
+
HardwareDeviceHealth.HealthStatus |
+getHealthStatus() |
+
I2cDeviceSynch.HeartbeatAction |
+getHeartbeatAction()
+Returns the current action, if any, to take upon expiration of the heartbeat interval.
+ |
+
int |
+getHeartbeatInterval()
+Returns the interval within which communication must be received by the I2C device lest
+ a timeout occur.
+ |
+
I2cAddr |
+getI2cAddr()
+Deprecated.
+ |
+
I2cAddr |
+getI2cAddress()
+Returns the I2C address currently in use to communicate with an I2C hardware device
+ |
+
boolean |
+getLogging() |
+
java.lang.String |
+getLoggingTag() |
+
HardwareDevice.Manufacturer |
+getManufacturer()
+Returns an indication of the manufacturer of this device.
+ |
+
I2cDeviceSynch.ReadWindow |
+getReadWindow()
+Returns the current register window used for reading.
+ |
+
java.lang.String |
+getUserConfiguredName()
+Returns the human-recognizable name of this device, if same has been set.
+ |
+
int |
+getVersion()
+Version
+ |
+
protected I2cDeviceSynchImpl.WRITE_CACHE_STATUS |
+getWriteCacheStatus() |
+
protected void |
+gracefullyDrainReadersAndWriters() |
+
protected void |
+hook() |
+
protected void |
+initWriteCacheStatus(I2cDeviceSynchImpl.WRITE_CACHE_STATUS status) |
+
boolean |
+isArmed()
+Returns whether, as of this instant, this device client is alive and operational in
+ its normally expected mode; that is, whether it is currently in communication
+ with its underlying hardware or whether it is in some other state.
+ |
+
boolean |
+isEngaged()
+Returns whether the object is currently in the engaged state.
+ |
+
protected boolean |
+isOpenForReading() |
+
protected boolean |
+isOpenForWriting() |
+
boolean |
+isWriteCoalescingEnabled()
+Answers as to whether write coalescing is currently enabled on this device.
+ |
+
protected void |
+log(int verbosity,
+ java.lang.String message) |
+
protected void |
+log(int verbosity,
+ java.lang.String format,
+ java.lang.Object... args) |
+
protected boolean |
+newReadsAndWritesAllowed() |
+
byte[] |
+read(int ireg,
+ int creg)
+Read a contiguous set of device I2C registers.
+ |
+
byte |
+read8(int ireg)
+Read the byte at the indicated register.
+ |
+
protected boolean |
+readCacheIsValid() |
+
protected boolean |
+readCacheValidityCurrentOrImminent() |
+
TimestampedData |
+readTimeStamped(int ireg,
+ int creg)
+Reads and returns a contiguous set of device I2C registers, together with a best-available
+ timestamp of when the actual I2C read occurred.
+ |
+
TimestampedData |
+readTimeStamped(int ireg,
+ int creg,
+ I2cDeviceSynch.ReadWindow readWindowNeeded,
+ I2cDeviceSynch.ReadWindow readWindowSet)
+Advanced: Atomically calls ensureReadWindow() with the last two parameters and then
+ readTimeStamped() with the first two without the possibility of a concurrent client
+ interrupting in the middle.
+ |
+
protected byte[] |
+readWriteCache() |
+
protected void |
+releaseReaderLockShared() |
+
void |
+resetDeviceConfigurationForOpMode()
+Resets the device's configuration to that which is expected at the beginning of an OpMode.
+ |
+
void |
+setHealthStatus(HardwareDeviceHealth.HealthStatus status) |
+
void |
+setHeartbeatAction(I2cDeviceSynch.HeartbeatAction action)
+Sets the action to take when the current heartbeat interval expires.
+ |
+
void |
+setHeartbeatInterval(int msHeartbeatInterval)
+Sets the interval within which communication must be received by the I2C device lest
+ a timeout may occur.
+ |
+
void |
+setI2cAddr(I2cAddr newAddress)
+Deprecated.
+ |
+
void |
+setI2cAddress(I2cAddr i2cAddr)
+Configures a new I2C address to use
+ |
+
void |
+setLogging(boolean enabled)
+Turn logging on or off.
+ |
+
void |
+setLoggingTag(java.lang.String loggingTag)
+Set the tag to use when logging is on.
+ |
+
void |
+setReadWindow(I2cDeviceSynch.ReadWindow newWindow)
+Set the set of registers that we will read and read and read again on every hardware cycle
+ |
+
protected void |
+setReadWindowInternal(I2cDeviceSynch.ReadWindow newWindow) |
+
void |
+setUserConfiguredName(java.lang.String name)
+Informs the device of a name by which it would be recognized by the user.
+ |
+
protected void |
+setWriteCacheStatus(I2cDeviceSynchImpl.WRITE_CACHE_STATUS status) |
+
protected void |
+unhook() |
+
protected long |
+waitForIdleWriteCache() |
+
protected void |
+waitForValidReadCache() |
+
protected void |
+waitForWriteCompletionInternal(I2cWaitControl writeControl) |
+
void |
+waitForWriteCompletions(I2cWaitControl waitControl)
+Waits for the most recent write to complete according to the behavior specified in writeControl.
+ |
+
void |
+write(int ireg,
+ byte[] data)
+Writes data to a set of registers, beginning with the one indicated, using
+
+I2cWaitControl.ATOMIC semantics. |
+
void |
+write(int ireg,
+ byte[] data,
+ I2cWaitControl waitControl)
+Writes data to a set of registers, beginning with the one indicated.
+ |
+
void |
+write8(int ireg,
+ int data)
+Writes a byte to the indicated register using
+I2cWaitControl.ATOMIC semantics. |
+
void |
+write8(int ireg,
+ int data,
+ I2cWaitControl waitControl)
+Writes a byte to the indicated register.
+ |
+
addToHistoryQueue, getHistoryQueue, getHistoryQueueCapacity, setHistoryQueueCapacity
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected I2cAddr i2cAddr+
protected I2cDevice i2cDevice+
protected boolean isI2cDeviceOwned+
protected I2cController controller+
protected boolean isControllerLegacy+
protected HardwareDeviceHealthImpl hardwareDeviceHealth+
protected RobotUsbModule robotUsbModule+
protected boolean isHooked+
protected boolean isEngaged+
protected java.util.concurrent.atomic.AtomicInteger readerWriterPreventionCount+
protected java.util.concurrent.locks.ReadWriteLock readerWriterGate+
protected java.util.concurrent.atomic.AtomicInteger readerWriterCount+
protected boolean isClosing+
protected I2cDeviceSynchImpl.Callback callback+
protected boolean loggingEnabled+
protected java.lang.String loggingTag+
protected java.lang.String name+
protected ElapsedTime timeSinceLastHeartbeat+
protected TimeWindow readCacheTimeWindow+
protected byte[] readCache+
protected byte[] writeCache+
protected static final int dibCacheOverhead+
protected java.util.concurrent.locks.Lock readCacheLock+
protected java.util.concurrent.locks.Lock writeCacheLock+
protected static final int msCallbackLockWaitQuantum+
protected static final int msCallbackLockAbandon+
protected boolean isWriteCoalescingEnabled+
protected final java.lang.Object engagementLock+
protected final java.lang.Object concurrentClientLock+
protected final java.lang.Object callbackLock+
protected boolean disableReadWindows+
protected volatile I2cDeviceSynch.ReadWindow readWindow+
protected volatile I2cDeviceSynch.ReadWindow readWindowActuallyRead+
protected volatile I2cDeviceSynch.ReadWindow readWindowSentToController+
protected volatile boolean isReadWindowSentToControllerInitialized+
protected volatile boolean hasReadWindowChanged+
protected volatile long nanoTimeReadCacheValid+
protected volatile I2cDeviceSynchImpl.READ_CACHE_STATUS readCacheStatus+
protected final I2cDeviceSynchImpl.WriteCacheStatus writeCacheStatus+
protected volatile I2cDeviceSynchImpl.CONTROLLER_PORT_MODE controllerPortMode+
protected volatile int iregWriteFirst+
protected volatile int cregWrite+
protected volatile int msHeartbeatInterval+
protected volatile I2cDeviceSynch.HeartbeatAction heartbeatAction+
protected volatile java.util.concurrent.ExecutorService heartbeatExecutor+
public I2cDeviceSynchImpl(I2cDevice i2cDevice, + I2cAddr i2cAddr, + boolean isI2cDeviceOwned)+
I2cDeviceSynchImpl
instance on the indicated I2cDevice
+ using the indicated I2C address.i2cDevice
- the I2cDevice
that the new I2cDeviceSynchImpl
is
+ to be a client ofi2cAddr
- the I2C address to which communications will be targetedisI2cDeviceOwned
- If true, then when this I2cDeviceSynchImpl
closes, the
+ underlying I2cDevice
is closed as well; otherwise, it is
+ not. Typically, if the provided I2cDevice
is retrieved from
+ an OpMode's hardware map, one passes false to isI2cDeviceOwned
,
+ as such @link I2cDevice}s should remain functional across multiple
+ OpMode invocations.HardwareDevice.close()
,
+HardwareDevice.close()
public I2cDeviceSynchImpl(I2cDevice i2cDevice, + boolean isI2cDeviceOwned)+
I2cDeviceSynchImpl
instance on the indicated I2cDevice
.
+ When this constructor is used, setI2cAddress(I2cAddr)
must be called later in order
+ for the instance to be functional.I2cDeviceSynchImpl(I2cDevice, I2cAddr, boolean)
@Deprecated +public void setI2cAddr(I2cAddr newAddress)+
I2cDeviceSynchSimple
setI2cAddr
in interface I2cDeviceSynchSimple
newAddress
- the new I2C addresspublic void setI2cAddress(I2cAddr i2cAddr)+
I2cAddrConfig
setI2cAddress
in interface I2cAddrConfig
i2cAddr
- the new I2C address to usepublic I2cAddr getI2cAddress()+
I2cAddressableDevice
getI2cAddress
in interface I2cAddressableDevice
@Deprecated +public I2cAddr getI2cAddr()+
I2cDeviceSynchSimple
getI2cAddr
in interface I2cDeviceSynchSimple
public void engage()+
Engagable
protected void hook()+
protected void adjustHooking()+
public boolean isEngaged()+
Engagable
public boolean isArmed()+
I2cDeviceSynchSimple
isArmed
in interface I2cDeviceSynchSimple
Engagable.engage()
public void disengage()+
Engagable
protected void unhook()+
protected void disableReadsAndWrites()+
protected void enableReadsAndWrites()+
protected boolean newReadsAndWritesAllowed()+
protected void gracefullyDrainReadersAndWriters()+
protected void forceDrainReadersAndWriters()+
public HardwareDevice.Manufacturer getManufacturer()+
HardwareDevice
getManufacturer
in interface HardwareDevice
public java.lang.String getDeviceName()+
HardwareDevice
getDeviceName
in interface HardwareDevice
public java.lang.String getConnectionInfo()+
HardwareDevice
getConnectionInfo
in interface HardwareDevice
public int getVersion()+
HardwareDevice
getVersion
in interface HardwareDevice
public void resetDeviceConfigurationForOpMode()+
HardwareDevice
resetDeviceConfigurationForOpMode
in interface HardwareDevice
public void close()+
HardwareDevice
close
in interface HardwareDevice
public void setHealthStatus(HardwareDeviceHealth.HealthStatus status)+
setHealthStatus
in interface HardwareDeviceHealth
public HardwareDeviceHealth.HealthStatus getHealthStatus()+
getHealthStatus
in interface HardwareDeviceHealth
public void setReadWindow(I2cDeviceSynch.ReadWindow newWindow)+
I2cDeviceSynch
setReadWindow
in interface I2cDeviceSynch
newWindow
- the register window to read. May be null, indicating that no reads are to occur.I2cDeviceSynch.getReadWindow()
protected void setReadWindowInternal(I2cDeviceSynch.ReadWindow newWindow)+
protected void assignReadWindow(I2cDeviceSynch.ReadWindow newWindow)+
public I2cDeviceSynch.ReadWindow getReadWindow()+
I2cDeviceSynch
getReadWindow
in interface I2cDeviceSynch
I2cDeviceSynch.setReadWindow(ReadWindow)
public void ensureReadWindow(I2cDeviceSynch.ReadWindow windowNeeded, + I2cDeviceSynch.ReadWindow windowToSet)+
I2cDeviceSynch
ensureReadWindow
in interface I2cDeviceSynch
windowNeeded
- Test the current register window, if any, against this window
+ to see if an update to the current register window is needed in
+ order to cover it. May be null, indicating that an update to the
+ current register window is always neededwindowToSet
- If an update to the current register window is needed, then this
+ is the window to which it will be set. May be null.I2cDeviceSynch.setReadWindow(ReadWindow)
,
+I2cDeviceSynchSimple.read8(int)
public byte read8(int ireg)+
I2cDeviceSynchSimple
I2cDeviceSynchSimple.readTimeStamped(int, int)
for a
+ complete description.read8
in interface I2cDeviceSynchSimple
ireg
- the register number to readI2cDeviceSynchSimple.read(int, int)
,
+I2cDeviceSynchSimple.readTimeStamped(int, int)
,
+I2cDeviceSynch.ensureReadWindow(I2cDeviceSynch.ReadWindow, I2cDeviceSynch.ReadWindow)
public byte[] read(int ireg, + int creg)+
I2cDeviceSynchSimple
I2cDeviceSynchSimple.readTimeStamped(int, int)
for a
+ complete description.read
in interface I2cDeviceSynchSimple
ireg
- the register number of the first byte register to readcreg
- the number of bytes / registers to readI2cDeviceSynchSimple.read8(int)
,
+I2cDeviceSynchSimple.readTimeStamped(int, int)
,
+I2cDeviceSynch.ensureReadWindow(I2cDeviceSynch.ReadWindow, I2cDeviceSynch.ReadWindow)
public TimestampedData readTimeStamped(int ireg, + int creg)+
I2cDeviceSynchSimple
You can always just call this method without worrying at all about
+ read windows
,
+ that will work, but usually it is more efficient to take some thought and care as to what set
+ of registers the I2C device controller is being set up to read, as adjusting that window
+ of registers incurs significant extra time.
If the current read window can't be used to read the requested registers, then
+ a new read window will automatically be created as follows. If the current read window is non
+ null and wholly contains the registers to read but can't be read because it is a used-up
+ ReadMode#ONLY_ONCE
window,
+ a new read fresh window will be created with the same set of registers. Otherwise, a
+ window that exactly covers the requested set of registers will be created.
readTimeStamped
in interface I2cDeviceSynchSimple
ireg
- the register number of the first byte register to readcreg
- the number of bytes / registers to readI2cDeviceSynchSimple.read(int, int)
,
+I2cDeviceSynchSimple.read8(int)
,
+I2cDeviceSynch.ensureReadWindow(I2cDeviceSynch.ReadWindow, I2cDeviceSynch.ReadWindow)
protected boolean isOpenForReading()+
protected boolean isOpenForWriting()+
protected void acquireReaderLockShared() + throws java.lang.InterruptedException+
java.lang.InterruptedException
protected void releaseReaderLockShared()+
public TimestampedData readTimeStamped(int ireg, + int creg, + I2cDeviceSynch.ReadWindow readWindowNeeded, + I2cDeviceSynch.ReadWindow readWindowSet)+
I2cDeviceSynch
readTimeStamped
in interface I2cDeviceSynch
ireg
- the register number of the first byte register to readcreg
- the number of bytes / registers to readreadWindowNeeded
- the read window we requirereadWindowSet
- the read window to set if the required read window is not currentI2cDeviceSynch.ensureReadWindow(ReadWindow, ReadWindow)
,
+I2cDeviceSynchSimple.readTimeStamped(int, int)
protected boolean readCacheValidityCurrentOrImminent()+
protected boolean readCacheIsValid()+
public void write8(int ireg, + int data)+
I2cDeviceSynchSimple
I2cWaitControl.ATOMIC
semantics.write8
in interface I2cDeviceSynchSimple
ireg
- the register number that is to be writtendata
- the byte which is to be written to that registerI2cDeviceSynchSimple.write(int, byte[], I2cWaitControl)
public void write8(int ireg, + int data, + I2cWaitControl waitControl)+
I2cDeviceSynchSimple
I2cDeviceSynchSimple.write(int, byte[], I2cWaitControl)
.write8
in interface I2cDeviceSynchSimple
ireg
- the register number that is to be writtendata
- the byte which is to be written to that registerwaitControl
- controls the behavior of waiting for the completion of the writeI2cDeviceSynchSimple.write(int, byte[], I2cWaitControl)
public void write(int ireg, + byte[] data)+
I2cDeviceSynchSimple
I2cWaitControl.ATOMIC
semantics.write
in interface I2cDeviceSynchSimple
ireg
- the first of the registers which is to be writtendata
- the data which is to be written to the registersI2cDeviceSynchSimple.write(int, byte[], I2cWaitControl)
public void write(int ireg, + byte[] data, + I2cWaitControl waitControl)+
I2cDeviceSynchSimple
write
in interface I2cDeviceSynchSimple
ireg
- the first of the registers which is to be writtendata
- the data which is to be written to the registerswaitControl
- controls the behavior of waiting for the completion of the writeprotected static byte[] concatenateByteArrays(byte[] left, + byte[] right)+
public void waitForWriteCompletions(I2cWaitControl waitControl)+
I2cDeviceSynchSimple
waitForWriteCompletions
in interface I2cDeviceSynchSimple
waitControl
- controls the behavior of waiting for the completion of the write
+ Note that a value of I2cWaitControl.NONE
is essentially a no-op.protected byte[] readWriteCache()+
protected void waitForWriteCompletionInternal(I2cWaitControl writeControl) + throws java.lang.InterruptedException+
java.lang.InterruptedException
protected void setWriteCacheStatus(I2cDeviceSynchImpl.WRITE_CACHE_STATUS status)+
protected I2cDeviceSynchImpl.WRITE_CACHE_STATUS getWriteCacheStatus()+
protected void initWriteCacheStatus(I2cDeviceSynchImpl.WRITE_CACHE_STATUS status)+
protected long waitForIdleWriteCache() + throws java.lang.InterruptedException+
java.lang.InterruptedException
protected void waitForValidReadCache() + throws java.lang.InterruptedException+
java.lang.InterruptedException
I2cDeviceSynchImpl.WriteCacheStatus.waitForIdle()
public void enableWriteCoalescing(boolean enable)+
I2cDeviceSynchSimple
enableWriteCoalescing
in interface I2cDeviceSynchSimple
enable
- whether to enable write coalescing or notI2cDeviceSynchSimple.isWriteCoalescingEnabled()
public boolean isWriteCoalescingEnabled()+
I2cDeviceSynchSimple
isWriteCoalescingEnabled
in interface I2cDeviceSynchSimple
I2cDeviceSynchSimple.enableWriteCoalescing(boolean)
public void setUserConfiguredName(java.lang.String name)+
RobotConfigNameable
setUserConfiguredName
in interface RobotConfigNameable
public java.lang.String getUserConfiguredName()+
RobotConfigNameable
getUserConfiguredName
in interface RobotConfigNameable
RobotConfigNameable.setUserConfiguredName(String)
public void setLogging(boolean enabled)+
I2cDeviceSynchSimple
setLogging
in interface I2cDeviceSynchSimple
enabled
- whether to enable logging or notpublic boolean getLogging()+
getLogging
in interface I2cDeviceSynchSimple
I2cDeviceSynchSimple.setLogging(boolean)
public void setLoggingTag(java.lang.String loggingTag)+
I2cDeviceSynchSimple
setLoggingTag
in interface I2cDeviceSynchSimple
loggingTag
- the logging tag to suepublic java.lang.String getLoggingTag()+
getLoggingTag
in interface I2cDeviceSynchSimple
I2cDeviceSynchSimple.setLoggingTag(String)
public int getHeartbeatInterval()+
I2cDeviceSynch
getHeartbeatInterval
in interface I2cDeviceSynch
I2cDeviceSynch.setHeartbeatInterval(int)
public void setHeartbeatInterval(int msHeartbeatInterval)+
I2cDeviceSynch
setHeartbeatInterval
in interface I2cDeviceSynch
msHeartbeatInterval
- the new hearbeat interval, in millisecondsI2cDeviceSynch.getHeartbeatInterval()
public void setHeartbeatAction(I2cDeviceSynch.HeartbeatAction action)+
I2cDeviceSynch
setHeartbeatAction
in interface I2cDeviceSynch
action
- the action to take at each heartbeat.I2cDeviceSynch.getHeartbeatAction()
,
+I2cDeviceSynch.setHeartbeatInterval(int)
public I2cDeviceSynch.HeartbeatAction getHeartbeatAction()+
I2cDeviceSynch
getHeartbeatAction
in interface I2cDeviceSynch
I2cDeviceSynch.setHeartbeatAction(HeartbeatAction)
protected void log(int verbosity, + java.lang.String message)+
protected void log(int verbosity, + java.lang.String format, + java.lang.Object... args)+
public class I2cDeviceSynchImplOnSimple +extends I2cDeviceSynchReadHistoryImpl +implements I2cDeviceSynch+
I2cDeviceSynch.HeartbeatAction, I2cDeviceSynch.ReadMode, I2cDeviceSynch.ReadWindow
HardwareDeviceHealth.HealthStatus
HardwareDevice.Manufacturer
Modifier and Type | +Field and Description | +
---|---|
protected java.lang.Object |
+concurrentClientLock |
+
protected int |
+cregReadLast |
+
protected java.lang.Object |
+engagementLock |
+
protected I2cDeviceSynch.HeartbeatAction |
+heartbeatAction |
+
protected java.util.concurrent.ScheduledExecutorService |
+heartbeatExecutor |
+
protected I2cDeviceSynchSimple |
+i2cDeviceSynchSimple |
+
protected I2cDeviceSynchReadHistory |
+i2cDeviceSynchSimpleHistory |
+
protected int |
+iregReadLast |
+
protected int |
+iregWriteLast |
+
protected boolean |
+isClosing |
+
protected boolean |
+isEngaged |
+
protected boolean |
+isHooked |
+
protected boolean |
+isSimpleOwned |
+
protected int |
+msHeartbeatInterval |
+
protected I2cDeviceSynch.ReadWindow |
+readWindow |
+
protected byte[] |
+rgbWriteLast |
+
historyQueue, historyQueueCapacity, historyQueueLock
Constructor and Description | +
---|
I2cDeviceSynchImplOnSimple(I2cDeviceSynchSimple simple,
+ boolean isSimpleOwned) |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+addToHistoryQueue(TimestampedI2cData data) |
+
protected void |
+adjustHooking() |
+
void |
+close()
+Closes this device
+ |
+
void |
+disengage()
+Disengage the object from underlying services it uses to render its function.
+ |
+
void |
+enableWriteCoalescing(boolean enable)
+Enables or disables an optimization wherein writes to two sets of adjacent register
+ ranges may be coalesced into a single I2c transaction if the second write comes along
+ while the first is still queued for writing.
+ |
+
void |
+engage()
+(Re)enage the object with its underlying services.
+ |
+
void |
+ensureReadWindow(I2cDeviceSynch.ReadWindow windowNeeded,
+ I2cDeviceSynch.ReadWindow windowToSet)
+Ensure that the current register window covers the indicated set of registers.
+ |
+
java.lang.String |
+getConnectionInfo()
+Get connection information about this device in a human readable format
+ |
+
java.lang.String |
+getDeviceName()
+Returns a string suitable for display to the user as to the type of device.
+ |
+
HardwareDeviceHealth.HealthStatus |
+getHealthStatus() |
+
I2cDeviceSynch.HeartbeatAction |
+getHeartbeatAction()
+Returns the current action, if any, to take upon expiration of the heartbeat interval.
+ |
+
int |
+getHeartbeatInterval()
+Returns the interval within which communication must be received by the I2C device lest
+ a timeout occur.
+ |
+
java.util.concurrent.BlockingQueue<TimestampedI2cData> |
+getHistoryQueue()
+(Advanced) Returns a queue into which, if requested,
+TimestampedI2cData s are (optionally)
+ placed as they become available. |
+
int |
+getHistoryQueueCapacity()
+Returns the current capacity of the history queue.
+ |
+
I2cAddr |
+getI2cAddr()
+Returns the I2C address currently being used by this device client
+ |
+
I2cAddr |
+getI2cAddress()
+Returns the I2C address currently in use to communicate with an I2C hardware device
+ |
+
boolean |
+getLogging() |
+
java.lang.String |
+getLoggingTag() |
+
HardwareDevice.Manufacturer |
+getManufacturer()
+Returns an indication of the manufacturer of this device.
+ |
+
I2cDeviceSynch.ReadWindow |
+getReadWindow()
+Returns the current register window used for reading.
+ |
+
java.lang.String |
+getUserConfiguredName()
+Returns the human-recognizable name of this device, if same has been set.
+ |
+
int |
+getVersion()
+Version
+ |
+
protected void |
+hook() |
+
boolean |
+isArmed()
+Returns whether, as of this instant, this device client is alive and operational in
+ its normally expected mode; that is, whether it is currently in communication
+ with its underlying hardware or whether it is in some other state.
+ |
+
boolean |
+isEngaged()
+Returns whether the object is currently in the engaged state.
+ |
+
protected boolean |
+isOpenForReading() |
+
protected boolean |
+isOpenForWriting() |
+
boolean |
+isWriteCoalescingEnabled()
+Answers as to whether write coalescing is currently enabled on this device.
+ |
+
protected boolean |
+newReadsAndWritesAllowed() |
+
byte[] |
+read(int ireg,
+ int creg)
+Read a contiguous set of device I2C registers.
+ |
+
byte |
+read8(int ireg)
+Read the byte at the indicated register.
+ |
+
TimestampedData |
+readTimeStamped(int ireg,
+ int creg)
+Reads and returns a contiguous set of device I2C registers, together with a best-available
+ timestamp of when the actual I2C read occurred.
+ |
+
TimestampedData |
+readTimeStamped(int ireg,
+ int creg,
+ I2cDeviceSynch.ReadWindow readWindowNeeded,
+ I2cDeviceSynch.ReadWindow readWindowSet)
+Advanced: Atomically calls ensureReadWindow() with the last two parameters and then
+ readTimeStamped() with the first two without the possibility of a concurrent client
+ interrupting in the middle.
+ |
+
void |
+resetDeviceConfigurationForOpMode()
+Resets the device's configuration to that which is expected at the beginning of an OpMode.
+ |
+
void |
+setHealthStatus(HardwareDeviceHealth.HealthStatus status) |
+
void |
+setHeartbeatAction(I2cDeviceSynch.HeartbeatAction action)
+Sets the action to take when the current heartbeat interval expires.
+ |
+
void |
+setHeartbeatInterval(int ms)
+Sets the interval within which communication must be received by the I2C device lest
+ a timeout may occur.
+ |
+
void |
+setHistoryQueueCapacity(int capacity)
+Sets the maximum number of
+TimestampedI2cData s that will simultaneously be stored in the
+ history queue. |
+
void |
+setI2cAddr(I2cAddr i2cAddr)
+Sets the I2C address of the underlying client.
+ |
+
void |
+setI2cAddress(I2cAddr newAddress)
+Configures a new I2C address to use
+ |
+
void |
+setLogging(boolean enabled)
+Turn logging on or off.
+ |
+
void |
+setLoggingTag(java.lang.String loggingTag)
+Set the tag to use when logging is on.
+ |
+
void |
+setReadWindow(I2cDeviceSynch.ReadWindow window)
+Set the set of registers that we will read and read and read again on every hardware cycle
+ |
+
void |
+setUserConfiguredName(java.lang.String name)
+Informs the device of a name by which it would be recognized by the user.
+ |
+
protected void |
+unhook() |
+
void |
+waitForWriteCompletions(I2cWaitControl waitControl)
+Waits for the most recent write to complete according to the behavior specified in writeControl.
+ |
+
void |
+write(int ireg,
+ byte[] data)
+Writes data to a set of registers, beginning with the one indicated, using
+
+I2cWaitControl.ATOMIC semantics. |
+
void |
+write(int ireg,
+ byte[] data,
+ I2cWaitControl waitControl)
+Writes data to a set of registers, beginning with the one indicated.
+ |
+
void |
+write8(int ireg,
+ int bVal)
+Writes a byte to the indicated register using
+I2cWaitControl.ATOMIC semantics. |
+
void |
+write8(int ireg,
+ int bVal,
+ I2cWaitControl waitControl)
+Writes a byte to the indicated register.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected I2cDeviceSynchSimple i2cDeviceSynchSimple+
protected I2cDeviceSynchReadHistory i2cDeviceSynchSimpleHistory+
protected boolean isSimpleOwned+
protected I2cDeviceSynch.ReadWindow readWindow+
protected int iregReadLast+
protected int cregReadLast+
protected int iregWriteLast+
protected byte[] rgbWriteLast+
protected boolean isHooked+
protected boolean isEngaged+
protected boolean isClosing+
protected int msHeartbeatInterval+
protected I2cDeviceSynch.HeartbeatAction heartbeatAction+
protected java.util.concurrent.ScheduledExecutorService heartbeatExecutor+
protected final java.lang.Object engagementLock+
protected final java.lang.Object concurrentClientLock+
public I2cDeviceSynchImplOnSimple(I2cDeviceSynchSimple simple, + boolean isSimpleOwned)+
public void setUserConfiguredName(java.lang.String name)+
RobotConfigNameable
setUserConfiguredName
in interface RobotConfigNameable
public java.lang.String getUserConfiguredName()+
RobotConfigNameable
getUserConfiguredName
in interface RobotConfigNameable
RobotConfigNameable.setUserConfiguredName(String)
public void setLogging(boolean enabled)+
I2cDeviceSynchSimple
setLogging
in interface I2cDeviceSynchSimple
enabled
- whether to enable logging or notpublic boolean getLogging()+
getLogging
in interface I2cDeviceSynchSimple
I2cDeviceSynchSimple.setLogging(boolean)
public void setLoggingTag(java.lang.String loggingTag)+
I2cDeviceSynchSimple
setLoggingTag
in interface I2cDeviceSynchSimple
loggingTag
- the logging tag to suepublic java.lang.String getLoggingTag()+
getLoggingTag
in interface I2cDeviceSynchSimple
I2cDeviceSynchSimple.setLoggingTag(String)
public void engage()+
Engagable
protected void hook()+
protected void adjustHooking()+
public boolean isEngaged()+
Engagable
public boolean isArmed()+
I2cDeviceSynchSimple
isArmed
in interface I2cDeviceSynchSimple
Engagable.engage()
public void disengage()+
Engagable
protected void unhook()+
public void setHeartbeatInterval(int ms)+
I2cDeviceSynch
setHeartbeatInterval
in interface I2cDeviceSynch
ms
- the new hearbeat interval, in millisecondsI2cDeviceSynch.getHeartbeatInterval()
public int getHeartbeatInterval()+
I2cDeviceSynch
getHeartbeatInterval
in interface I2cDeviceSynch
I2cDeviceSynch.setHeartbeatInterval(int)
public void setHeartbeatAction(I2cDeviceSynch.HeartbeatAction action)+
I2cDeviceSynch
setHeartbeatAction
in interface I2cDeviceSynch
action
- the action to take at each heartbeat.I2cDeviceSynch.getHeartbeatAction()
,
+I2cDeviceSynch.setHeartbeatInterval(int)
public I2cDeviceSynch.HeartbeatAction getHeartbeatAction()+
I2cDeviceSynch
getHeartbeatAction
in interface I2cDeviceSynch
I2cDeviceSynch.setHeartbeatAction(HeartbeatAction)
public void setReadWindow(I2cDeviceSynch.ReadWindow window)+
I2cDeviceSynch
setReadWindow
in interface I2cDeviceSynch
window
- the register window to read. May be null, indicating that no reads are to occur.I2cDeviceSynch.getReadWindow()
public I2cDeviceSynch.ReadWindow getReadWindow()+
I2cDeviceSynch
getReadWindow
in interface I2cDeviceSynch
I2cDeviceSynch.setReadWindow(ReadWindow)
public void ensureReadWindow(I2cDeviceSynch.ReadWindow windowNeeded, + I2cDeviceSynch.ReadWindow windowToSet)+
I2cDeviceSynch
ensureReadWindow
in interface I2cDeviceSynch
windowNeeded
- Test the current register window, if any, against this window
+ to see if an update to the current register window is needed in
+ order to cover it. May be null, indicating that an update to the
+ current register window is always neededwindowToSet
- If an update to the current register window is needed, then this
+ is the window to which it will be set. May be null.I2cDeviceSynch.setReadWindow(ReadWindow)
,
+I2cDeviceSynchSimple.read8(int)
public TimestampedData readTimeStamped(int ireg, + int creg, + I2cDeviceSynch.ReadWindow readWindowNeeded, + I2cDeviceSynch.ReadWindow readWindowSet)+
I2cDeviceSynch
readTimeStamped
in interface I2cDeviceSynch
ireg
- the register number of the first byte register to readcreg
- the number of bytes / registers to readreadWindowNeeded
- the read window we requirereadWindowSet
- the read window to set if the required read window is not currentI2cDeviceSynch.ensureReadWindow(ReadWindow, ReadWindow)
,
+I2cDeviceSynchSimple.readTimeStamped(int, int)
public HardwareDevice.Manufacturer getManufacturer()+
HardwareDevice
getManufacturer
in interface HardwareDevice
public java.lang.String getDeviceName()+
HardwareDevice
getDeviceName
in interface HardwareDevice
public java.lang.String getConnectionInfo()+
HardwareDevice
getConnectionInfo
in interface HardwareDevice
public int getVersion()+
HardwareDevice
getVersion
in interface HardwareDevice
public void resetDeviceConfigurationForOpMode()+
HardwareDevice
resetDeviceConfigurationForOpMode
in interface HardwareDevice
public void close()+
HardwareDevice
close
in interface HardwareDevice
public void setHealthStatus(HardwareDeviceHealth.HealthStatus status)+
setHealthStatus
in interface HardwareDeviceHealth
public HardwareDeviceHealth.HealthStatus getHealthStatus()+
getHealthStatus
in interface HardwareDeviceHealth
public java.util.concurrent.BlockingQueue<TimestampedI2cData> getHistoryQueue()+
I2cDeviceSynchReadHistory
TimestampedI2cData
s are (optionally)
+ placed as they become available.
+
+ To access these TimestampedI2cData
s, call I2cDeviceSynchReadHistory.setHistoryQueueCapacity(int)
to enable
+ the history queue. Once enabled, the history queue can be accessed using I2cDeviceSynchReadHistory.getHistoryQueue()
+ and the methods thereon used to access TimestampedI2cData
s as they become available.
When I2cDeviceSynchReadHistory.setHistoryQueueCapacity(int)
is called, any history queue returned previously by
+ I2cDeviceSynchReadHistory.getHistoryQueue()
becomes invalid and must be re-fetched.
getHistoryQueue
in interface I2cDeviceSynchReadHistory
getHistoryQueue
in class I2cDeviceSynchReadHistoryImpl
TimestampedI2cData
s may be retrieved.I2cDeviceSynchReadHistory.setHistoryQueueCapacity(int)
public void setHistoryQueueCapacity(int capacity)+
I2cDeviceSynchReadHistory
TimestampedI2cData
s that will simultaneously be stored in the
+ history queue. If the queue is full and new TimestampedI2cData
s become available, older
+ data will be discarded. The history queue initially has a capacity of zero.
+
+ Note that calling this method invalidates any history queue retrieved previously
+ through I2cDeviceSynchReadHistory.getHistoryQueue()
.
setHistoryQueueCapacity
in interface I2cDeviceSynchReadHistory
setHistoryQueueCapacity
in class I2cDeviceSynchReadHistoryImpl
capacity
- the maximum number of items that may be stored in the history queueI2cDeviceSynchReadHistory.getHistoryQueue()
,
+I2cDeviceSynchReadHistory.getHistoryQueueCapacity()
public int getHistoryQueueCapacity()+
I2cDeviceSynchReadHistory
getHistoryQueueCapacity
in interface I2cDeviceSynchReadHistory
getHistoryQueueCapacity
in class I2cDeviceSynchReadHistoryImpl
I2cDeviceSynchReadHistory.setHistoryQueueCapacity(int)
,
+I2cDeviceSynchReadHistory.getHistoryQueue()
public void addToHistoryQueue(TimestampedI2cData data)+
addToHistoryQueue
in class I2cDeviceSynchReadHistoryImpl
protected boolean isOpenForReading()+
protected boolean isOpenForWriting()+
protected boolean newReadsAndWritesAllowed()+
public void setI2cAddress(I2cAddr newAddress)+
I2cAddrConfig
setI2cAddress
in interface I2cAddrConfig
newAddress
- the new I2C address to usepublic I2cAddr getI2cAddress()+
I2cAddressableDevice
getI2cAddress
in interface I2cAddressableDevice
public void setI2cAddr(I2cAddr i2cAddr)+
I2cDeviceSynchSimple
setI2cAddr
in interface I2cDeviceSynchSimple
i2cAddr
- the new I2C addresspublic I2cAddr getI2cAddr()+
I2cDeviceSynchSimple
getI2cAddr
in interface I2cDeviceSynchSimple
public byte read8(int ireg)+
I2cDeviceSynchSimple
I2cDeviceSynchSimple.readTimeStamped(int, int)
for a
+ complete description.read8
in interface I2cDeviceSynchSimple
ireg
- the register number to readI2cDeviceSynchSimple.read(int, int)
,
+I2cDeviceSynchSimple.readTimeStamped(int, int)
,
+I2cDeviceSynch.ensureReadWindow(I2cDeviceSynch.ReadWindow, I2cDeviceSynch.ReadWindow)
public byte[] read(int ireg, + int creg)+
I2cDeviceSynchSimple
I2cDeviceSynchSimple.readTimeStamped(int, int)
for a
+ complete description.read
in interface I2cDeviceSynchSimple
ireg
- the register number of the first byte register to readcreg
- the number of bytes / registers to readI2cDeviceSynchSimple.read8(int)
,
+I2cDeviceSynchSimple.readTimeStamped(int, int)
,
+I2cDeviceSynch.ensureReadWindow(I2cDeviceSynch.ReadWindow, I2cDeviceSynch.ReadWindow)
public TimestampedData readTimeStamped(int ireg, + int creg)+
I2cDeviceSynchSimple
You can always just call this method without worrying at all about
+ read windows
,
+ that will work, but usually it is more efficient to take some thought and care as to what set
+ of registers the I2C device controller is being set up to read, as adjusting that window
+ of registers incurs significant extra time.
If the current read window can't be used to read the requested registers, then
+ a new read window will automatically be created as follows. If the current read window is non
+ null and wholly contains the registers to read but can't be read because it is a used-up
+ ReadMode#ONLY_ONCE
window,
+ a new read fresh window will be created with the same set of registers. Otherwise, a
+ window that exactly covers the requested set of registers will be created.
readTimeStamped
in interface I2cDeviceSynchSimple
ireg
- the register number of the first byte register to readcreg
- the number of bytes / registers to readI2cDeviceSynchSimple.read(int, int)
,
+I2cDeviceSynchSimple.read8(int)
,
+I2cDeviceSynch.ensureReadWindow(I2cDeviceSynch.ReadWindow, I2cDeviceSynch.ReadWindow)
public void write8(int ireg, + int bVal)+
I2cDeviceSynchSimple
I2cWaitControl.ATOMIC
semantics.write8
in interface I2cDeviceSynchSimple
ireg
- the register number that is to be writtenbVal
- the byte which is to be written to that registerI2cDeviceSynchSimple.write(int, byte[], I2cWaitControl)
public void write8(int ireg, + int bVal, + I2cWaitControl waitControl)+
I2cDeviceSynchSimple
I2cDeviceSynchSimple.write(int, byte[], I2cWaitControl)
.write8
in interface I2cDeviceSynchSimple
ireg
- the register number that is to be writtenbVal
- the byte which is to be written to that registerwaitControl
- controls the behavior of waiting for the completion of the writeI2cDeviceSynchSimple.write(int, byte[], I2cWaitControl)
public void write(int ireg, + byte[] data)+
I2cDeviceSynchSimple
I2cWaitControl.ATOMIC
semantics.write
in interface I2cDeviceSynchSimple
ireg
- the first of the registers which is to be writtendata
- the data which is to be written to the registersI2cDeviceSynchSimple.write(int, byte[], I2cWaitControl)
public void write(int ireg, + byte[] data, + I2cWaitControl waitControl)+
I2cDeviceSynchSimple
write
in interface I2cDeviceSynchSimple
ireg
- the first of the registers which is to be writtendata
- the data which is to be written to the registerswaitControl
- controls the behavior of waiting for the completion of the writepublic void waitForWriteCompletions(I2cWaitControl waitControl)+
I2cDeviceSynchSimple
waitForWriteCompletions
in interface I2cDeviceSynchSimple
waitControl
- controls the behavior of waiting for the completion of the write
+ Note that a value of I2cWaitControl.NONE
is essentially a no-op.public void enableWriteCoalescing(boolean enable)+
I2cDeviceSynchSimple
enableWriteCoalescing
in interface I2cDeviceSynchSimple
enable
- whether to enable write coalescing or notI2cDeviceSynchSimple.isWriteCoalescingEnabled()
public boolean isWriteCoalescingEnabled()+
I2cDeviceSynchSimple
isWriteCoalescingEnabled
in interface I2cDeviceSynchSimple
I2cDeviceSynchSimple.enableWriteCoalescing(boolean)
public interface I2cDeviceSynchReadHistory
+I2cDeviceSynchReadHistory
provides a means by which one can be guaranteed
+ to be informed of all data read by through an I2cDeviceSynch
. This is
+ provided by means of a queue into which all data retrieved is (optionally) be stored.
+
+ This functionality can be useful in I2c devices in which the mere act of reading data causes + state transitions in the actual device itself. For such devices, the history queue can (e.g.) + assist the software driver layer for the device in reliably tracking the device state.
+ +Implementations of I2cDeviceSynchReadHistory
are commonly retrieved by casting from
+ an implementation of I2cDeviceSynch
or I2cDeviceSynchSimple
(but don't forget
+ to first test using instanceOf
).
Modifier and Type | +Method and Description | +
---|---|
java.util.concurrent.BlockingQueue<TimestampedI2cData> |
+getHistoryQueue()
+(Advanced) Returns a queue into which, if requested,
+TimestampedI2cData s are (optionally)
+ placed as they become available. |
+
int |
+getHistoryQueueCapacity()
+Returns the current capacity of the history queue.
+ |
+
void |
+setHistoryQueueCapacity(int capacity)
+Sets the maximum number of
+TimestampedI2cData s that will simultaneously be stored in the
+ history queue. |
+
void setHistoryQueueCapacity(int capacity)+
TimestampedI2cData
s that will simultaneously be stored in the
+ history queue. If the queue is full and new TimestampedI2cData
s become available, older
+ data will be discarded. The history queue initially has a capacity of zero.
+
+ Note that calling this method invalidates any history queue retrieved previously
+ through getHistoryQueue()
.
capacity
- the maximum number of items that may be stored in the history queuegetHistoryQueue()
,
+getHistoryQueueCapacity()
int getHistoryQueueCapacity()+
setHistoryQueueCapacity(int)
,
+getHistoryQueue()
java.util.concurrent.BlockingQueue<TimestampedI2cData> getHistoryQueue()+
TimestampedI2cData
s are (optionally)
+ placed as they become available.
+
+ To access these TimestampedI2cData
s, call setHistoryQueueCapacity(int)
to enable
+ the history queue. Once enabled, the history queue can be accessed using getHistoryQueue()
+ and the methods thereon used to access TimestampedI2cData
s as they become available.
When setHistoryQueueCapacity(int)
is called, any history queue returned previously by
+ getHistoryQueue()
becomes invalid and must be re-fetched.
TimestampedI2cData
s may be retrieved.setHistoryQueueCapacity(int)
public class I2cDeviceSynchReadHistoryImpl +extends java.lang.Object +implements I2cDeviceSynchReadHistory+
I2cDeviceSynchReadHistoryImpl
is a helper class providing an implementation
+ of the I2c read history queueModifier and Type | +Field and Description | +
---|---|
protected java.util.concurrent.BlockingQueue<TimestampedI2cData> |
+historyQueue |
+
protected int |
+historyQueueCapacity |
+
protected java.lang.Object |
+historyQueueLock |
+
Constructor and Description | +
---|
I2cDeviceSynchReadHistoryImpl() |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+addToHistoryQueue(TimestampedI2cData data) |
+
java.util.concurrent.BlockingQueue<TimestampedI2cData> |
+getHistoryQueue()
+(Advanced) Returns a queue into which, if requested,
+TimestampedI2cData s are (optionally)
+ placed as they become available. |
+
int |
+getHistoryQueueCapacity()
+Returns the current capacity of the history queue.
+ |
+
void |
+setHistoryQueueCapacity(int capacity)
+Sets the maximum number of
+TimestampedI2cData s that will simultaneously be stored in the
+ history queue. |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected final java.lang.Object historyQueueLock+
protected java.util.concurrent.BlockingQueue<TimestampedI2cData> historyQueue+
protected int historyQueueCapacity+
public I2cDeviceSynchReadHistoryImpl()+
public java.util.concurrent.BlockingQueue<TimestampedI2cData> getHistoryQueue()+
I2cDeviceSynchReadHistory
TimestampedI2cData
s are (optionally)
+ placed as they become available.
+
+ To access these TimestampedI2cData
s, call I2cDeviceSynchReadHistory.setHistoryQueueCapacity(int)
to enable
+ the history queue. Once enabled, the history queue can be accessed using I2cDeviceSynchReadHistory.getHistoryQueue()
+ and the methods thereon used to access TimestampedI2cData
s as they become available.
When I2cDeviceSynchReadHistory.setHistoryQueueCapacity(int)
is called, any history queue returned previously by
+ I2cDeviceSynchReadHistory.getHistoryQueue()
becomes invalid and must be re-fetched.
getHistoryQueue
in interface I2cDeviceSynchReadHistory
TimestampedI2cData
s may be retrieved.I2cDeviceSynchReadHistory.setHistoryQueueCapacity(int)
public void setHistoryQueueCapacity(int capacity)+
I2cDeviceSynchReadHistory
TimestampedI2cData
s that will simultaneously be stored in the
+ history queue. If the queue is full and new TimestampedI2cData
s become available, older
+ data will be discarded. The history queue initially has a capacity of zero.
+
+ Note that calling this method invalidates any history queue retrieved previously
+ through I2cDeviceSynchReadHistory.getHistoryQueue()
.
setHistoryQueueCapacity
in interface I2cDeviceSynchReadHistory
capacity
- the maximum number of items that may be stored in the history queueI2cDeviceSynchReadHistory.getHistoryQueue()
,
+I2cDeviceSynchReadHistory.getHistoryQueueCapacity()
public int getHistoryQueueCapacity()+
I2cDeviceSynchReadHistory
getHistoryQueueCapacity
in interface I2cDeviceSynchReadHistory
I2cDeviceSynchReadHistory.setHistoryQueueCapacity(int)
,
+I2cDeviceSynchReadHistory.getHistoryQueue()
public void addToHistoryQueue(TimestampedI2cData data)+
public interface I2cDeviceSynchSimple +extends HardwareDevice, HardwareDeviceHealth, I2cAddrConfig, RobotConfigNameable+
I2cDeviceSynch
,
+I2cDeviceSynchImplOnSimple
HardwareDeviceHealth.HealthStatus
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
void |
+enableWriteCoalescing(boolean enable)
+Enables or disables an optimization wherein writes to two sets of adjacent register
+ ranges may be coalesced into a single I2c transaction if the second write comes along
+ while the first is still queued for writing.
+ |
+
I2cAddr |
+getI2cAddr()
+Deprecated.
+
+Use
+I2cAddressableDevice.getI2cAddress() instead. |
+
boolean |
+getLogging() |
+
java.lang.String |
+getLoggingTag() |
+
boolean |
+isArmed()
+Returns whether, as of this instant, this device client is alive and operational in
+ its normally expected mode; that is, whether it is currently in communication
+ with its underlying hardware or whether it is in some other state.
+ |
+
boolean |
+isWriteCoalescingEnabled()
+Answers as to whether write coalescing is currently enabled on this device.
+ |
+
byte[] |
+read(int ireg,
+ int creg)
+Read a contiguous set of device I2C registers.
+ |
+
byte |
+read8(int ireg)
+Read the byte at the indicated register.
+ |
+
TimestampedData |
+readTimeStamped(int ireg,
+ int creg)
+Reads and returns a contiguous set of device I2C registers, together with a best-available
+ timestamp of when the actual I2C read occurred.
+ |
+
void |
+setI2cAddr(I2cAddr i2cAddr)
+Deprecated.
+
+Use
+I2cAddrConfig.setI2cAddress(I2cAddr) instead. |
+
void |
+setLogging(boolean enabled)
+Turn logging on or off.
+ |
+
void |
+setLoggingTag(java.lang.String loggingTag)
+Set the tag to use when logging is on.
+ |
+
void |
+waitForWriteCompletions(I2cWaitControl waitControl)
+Waits for the most recent write to complete according to the behavior specified in writeControl.
+ |
+
void |
+write(int ireg,
+ byte[] data)
+Writes data to a set of registers, beginning with the one indicated, using
+
+I2cWaitControl.ATOMIC semantics. |
+
void |
+write(int ireg,
+ byte[] data,
+ I2cWaitControl waitControl)
+Writes data to a set of registers, beginning with the one indicated.
+ |
+
void |
+write8(int ireg,
+ int bVal)
+Writes a byte to the indicated register using
+I2cWaitControl.ATOMIC semantics. |
+
void |
+write8(int ireg,
+ int bVal,
+ I2cWaitControl waitControl)
+Writes a byte to the indicated register.
+ |
+
getHealthStatus, setHealthStatus
setI2cAddress
getI2cAddress
getUserConfiguredName, setUserConfiguredName
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
byte read8(int ireg)+
readTimeStamped(int, int)
for a
+ complete description.ireg
- the register number to readread(int, int)
,
+readTimeStamped(int, int)
,
+I2cDeviceSynch.ensureReadWindow(I2cDeviceSynch.ReadWindow, I2cDeviceSynch.ReadWindow)
byte[] read(int ireg, + int creg)+
readTimeStamped(int, int)
for a
+ complete description.ireg
- the register number of the first byte register to readcreg
- the number of bytes / registers to readread8(int)
,
+readTimeStamped(int, int)
,
+I2cDeviceSynch.ensureReadWindow(I2cDeviceSynch.ReadWindow, I2cDeviceSynch.ReadWindow)
TimestampedData readTimeStamped(int ireg, + int creg)+
You can always just call this method without worrying at all about
+ read windows
,
+ that will work, but usually it is more efficient to take some thought and care as to what set
+ of registers the I2C device controller is being set up to read, as adjusting that window
+ of registers incurs significant extra time.
If the current read window can't be used to read the requested registers, then
+ a new read window will automatically be created as follows. If the current read window is non
+ null and wholly contains the registers to read but can't be read because it is a used-up
+ ReadMode#ONLY_ONCE
window,
+ a new read fresh window will be created with the same set of registers. Otherwise, a
+ window that exactly covers the requested set of registers will be created.
ireg
- the register number of the first byte register to readcreg
- the number of bytes / registers to readread(int, int)
,
+read8(int)
,
+I2cDeviceSynch.ensureReadWindow(I2cDeviceSynch.ReadWindow, I2cDeviceSynch.ReadWindow)
void write8(int ireg, + int bVal)+
I2cWaitControl.ATOMIC
semantics.ireg
- the register number that is to be writtenbVal
- the byte which is to be written to that registerwrite(int, byte[], I2cWaitControl)
void write(int ireg, + byte[] data)+
I2cWaitControl.ATOMIC
semantics.ireg
- the first of the registers which is to be writtendata
- the data which is to be written to the registerswrite(int, byte[], I2cWaitControl)
void write8(int ireg, + int bVal, + I2cWaitControl waitControl)+
write(int, byte[], I2cWaitControl)
.ireg
- the register number that is to be writtenbVal
- the byte which is to be written to that registerwaitControl
- controls the behavior of waiting for the completion of the writewrite(int, byte[], I2cWaitControl)
void write(int ireg, + byte[] data, + I2cWaitControl waitControl)+
ireg
- the first of the registers which is to be writtendata
- the data which is to be written to the registerswaitControl
- controls the behavior of waiting for the completion of the writevoid waitForWriteCompletions(I2cWaitControl waitControl)+
waitControl
- controls the behavior of waiting for the completion of the write
+ Note that a value of I2cWaitControl.NONE
is essentially a no-op.void enableWriteCoalescing(boolean enable)+
enable
- whether to enable write coalescing or notisWriteCoalescingEnabled()
boolean isWriteCoalescingEnabled()+
enableWriteCoalescing(boolean)
boolean isArmed()+
Engagable.engage()
@Deprecated +void setI2cAddr(I2cAddr i2cAddr)+
I2cAddrConfig.setI2cAddress(I2cAddr)
instead.i2cAddr
- the new I2C address@Deprecated +I2cAddr getI2cAddr()+
I2cAddressableDevice.getI2cAddress()
instead.void setLogging(boolean enabled)+
enabled
- whether to enable logging or notboolean getLogging()+
setLogging(boolean)
void setLoggingTag(java.lang.String loggingTag)+
loggingTag
- the logging tag to suejava.lang.String getLoggingTag()+
setLoggingTag(String)
public enum I2cWaitControl +extends java.lang.Enum<I2cWaitControl>+
I2cWaitControl
control the semantics of waiting on I2c writesEnum Constant and Description | +
---|
ATOMIC
+The associated write is guaranteed to make it out to the I2c device.
+ |
+
NONE
+No write timing control is performed.
+ |
+
WRITTEN
+The semantics of
+ATOMIC with the additional behavior that the wait of the
+ write call will not return until the data has actually been written to the I2c device. |
+
Modifier and Type | +Method and Description | +
---|---|
static I2cWaitControl |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static I2cWaitControl[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final I2cWaitControl NONE+
public static final I2cWaitControl ATOMIC+
public static final I2cWaitControl WRITTEN+
ATOMIC
with the additional behavior that the wait of the
+ write call will not return until the data has actually been written to the I2c device.
+ This is useful in situations where a certain quiescent delay is required after a
+ particular I2c location has been updated.public static I2cWaitControl[] values()+
+for (I2cWaitControl c : I2cWaitControl.values()) + System.out.println(c); +
public static I2cWaitControl valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic interface IntegratingGyroscope +extends Gyroscope, OrientationSensor+
IntegratingGyroscope
provides a means by which the integrated rotation
+ can be easily retrieved.getAngularVelocity, getAngularVelocityAxes
getAngularOrientation, getAngularOrientationAxes
public static class IrSeekerSensor.IrSeekerIndividualSensor
+extends java.lang.Object
++ Get the angle of this sensor, along with signal strength
Constructor and Description | +
---|
IrSeekerIndividualSensor()
+Constructor
+ |
+
IrSeekerIndividualSensor(double angle,
+ double strength)
+Constructor
+ |
+
Modifier and Type | +Method and Description | +
---|---|
double |
+getSensorAngle()
+Get the angle at which this sensor is mounted
+ |
+
double |
+getSensorStrength()
+Get the strength of the IR signal detected by this sensor
+ |
+
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public IrSeekerIndividualSensor()+
public IrSeekerIndividualSensor(double angle, + double strength)+
public double getSensorAngle()+
public double getSensorStrength()+
public java.lang.String toString()+
toString
in class java.lang.Object
public static enum IrSeekerSensor.Mode +extends java.lang.Enum<IrSeekerSensor.Mode>+
Enum Constant and Description | +
---|
MODE_1200HZ |
+
MODE_600HZ |
+
Modifier and Type | +Method and Description | +
---|---|
static IrSeekerSensor.Mode |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static IrSeekerSensor.Mode[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final IrSeekerSensor.Mode MODE_600HZ+
public static final IrSeekerSensor.Mode MODE_1200HZ+
public static IrSeekerSensor.Mode[] values()+
+for (IrSeekerSensor.Mode c : IrSeekerSensor.Mode.values()) + System.out.println(c); +
public static IrSeekerSensor.Mode valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic interface IrSeekerSensor +extends HardwareDevice+
+ Determine the location of an IR source
Modifier and Type | +Interface and Description | +
---|---|
static class |
+IrSeekerSensor.IrSeekerIndividualSensor
+IR Sensor attached to an IR Seeker
+ |
+
static class |
+IrSeekerSensor.Mode
+Enumeration of device modes
+ |
+
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
double |
+getAngle()
+Estimated angle in which the signal is coming from
+ |
+
I2cAddr |
+getI2cAddress()
+Get the current I2C Address of this object.
+ |
+
IrSeekerSensor.IrSeekerIndividualSensor[] |
+getIndividualSensors()
+Get a list of all IR sensors attached to this seeker.
+ |
+
IrSeekerSensor.Mode |
+getMode()
+Get the device mode
+ |
+
double |
+getSignalDetectedThreshold()
+Get the minimum threshold for a signal to be considered detected
+ |
+
double |
+getStrength()
+IR Signal strength
+ |
+
void |
+setI2cAddress(I2cAddr newAddress)
+Set the I2C address to a new value.
+ |
+
void |
+setMode(IrSeekerSensor.Mode mode)
+Set the device mode
+ |
+
void |
+setSignalDetectedThreshold(double threshold)
+Set the minimum threshold for a signal to be considered detected
+ |
+
boolean |
+signalDetected()
+Returns true if an IR signal is detected
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
void setSignalDetectedThreshold(double threshold)+
threshold
- minimum thresholddouble getSignalDetectedThreshold()+
void setMode(IrSeekerSensor.Mode mode)+
mode
- sample rateIrSeekerSensor.Mode getMode()+
boolean signalDetected()+
double getAngle()+
+ If the signal is estimated to be directly ahead, 0 will be returned. If the signal is to the + left a negative angle will be returned. If the signal is to the right a positive angle will be + returned. If no signal is detected, a 0 will be returned. +
+ NOTE: not all sensors give an accurate angle.
double getStrength()+
+ Detected IR signal strength, on a scale of 0.0 to 1.0, where 0 is no signal detected and 1 is + max IR signal detected.
IrSeekerSensor.IrSeekerIndividualSensor[] getIndividualSensors()+
void setI2cAddress(I2cAddr newAddress)+
I2cAddr getI2cAddress()+
public class LED +extends java.lang.Object +implements HardwareDevice, SwitchableLight+
HardwareDevice.Manufacturer
Constructor and Description | +
---|
LED(DigitalChannelController controller,
+ int physicalPort)
+Constructor
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close()
+Closes this device
+ |
+
void |
+enable(boolean set)
+A method to turn on or turn off the LED
+ |
+
void |
+enableLight(boolean enable)
+Turns the light on or off.
+ |
+
java.lang.String |
+getConnectionInfo()
+Get connection information about this device in a human readable format
+ |
+
java.lang.String |
+getDeviceName()
+Returns a string suitable for display to the user as to the type of device.
+ |
+
HardwareDevice.Manufacturer |
+getManufacturer()
+Returns an indication of the manufacturer of this device.
+ |
+
int |
+getVersion()
+Version
+ |
+
boolean |
+isLightOn()
+Answers whether the light is on or off
+ |
+
void |
+resetDeviceConfigurationForOpMode()
+Resets the device's configuration to that which is expected at the beginning of an OpMode.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public LED(DigitalChannelController controller, + int physicalPort)+
controller
- Digital Channel Controller this LED is attached tophysicalPort
- the physical port it's plugged into.public void enable(boolean set)+
set
- - true turns it on, false turns it off.public boolean isLightOn()+
Light
public void enableLight(boolean enable)+
SwitchableLight
enableLight
in interface SwitchableLight
enable
- if true, the light turns on; otherwise the light turns offpublic HardwareDevice.Manufacturer getManufacturer()+
HardwareDevice
getManufacturer
in interface HardwareDevice
public java.lang.String getDeviceName()+
HardwareDevice
getDeviceName
in interface HardwareDevice
public java.lang.String getConnectionInfo()+
HardwareDevice
getConnectionInfo
in interface HardwareDevice
public int getVersion()+
HardwareDevice
getVersion
in interface HardwareDevice
public void resetDeviceConfigurationForOpMode()+
HardwareDevice
resetDeviceConfigurationForOpMode
in interface HardwareDevice
public void close()+
HardwareDevice
close
in interface HardwareDevice
public interface LegacyModule +extends HardwareDevice, I2cController+
I2cController.I2cPortReadyBeginEndNotifications, I2cController.I2cPortReadyCallback
HardwareDevice.Manufacturer
I2C_BUFFER_START_ADDRESS
Modifier and Type | +Method and Description | +
---|---|
void |
+enable9v(int physicalPort,
+ boolean enable)
+Enable or disable 9V power on a port
+ |
+
void |
+enableAnalogReadMode(int physicalPort)
+Enable a physical port in analog read mode
+ |
+
double |
+getMaxAnalogInputVoltage()
+Returns the maximum voltage that can be read by our analog inputs
+ |
+
byte[] |
+readAnalogRaw(int physicalPort)
+Read an analog value from a device; only works in analog read mode
+ |
+
double |
+readAnalogVoltage(int physicalPort)
+Reads the analog voltage from a device.
+ |
+
void |
+setDigitalLine(int physicalPort,
+ int line,
+ boolean set)
+Set the value of digital line 0 or 1 while in analog mode.
+ |
+
clearI2cPortActionFlag, copyBufferIntoWriteBuffer, deregisterForPortReadyBeginEndCallback, deregisterForPortReadyCallback, enableI2cReadMode, enableI2cWriteMode, getCopyOfReadBuffer, getCopyOfWriteBuffer, getI2cPortReadyCallback, getI2cReadCache, getI2cReadCacheLock, getI2cReadCacheTimeWindow, getI2cWriteCache, getI2cWriteCacheLock, getMaxI2cWriteLatency, getPortReadyBeginEndCallback, getSerialNumber, isArmed, isI2cPortActionFlagSet, isI2cPortInReadMode, isI2cPortInWriteMode, isI2cPortReady, readI2cCacheFromController, readI2cCacheFromModule, registerForI2cPortReadyCallback, registerForPortReadyBeginEndCallback, setI2cPortActionFlag, writeI2cCacheToController, writeI2cCacheToModule, writeI2cPortFlagOnlyToController, writeI2cPortFlagOnlyToModule
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
void enableAnalogReadMode(int physicalPort)+
physicalPort
- physical port number on the devicebyte[] readAnalogRaw(int physicalPort)+
physicalPort
- physical port number on the devicedouble readAnalogVoltage(int physicalPort)+
physicalPort
- the port whose voltage is to be readdouble getMaxAnalogInputVoltage()+
void enable9v(int physicalPort, + boolean enable)+
physicalPort
- physical port number on the deviceenable
- true to enable; false to disablevoid setDigitalLine(int physicalPort, + int line, + boolean set)+
+ These are port pins 5 and 6.
physicalPort
- physical port number on the deviceline
- line 0 or 1set
- true to set; otherwise falsepublic interface LegacyModulePortDevice
+Modifier and Type | +Method and Description | +
---|---|
LegacyModule |
+getLegacyModule()
+Returns the legacy module associated with this device.
+ |
+
int |
+getPort()
+Returns the port on the associated legacy module that this device occupies.
+ |
+
LegacyModule getLegacyModule()+
int getPort()+
public abstract class LegacyModulePortDeviceImpl +extends java.lang.Object +implements LegacyModulePortDevice+
Modifier and Type | +Field and Description | +
---|---|
protected LegacyModule |
+module |
+
protected int |
+physicalPort |
+
Modifier | +Constructor and Description | +
---|---|
protected |
+LegacyModulePortDeviceImpl(LegacyModule module,
+ int physicalPort) |
+
Modifier and Type | +Method and Description | +
---|---|
protected void |
+finishConstruction() |
+
LegacyModule |
+getLegacyModule()
+Returns the legacy module associated with this device.
+ |
+
int |
+getPort()
+Returns the port on the associated legacy module that this device occupies.
+ |
+
protected void |
+moduleNowArmedOrPretending()
+intended as a subclass hook
+ |
+
protected void |
+moduleNowDisarmed()
+intended as a subclass hook
+ |
+
void |
+onModuleStateChange(RobotArmingStateNotifier module,
+ RobotUsbModule.ARMINGSTATE state) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected final LegacyModule module+
protected final int physicalPort+
protected LegacyModulePortDeviceImpl(LegacyModule module, + int physicalPort)+
protected void finishConstruction()+
protected void moduleNowArmedOrPretending()+
protected void moduleNowDisarmed()+
public void onModuleStateChange(RobotArmingStateNotifier module, + RobotUsbModule.ARMINGSTATE state)+
public LegacyModule getLegacyModule()+
LegacyModulePortDevice
getLegacyModule
in interface LegacyModulePortDevice
public int getPort()+
LegacyModulePortDevice
getPort
in interface LegacyModulePortDevice
public interface Light
+Light
instances are sources of illumination. They can inform as to whether
+ they are on or off.SwitchableLight
Modifier and Type | +Method and Description | +
---|---|
boolean |
+isLightOn()
+Answers whether the light is on or off
+ |
+
public class LightBlinker +extends java.lang.Object +implements Blinker+
LightBlinker
is a handy utility that will flash a SwitchableLight
+ in a pattern of timed durations, and, optionally, colors, if the light supports same (NYI)Blinker.Step
Modifier and Type | +Field and Description | +
---|---|
protected java.util.ArrayList<Blinker.Step> |
+currentSteps |
+
protected java.util.concurrent.ScheduledFuture<?> |
+future |
+
protected SwitchableLight |
+light |
+
protected int |
+nextStep |
+
protected java.util.Deque<java.util.ArrayList<Blinker.Step>> |
+previousSteps |
+
static java.lang.String |
+TAG |
+
Constructor and Description | +
---|
LightBlinker(SwitchableLight light) |
+
Modifier and Type | +Method and Description | +
---|---|
int |
+getBlinkerPatternMaxLength()
+Returns the maximum number of
+Blinker.Step s that can be present in a pattern |
+
java.util.Collection<Blinker.Step> |
+getPattern()
+Returns the current blinking pattern
+ |
+
protected boolean |
+isCurrentPattern(java.util.Collection<Blinker.Step> steps) |
+
boolean |
+patternStackNotEmpty()
+Returns whether the pattern stack is currently nonempty.
+ |
+
boolean |
+popPattern()
+Pops the next pattern off of the stack of saved patterns, if any.
+ |
+
void |
+pushPattern(java.util.Collection<Blinker.Step> steps)
+Saves the existing pattern such that it can be later restored, then calls setPattern().
+ |
+
protected void |
+scheduleNext() |
+
void |
+setConstant(int color)
+Sets the blinker pattern to be a single, unchanging color
+ |
+
void |
+setPattern(java.util.Collection<Blinker.Step> steps)
+Sets the pattern with which this LED or light should illuminate.
+ |
+
protected void |
+stop() |
+
void |
+stopBlinking()
+Sets the blinker to constant black and frees any internal resources
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String TAG+
protected final SwitchableLight light+
protected java.util.ArrayList<Blinker.Step> currentSteps+
protected java.util.Deque<java.util.ArrayList<Blinker.Step>> previousSteps+
protected java.util.concurrent.ScheduledFuture<?> future+
protected int nextStep+
public LightBlinker(SwitchableLight light)+
public void setConstant(int color)+
Blinker
setConstant
in interface Blinker
color
- the color with which the LED or light should be illuminatedpublic void stopBlinking()+
Blinker
stopBlinking
in interface Blinker
public int getBlinkerPatternMaxLength()+
Blinker
Blinker.Step
s that can be present in a patterngetBlinkerPatternMaxLength
in interface Blinker
Blinker.Step
s that can be present in a patternpublic void pushPattern(java.util.Collection<Blinker.Step> steps)+
Blinker
pushPattern
in interface Blinker
steps
- the new pattern to be displayedpublic boolean patternStackNotEmpty()+
Blinker
patternStackNotEmpty
in interface Blinker
public boolean popPattern()+
Blinker
popPattern
in interface Blinker
public void setPattern(java.util.Collection<Blinker.Step> steps)+
Blinker
setPattern
in interface Blinker
steps
- the pattern of colors and durations that the LED or light should illuminate itself withprotected boolean isCurrentPattern(java.util.Collection<Blinker.Step> steps)+
public java.util.Collection<Blinker.Step> getPattern()+
Blinker
getPattern
in interface Blinker
protected void scheduleNext()+
protected void stop()+
public class LightMultiplexor +extends java.lang.Object +implements SwitchableLight+
LightMultiplexor
adapts a second SwitchableLight
by adding reference
+ counting to SwitchableLight.enableLight(boolean)
: the light will be lit if the net
+ number of enables is greater than zero.Modifier and Type | +Field and Description | +
---|---|
protected int |
+enableCount |
+
protected static java.util.Set<LightMultiplexor> |
+extantMultiplexors |
+
protected SwitchableLight |
+target |
+
Modifier | +Constructor and Description | +
---|---|
protected |
+LightMultiplexor(SwitchableLight target) |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+enableLight(boolean enable)
+Turns the light on or off.
+ |
+
static LightMultiplexor |
+forLight(SwitchableLight target) |
+
boolean |
+isLightOn()
+Answers whether the light is on or off
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected static final java.util.Set<LightMultiplexor> extantMultiplexors+
protected final SwitchableLight target+
protected int enableCount+
protected LightMultiplexor(SwitchableLight target)+
public static LightMultiplexor forLight(SwitchableLight target)+
public boolean isLightOn()+
Light
public void enableLight(boolean enable)+
SwitchableLight
enableLight
in interface SwitchableLight
enable
- if true, the light turns on; otherwise the light turns offpublic interface LightSensor +extends HardwareDevice+
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
void |
+enableLed(boolean enable)
+Enable the LED light
+ |
+
double |
+getLightDetected()
+Get the amount of light detected by the sensor, scaled and cliped to a range
+ which is a pragmatically useful sensitivity.
+ |
+
double |
+getRawLightDetected()
+Returns a signal whose strength is proportional to the intensity of the light measured.
+ |
+
double |
+getRawLightDetectedMax()
+Returns the maximum value that can be returned by
+getRawLightDetected() . |
+
java.lang.String |
+status()
+Status of this sensor, in string form
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
double getLightDetected()+
double getRawLightDetected()+
double getRawLightDetectedMax()+
getRawLightDetected()
.getRawLightDetected()
void enableLed(boolean enable)+
enable
- true to enable; false to disablejava.lang.String status()+
public class LynxModuleMeta
+extends java.lang.Object
+LynxModuleMeta
has simple lynx module meta information for transmission from RC to DSModifier and Type | +Field and Description | +
---|---|
protected boolean |
+isParent |
+
protected int |
+moduleAddress |
+
Constructor and Description | +
---|
LynxModuleMeta(int moduleAddress,
+ boolean isParent) |
+
LynxModuleMeta(LynxModuleMeta him) |
+
LynxModuleMeta(RobotCoreLynxModule him) |
+
Modifier and Type | +Method and Description | +
---|---|
int |
+getModuleAddress() |
+
boolean |
+isParent() |
+
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
protected int moduleAddress+
protected boolean isParent+
public LynxModuleMeta(int moduleAddress, + boolean isParent)+
public LynxModuleMeta(RobotCoreLynxModule him)+
public LynxModuleMeta(LynxModuleMeta him)+
public class LynxModuleMetaList +extends java.lang.Object +implements java.lang.Iterable<LynxModuleMeta>+
LynxModuleMetaList
is a container of RobotCoreLynxModule
s.
+ Its primary use is for transmission of module information from RC to DS.Modifier and Type | +Field and Description | +
---|---|
LynxModuleMeta[] |
+modules |
+
SerialNumber |
+serialNumber |
+
Constructor and Description | +
---|
LynxModuleMetaList(SerialNumber serialNumber) |
+
LynxModuleMetaList(SerialNumber serialNumber,
+ java.util.Collection<LynxModuleMeta> modules) |
+
LynxModuleMetaList(SerialNumber serialNumber,
+ java.util.List<RobotCoreLynxModule> modules) |
+
Modifier and Type | +Method and Description | +
---|---|
protected LynxModuleMetaList |
+flatten() |
+
static LynxModuleMetaList |
+fromSerializationString(java.lang.String serialization) |
+
LynxModuleMeta |
+getParent() |
+
java.util.Iterator<LynxModuleMeta> |
+iterator() |
+
java.lang.String |
+toSerializationString() |
+
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public SerialNumber serialNumber+
public LynxModuleMeta[] modules+
public LynxModuleMetaList(SerialNumber serialNumber)+
public LynxModuleMetaList(SerialNumber serialNumber, + java.util.Collection<LynxModuleMeta> modules)+
public LynxModuleMetaList(SerialNumber serialNumber, + java.util.List<RobotCoreLynxModule> modules)+
public java.util.Iterator<LynxModuleMeta> iterator()+
iterator
in interface java.lang.Iterable<LynxModuleMeta>
public LynxModuleMeta getParent()+
protected LynxModuleMetaList flatten()+
public java.lang.String toSerializationString()+
public static LynxModuleMetaList fromSerializationString(java.lang.String serialization)+
public java.lang.String toString()+
toString
in class java.lang.Object
public enum MotorControlAlgorithm +extends java.lang.Enum<MotorControlAlgorithm>+
DcMotor.RunMode.RUN_TO_POSITION
and DcMotor.RunMode.RUN_USING_ENCODER
.Enum Constant and Description | +
---|
LegacyPID
+Deprecated.
+
+Switch to
+PIDF instead |
+
PIDF |
+
Unknown |
+
Modifier and Type | +Method and Description | +
---|---|
static MotorControlAlgorithm |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static MotorControlAlgorithm[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final MotorControlAlgorithm Unknown+
@Deprecated +public static final MotorControlAlgorithm LegacyPID+
PIDF
insteadpublic static final MotorControlAlgorithm PIDF+
public static MotorControlAlgorithm[] values()+
+for (MotorControlAlgorithm c : MotorControlAlgorithm.values()) + System.out.println(c); +
public static MotorControlAlgorithm valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic interface NormalizedColorSensor +extends HardwareDevice+
NormalizedColorSensor
returns color sensor data in standardized units, which
+ provides a measure of absolute color color intensity beyond the relative
+ intensities available using ColorSensor
.HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
NormalizedRGBA |
+getNormalizedColors()
+Reads the colors from the sensor
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
NormalizedRGBA getNormalizedColors()+
public class NormalizedRGBA
+extends java.lang.Object
+NormalizedRGBA
instances represent a set of normalized color values.NormalizedColorSensor
Modifier and Type | +Field and Description | +
---|---|
float |
+alpha
+normalized alpha value, in range [0,1)
+ |
+
float |
+blue
+normalized blue value, in range [0,1)
+ |
+
float |
+green
+normalized green value, in range [0,1)
+ |
+
float |
+red
+normalized red value, in range [0,1)
+ |
+
Constructor and Description | +
---|
NormalizedRGBA() |
+
Modifier and Type | +Method and Description | +
---|---|
int |
+toColor()
+Converts the normalized colors into an Android color integer
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public float red+
public float green+
public float blue+
public float alpha+
public interface OpticalDistanceSensor +extends LightSensor+
OpticalDistanceSensor
is a LightSensor
whose reported light intensities
+ reflect (pun intended) a relationship to distance. Both raw readings and normalized readings
+ can be obtained; however, these both (usually) have an inverse-square relationship to distance,
+ and thus can be cumbersome to use. For an easier-to-use, linear relationship, see
+ DistanceSensor
.DistanceSensor
HardwareDevice.Manufacturer
enableLed, getLightDetected, getRawLightDetected, getRawLightDetectedMax, status
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
public interface OrientationSensor
+OrientationSensor
provides access to sensors which measure absolute orientationModifier and Type | +Method and Description | +
---|---|
Orientation |
+getAngularOrientation(AxesReference reference,
+ AxesOrder order,
+ AngleUnit angleUnit)
+Returns the absolute orientation of the sensor as a set three angles.
+ |
+
java.util.Set<Axis> |
+getAngularOrientationAxes()
+Returns the axes on which the sensor measures angular orientation.
+ |
+
java.util.Set<Axis> getAngularOrientationAxes()+
Orientation getAngularOrientation(AxesReference reference, + AxesOrder order, + AngleUnit angleUnit)+
reference
- the axes reference in which the result will be expressedorder
- the axes order in which the result will be expressedangleUnit
- the angle units in which the result will be expressedOrientation
public class PIDCoefficients
+extends java.lang.Object
+PIDCoefficients
conveys a set of configuration parameters for a PID algorithm.Modifier and Type | +Field and Description | +
---|---|
double |
+d |
+
double |
+i |
+
double |
+p |
+
Constructor and Description | +
---|
PIDCoefficients() |
+
PIDCoefficients(double p,
+ double i,
+ double d) |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public double p+
public double i+
public double d+
public class PIDFCoefficients
+extends java.lang.Object
+PIDFCoefficients
conveys a set of configuration parameters for a PIDF algorithm,
+ a PID algorithm which includes an additional feed-forward term. Optionally, coefficients
+ for the original Expansion Hub "Legacy PID" alogrithm may also be indicated.Modifier and Type | +Field and Description | +
---|---|
MotorControlAlgorithm |
+algorithm |
+
double |
+d |
+
double |
+f |
+
double |
+i |
+
double |
+p |
+
Constructor and Description | +
---|
PIDFCoefficients() |
+
PIDFCoefficients(double p,
+ double i,
+ double d,
+ double f) |
+
PIDFCoefficients(double p,
+ double i,
+ double d,
+ double f,
+ MotorControlAlgorithm algorithm) |
+
PIDFCoefficients(PIDCoefficients them) |
+
PIDFCoefficients(PIDFCoefficients them) |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public double p+
public double i+
public double d+
public double f+
public MotorControlAlgorithm algorithm+
public PIDFCoefficients()+
public PIDFCoefficients(double p, + double i, + double d, + double f, + MotorControlAlgorithm algorithm)+
public PIDFCoefficients(double p, + double i, + double d, + double f)+
public PIDFCoefficients(PIDFCoefficients them)+
public PIDFCoefficients(PIDCoefficients them)+
public interface PWMOutput +extends HardwareDevice+
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
int |
+getPulseWidthOutputTime() |
+
int |
+getPulseWidthPeriod() |
+
void |
+setPulseWidthOutputTime(int usDuration) |
+
void |
+setPulseWidthPeriod(int usFrame) |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
void setPulseWidthOutputTime(int usDuration)+
int getPulseWidthOutputTime()+
void setPulseWidthPeriod(int usFrame)+
int getPulseWidthPeriod()+
public interface PWMOutputController +extends HardwareDevice+
+ Different analog input controllers will implement this interface.
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
int |
+getPulseWidthOutputTime(int port)
+Gets the pulse width for the channel output in units of 1 microsecond.
+ |
+
int |
+getPulseWidthPeriod(int port)
+Gets the pulse repetition period for the channel output in units of 1 microsecond.
+ |
+
SerialNumber |
+getSerialNumber()
+Serial Number
+ |
+
void |
+setPulseWidthOutputTime(int port,
+ int usDuration)
+Set the pulse width output time for this channel.
+ |
+
void |
+setPulseWidthPeriod(int port,
+ int usPeriod)
+Set the pulse width output period.
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
SerialNumber getSerialNumber()+
void setPulseWidthOutputTime(int port, + int usDuration)+
port
- port this device is attached tousDuration
- pulse width for the port in microseconds.void setPulseWidthPeriod(int port, + int usPeriod)+
port
- port this device is attached tousPeriod
- pulse repetition period in microseconds.int getPulseWidthOutputTime(int port)+
port
- port this device is attached toint getPulseWidthPeriod(int port)+
port
- port this device is attached topublic interface PWMOutputControllerEx
+Modifier and Type | +Method and Description | +
---|---|
boolean |
+isPwmEnabled(int port) |
+
void |
+setPwmDisable(int port) |
+
void |
+setPwmEnable(int port) |
+
public interface PWMOutputEx
+Modifier and Type | +Method and Description | +
---|---|
boolean |
+isPwmEnabled() |
+
void |
+setPwmDisable() |
+
void |
+setPwmEnable() |
+
public class PWMOutputImpl +extends java.lang.Object +implements PWMOutput+
HardwareDevice.Manufacturer
Modifier and Type | +Field and Description | +
---|---|
protected PWMOutputController |
+controller |
+
protected int |
+port |
+
Constructor and Description | +
---|
PWMOutputImpl(PWMOutputController controller,
+ int port)
+Constructor
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close()
+Closes this device
+ |
+
java.lang.String |
+getConnectionInfo()
+Get connection information about this device in a human readable format
+ |
+
java.lang.String |
+getDeviceName()
+Returns a string suitable for display to the user as to the type of device.
+ |
+
HardwareDevice.Manufacturer |
+getManufacturer()
+Returns an indication of the manufacturer of this device.
+ |
+
int |
+getPulseWidthOutputTime()
+Get the pulse width output time for this port
+ |
+
int |
+getPulseWidthPeriod()
+Get the pulse width output
+ |
+
int |
+getVersion()
+Version
+ |
+
void |
+resetDeviceConfigurationForOpMode()
+Resets the device's configuration to that which is expected at the beginning of an OpMode.
+ |
+
void |
+setPulseWidthOutputTime(int time)
+Set the pulse width output time for this port.
+ |
+
void |
+setPulseWidthPeriod(int period)
+Set the pulse width output period.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected PWMOutputController controller+
protected int port+
public PWMOutputImpl(PWMOutputController controller, + int port)+
controller
- Digital port controller this port is attached toport
- port on the digital port controllerpublic void setPulseWidthOutputTime(int time)+
setPulseWidthOutputTime
in interface PWMOutput
time
- pulse width for the port in microseconds.public int getPulseWidthOutputTime()+
getPulseWidthOutputTime
in interface PWMOutput
public void setPulseWidthPeriod(int period)+
setPulseWidthPeriod
in interface PWMOutput
period
- pulse repetition period in microseconds.public int getPulseWidthPeriod()+
getPulseWidthPeriod
in interface PWMOutput
public HardwareDevice.Manufacturer getManufacturer()+
HardwareDevice
getManufacturer
in interface HardwareDevice
public java.lang.String getDeviceName()+
HardwareDevice
getDeviceName
in interface HardwareDevice
public java.lang.String getConnectionInfo()+
HardwareDevice
getConnectionInfo
in interface HardwareDevice
public int getVersion()+
HardwareDevice
getVersion
in interface HardwareDevice
public void resetDeviceConfigurationForOpMode()+
HardwareDevice
resetDeviceConfigurationForOpMode
in interface HardwareDevice
public void close()+
HardwareDevice
close
in interface HardwareDevice
public class PWMOutputImplEx +extends PWMOutputImpl +implements PWMOutputEx+
HardwareDevice.Manufacturer
controller, port
Constructor and Description | +
---|
PWMOutputImplEx(PWMOutputController controller,
+ int port) |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+isPwmEnabled() |
+
void |
+setPwmDisable() |
+
void |
+setPwmEnable() |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getPulseWidthOutputTime, getPulseWidthPeriod, getVersion, resetDeviceConfigurationForOpMode, setPulseWidthOutputTime, setPulseWidthPeriod
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public PWMOutputImplEx(PWMOutputController controller, + int port)+
public void setPwmEnable()+
setPwmEnable
in interface PWMOutputEx
public void setPwmDisable()+
setPwmDisable
in interface PWMOutputEx
public boolean isPwmEnabled()+
isPwmEnabled
in interface PWMOutputEx
public static class PwmControl.PwmRange
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
static PwmControl.PwmRange |
+defaultRange
+defaultRange is the default PWM range used
+ |
+
double |
+usFrame
+usFrame is the rate, in microseconds, at which the PWM is transmitted.
+ |
+
static double |
+usFrameDefault
+usFrameDefault is the default frame rate used, in microseconds
+ |
+
double |
+usPulseLower
+usPulseLower is the minimum PWM rate used, in microseconds.
+ |
+
static double |
+usPulseLowerDefault |
+
double |
+usPulseUpper
+usPulseLower is the maximum PWM rate used, in microseconds.
+ |
+
static double |
+usPulseUpperDefault |
+
Constructor and Description | +
---|
PwmRange(double usPulseLower,
+ double usPulseUpper)
+Creates a new PwmRange with the indicated lower and upper bounds and the default
+ framing rate.
+ |
+
PwmRange(double usPulseLower,
+ double usPulseUpper,
+ double usFrame)
+Creates a new PwmRange with the indicated lower and upper bounds and the specified
+ framing rate.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+equals(java.lang.Object o) |
+
int |
+hashCode() |
+
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
public static final double usFrameDefault+
public static final double usPulseUpperDefault+
public static final double usPulseLowerDefault+
public static final PwmControl.PwmRange defaultRange+
public final double usPulseLower+
public final double usPulseUpper+
public final double usFrame+
public PwmRange(double usPulseLower, + double usPulseUpper)+
usPulseLower
- the minimum PWM rate used, in microsecondusPulseUpper
- the maximum PWM rate used, in microsecondspublic PwmRange(double usPulseLower, + double usPulseUpper, + double usFrame)+
usPulseLower
- the minimum PWM rate used, in microsecondusPulseUpper
- the maximum PWM rate used, in microsecondsusFrame
- the framing rate, in microsecondspublic interface PwmControl
+PwmControl
interface provides control of the width of pulses used and whether
+ the PWM is enabled or disabled.
+
+ PWM is commonly used to control servos. PwmControl
is thus found as a second
+ interface on servo objects whose primary interface is Servo
or CRServo
+ when the underlying servo controller hardware supports this fine-grained control (not all
+ servo controllers provide such control). To access the PwmControl
interface,
+ cast your Servo
or CRServo
object to PwmControl
; however, it is
+ usually prudent to first test whether the cast will succeed by testing using
instanceof.
DcMotorEx
,
+Pulse-width modulationModifier and Type | +Interface and Description | +
---|---|
static class |
+PwmControl.PwmRange
+PwmRange instances are used to specify the upper and lower pulse widths
+ and overall framing rate for a servo.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
PwmControl.PwmRange |
+getPwmRange()
+Returns the current PWM range limits for the servo
+ |
+
boolean |
+isPwmEnabled()
+Returns whether the PWM is energized for this particular servo
+ |
+
void |
+setPwmDisable()
+Individually denergizes the PWM for this particular servo
+ |
+
void |
+setPwmEnable()
+Individually energizes the PWM for this particular servo.
+ |
+
void |
+setPwmRange(PwmControl.PwmRange range)
+Sets the PWM range limits for the servo
+ |
+
void setPwmRange(PwmControl.PwmRange range)+
range
- the new PWM range limits for the servogetPwmRange()
PwmControl.PwmRange getPwmRange()+
setPwmRange(PwmRange)
void setPwmEnable()+
setPwmDisable()
,
+isPwmEnabled()
void setPwmDisable()+
setPwmEnable()
boolean isPwmEnabled()+
setPwmEnable()
public interface RobotConfigNameable +extends HardwareDevice+
RobotConfigNameable
provides access to the name by which a device has been configured
+ within a robot configurationHardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+getUserConfiguredName()
+Returns the human-recognizable name of this device, if same has been set.
+ |
+
void |
+setUserConfiguredName(java.lang.String name)
+Informs the device of a name by which it would be recognized by the user.
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
void setUserConfiguredName(java.lang.String name)+
java.lang.String getUserConfiguredName()+
setUserConfiguredName(String)
public interface RobotCoreLynxModule
+RobotCoreLynxModule
is the view of a Lynx Module available at the RobotCore layer.Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+getFirmwareVersionString() |
+
int |
+getModuleAddress() |
+
boolean |
+isParent() |
+
public interface RobotCoreLynxUsbDevice
+Modifier and Type | +Method and Description | +
---|---|
void |
+close() |
+
LynxModuleMetaList |
+discoverModules() |
+
void |
+failSafe() |
+
void failSafe()+
LynxModuleMetaList discoverModules() + throws RobotCoreException, + java.lang.InterruptedException+
RobotCoreException
java.lang.InterruptedException
void close()+
protected static class ScannedDevices.MapAdapter
+extends <any>
+Modifier | +Constructor and Description | +
---|---|
protected |
+MapAdapter() |
+
Modifier and Type | +Method and Description | +
---|---|
java.util.Map<SerialNumber,DeviceManager.UsbDeviceType> |
+read(JsonReader reader) |
+
void |
+write(JsonWriter writer,
+ java.util.Map<SerialNumber,DeviceManager.UsbDeviceType> map) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public void write(JsonWriter writer, + java.util.Map<SerialNumber,DeviceManager.UsbDeviceType> map) + throws java.io.IOException+
java.io.IOException
public java.util.Map<SerialNumber,DeviceManager.UsbDeviceType> read(JsonReader reader) + throws java.io.IOException+
java.io.IOException
public class ScannedDevices
+extends java.lang.Object
+ScannedDevices
is a simple distinguished kind of map of serial numbers
+ to device types. Simple serialization and deserialization logic is provided.Modifier and Type | +Class and Description | +
---|---|
protected static class |
+ScannedDevices.MapAdapter
+There *has* to be an easier way here, somehow.
+ |
+
Modifier and Type | +Field and Description | +
---|---|
protected java.lang.String |
+errorMessage |
+
protected java.lang.Object |
+lock |
+
protected java.util.Map<SerialNumber,DeviceManager.UsbDeviceType> |
+map |
+
static java.lang.String |
+TAG |
+
Constructor and Description | +
---|
ScannedDevices() |
+
ScannedDevices(ScannedDevices them) |
+
Modifier and Type | +Method and Description | +
---|---|
boolean |
+containsKey(SerialNumber serialNumber) |
+
java.util.Set<java.util.Map.Entry<SerialNumber,DeviceManager.UsbDeviceType>> |
+entrySet() |
+
static ScannedDevices |
+fromSerializationString(java.lang.String string) |
+
DeviceManager.UsbDeviceType |
+get(SerialNumber serialNumber) |
+
java.lang.String |
+getErrorMessage() |
+
java.util.Set<SerialNumber> |
+keySet() |
+
protected static Gson |
+newGson() |
+
DeviceManager.UsbDeviceType |
+put(SerialNumber serialNumber,
+ DeviceManager.UsbDeviceType deviceType) |
+
DeviceManager.UsbDeviceType |
+remove(SerialNumber serialNumber) |
+
void |
+setErrorMessage(java.lang.String errorMessage) |
+
int |
+size() |
+
java.lang.String |
+toSerializationString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String TAG+
protected final java.lang.Object lock+
protected java.lang.String errorMessage+
protected java.util.Map<SerialNumber,DeviceManager.UsbDeviceType> map+
public ScannedDevices(ScannedDevices them)+
public ScannedDevices()+
public void setErrorMessage(java.lang.String errorMessage)+
public java.lang.String getErrorMessage()+
public int size()+
public DeviceManager.UsbDeviceType put(SerialNumber serialNumber, + DeviceManager.UsbDeviceType deviceType)+
public DeviceManager.UsbDeviceType get(SerialNumber serialNumber)+
public boolean containsKey(SerialNumber serialNumber)+
public java.util.Set<SerialNumber> keySet()+
public java.util.Set<java.util.Map.Entry<SerialNumber,DeviceManager.UsbDeviceType>> entrySet()+
public DeviceManager.UsbDeviceType remove(SerialNumber serialNumber)+
protected static Gson newGson()+
public java.lang.String toSerializationString()+
public static ScannedDevices fromSerializationString(java.lang.String string)+
public static enum Servo.Direction +extends java.lang.Enum<Servo.Direction>+
At the start of an OpMode, servos are guaranteed to be in the forward direction.
Servo.setDirection(Direction)
Enum Constant and Description | +
---|
FORWARD |
+
REVERSE |
+
Modifier and Type | +Method and Description | +
---|---|
static Servo.Direction |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static Servo.Direction[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final Servo.Direction FORWARD+
public static final Servo.Direction REVERSE+
public static Servo.Direction[] values()+
+for (Servo.Direction c : Servo.Direction.values()) + System.out.println(c); +
public static Servo.Direction valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic interface Servo +extends HardwareDevice+
Modifier and Type | +Interface and Description | +
---|---|
static class |
+Servo.Direction
+Servos can be configured to internally reverse the values
+ to which their positioning power is set.
+ |
+
HardwareDevice.Manufacturer
Modifier and Type | +Field and Description | +
---|---|
static double |
+MAX_POSITION
+The maximum allowable position to which a servo can be moved
+ |
+
static double |
+MIN_POSITION
+The minimum allowable position to which a servo can be moved
+ |
+
Modifier and Type | +Method and Description | +
---|---|
ServoController |
+getController()
+Returns the underlying servo controller on which this servo is situated.
+ |
+
Servo.Direction |
+getDirection()
+Returns the current logical direction in which this servo is set as operating.
+ |
+
int |
+getPortNumber()
+Returns the port number on the underlying servo controller on which this motor is situated.
+ |
+
double |
+getPosition()
+Returns the position to which the servo was last commanded to move.
+ |
+
void |
+scaleRange(double min,
+ double max)
+Scales the available movement range of the servo to be a subset of its maximum range.
+ |
+
void |
+setDirection(Servo.Direction direction)
+Sets the logical direction in which this servo operates.
+ |
+
void |
+setPosition(double position)
+Sets the current position of the servo, expressed as a fraction of its available
+ range.
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
static final double MIN_POSITION+
setPosition(double)
,
+Constant Field Valuesstatic final double MAX_POSITION+
setPosition(double)
,
+Constant Field ValuesServoController getController()+
getPortNumber()
int getPortNumber()+
getController()
void setDirection(Servo.Direction direction)+
direction
- the direction to set for this servogetDirection()
,
+Servo.Direction
Servo.Direction getDirection()+
setDirection(Direction)
void setPosition(double position)+
position
- the position to which the servo should move, a value in the range [0.0, 1.0]ServoController.pwmEnable()
,
+getPosition()
double getPosition()+
setPosition(double)
,
+Double.NaN
,
+Double.isNaN()
void scaleRange(double min, + double max)+
setPosition()
each time.
+
+ For example, if scaleRange(0.2, 0.8) is set; then servo positions will be
+ scaled to fit in that range:
+ setPosition(0.0) scales to 0.2
+ setPosition(1.0) scales to 0.8
+ setPosition(0.5) scales to 0.5
+ setPosition(0.25) scales to 0.35
+ setPosition(0.75) scales to 0.65
+
Note the parameters passed here are relative to the underlying full range of motion of + the servo, not its currently scaled range, if any. Thus, scaleRange(0.0, 1.0) will reset + the servo to its full range of movement.
min
- the lower limit of the servo movement range, a value in the interval [0.0, 1.0]max
- the upper limit of the servo movement range, a value in the interval [0.0, 1.0]setPosition(double)
public static enum ServoController.PwmStatus +extends java.lang.Enum<ServoController.PwmStatus>+
Enum Constant and Description | +
---|
DISABLED |
+
ENABLED |
+
MIXED |
+
Modifier and Type | +Method and Description | +
---|---|
static ServoController.PwmStatus |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static ServoController.PwmStatus[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final ServoController.PwmStatus ENABLED+
public static final ServoController.PwmStatus DISABLED+
public static final ServoController.PwmStatus MIXED+
public static ServoController.PwmStatus[] values()+
+for (ServoController.PwmStatus c : ServoController.PwmStatus.values()) + System.out.println(c); +
public static ServoController.PwmStatus valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic interface ServoController +extends HardwareDevice+
+ Different servo controllers will implement this interface.
Modifier and Type | +Interface and Description | +
---|---|
static class |
+ServoController.PwmStatus
+PWM Status - is pwm enabled?
+ |
+
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
ServoController.PwmStatus |
+getPwmStatus()
+Returns the enablement status of the collective set of servos connected to this controller
+ |
+
double |
+getServoPosition(int servo)
+Get the position of a servo at a given channel
+ |
+
void |
+pwmDisable()
+Disables all of the servos connected to this controller
+ |
+
void |
+pwmEnable()
+Enables all of the servos connected to this controller
+ |
+
void |
+setServoPosition(int servo,
+ double position)
+Set the position of a servo at the given channel
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
void pwmEnable()+
void pwmDisable()+
ServoController.PwmStatus getPwmStatus()+
void setServoPosition(int servo, + double position)+
servo
- channel of servoposition
- from 0.0 to 1.0double getServoPosition(int servo)+
servo
- channel of servopublic interface ServoControllerEx +extends ServoController+
PwmControl
ServoController.PwmStatus
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
PwmControl.PwmRange |
+getServoPwmRange(int servo)
+Returns the PWM range of the indicated servo on this controller.
+ |
+
boolean |
+isServoPwmEnabled(int servo)
+Returns whether the PWM is energized for this particular servo
+ |
+
void |
+setServoPwmDisable(int servo)
+Individually de-energizes the PWM for a particular servo
+ |
+
void |
+setServoPwmEnable(int servo)
+Individually energizes the PWM for a particular servo
+ |
+
void |
+setServoPwmRange(int servo,
+ PwmControl.PwmRange range)
+Sets the PWM range of the indicated servo.
+ |
+
void |
+setServoType(int servo,
+ ServoConfigurationType servoType)
+Sets the servo type for a particular servo
+ |
+
getPwmStatus, getServoPosition, pwmDisable, pwmEnable, setServoPosition
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
void setServoPwmRange(int servo, + PwmControl.PwmRange range)+
servo
- the servo port number on the controllerrange
- the new range for the servogetServoPwmRange(int)
,
+PwmControl.setPwmRange(PwmControl.PwmRange)
PwmControl.PwmRange getServoPwmRange(int servo)+
servo
- the servo port number on the controllersetServoPwmRange(int, PwmControl.PwmRange)
,
+PwmControl.getPwmRange()
void setServoPwmEnable(int servo)+
servo
- the servo port number on the controllerPwmControl.setPwmEnable()
void setServoPwmDisable(int servo)+
servo
- the servo port number on the controllerPwmControl.setPwmDisable()
boolean isServoPwmEnabled(int servo)+
servo
- the servo port number on the controllerPwmControl.isPwmEnabled()
void setServoType(int servo, + ServoConfigurationType servoType)+
servo
- the servo port number on the controllerservoType
- the ServoConfigurationType instance to setpublic class ServoImpl +extends java.lang.Object +implements Servo+
Servo.Direction
HardwareDevice.Manufacturer
Modifier and Type | +Field and Description | +
---|---|
protected ServoController |
+controller |
+
protected Servo.Direction |
+direction |
+
protected double |
+limitPositionMax |
+
protected double |
+limitPositionMin |
+
protected int |
+portNumber |
+
MAX_POSITION, MIN_POSITION
Constructor and Description | +
---|
ServoImpl(ServoController controller,
+ int portNumber)
+Constructor
+ |
+
ServoImpl(ServoController controller,
+ int portNumber,
+ Servo.Direction direction)
+COnstructor
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close()
+Closes this device
+ |
+
java.lang.String |
+getConnectionInfo()
+Get connection information about this device in a human readable format
+ |
+
ServoController |
+getController()
+Get Servo Controller
+ |
+
java.lang.String |
+getDeviceName()
+Returns a string suitable for display to the user as to the type of device.
+ |
+
Servo.Direction |
+getDirection()
+Get the direction
+ |
+
HardwareDevice.Manufacturer |
+getManufacturer()
+Returns an indication of the manufacturer of this device.
+ |
+
int |
+getPortNumber()
+Get Channel
+ |
+
double |
+getPosition()
+Returns the position to which the servo was last commanded, or Double.NaN if that is
+ unavailable.
+ |
+
int |
+getVersion()
+Version
+ |
+
protected void |
+internalSetPosition(double position) |
+
void |
+resetDeviceConfigurationForOpMode()
+Resets the device's configuration to that which is expected at the beginning of an OpMode.
+ |
+
void |
+scaleRange(double min,
+ double max)
+Automatically scales the position of the servo.
+ |
+
void |
+setDirection(Servo.Direction direction)
+Set the direction
+ |
+
void |
+setPosition(double position)
+Commands the servo to move to a designated position.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected ServoController controller+
protected int portNumber+
protected Servo.Direction direction+
protected double limitPositionMin+
protected double limitPositionMax+
public ServoImpl(ServoController controller, + int portNumber)+
controller
- Servo controller that this servo is attached toportNumber
- physical port number on the servo controllerpublic ServoImpl(ServoController controller, + int portNumber, + Servo.Direction direction)+
controller
- Servo controller that this servo is attached toportNumber
- physical port number on the servo controllerdirection
- FORWARD for normal operation, REVERSE to reverse operationpublic HardwareDevice.Manufacturer getManufacturer()+
HardwareDevice
getManufacturer
in interface HardwareDevice
public java.lang.String getDeviceName()+
HardwareDevice
getDeviceName
in interface HardwareDevice
public java.lang.String getConnectionInfo()+
HardwareDevice
getConnectionInfo
in interface HardwareDevice
public int getVersion()+
HardwareDevice
getVersion
in interface HardwareDevice
public void resetDeviceConfigurationForOpMode()+
HardwareDevice
resetDeviceConfigurationForOpMode
in interface HardwareDevice
public void close()+
HardwareDevice
close
in interface HardwareDevice
public ServoController getController()+
getController
in interface Servo
Servo.getPortNumber()
public void setDirection(Servo.Direction direction)+
setDirection
in interface Servo
direction
- directionServo.getDirection()
,
+Servo.Direction
public Servo.Direction getDirection()+
getDirection
in interface Servo
Servo.setDirection(Direction)
public int getPortNumber()+
getPortNumber
in interface Servo
Servo.getController()
public void setPosition(double position)+
setPosition
in interface Servo
position
- the commanded servo position. Should be in the range [0.0, 1.0].getPosition()
protected void internalSetPosition(double position)+
public double getPosition()+
getPosition
in interface Servo
setPosition(double)
,
+Double.isNaN(double)
public void scaleRange(double min, + double max)+
scaleRange
in interface Servo
min
- the lower limit of the servo movement range, a value in the interval [0.0, 1.0]max
- the upper limit of the servo movement range, a value in the interval [0.0, 1.0]Servo.setPosition(double)
public class ServoImplEx +extends ServoImpl +implements PwmControl+
Servo
and the PwmControl
interfaces.PwmControl.PwmRange
Servo.Direction
HardwareDevice.Manufacturer
Modifier and Type | +Field and Description | +
---|---|
protected ServoControllerEx |
+controllerEx |
+
controller, direction, limitPositionMax, limitPositionMin, portNumber
MAX_POSITION, MIN_POSITION
Constructor and Description | +
---|
ServoImplEx(ServoControllerEx controller,
+ int portNumber,
+ Servo.Direction direction,
+ ServoConfigurationType servoType) |
+
ServoImplEx(ServoControllerEx controller,
+ int portNumber,
+ ServoConfigurationType servoType) |
+
Modifier and Type | +Method and Description | +
---|---|
PwmControl.PwmRange |
+getPwmRange()
+Returns the current PWM range limits for the servo
+ |
+
boolean |
+isPwmEnabled()
+Returns whether the PWM is energized for this particular servo
+ |
+
void |
+setPwmDisable()
+Individually denergizes the PWM for this particular servo
+ |
+
void |
+setPwmEnable()
+Individually energizes the PWM for this particular servo.
+ |
+
void |
+setPwmRange(PwmControl.PwmRange range)
+Sets the PWM range limits for the servo
+ |
+
close, getConnectionInfo, getController, getDeviceName, getDirection, getManufacturer, getPortNumber, getPosition, getVersion, internalSetPosition, resetDeviceConfigurationForOpMode, scaleRange, setDirection, setPosition
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected ServoControllerEx controllerEx+
public ServoImplEx(ServoControllerEx controller, + int portNumber, + ServoConfigurationType servoType)+
public ServoImplEx(ServoControllerEx controller, + int portNumber, + Servo.Direction direction, + ServoConfigurationType servoType)+
public void setPwmRange(PwmControl.PwmRange range)+
PwmControl
setPwmRange
in interface PwmControl
range
- the new PWM range limits for the servoPwmControl.getPwmRange()
public PwmControl.PwmRange getPwmRange()+
PwmControl
getPwmRange
in interface PwmControl
PwmControl.setPwmRange(PwmRange)
public void setPwmEnable()+
PwmControl
setPwmEnable
in interface PwmControl
PwmControl.setPwmDisable()
,
+PwmControl.isPwmEnabled()
public void setPwmDisable()+
PwmControl
setPwmDisable
in interface PwmControl
PwmControl.setPwmEnable()
public boolean isPwmEnabled()+
PwmControl
isPwmEnabled
in interface PwmControl
PwmControl.setPwmEnable()
public interface SwitchableLight +extends Light+
SwitchableLight
instances are Light
s whose on/off status can be
+ programmatically manipulated.Light
Modifier and Type | +Method and Description | +
---|---|
void |
+enableLight(boolean enable)
+Turns the light on or off.
+ |
+
public class TimestampedData
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
byte[] |
+data
+the data in question
+ |
+
long |
+nanoTime
+the timestamp on the System.nanoTime() clock associated with that data
+ |
+
Constructor and Description | +
---|
TimestampedData() |
+
public class TimestampedI2cData +extends TimestampedData+
TimestampedI2cData
extends TimestampedData
so as to provide an indication
+ of the I2c source from which the data was retrieved.Modifier and Type | +Field and Description | +
---|---|
protected static java.util.concurrent.atomic.AtomicInteger |
+healthStatusSuppressionCount
+internal: keeps track of
+ |
+
I2cAddr |
+i2cAddr
+the I2c address from which the data was read
+ |
+
int |
+register
+the starting register address from which the data was retrieved
+ |
+
data, nanoTime
Constructor and Description | +
---|
TimestampedI2cData() |
+
Modifier and Type | +Method and Description | +
---|---|
static TimestampedI2cData |
+makeFakeData(java.lang.Object deviceHavingProblems,
+ I2cAddr i2cAddr,
+ int ireg,
+ int creg)
+Creates and returns fake I2C data for use in situations where data must be returned but actual
+ data is unavailable.
+ |
+
static void |
+suppressNewHealthWarnings(boolean suppress) |
+
static void |
+suppressNewHealthWarningsWhile(java.lang.Runnable runnable) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public I2cAddr i2cAddr+
public int register+
protected static java.util.concurrent.atomic.AtomicInteger healthStatusSuppressionCount+
public static TimestampedI2cData makeFakeData(java.lang.Object deviceHavingProblems, + I2cAddr i2cAddr, + int ireg, + int creg)+
public static void suppressNewHealthWarningsWhile(java.lang.Runnable runnable)+
public static void suppressNewHealthWarnings(boolean suppress)+
public interface TouchSensor +extends HardwareDevice+
TouchSensor
models a button.HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
double |
+getValue()
+Represents how much force is applied to the touch sensor; for some touch sensors
+ this value will only ever be 0 or 1.
+ |
+
boolean |
+isPressed()
+Return true if the touch sensor is being pressed
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
double getValue()+
boolean isPressed()+
public interface TouchSensorMultiplexer +extends HardwareDevice+
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
int |
+getSwitches() |
+
boolean |
+isTouchSensorPressed(int channel) |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
public interface UltrasonicSensor +extends HardwareDevice+
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
double |
+getUltrasonicLevel()
+Get the Ultrasonic levels from this sensor
+ |
+
java.lang.String |
+status()
+Status of this sensor, in string form
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
public interface VisuallyIdentifiableHardwareDevice
+Modifier and Type | +Method and Description | +
---|---|
void |
+visuallyIdentify(boolean shouldIdentify)
+idempotent
+ |
+
public interface VoltageSensor +extends HardwareDevice+
HardwareDevice.Manufacturer
Modifier and Type | +Method and Description | +
---|---|
double |
+getVoltage()
+Get the current voltage
+ |
+
close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode
Interface | +Description | +
---|---|
AccelerationSensor | +
+ Acceleration Sensor
+ |
+
AnalogInputController | +
+ Interface for working with Analog Controllers
+ |
+
AnalogOutputController | +
+ Interface for working with Analog Controllers
+ |
+
AnalogSensor | +
+ Instances of this interface are sensors whose input is reported as a voltage level
+ to an analog to digital converter.
+ |
+
Blinker | +
+Blinker provides the means to control an LED or a light that can be illuminated in a
+ sequenced pattern of colors and durations. |
+
ColorSensor | +
+ Color Sensor
+ |
+
CompassSensor | +
+ Compass Sensor
+ |
+
CRServo | +
+ CRServo is the central interface supported by continuous rotation servos
+ |
+
DcMotor | +
+ DcMotor interface provides access to full-featured motor functionality.
+ |
+
DcMotorController | +
+ Interface for working with DC Motor Controllers
+ |
+
DcMotorControllerEx | +
+ DcMotorControllerEx is an optional motor controller interface supported by some hardware
+ that provides enhanced motor functionality.
+ |
+
DcMotorEx | +
+ The DcMotorEx interface provides enhanced motor functionality which is available with some
+ hardware devices.
+ |
+
DcMotorSimple | +
+ Instances of DcMotorSimple interface provide a most basic motor-like functionality
+ |
+
DeviceInterfaceModule | +
+ DeviceInterfaceModule for working with various devices
+ |
+
DeviceManager | ++ |
DigitalChannel | +
+DigitalChannel is an interface by which digital channels can be controlled. |
+
DigitalChannelController | +
+ Interface for working with Digital Channel Controllers
+ |
+
DistanceSensor | +
+ The
+DistanceSensor may be found on hardware sensors which measure distance
+ by one means or another. |
+
Engagable | +
+ The engageable interface can be used to temporarily disengage higher-level hardware objects
+ from the services they manipulate, then later be able to re-engage them.
+ |
+
Gamepad.GamepadCallback | +
+ Optional callback interface for monitoring changes due to MotionEvents and KeyEvents.
+ |
+
Gyroscope | +
+ The
+Gyroscope interface exposes core, fundamental functionality that
+ is applicable to all gyroscopes: that of reporting angular rotation rate. |
+
GyroSensor | +
+ Gyro Sensor
+ |
+
HardwareDevice | +
+ Interface used by Hardware Devices
+ |
+
HardwareDeviceCloseOnTearDown | +
+ Instances of
+HardwareDeviceCloseOnTearDown are those which should be
+ automatically closed when we we 'teardown' a robot |
+
HardwareDeviceHealth | +
+HardwareDeviceHealth provides an indication of the perceived health of a hardware device |
+
I2cAddrConfig | +
+I2cAddrConfig allows the runtime I2C address used with a sensor to be changed
+ or queried. |
+
I2cAddressableDevice | +
+I2cAddressableDevice provides a means by which the address of a device
+ living on an I2C bus can be retrieved. |
+
I2cController | +
+ Interface for working with Digital Channel Controllers
+ |
+
I2cController.I2cPortReadyBeginEndNotifications | +
+ A callback interface through which a client can learn when portIsReady callbacks
+ begin and then later end.
+ |
+
I2cController.I2cPortReadyCallback | +
+ Callback interface for I2C port ready notifications
+ |
+
I2cControllerPortDevice | +
+ The I2cControllerPortDevice interface should be supported by hardware devices which
+ occupy a port on an I2cController.
+ |
+
I2cDevice | +
+ The
+I2cDevice interface abstracts the engine used to interact on with a specific I2c device
+ on a port of an I2cController . |
+
I2cDeviceSynch | +
+I2cDeviceSynch is an interface that exposes functionality for interacting with I2c
+ devices. |
+
I2cDeviceSynchReadHistory | +
+I2cDeviceSynchReadHistory provides a means by which one can be guaranteed
+ to be informed of all data read by through an I2cDeviceSynch . |
+
I2cDeviceSynchSimple | +
+ I2cDeviceSyncSimple is an interface that provides simple synchronous read and write
+ functionality to an I2c device.
+ |
+
IntegratingGyroscope | +
+ For gyroscopes which perform angular rotation rate integration inside the sensor,
+
+IntegratingGyroscope provides a means by which the integrated rotation
+ can be easily retrieved. |
+
IrSeekerSensor | +
+ IR Seeker Sensor
+ |
+
LegacyModule | +
+ Legacy Module for working with NXT devices.
+ |
+
LegacyModulePortDevice | +
+ The LegacyModulePortDevice interface should be supported by hardware devices which
+ occupy a port on a LegacyModule.
+ |
+
Light | +
+Light instances are sources of illumination. |
+
LightSensor | +
+ Light Sensor
+ |
+
NormalizedColorSensor | +
+NormalizedColorSensor returns color sensor data in standardized units, which
+ provides a measure of absolute color color intensity beyond the relative
+ intensities available using ColorSensor . |
+
OpticalDistanceSensor | +
+OpticalDistanceSensor is a LightSensor whose reported light intensities
+ reflect (pun intended) a relationship to distance. |
+
OrientationSensor | +
+OrientationSensor provides access to sensors which measure absolute orientation |
+
PwmControl | +
+ For hardware devices which are manipulated using a pulse width modulation (PWM) signal,
+ the
+PwmControl interface provides control of the width of pulses used and whether
+ the PWM is enabled or disabled. |
+
PWMOutput | +
+ Created by bob on 2016-03-12.
+ |
+
PWMOutputController | +
+ Interface for working with PWM Input Controllers
+ |
+
PWMOutputControllerEx | +
+ Created by bob on 2016-03-12.
+ |
+
PWMOutputEx | +
+ Created by bob on 2016-03-12.
+ |
+
RobotConfigNameable | +
+RobotConfigNameable provides access to the name by which a device has been configured
+ within a robot configuration |
+
RobotCoreLynxModule | +
+RobotCoreLynxModule is the view of a Lynx Module available at the RobotCore layer. |
+
RobotCoreLynxUsbDevice | +
+ RobotCoreLynxUsbDevice is the subset of the functionality of the LynxUsbDevice
+ which is accessible from the RobotCore subsystem.
+ |
+
Servo | +
+ Instances of Servo interface provide access to servo hardware devices.
+ |
+
ServoController | +
+ Interface for working with Servo Controllers
+ |
+
ServoControllerEx | +
+ ServoControllerEx is an optional servo controller interface supported by some hardware
+ that provides enhanced servo functionality.
+ |
+
SwitchableLight | +
+SwitchableLight instances are Light s whose on/off status can be
+ programmatically manipulated. |
+
TouchSensor | +
+TouchSensor models a button. |
+
TouchSensorMultiplexer | +
+ NXT Touch Sensor Multiplexer.
+ |
+
UltrasonicSensor | ++ |
VisuallyIdentifiableHardwareDevice | ++ |
VoltageSensor | +
+ Voltage Sensor
+ |
+
Class | +Description | +
---|---|
AnalogInput | +
+ Control a single analog device
+ |
+
AnalogOutput | +
+ Control a single analog device
+ |
+
Blinker.Step | +
+Blinker.Step represents a particular color held for a particular length of time. |
+
CRServoImpl | +
+ ContinuousRotationServoImpl provides an implementation of continuous
+ rotation servo functionality.
+ |
+
CRServoImplEx | +
+ CRServoEx provides access to extended functionality on continuous rotation
+ servos.
+ |
+
DcMotorImpl | +
+ Control a DC Motor attached to a DC Motor Controller
+ |
+
DcMotorImplEx | ++ + | +
DigitalChannelImpl | +
+ Control a single digital channel
+ |
+
Gamepad | +
+ Monitor a hardware gamepad.
+ |
+
HardwareDeviceHealthImpl | +
+HardwareDeviceHealthImpl provides a delegatable-to implemenatation of HardwareDeviceHealth |
+
HardwareMap | +
+ HardwareMap provides a means of retrieving runtime HardwareDevice instances according to the
+ names with which the corresponding physical devices were associated during robot configuration.
+ |
+
I2cAddr | +
+ I2cAddr represents an address on an I2C bus.
+ |
+
I2cControllerPortDeviceImpl | ++ |
I2cDeviceImpl | +
+ Control a single I2C Device
+ |
+
I2cDeviceReader | +
+ Monitor an I2C Device and read in the most current values
+ |
+
I2cDeviceSynch.HeartbeatAction | +
+ Instances of HeartBeatAction indicate what action to carry out to perform
+ a heartbeat should that become necessary.
+ |
+
I2cDeviceSynch.ReadWindow | +
+ RegWindow is a utility class for managing the window of I2C register bytes that
+ are read from our I2C device on every hardware cycle
+ |
+
I2cDeviceSynchDevice<DEVICE_CLIENT extends I2cDeviceSynchSimple> | +
+I2cDeviceSynchDevice instances are I2c devices which are built on top of
+ I2cDeviceSynchSimple instances or subclasses thereof. |
+
I2cDeviceSynchDeviceWithParameters<DEVICE_CLIENT extends I2cDeviceSynchSimple,PARAMETERS> | +
+I2cDeviceSynchDeviceWithParameters adds to I2cDeviceSynchDevice support for
+ sensors that can be publicly initialized with parameter block of a particular type. |
+
I2cDeviceSynchImpl | +
+I2cDeviceSynchImpl is a utility class that makes it easy to read or write data to
+ an instance of I2cDevice . |
+
I2cDeviceSynchImplOnSimple | +
+ I2cDeviceSynchImplOnSimple takes an I2cDeviceSynchSimple and adds to it heartbeat and
+ readwindow functionality.
+ |
+
I2cDeviceSynchReadHistoryImpl | +
+I2cDeviceSynchReadHistoryImpl is a helper class providing an implementation
+ of the I2c read history queue |
+
IrSeekerSensor.IrSeekerIndividualSensor | +
+ IR Sensor attached to an IR Seeker
+ |
+
LED | ++ |
LegacyModulePortDeviceImpl | ++ |
LightBlinker | +
+ A
+LightBlinker is a handy utility that will flash a SwitchableLight
+ in a pattern of timed durations, and, optionally, colors, if the light supports same (NYI) |
+
LightMultiplexor | +
+ A
+LightMultiplexor adapts a second SwitchableLight by adding reference
+ counting to SwitchableLight.enableLight(boolean) : the light will be lit if the net
+ number of enables is greater than zero. |
+
LynxModuleMeta | +
+LynxModuleMeta has simple lynx module meta information for transmission from RC to DS |
+
LynxModuleMetaList | +
+LynxModuleMetaList is a container of RobotCoreLynxModule s. |
+
NormalizedRGBA | +
+NormalizedRGBA instances represent a set of normalized color values. |
+
PIDCoefficients | +
+PIDCoefficients conveys a set of configuration parameters for a PID algorithm. |
+
PIDFCoefficients | +
+PIDFCoefficients conveys a set of configuration parameters for a PIDF algorithm,
+ a PID algorithm which includes an additional feed-forward term. |
+
PwmControl.PwmRange | +
+ PwmRange instances are used to specify the upper and lower pulse widths
+ and overall framing rate for a servo.
+ |
+
PWMOutputImpl | +
+ Control a single digital port
+ |
+
PWMOutputImplEx | +
+ Created by bob on 2016-03-12.
+ |
+
ScannedDevices | +
+ScannedDevices is a simple distinguished kind of map of serial numbers
+ to device types. |
+
ScannedDevices.MapAdapter | +
+ There *has* to be an easier way here, somehow.
+ |
+
ServoImpl | +
+ ServoImpl provides an implementation of the Servo interface that operates on top
+ of an instance of the ServoController interface.
+ |
+
ServoImplEx | +
+ ServoImplEx provides access to extended functionality on servos.
+ |
+
TimestampedData | +
+ TimestampedData pairs together data which has been read with the timestamp at which
+ the read occurred, as best that can be determined
+ |
+
TimestampedI2cData | +
+TimestampedI2cData extends TimestampedData so as to provide an indication
+ of the I2c source from which the data was retrieved. |
+
Enum | +Description | +
---|---|
CompassSensor.CompassMode | ++ |
ControlSystem | +
+ Used to specify what type of control system a particular piece of hardware is connected to
+ |
+
DcMotor.RunMode | +
+ The run mode of a motor
+DcMotor.RunMode controls how the motor interprets the
+ it's parameter settings passed through power- and encoder-related methods. |
+
DcMotor.ZeroPowerBehavior | +
+ ZeroPowerBehavior provides an indication as to a motor's behavior when a power level of zero
+ is applied.
+ |
+
DcMotorSimple.Direction | +
+ DcMotors can be configured to internally reverse the values
+ to which, e.g., their motor power is set.
+ |
+
DeviceManager.UsbDeviceType | +
+ Enum of known USB Device Types
+ |
+
DigitalChannel.Mode | +
+ Digital channel mode - input or output
+ |
+
DigitalChannelController.Mode | +Deprecated
+ use
+DigitalChannel.Mode instead |
+
HardwareDevice.Manufacturer | ++ |
HardwareDeviceHealth.HealthStatus | ++ |
I2cDeviceSynch.ReadMode | +
+I2cDeviceSynch.ReadMode controls whether when asked to read we read only once or read multiple times. |
+
I2cDeviceSynchImpl.CONTROLLER_PORT_MODE | ++ |
I2cDeviceSynchImpl.READ_CACHE_STATUS | ++ |
I2cDeviceSynchImpl.WRITE_CACHE_STATUS | ++ |
I2cWaitControl | +
+ Values in
+I2cWaitControl control the semantics of waiting on I2c writes |
+
IrSeekerSensor.Mode | +
+ Enumeration of device modes
+ |
+
MotorControlAlgorithm | +
+ indicates the control algorithm variant to use with
+
+DcMotor.RunMode.RUN_TO_POSITION and DcMotor.RunMode.RUN_USING_ENCODER . |
+
Servo.Direction | +
+ Servos can be configured to internally reverse the values
+ to which their positioning power is set.
+ |
+
ServoController.PwmStatus | +
+ PWM Status - is pwm enabled?
+ |
+
+ Contains libraries for working with gamepads, DC motor controllers, servo controllers, and more.
public static enum ElapsedTime.Resolution +extends java.lang.Enum<ElapsedTime.Resolution>+
ElapsedTime.ElapsedTime(Resolution)
Enum Constant and Description | +
---|
MILLISECONDS |
+
SECONDS |
+
Modifier and Type | +Method and Description | +
---|---|
static ElapsedTime.Resolution |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static ElapsedTime.Resolution[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final ElapsedTime.Resolution SECONDS+
public static final ElapsedTime.Resolution MILLISECONDS+
public static ElapsedTime.Resolution[] values()+
+for (ElapsedTime.Resolution c : ElapsedTime.Resolution.values()) + System.out.println(c); +
public static ElapsedTime.Resolution valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic class ElapsedTime
+extends java.lang.Object
+ElapsedTime
class provides a simple handy timer to measure elapsed time intervals.
+ The timer does not provide events or callbacks, as some other timers do. Rather, at an application-
+ determined juncture, one can reset()
the timer. Thereafter, one can query the interval
+ of wall-clock time that has subsequently elapsed by calling the time()
, seconds()
,
+ or milliseconds()
methods. The timer has nanosecond internal accuracy. The precision
+ reported by the time()
method is either seconds or milliseconds, depending on how the
+ timer is initially constructed.
+
+ This class is thread-safe.Modifier and Type | +Class and Description | +
---|---|
static class |
+ElapsedTime.Resolution
+An indicator of the resolution of a timer.
+ |
+
Modifier and Type | +Field and Description | +
---|---|
static long |
+MILLIS_IN_NANO
+the number of nanoseconds in a millisecond
+ |
+
protected long |
+nsStartTime |
+
protected double |
+resolution |
+
static long |
+SECOND_IN_NANO
+the number of nanoseconds in a second
+ |
+
Constructor and Description | +
---|
ElapsedTime()
+Creates a timer with resolution
+Resolution.Seconds
+ that is initialized with the now-current time. |
+
ElapsedTime(ElapsedTime.Resolution resolution)
+Creates a timer with a resolution of seconds or milliseconds.
+ |
+
ElapsedTime(long startTime)
+Creates a timer with resolution
+Resolution.Seconds . |
+
Modifier and Type | +Method and Description | +
---|---|
ElapsedTime.Resolution |
+getResolution()
+Returns the resolution with which the timer was instantiated.
+ |
+
void |
+log(java.lang.String label)
+Log a message stating how long the timer has been running
+ |
+
double |
+milliseconds()
+Returns the duration that has elapsed since the last reset of this timer in milliseconds
+ |
+
long |
+nanoseconds()
+Returns the duration that has elapsed since the last reset of this timer in nanoseconds
+ |
+
long |
+now(java.util.concurrent.TimeUnit unit)
+Returns the current time on the clock used by the timer
+ |
+
protected long |
+nsNow() |
+
void |
+reset()
+Resets the internal state of the timer to reflect the current time.
+ |
+
double |
+seconds()
+Returns the duration that has elapsed since the last reset of this timer in seconds
+ |
+
double |
+startTime()
+Returns, in resolution-dependent units, the time at which this timer was last reset.
+ |
+
long |
+startTimeNanoseconds()
+Returns the time at which the timer was last reset, in units of nanoseconds
+ |
+
double |
+time()
+Returns the duration that has elapsed since the last reset of this timer.
+ |
+
long |
+time(java.util.concurrent.TimeUnit unit)
+Returns the duration that has elapsed since the last reset of this timer
+ as an integer in the units requested.
+ |
+
java.lang.String |
+toString()
+Returns a string indicating the current elapsed time of the timer.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public static final long SECOND_IN_NANO+
public static final long MILLIS_IN_NANO+
protected volatile long nsStartTime+
protected final double resolution+
public ElapsedTime()+
Resolution.Seconds
+ that is initialized with the now-current time.ElapsedTime(long)
,
+ElapsedTime(Resolution)
public ElapsedTime(long startTime)+
Resolution.Seconds
.
+ The timer is initialized with the provided start time. Zero is often a useful value to provide
+ here: in common usage such timers will often be processed by application logic virtually immediately.startTime
- the initial value of the timerElapsedTime()
public ElapsedTime(ElapsedTime.Resolution resolution)+
time()
method reports. The timer is initialized
+ with the current time.resolution
- the resolution of the new timerElapsedTime()
protected long nsNow()+
public long now(java.util.concurrent.TimeUnit unit)+
unit
- the time unit in which the current time should be returnedpublic void reset()+
time()
will report as zero.time()
public double startTime()+
public long startTimeNanoseconds()+
public double time()+
ElapsedTime()
,
+ElapsedTime(Resolution)
,
+seconds()
,
+milliseconds()
public long time(java.util.concurrent.TimeUnit unit)+
unit
- the units in which to return the answerpublic double seconds()+
time()
public double milliseconds()+
time()
public long nanoseconds()+
time()
public ElapsedTime.Resolution getResolution()+
public void log(java.lang.String label)+
public java.lang.String toString()+
toString
in class java.lang.Object
public class Range
+extends java.lang.Object
+Modifier and Type | +Method and Description | +
---|---|
static byte |
+clip(byte number,
+ byte min,
+ byte max)
+clip 'number' if 'number' is less than 'min' or greater than 'max'
+ |
+
static double |
+clip(double number,
+ double min,
+ double max)
+clip 'number' if 'number' is less than 'min' or greater than 'max'
+ |
+
static float |
+clip(float number,
+ float min,
+ float max)
+clip 'number' if 'number' is less than 'min' or greater than 'max'
+ |
+
static int |
+clip(int number,
+ int min,
+ int max)
+clip 'number' if 'number' is less than 'min' or greater than 'max'
+ |
+
static short |
+clip(short number,
+ short min,
+ short max)
+clip 'number' if 'number' is less than 'min' or greater than 'max'
+ |
+
static double |
+scale(double n,
+ double x1,
+ double x2,
+ double y1,
+ double y2)
+Scale a number in the range of x1 to x2, to the range of y1 to y2
+ |
+
static void |
+throwIfRangeIsInvalid(double number,
+ double min,
+ double max)
+Throw an IllegalArgumentException if 'number' is less than 'min' or greater than 'max'
+ |
+
static void |
+throwIfRangeIsInvalid(int number,
+ int min,
+ int max)
+Throw an IllegalArgumentException if 'number' is less than 'min' or greater than 'max'
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static double scale(double n, + double x1, + double x2, + double y1, + double y2)+
n
- number to scalex1
- lower bound range of nx2
- upper bound range of ny1
- lower bound of scaley2
- upper bound of scalepublic static double clip(double number, + double min, + double max)+
number
- number to testmin
- minimum value allowedmax
- maximum value allowedpublic static float clip(float number, + float min, + float max)+
number
- number to testmin
- minimum value allowedmax
- maximum value allowedpublic static int clip(int number, + int min, + int max)+
number
- number to testmin
- minimum value allowedmax
- maximum value allowedpublic static short clip(short number, + short min, + short max)+
number
- number to testmin
- minimum value allowedmax
- maximum value allowedpublic static byte clip(byte number, + byte min, + byte max)+
number
- number to testmin
- minimum value allowedmax
- maximum value allowedpublic static void throwIfRangeIsInvalid(double number, + double min, + double max) + throws java.lang.IllegalArgumentException+
number
- number to testmin
- minimum value allowedmax
- maximum value allowedjava.lang.IllegalArgumentException
- if number is outside of rangepublic static void throwIfRangeIsInvalid(int number, + int min, + int max) + throws java.lang.IllegalArgumentException+
number
- number to testmin
- minimum value allowedmax
- maximum value allowedjava.lang.IllegalArgumentException
- if number is outside of rangepublic abstract class SerialNumber
+extends java.lang.Object
+implements java.io.Serializable
+SerialNumber
represent serial number indentifiers of hardware devices. For
+ USB-attached devices, these are usually the low-level USB serial number (see UsbDevice.getSerialNumber()
,
+ but that is not required. Rather, the notion of SerialNumber
is a general purpose one
+ representing a user-visible digital identity for a particular device instance.
+
+ 'Fake' serial numbers are serial numbers that will *never* appear for a real device; they
+ are useful, for example, as the serial number of a ControllerConfiguration
that
+ has not yet been associated with a actual controller device. Fake serial numbers are never
+ shown to users.
+
+ Note that *all* serial numbers loaded in memory at any given instant are guaranteed unique and
+ different, even the fake ones; this allows code that processes USB-device-bound ControllerConfiguration
s to operate easily on unbound ones as well, a significant coding
+ simplification. The technology used in fake serial numbers, UUID
s, in fact guarantees
+ uniqueness across space and time, so fake serial numbers can be recorded persistently and
+ still maintain uniqueness. Historically, non-unique 'fake' serial numbers were also used: these
+ appeared int the form of "-1" or "N/A". When loaded from persistent storage, such legacy
+ fake serial numbers are converted to unique ones to maintain the uniqueness guarantee.Modifier and Type | +Field and Description | +
---|---|
protected static java.util.HashMap<java.lang.String,java.lang.String> |
+deviceDisplayNames |
+
protected static java.lang.String |
+embedded |
+
protected static java.lang.String |
+fakePrefix |
+
protected static java.lang.String |
+lynxModulePrefix |
+
protected java.lang.String |
+serialNumberString |
+
protected static java.lang.String |
+vendorProductPrefix |
+
Modifier | +Constructor and Description | +
---|---|
protected |
+SerialNumber(java.lang.String serialNumberString)
+Constructs a serial number using the supplied initialization string.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
static SerialNumber |
+createEmbedded() |
+
static SerialNumber |
+createFake() |
+
boolean |
+equals(java.lang.Object object) |
+
boolean |
+equals(java.lang.String string) |
+
static SerialNumber |
+fromString(java.lang.String serialNumberString) |
+
static SerialNumber |
+fromStringOrNull(java.lang.String serialNumberString) |
+
static SerialNumber |
+fromUsbOrNull(java.lang.String serialNumberString) |
+
static SerialNumber |
+fromVidPid(int vid,
+ int pid,
+ java.lang.String connectionPath)
+Makes up a serial-number-like-thing for USB devices that internally lack a serial number.
+ |
+
static java.lang.String |
+getDeviceDisplayName(SerialNumber serialNumber) |
+
SerialNumber |
+getScannableDeviceSerialNumber()
+Returns the
+SerialNumber of the device associated with this one that would appear
+ in a ScannedDevices . |
+
java.lang.String |
+getString()
+Returns the string contents of the serial number.
+ |
+
int |
+hashCode() |
+
boolean |
+isEmbedded()
+Returns whether the serial number is the one used for the embedded
+ Expansion Hub inside a Rev Control Hub.
+ |
+
boolean |
+isFake()
+Returns whether the indicated serial number is one of the legacy
+ fake serial number forms or not.
+ |
+
boolean |
+isUsb()
+Returns whether the serial number is one of an actual USB device.
+ |
+
boolean |
+isVendorProduct() |
+
boolean |
+matches(java.lang.Object pattern) |
+
static void |
+noteSerialNumberType(SerialNumber serialNumber,
+ java.lang.String typeName) |
+
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
protected static final java.lang.String fakePrefix+
protected static final java.lang.String vendorProductPrefix+
protected static final java.lang.String lynxModulePrefix+
protected static final java.lang.String embedded+
protected final java.lang.String serialNumberString+
protected static final java.util.HashMap<java.lang.String,java.lang.String> deviceDisplayNames+
protected SerialNumber(java.lang.String serialNumberString)+
serialNumberString
- the initialization string for the serial number.public static SerialNumber createFake()+
public static SerialNumber createEmbedded()+
public static SerialNumber fromString(java.lang.String serialNumberString)+
public static SerialNumber fromStringOrNull(java.lang.String serialNumberString)+
public static SerialNumber fromUsbOrNull(java.lang.String serialNumberString)+
public static SerialNumber fromVidPid(int vid, + int pid, + java.lang.String connectionPath)+
public boolean isVendorProduct()+
public boolean isFake()+
public boolean isUsb()+
public boolean isEmbedded()+
public java.lang.String getString()+
Object.toString()
public SerialNumber getScannableDeviceSerialNumber()+
SerialNumber
of the device associated with this one that would appear
+ in a ScannedDevices
.public boolean matches(java.lang.Object pattern)+
public boolean equals(java.lang.Object object)+
equals
in class java.lang.Object
public boolean equals(java.lang.String string)+
public int hashCode()+
hashCode
in class java.lang.Object
public static void noteSerialNumberType(SerialNumber serialNumber, + java.lang.String typeName)+
public static java.lang.String getDeviceDisplayName(SerialNumber serialNumber)+
public class TypeConversion
+extends java.lang.Object
+Modifier and Type | +Method and Description | +
---|---|
static int |
+byteArrayToInt(byte[] byteArray)
+convert a byte array into an int; big endian is assumed
+ |
+
static int |
+byteArrayToInt(byte[] byteArray,
+ java.nio.ByteOrder byteOrder)
+convert a byte array into an int
+ |
+
static long |
+byteArrayToLong(byte[] byteArray)
+convert a byte array into a long; big endian is assumed
+ |
+
static long |
+byteArrayToLong(byte[] byteArray,
+ java.nio.ByteOrder byteOrder)
+convert a byte array into a long
+ |
+
static short |
+byteArrayToShort(byte[] byteArray)
+convert a byte array into a short; big endian is assumed
+ |
+
static short |
+byteArrayToShort(byte[] byteArray,
+ java.nio.ByteOrder byteOrder)
+convert a byte array into a short
+ |
+
static short |
+byteArrayToShort(byte[] byteArray,
+ int ibFirst,
+ java.nio.ByteOrder byteOrder) |
+
static double |
+doubleFromFixed(int value,
+ int fractionBits) |
+
static double |
+doubleFromFixed(long value,
+ int fractionBits) |
+
static int |
+doubleToFixedInt(double value,
+ int fractionBits) |
+
static long |
+doubleToFixedLong(double value,
+ int fractionBits) |
+
static byte[] |
+intToByteArray(int integer)
+convert an int into a byte array; big endian is assumed
+ |
+
static byte[] |
+intToByteArray(int integer,
+ java.nio.ByteOrder byteOrder)
+convert an int into a byte array
+ |
+
static byte[] |
+longToByteArray(long longInt)
+convert a long into a byte array; big endian is assumed
+ |
+
static byte[] |
+longToByteArray(long longInt,
+ java.nio.ByteOrder byteOrder)
+convert a long into a byte array
+ |
+
static byte[] |
+shortToByteArray(short shortInt)
+convert a short into a byte array; big endian is assumed
+ |
+
static byte[] |
+shortToByteArray(short shortInt,
+ java.nio.ByteOrder byteOrder)
+convert a short into a byte array
+ |
+
static byte[] |
+stringToUtf8(java.lang.String javaString)
+Convert a Java String into a UTF-8 byte array
+ |
+
static boolean |
+toBoolean(java.lang.Boolean value) |
+
static boolean |
+toBoolean(java.lang.Boolean value,
+ boolean defaultValue) |
+
static double |
+unsignedByteToDouble(byte b)
+Accept a byte, treat that byte as an unsigned byte, then covert it to the return type
+ |
+
static int |
+unsignedByteToInt(byte b)
+Accept a byte, treat that byte as an unsigned byte, then covert it to the return type
+ |
+
static long |
+unsignedIntToLong(int i)
+Accept an int, treat that int as an unsigned int, then covert it to the return type
+ |
+
static int |
+unsignedShortToInt(short s)
+Treats a short as an unsigned value and returns that value as a int
+ |
+
static java.lang.String |
+utf8ToString(byte[] utf8String) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static byte[] shortToByteArray(short shortInt)+
shortInt
- public static byte[] shortToByteArray(short shortInt, + java.nio.ByteOrder byteOrder)+
shortInt
- byteOrder
- public static byte[] intToByteArray(int integer)+
integer
- public static byte[] intToByteArray(int integer, + java.nio.ByteOrder byteOrder)+
integer
- byteOrder
- public static byte[] longToByteArray(long longInt)+
longInt
- public static byte[] longToByteArray(long longInt, + java.nio.ByteOrder byteOrder)+
longInt
- byteOrder
- public static short byteArrayToShort(byte[] byteArray)+
byteArray
- public static short byteArrayToShort(byte[] byteArray, + java.nio.ByteOrder byteOrder)+
byteArray
- byteOrder
- public static short byteArrayToShort(byte[] byteArray, + int ibFirst, + java.nio.ByteOrder byteOrder)+
public static int byteArrayToInt(byte[] byteArray)+
byteArray
- public static int byteArrayToInt(byte[] byteArray, + java.nio.ByteOrder byteOrder)+
byteArray
- byteOrder
- public static long byteArrayToLong(byte[] byteArray)+
byteArray
- public static long byteArrayToLong(byte[] byteArray, + java.nio.ByteOrder byteOrder)+
byteArray
- byteOrder
- public static int unsignedByteToInt(byte b)+
b
- byte to treat as unsigned bytepublic static int unsignedShortToInt(short s)+
s
- the short to be converted to an intpublic static double unsignedByteToDouble(byte b)+
b
- byte to treat as unsigned bytepublic static long unsignedIntToLong(int i)+
i
- int to treat as unsigned intpublic static byte[] stringToUtf8(java.lang.String javaString)+
javaString
- Java String to convertjava.lang.IllegalArgumentException
- if unable to cleanly convert the Java Stringpublic static int doubleToFixedInt(double value, + int fractionBits)+
public static double doubleFromFixed(int value, + int fractionBits)+
public static long doubleToFixedLong(double value, + int fractionBits)+
public static double doubleFromFixed(long value, + int fractionBits)+
public static java.lang.String utf8ToString(byte[] utf8String)+
public static boolean toBoolean(java.lang.Boolean value)+
public static boolean toBoolean(java.lang.Boolean value, + boolean defaultValue)+
Class | +Description | +
---|---|
ElapsedTime | +
+ The
+ElapsedTime class provides a simple handy timer to measure elapsed time intervals. |
+
Range | +
+ Utility class for performing range operations
+ |
+
SerialNumber | +
+ Instances of
+SerialNumber represent serial number indentifiers of hardware devices. |
+
TypeConversion | +
+ Utility class for performing type conversions
+ |
+
Enum | +Description | +
---|---|
ElapsedTime.Resolution | +
+ An indicator of the resolution of a timer.
+ |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+CMD_ACTIVATE_CONFIGURATION |
+"CMD_ACTIVATE_CONFIGURATION" |
+
+
+public static final java.lang.String |
+CMD_DELETE_CONFIGURATION |
+"CMD_DELETE_CONFIGURATION" |
+
+
+public static final java.lang.String |
+CMD_DISCOVER_LYNX_MODULES |
+"CMD_DISCOVER_LYNX_MODULES" |
+
+
+public static final java.lang.String |
+CMD_DISCOVER_LYNX_MODULES_RESP |
+"CMD_DISCOVER_LYNX_MODULES_RESP" |
+
+
+public static final java.lang.String |
+CMD_GET_CANDIDATE_LYNX_FIRMWARE_IMAGES |
+"CMD_GET_CANDIDATE_LYNX_FIRMWARE_IMAGES" |
+
+
+public static final java.lang.String |
+CMD_GET_CANDIDATE_LYNX_FIRMWARE_IMAGES_RESP |
+"CMD_GET_CANDIDATE_LYNX_FIRMWARE_IMAGES_RESP" |
+
+
+public static final java.lang.String |
+CMD_GET_USB_ACCESSIBLE_LYNX_MODULES |
+"CMD_GET_USB_ACCESSIBLE_LYNX_MODULES" |
+
+
+public static final java.lang.String |
+CMD_GET_USB_ACCESSIBLE_LYNX_MODULES_RESP |
+"CMD_GET_USB_ACCESSIBLE_LYNX_MODULES_RESP" |
+
+
+public static final java.lang.String |
+CMD_INIT_OP_MODE |
+"CMD_INIT_OP_MODE" |
+
+
+public static final java.lang.String |
+CMD_LYNX_ADDRESS_CHANGE |
+"CMD_LYNX_ADDRESS_CHANGE" |
+
+
+public static final java.lang.String |
+CMD_LYNX_FIRMWARE_UPDATE |
+"CMD_LYNX_FIRMWARE_UPDATE" |
+
+
+public static final java.lang.String |
+CMD_LYNX_FIRMWARE_UPDATE_RESP |
+"CMD_LYNX_FIRMWARE_UPDATE_RESP" |
+
+
+public static final java.lang.String |
+CMD_PROGRAMMING_MODE_LOG_NOTIFICATION |
+"CMD_PROGRAMMING_MODE_LOG_NOTIFICATION" |
+
+
+public static final java.lang.String |
+CMD_PROGRAMMING_MODE_PING_NOTIFICATION |
+"CMD_PROGRAMMING_MODE_PING_NOTIFICATION" |
+
+
+public static final java.lang.String |
+CMD_REQUEST_CONFIGURATION_TEMPLATES |
+"CMD_REQUEST_CONFIGURATION_TEMPLATES" |
+
+
+public static final java.lang.String |
+CMD_REQUEST_CONFIGURATION_TEMPLATES_RESP |
+"CMD_REQUEST_CONFIGURATION_TEMPLATES_RESP" |
+
+
+public static final java.lang.String |
+CMD_REQUEST_CONFIGURATIONS |
+"CMD_REQUEST_CONFIGURATIONS" |
+
+
+public static final java.lang.String |
+CMD_REQUEST_CONFIGURATIONS_RESP |
+"CMD_REQUEST_CONFIGURATIONS_RESP" |
+
+
+public static final java.lang.String |
+CMD_REQUEST_PARTICULAR_CONFIGURATION |
+"CMD_REQUEST_PARTICULAR_CONFIGURATION" |
+
+
+public static final java.lang.String |
+CMD_REQUEST_PARTICULAR_CONFIGURATION_RESP |
+"CMD_REQUEST_PARTICULAR_CONFIGURATION_RESP" |
+
+
+public static final java.lang.String |
+CMD_REQUEST_REMEMBERED_GROUPS |
+"CMD_REQUEST_REMEMBERED_GROUPS" |
+
+
+public static final java.lang.String |
+CMD_REQUEST_REMEMBERED_GROUPS_RESP |
+"CMD_REQUEST_REMEMBERED_GROUPS_RESP" |
+
+
+public static final java.lang.String |
+CMD_RESTART_ROBOT |
+"CMD_RESTART_ROBOT" |
+
+
+public static final java.lang.String |
+CMD_RUN_OP_MODE |
+"CMD_RUN_OP_MODE" |
+
+
+public static final java.lang.String |
+CMD_SAVE_CONFIGURATION |
+"CMD_SAVE_CONFIGURATION" |
+
+
+public static final java.lang.String |
+CMD_SCAN |
+"CMD_SCAN" |
+
+
+public static final java.lang.String |
+CMD_SCAN_RESP |
+"CMD_SCAN_RESP" |
+
+
+public static final java.lang.String |
+CMD_SET_MATCH_NUMBER |
+"CMD_SET_MATCH_NUMBER" |
+
+
+public static final java.lang.String |
+CMD_START_DS_PROGRAM_AND_MANAGE |
+"CMD_START_DS_PROGRAM_AND_MANAGE" |
+
+
+public static final java.lang.String |
+CMD_START_DS_PROGRAM_AND_MANAGE_RESP |
+"CMD_START_DS_PROGRAM_AND_MANAGE_RESP" |
+
+
+public static final java.lang.String |
+CMD_START_PROGRAMMING_MODE |
+"CMD_START_PROGRAMMING_MODE" |
+
+
+public static final java.lang.String |
+CMD_START_PROGRAMMING_MODE_RESP |
+"CMD_START_PROGRAMMING_MODE_RESP" |
+
+
+public static final java.lang.String |
+CMD_STOP_PROGRAMMING_MODE |
+"CMD_STOP_PROGRAMMING_MODE" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+Command |
+"CMD_PLAY_SOUND" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+Command |
+"CMD_REQUEST_SOUND" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+Command |
+"CMD_STOP_PLAYING_SOUNDS" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+Command |
+"CMD_VISUALLY_IDENTIFY" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+TAG |
+"ConfigWifiDirectActivity" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+TAG |
+"FtcDriverStationAboutActivity" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+protected static final java.lang.String |
+CLIENT_CONNECTED |
+"CLIENT_CONNECTED" |
+
+
+public static final java.lang.String |
+TAG |
+"FtcAdvancedRCSettingsActivity" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+TAG |
+"FtcEventLoop" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+protected static final boolean |
+DEBUG |
+false |
+
+
+public static final java.lang.String |
+NO_VOLTAGE_SENSOR |
+"$no$voltage$sensor$" |
+
+
+public static final java.lang.String |
+TAG |
+"FtcEventLoopHandler" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+TAG |
+"FtcEventLoopIdle" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+TAG |
+"FtcLynxFirmwareUpdateActivity" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+TAG |
+"FtcLynxModuleAddressUpdateActivity" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+TAG |
+"FTCService" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+TAG |
+"FtcWifiDirectChannelSelectorActivity" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+TAG |
+"FtcWifiDirectRememberedGroupsActivity" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+PROGRAMMING_MODE_ACTIVITY_PROGRAMMING_WEB_HANDLERS |
+"PROGRAMMING_MODE_ACTIVITY_PROGRAMMING_WEB_HANDLERS" |
+
+
+public static final java.lang.String |
+RC_WEB_INFO |
+"RC_WEB_INFO" |
+
+
+public static final java.lang.String |
+VIEW_LOGS_ACTIVITY_FILENAME |
+"org.firstinspires.ftc.ftccommon.logFilename" |
+
+
+public static final java.lang.String |
+ZTE_WIFI_CHANNEL_EDITOR_PACKAGE |
+"com.zte.wifichanneleditor" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final int |
+msSoundTransmissionFreshness |
+400 |
+
+
+public static final java.lang.String |
+TAG |
+"SoundPlayer" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final boolean |
+DEBUG |
+false |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+FILENAME |
+"org.firstinspires.ftc.ftccommon.logFilename" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final double |
+TELEMETRY_DEFAULT_INTERVAL |
+0d/0d |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+RC_BATTERY_STATUS_KEY |
+"$RobotController$Battery$Status$" |
+
+
+public static final java.lang.String |
+ROBOT_BATTERY_LEVEL_KEY |
+"$Robot$Battery$Level$" |
+
+
+public static final java.lang.String |
+SYSTEM_ERROR_KEY |
+"$System$Error$" |
+
+
+public static final java.lang.String |
+SYSTEM_NONE_KEY |
+"$System$None$" |
+
+
+public static final java.lang.String |
+SYSTEM_WARNING_KEY |
+"$System$Warning$" |
+
+
+public static final java.lang.String |
+TAG |
+"EventLoopManager" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final int |
+msAbnormalReopenInterval |
+250 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+DEFAULT_OP_MODE_NAME |
+"$Stop$Robot$" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+protected static final double |
+apiPowerMax |
+1.0 |
+
+
+protected static final double |
+apiPowerMin |
+-1.0 |
+
+
+protected static final double |
+apiServoPositionMax |
+1.0 |
+
+
+protected static final double |
+apiServoPositionMin |
+0.0 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final double |
+distanceOutOfRange |
+1.7976931348623157E308 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final int |
+ID_SYNTHETIC |
+-2 |
+
+
+public static final int |
+ID_UNASSOCIATED |
+-1 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final byte |
+I2C_BUFFER_START_ADDRESS |
+4 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final int |
+READ_REGISTER_COUNT_MAX |
+26 |
+
+
+public static final int |
+WRITE_REGISTER_COUNT_MAX |
+26 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+protected static final int |
+dibCacheOverhead |
+4 |
+
+
+protected static final int |
+msCallbackLockAbandon |
+500 |
+
+
+protected static final int |
+msCallbackLockWaitQuantum |
+60 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+TAG |
+"LightBlinker" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final double |
+usFrameDefault |
+20000.0 |
+
+
+public static final double |
+usPulseLowerDefault |
+600.0 |
+
+
+public static final double |
+usPulseUpperDefault |
+2400.0 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+TAG |
+"ScannedDevices" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final double |
+MAX_POSITION |
+1.0 |
+
+
+public static final double |
+MIN_POSITION |
+0.0 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final long |
+MILLIS_IN_NANO |
+1000000L |
+
+
+public static final long |
+SECOND_IN_NANO |
+1000000000L |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+protected static final java.lang.String |
+embedded |
+"(embedded)" |
+
+
+protected static final java.lang.String |
+fakePrefix |
+"FakeUSB:" |
+
+
+protected static final java.lang.String |
+lynxModulePrefix |
+"ExpHub:" |
+
+
+protected static final java.lang.String |
+vendorProductPrefix |
+"VendorProduct:" |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final double |
+earthGravity |
+9.80665 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final float |
+Pif |
+3.1415927410125732f |
+
+
+protected static final double |
+TwoPi |
+6.283185307179586 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final double |
+infinity |
+1.7976931348623157E308 |
+
+
+public static final double |
+mmPerInch |
+25.4 |
+
+
+public static final double |
+mPerInch |
+0.0254 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final double |
+CperF |
+0.5555555555555556 |
+
+
+public static final double |
+zeroCelsiusF |
+32.0 |
+
+
+public static final double |
+zeroCelsiusK |
+273.15 |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final float |
+MM_FTC_FIELD_WIDTH |
+3606.800048828125f |
+
+
+public static final float |
+MM_PER_INCH |
+25.399999618530273f |
+
Modifier and Type | +Constant Field | +Value | +
---|---|---|
+
+public static final java.lang.String |
+TAG |
+"Vuforia" |
+
Class and Description | +
---|
com.qualcomm.robotcore.eventloop.opmode.AnnotatedOpModeRegistrar
+ The function formerly performed by this class is now automatically executed by the system
+ |
+
Enum and Description | +
---|
com.qualcomm.robotcore.hardware.DigitalChannelController.Mode
+ use
+DigitalChannel.Mode instead |
+
Enum Constant and Description | +
---|
com.qualcomm.robotcore.hardware.MotorControlAlgorithm.LegacyPID
+ Switch to
+MotorControlAlgorithm.PIDF instead |
+
com.qualcomm.robotcore.hardware.DcMotor.RunMode.RESET_ENCODERS
+ Use
+DcMotor.RunMode.STOP_AND_RESET_ENCODER instead |
+
com.qualcomm.robotcore.hardware.DcMotor.RunMode.RUN_USING_ENCODERS
+ Use
+DcMotor.RunMode.RUN_USING_ENCODER instead |
+
com.qualcomm.robotcore.hardware.DcMotor.RunMode.RUN_WITHOUT_ENCODERS
+ Use
+DcMotor.RunMode.RUN_WITHOUT_ENCODER instead |
+
The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.
+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+Each annotation type has its own separate page with the following sections:
+Each enum has its own separate page with the following sections:
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object
. The interfaces do not inherit from java.lang.Object
.
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+These links take you to the next or previous class, interface, package, or related page.
+These links show and hide the HTML frames. All pages are available with or without frames.
+The All Classes link shows all classes and interfaces except non-static nested types.
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+The Constant Field Values page lists the static final fields and their values.
+Acceleration
represent the second derivative of Position
over time.Telemetry
immediately following the receiver.Telemetry
immediately following the receiver.Telemetry
immediately following the receiver.Telemetry
immediately following the receiver.Telemetry
.Telemetry
.VuforiaTrackable.Listener
is listening.AngleUnit
represents angles in different units of measure and
+ provides utility methods to convert across units.AngularVelocity
represent an instantaneous body-referenced 3D rotation rate.AxesOrder
indicates the chronological order of axes about which the three rotations
+ of an Orientation
take place.AxesReference
indicates whether we have intrinsic rotations, where the axes
+ move with the object that is rotating, or extrinsic rotations, where they remain fixed
+ in the world around the object.Axis
enumerates the common X,Y,Z three-dimensional orthogonal axes.Blinker
provides the means to control an LED or a light that can be illuminated in a
+ sequenced pattern of colors and durations.Blinker.Step
represents a particular color held for a particular length of time.Camera
to use with Vuforia.VuforiaLocalizer.Parameters.camera
is null and VuforiaLocalizer.Parameters.cameraName
is the 'unknown' camera name, then
+ this value is used to indicate the camera to use with Vuforia.VuforiaLocalizer.Parameters.activity
that will be used
+ as the parent for a live monitor which provides feedback as to what the
+ camera is seeing.VuforiaLocalizer.Parameters.camera
is non-null, this value is ignored.ClassFactory
provides a means by which various objects in the SDK may be logically
+ instantiated without exposing their external class identities to user's programs.Telemetry.Log
I2cDevice.setI2cPortActionFlag()
setsColumnMajorMatrixF
is a dense matrix whose entries are arranged in
+ column-major order.ColumnMatrixF
is a matrix that converts a VectorF into a 1xn matrixConst
documents a method that promises not to change the internal state
+ of the method receiver.Consumer
are functions that act on an instance of a indicated typeFrame
into an Android Bitmap
.createTFObjectDetector
returns
+ an instance of the TensorFlow object detector engine configured with the indicated set of parameters.createVuforia
returns
+ an instance of the Vuforia localizer engine configured with the indicated set of parameters.WebcamName
from the indicated serialized contentsDcMotor.RunMode
controls how the motor interprets the
+ it's parameter settings passed through power- and encoder-related methods.DenseMatrixF
is a matrix of floats whose storage is a contiguous float[] array.DigitalChannel
is an interface by which digital channels can be controlled.DigitalChannel.Mode
insteadAutonomous
or TeleOp
from showing up
+ on the driver station OpMode list.DistanceSensor
may be found on hardware sensors which measure distance
+ by one means or another.DistanceUnit
represents a unit of measure of distance.ElapsedTime
class provides a simple handy timer to measure elapsed time intervals.Resolution.Seconds
+ that is initialized with the now-current time.Resolution.Seconds
.Frame
s that allows
+ VuforiaLocalizer.convertFrameToBitmap(Frame)
to functionSoundPlayer.SoundInfo
; caller must releaseRef()SoundPlayer.SoundInfo
; caller must releaseRef()AxesOrder
FtcAdvancedRCSettingsActivity
manages the editing of advanced RC settingsFtcEventLoopBase
is an abstract base that handles defines core event processing
+ logic that's available whether or not a Robot is currently extant or notFtcEventLoopIdle
is an eventloop that runs whenever a full FtcEventLoop
+ is inappropriate.FtcLynxFirmwareUpdateActivity
manages the updating of the firmware on
+ all available attached lynx modules.FtcLynxModuleAddressUpdateActivity
provides a means by which users can update
+ the (persistently stored) address of a Lynx ModuleFunc
are nullary producers of values.GeneralMatrixF
is a concrete matrix implementation that is supported by
+ a backing store consisting of an array of floats.SerialNumber
, if it exists,
+ cast to the indicated class or interface; otherwise, null.Blinker.Step
s that can be present in a patternCamera
used by Vuforia.VuforiaTrackableDefaultListener.setCameraLocationOnRobot(CameraName, OpenGLMatrix)
CameraManager
which can be used to access the USB webcams
+ attached to the robot controller.Telemetry.log()()
and
+ shown on the driver station display.Telemetry
+ Telemetry.Item
.I2cControllerPortDevice.getI2cController()
is suggested insteadFrame
s are placed
+ as they become available.OpenGLMatrix
transform that represents the location of the robot
+ on in the FTC Field Coordinate System, or null if that cannot be computed.TimestampedI2cData
s are (optionally)
+ placed as they become available.I2cAddressableDevice.getI2cAddress()
instead.I2cDevice.registerForI2cPortReadyCallback(com.qualcomm.robotcore.hardware.I2cController.I2cPortReadyCallback)
, or
+ null if no callback is currently registered.Telemetry.Item
s contained within a line.VuforiaLocalizer
which manages this list of trackables.Telemetry
transmissions from the robot controller
+ to the driver stationAxesReference
and AxesOrder
, returns an orientation
+ that would produce that rotation matrix.AxesReference
and AxesOrder
, returns an orientation
+ that would produce that rotation matrix.VuforiaTrackableDefaultListener.getCameraLocationOnRobot(CameraName)
is a better choice.#getPIDFCoefficients(RunMode)
insteadVuforiaTrackableDefaultListener.getPosePhone()
, the latter being more descriptive of the
+ coordinate system of the value returned.LightSensor.getRawLightDetected()
.Orientation
.SerialNumber
of the device associated with this one that would appear
+ in a ScannedDevices
.VuforiaTrackables
of which this VuforiaTrackable
is a memberVuforiaTrackableDefaultListener.getUpdatedRobotLocation()
.VuforiaTrackableDefaultListener.getUpdatedVuforiaCameraFromTarget()
.Gyroscope
interface exposes core, fundamental functionality that
+ is applicable to all gyroscopes: that of reporting angular rotation rate.HardwareDeviceCloseOnTearDown
are those which should be
+ automatically closed when we we 'teardown' a robotHardwareDeviceHealth
provides an indication of the perceived health of a hardware deviceHardwareDeviceHealthImpl
provides a delegatable-to implemenatation of HardwareDeviceHealthHardwareMap
+ comprised of all the devices of a particular device typeI2cAddrConfig
allows the runtime I2C address used with a sensor to be changed
+ or queried.I2cAddressableDevice
provides a means by which the address of a device
+ living on an I2C bus can be retrieved.I2cDevice
interface abstracts the engine used to interact on with a specific I2c device
+ on a port of an I2cController
.I2cDeviceSynch
is an interface that exposes functionality for interacting with I2c
+ devices.I2cDeviceSynch.ReadMode
controls whether when asked to read we read only once or read multiple times.I2cDeviceSynchDevice
instances are I2c devices which are built on top of
+ I2cDeviceSynchSimple instances or subclasses thereof.I2cDeviceSynchDeviceWithParameters
adds to I2cDeviceSynchDevice
support for
+ sensors that can be publicly initialized with parameter block of a particular type.I2cDeviceSynchImpl
is a utility class that makes it easy to read or write data to
+ an instance of I2cDevice
.I2cDeviceSynchImpl
instance on the indicated I2cDevice
+ using the indicated I2C address.I2cDeviceSynchImpl
instance on the indicated I2cDevice
.I2cDeviceSynchReadHistory
provides a means by which one can be guaranteed
+ to be informed of all data read by through an I2cDeviceSynch
.I2cDeviceSynchReadHistoryImpl
is a helper class providing an implementation
+ of the I2c read history queueI2cWaitControl
control the semantics of waiting on I2c writesAxesOrder
.IntegratingGyroscope
provides a means by which the integrated rotation
+ can be easily retrieved.Telemetry.clear()
is automatically called after each call to Telemetry.update()
.Light
instances are sources of illumination.LightBlinker
is a handy utility that will flash a SwitchableLight
+ in a pattern of timed durations, and, optionally, colors, if the light supports same (NYI)LightMultiplexor
adapts a second SwitchableLight
by adding reference
+ counting to SwitchableLight.enableLight(boolean)
: the light will be lit if the net
+ number of enables is greater than zero.Telemetry
to which log entries may be appended.LynxModuleMeta
has simple lynx module meta information for transmission from RC to DSLynxModuleMetaList
is a container of RobotCoreLynxModule
s.MagneticFlux
represent a three-dimensional magnetic strength vector.MatrixF
represents a matrix of floats of a defined dimensionality but abstracts
+ the means by which a particular element of the matrix is retrieved or updated.DcMotor.RunMode.RUN_TO_POSITION
and DcMotor.RunMode.RUN_USING_ENCODER
.SyncdDevice.ShutdownReason.ABNORMAL_ATTEMPT_REOPEN
, this is
+ the recommended duration of time to wait before attempting reopen.NavUtil
is a collection of utilities that provide useful manipulations of
+ objects related to navigation.NonConst
documents a method that performs its function by updating internal
+ state of the method receiver.NormalizedColorSensor
returns color sensor data in standardized units, which
+ provides a measure of absolute color color intensity beyond the relative
+ intensities available using ColorSensor
.NormalizedRGBA
instances represent a set of normalized color values.VuforiaTrackable.Listener.onTracked(TrackableResult, CameraName, Camera, org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable)
is called by the system to notify the listener that its associated trackable is currently visible.VuforiaTrackableDefaultListener.onTracked(TrackableResult, CameraName, Camera, org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable)
is called by the system to notify the listener that its associated trackable is currently visible.OpenGLMatrix
is a 4x4 matrix commonly used as a transformation matrix for 3D
+ homogeneous coordinates.OpModeManagerNotifier.Notifications
is an interface by which interested
+ parties can receive notification of the coming and going of opmodes.OpModeManagerNotifier.Notifications
can be used to receive notifications of the comings
+ and goings of opmodes in the system.OpticalDistanceSensor
is a LightSensor
whose reported light intensities
+ reflect (pun intended) a relationship to distance.Orientation
represent a rotated stance in three-dimensional space
+ by way of a set of three successive rotations.Orientation.AngleSet
is used to distinguish between the two sets of angles that will produce
+ a given rotation in a given axes reference and a given axes orderOrientationSensor
provides access to sensors which measure absolute orientationPIDCoefficients
conveys a set of configuration parameters for a PID algorithm.PIDFCoefficients
conveys a set of configuration parameters for a PIDF algorithm,
+ a PID algorithm which includes an additional feed-forward term.SoundPlayer.startPlaying(Context, int)
instead#startPlaying(Context, int, PlaySoundParams, Consumer, Runnable)
insteadPosition
represent a three-dimensional distance in a particular distance unit.PwmControl
interface provides control of the width of pulses used and whether
+ the PWM is enabled or disabled.Quaternion
can indicate an orientation in three-space without the trouble of
+ possible gimbal-lock.org.firstinspires.ftc.robotcore.internal.webserver.RobotControllerWebInfo
used when launching
+ RemoteProgrammingModeActivity on the driver station.I2cDeviceSynch.ReadWindow.usedForRead
flag clearI2cDevice.enableI2cReadMode(I2cAddr, int, int)
and subsequently written
+ to the controller.I2cDevice.readI2cCacheFromController()
is suggested insteadportIsReady()
+ callbacks at regular intervals from the I2cDevice
.portIsReady()
+ begin and end.RelicRecoveryVuMark
represent the VuMarks used in the Relic Recovery
+ FTC competition of 2017-18.AxesOrder
which is the chronological reverse of the receiver.RobotConfigNameable
provides access to the name by which a device has been configured
+ within a robot configurationRobotCoreLynxModule
is the view of a Lynx Module available at the RobotCore layer.Rotation
captures an angluar direction of movementRowMajorMatrixF
is a dense matrix whose entries are arranged in
+ row-major order.ColumnMatrixF
is a matrix that converts a VectorF into a 1xn matrixScannedDevices
is a simple distinguished kind of map of serial numbers
+ to device types.AxesOrder
SerialNumber
represent serial number indentifiers of hardware devices.Telemetry.clear()
is automatically called after each call to Telemetry.update()
.VuforiaTrackableDefaultListener
of the location of a particular camera
+ on the robot.Frame
s that will simultaneously be stored in the
+ frame queue.TimestampedI2cData
s that will simultaneously be stored in the
+ history queue.I2cAddrConfig.setI2cAddress(I2cAddr)
instead.VuforiaTrackable
+ is tracked and is not tracked.DigitalChannel.setMode(Mode)
insteadTelemetry
transmissions from the robot controller
+ to the driver station.VuforiaTrackables
and any of its contained
+ trackables which do not already have a user-specified name#setPIDFCoefficients(RunMode, PIDFCoefficients)
insteadDcMotor.RunMode.RUN_TO_POSITION
+ mode.setZeroPowerBehavior()
and
+ setPower()
.SystemClock.uptimeMillis()
time base.Object.toString()
+ to the indicated object.DcMotor.RunMode.RUN_USING_ENCODER
+ mode.EventLoopManager.start(EventLoop)
.SliceMatrixF
is a matrix whose implementation is a submatrix of some other matrix.SliceMatrixF
based on the indicated matrix whose upper left corner is at
+ (row, col) of that matrix and whose size is numRows x numCols.SoundPlayer
is a simple utility class that plays sounds on the phone.SoundPlayer.LoadedSoundCache
keeps track of loaded sounds, mapping sound resource id to loaded
+ sound id.EventLoopManager
.SwitchableLight
instances are Light
s whose on/off status can be
+ programmatically manipulated.SyncdDevice
is for a device that wants to be in sync with the event loop.SyncdDevice.ShutdownReason
indicates the health of the shutdown of the device.OpMode.telemetry
field contains an object in which a user may accumulate data which
+ is to be transmitted to the driver station.Telemetry
provide a means by which data can be transmitted from the
+ robot controller to the driver station and displayed on the driver station screen.Telemetry.Item
represent an item of data on the drive station telemetry display.Telemetry.Line
build lines of data on the driver station telemetry display.Telemetry.Log
in a Telemetry
instance provides an append-only list of messages
+ that appear on the driver station below the Telemetry.Item
s of the Telemetry
.Telemetry.Log.DisplayOrder
instances indicate the desired ordering of a Telemetry.log()
.EventLoop.refreshUserTelemetry(TelemetryMessage, double)
as the time interval
+ parameter in order to cause a system default interval to be used.Temperature
represent a temperature in a particular temperature scale.TempUnit
enumerate a known different temperature scalesAxesOrder
TimestampedI2cData
extends TimestampedData
so as to provide an indication
+ of the I2c source from which the data was retrieved.AngularVelocity
to one with the indicated angular units.Orientation
to one with the indicated angular units.Orientation
to an equivalent one with the indicated ordering of axesOrientation
to an equivalent one with the indicted point of view.TouchSensor
models a button.UnnormalizedAngleUnit
represents angles in different units of measure and
+ provides utility methods to convert across units.Telemetry
to the driver station if more than the transmission interval
has elapsed since the last transmission, or schedules the transmission
+ of the receiver should no subsequent Telemetry
state be scheduled for transmission before
+ the transmission interval
expires.VectorF
represents a single-dimensional vector of floats.VuforiaLocalizer.CameraDirection
enumerates the identities of the builtin phone cameras that Vuforia can use.VuforiaLocalizer.CloseableFrame
exposes a close() method so that one can proactively
+ reduce memory pressure when we're done with a FrameVuforiaLocalizer.Parameters
provides configuration information for instantiating the Vuforia localizerVuforiaLocalizer.Parameters.CameraMonitorFeedback
enumerates the kinds of positioning feedback that
+ may be drawn in the camera monitor window.VuforiaTrackable
provides access to an individual trackable Vuforia target.VuforiaTrackableDefaultListener
is the default listener used for VuforiaTrackable
+ implementations.VuforiaTrackable
is provided, then VuforiaTrackableDefaultListener.addTrackable(VuforiaTrackable)
+ must be called later, before tracking actually begins.VuforiaTrackables
represents a set of targets that can be visually tracked.VuMarkInstanceId
captures the identifying state decoded from a particular instance
+ of a Vuforia VuMark.VuMarkInstanceId.Type
indicates the type of data that was found in the InstanceId
+ from which this data was decoded.sleep()
method is a better choice.
+ If one simply wants to allow other threads to run, LinearOpMode.idle()
is a good choice.sleep()
method is a better choice.
+ If one simply wants to allow other threads to run, LinearOpMode.idle()
is a good choice.I2cWaitControl.ATOMIC
semantics.I2cWaitControl.ATOMIC
semantics.I2cDevice.writeI2cCacheToController()
is suggested insteadI2cDevice.writeI2cPortFlagOnlyToController()
is suggested insteadAngularVelocity.unit
s per second".AngularVelocity.unit
s per second".AngularVelocity.unit
s per second".protected static class ClassFactory.InstanceHolder
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
static ClassFactory |
+theInstance |
+
Modifier | +Constructor and Description | +
---|---|
protected |
+InstanceHolder() |
+
public static ClassFactory theInstance+
public abstract class ClassFactory
+extends java.lang.Object
+ClassFactory
provides a means by which various objects in the SDK may be logically
+ instantiated without exposing their external class identities to user's programs.Modifier and Type | +Class and Description | +
---|---|
protected static class |
+ClassFactory.InstanceHolder |
+
Constructor and Description | +
---|
ClassFactory() |
+
Modifier and Type | +Method and Description | +
---|---|
abstract boolean |
+canCreateTFObjectDetector()
+Return true if this device is compatible with TensorFlow Object Detection, false otherwise.
+ |
+
abstract TFObjectDetector |
+createTFObjectDetector(TFObjectDetector.Parameters parameters,
+ VuforiaLocalizer vuforiaLocalizer)
+createTFObjectDetector returns
+ an instance of the TensorFlow object detector engine configured with the indicated set of parameters. |
+
abstract VuforiaLocalizer |
+createVuforia(VuforiaLocalizer.Parameters parameters)
+createVuforia returns
+ an instance of the Vuforia localizer engine configured with the indicated set of parameters. |
+
static VuforiaLocalizer |
+createVuforiaLocalizer(VuforiaLocalizer.Parameters parameters)
+Deprecated.
+
+Use
+createVuforia(VuforiaLocalizer.Parameters) instead |
+
abstract CameraManager |
+getCameraManager()
+Returns a
+CameraManager which can be used to access the USB webcams
+ attached to the robot controller. |
+
static ClassFactory |
+getInstance() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static ClassFactory getInstance()+
public abstract VuforiaLocalizer createVuforia(VuforiaLocalizer.Parameters parameters)+
createVuforia
returns
+ an instance of the Vuforia localizer engine configured with the indicated set of parameters.parameters
- the parameters used to configure the instance of the engineVuforiaLocalizer
,
+Orientation
,
+vuforia.compublic abstract boolean canCreateTFObjectDetector()+
public abstract TFObjectDetector createTFObjectDetector(TFObjectDetector.Parameters parameters, + VuforiaLocalizer vuforiaLocalizer)+
createTFObjectDetector
returns
+ an instance of the TensorFlow object detector engine configured with the indicated set of parameters.parameters
- the parameters used to configure the instance of the enginevuforiaLocalizer
- the VuforiaLocalizer that will be used to obtain camera framesTFObjectDetector
public abstract CameraManager getCameraManager()+
CameraManager
which can be used to access the USB webcams
+ attached to the robot controller.CameraManager
@Deprecated +public static VuforiaLocalizer createVuforiaLocalizer(VuforiaLocalizer.Parameters parameters)+
createVuforia(VuforiaLocalizer.Parameters)
instead@Documented
+ @Target(value=METHOD)
+ @Retention(value=CLASS)
+public @interface Const
+Const
documents a method that promises not to change the internal state
+ of the method receiver. Documenting methods in this way helps programmers understand
+ which methods examine the object and return results based on that examination but don't
+ change the internal object state and which methods, by contrast, perform their function
+ but updating or changing internal object state.NonConst
public interface Consumer<T>
+Consumer
are functions that act on an instance of a indicated typeModifier and Type | +Method and Description | +
---|---|
void |
+accept(T value)
+Performs this operation on the given argument.
+ |
+
public interface Event
+Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+getName() |
+
public interface Func<T>
+
+Modifier and Type | +Method and Description | +
---|---|
T |
+value()
+Returns a value of the indicated type
+ |
+
public interface Function<T,R>
+Modifier and Type | +Method and Description | +
---|---|
R |
+apply(T arg) |
+
public static enum JavaUtil.AtMode +extends java.lang.Enum<JavaUtil.AtMode>+
Enum Constant and Description | +
---|
FIRST |
+
FROM_END |
+
FROM_START |
+
LAST |
+
RANDOM |
+
Modifier and Type | +Method and Description | +
---|---|
static JavaUtil.AtMode |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static JavaUtil.AtMode[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final JavaUtil.AtMode FIRST+
public static final JavaUtil.AtMode LAST+
public static final JavaUtil.AtMode FROM_START+
public static final JavaUtil.AtMode FROM_END+
public static final JavaUtil.AtMode RANDOM+
public static JavaUtil.AtMode[] values()+
+for (JavaUtil.AtMode c : JavaUtil.AtMode.values()) + System.out.println(c); +
public static JavaUtil.AtMode valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static enum JavaUtil.SortDirection +extends java.lang.Enum<JavaUtil.SortDirection>+
Enum Constant and Description | +
---|
ASCENDING |
+
DESCENDING |
+
Modifier and Type | +Method and Description | +
---|---|
static JavaUtil.SortDirection |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static JavaUtil.SortDirection[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final JavaUtil.SortDirection ASCENDING+
public static final JavaUtil.SortDirection DESCENDING+
public static JavaUtil.SortDirection[] values()+
+for (JavaUtil.SortDirection c : JavaUtil.SortDirection.values()) + System.out.println(c); +
public static JavaUtil.SortDirection valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static enum JavaUtil.SortType +extends java.lang.Enum<JavaUtil.SortType>+
Enum Constant and Description | +
---|
IGNORE_CASE |
+
NUMERIC |
+
TEXT |
+
Modifier and Type | +Method and Description | +
---|---|
static JavaUtil.SortType |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static JavaUtil.SortType[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final JavaUtil.SortType NUMERIC+
public static final JavaUtil.SortType TEXT+
public static final JavaUtil.SortType IGNORE_CASE+
public static JavaUtil.SortType[] values()+
+for (JavaUtil.SortType c : JavaUtil.SortType.values()) + System.out.println(c); +
public static JavaUtil.SortType valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static enum JavaUtil.TrimMode +extends java.lang.Enum<JavaUtil.TrimMode>+
Enum Constant and Description | +
---|
BOTH |
+
LEFT |
+
RIGHT |
+
Modifier and Type | +Method and Description | +
---|---|
static JavaUtil.TrimMode |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static JavaUtil.TrimMode[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final JavaUtil.TrimMode LEFT+
public static final JavaUtil.TrimMode RIGHT+
public static final JavaUtil.TrimMode BOTH+
public static JavaUtil.TrimMode[] values()+
+for (JavaUtil.TrimMode c : JavaUtil.TrimMode.values()) + System.out.println(c); +
public static JavaUtil.TrimMode valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic class JavaUtil
+extends java.lang.Object
+Modifier and Type | +Class and Description | +
---|---|
static class |
+JavaUtil.AtMode |
+
static class |
+JavaUtil.SortDirection |
+
static class |
+JavaUtil.SortType |
+
static class |
+JavaUtil.TrimMode |
+
Modifier and Type | +Method and Description | +
---|---|
static int |
+ahsvToColor(int alpha,
+ float hue,
+ float saturation,
+ float value) |
+
static double |
+averageOfList(java.util.List list) |
+
static float |
+colorToHue(int color) |
+
static float |
+colorToSaturation(int color) |
+
static float |
+colorToValue(int color) |
+
static java.util.List |
+createListWith(java.lang.Object... elements) |
+
static java.util.List |
+createListWithItemRepeated(java.lang.Object element,
+ int n) |
+
static java.lang.String |
+formatNumber(double number,
+ int precision) |
+
static int |
+hsvToColor(float hue,
+ float saturation,
+ float value) |
+
static java.lang.Object |
+inListGet(java.util.List list,
+ JavaUtil.AtMode atMode,
+ int i,
+ boolean remove) |
+
static java.util.List |
+inListGetSublist(java.util.List list,
+ JavaUtil.AtMode atMode1,
+ int i1,
+ JavaUtil.AtMode atMode2,
+ int i2) |
+
static void |
+inListSet(java.util.List list,
+ JavaUtil.AtMode atMode,
+ int i,
+ boolean insert,
+ java.lang.Object value) |
+
static java.lang.String |
+inTextGetLetter(java.lang.String str,
+ JavaUtil.AtMode atMode,
+ int i) |
+
static java.lang.String |
+inTextGetSubstring(java.lang.String str,
+ JavaUtil.AtMode atMode1,
+ int i1,
+ JavaUtil.AtMode atMode2,
+ int i2) |
+
static boolean |
+isPrime(double d) |
+
static java.util.List |
+makeListFromText(java.lang.String text,
+ java.lang.String delimiter) |
+
static java.lang.String |
+makeTextFromList(java.util.List list,
+ java.lang.String delimiter) |
+
static double |
+maxOfList(java.util.List list) |
+
static double |
+medianOfList(java.util.List list) |
+
static double |
+minOfList(java.util.List list) |
+
static java.util.List |
+modesOfList(java.util.List list) |
+
static int |
+randomInt(double a,
+ double b) |
+
static java.lang.Object |
+randomItemOfList(java.util.List list) |
+
static java.util.List |
+sort(java.util.List list,
+ JavaUtil.SortType sortType,
+ JavaUtil.SortDirection sortDirection) |
+
static double |
+standardDeviationOfList(java.util.List list) |
+
static double |
+sumOfList(java.util.List list) |
+
static java.lang.String |
+textTrim(java.lang.String str,
+ JavaUtil.TrimMode trimMode) |
+
static java.lang.String |
+toTitleCase(java.lang.String str) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static java.lang.String inTextGetLetter(java.lang.String str, + JavaUtil.AtMode atMode, + int i)+
public static java.lang.String inTextGetSubstring(java.lang.String str, + JavaUtil.AtMode atMode1, + int i1, + JavaUtil.AtMode atMode2, + int i2)+
public static java.lang.String toTitleCase(java.lang.String str)+
public static java.lang.String textTrim(java.lang.String str, + JavaUtil.TrimMode trimMode)+
public static java.lang.String formatNumber(double number, + int precision)+
public static boolean isPrime(double d)+
public static double sumOfList(java.util.List list)+
public static double minOfList(java.util.List list)+
public static double maxOfList(java.util.List list)+
public static double averageOfList(java.util.List list)+
public static double medianOfList(java.util.List list)+
public static java.util.List modesOfList(java.util.List list)+
public static double standardDeviationOfList(java.util.List list)+
public static java.lang.Object randomItemOfList(java.util.List list)+
public static int randomInt(double a, + double b)+
public static java.util.List createListWith(java.lang.Object... elements)+
public static java.util.List createListWithItemRepeated(java.lang.Object element, + int n)+
public static java.lang.Object inListGet(java.util.List list, + JavaUtil.AtMode atMode, + int i, + boolean remove)+
public static void inListSet(java.util.List list, + JavaUtil.AtMode atMode, + int i, + boolean insert, + java.lang.Object value)+
public static java.util.List inListGetSublist(java.util.List list, + JavaUtil.AtMode atMode1, + int i1, + JavaUtil.AtMode atMode2, + int i2)+
public static java.util.List sort(java.util.List list, + JavaUtil.SortType sortType, + JavaUtil.SortDirection sortDirection)+
public static java.lang.String makeTextFromList(java.util.List list, + java.lang.String delimiter)+
public static java.util.List makeListFromText(java.lang.String text, + java.lang.String delimiter)+
public static float colorToHue(int color)+
public static float colorToSaturation(int color)+
public static float colorToValue(int color)+
public static int hsvToColor(float hue, + float saturation, + float value)+
public static int ahsvToColor(int alpha, + float hue, + float saturation, + float value)+
@Documented
+ @Target(value=METHOD)
+ @Retention(value=CLASS)
+public @interface NonConst
+NonConst
documents a method that performs its function by updating internal
+ state of the method receiver. Documenting methods in this way helps programmers understand
+ which methods examine the object and return results based on that examination but don't
+ change the internal object state and which methods, by contrast, perform their function
+ but updating or changing internal object state.Const
public interface Predicate<T>
+Modifier and Type | +Method and Description | +
---|---|
boolean |
+test(T t) |
+
public static interface SignificantMotionDetection.SignificantMotionDetectionListener
+Modifier and Type | +Method and Description | +
---|---|
void |
+onSignificantMotion() |
+
public class SignificantMotionDetection
+extends java.lang.Object
+Modifier and Type | +Class and Description | +
---|---|
static interface |
+SignificantMotionDetection.SignificantMotionDetectionListener |
+
Constructor and Description | +
---|
SignificantMotionDetection() |
+
Modifier and Type | +Method and Description | +
---|---|
protected void |
+notifyListeners() |
+
void |
+registerListener(SignificantMotionDetection.SignificantMotionDetectionListener listener) |
+
void |
+startListening()
+Start processing sensor data.
+ |
+
void |
+stopListening()
+Stop processing sensor data.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public SignificantMotionDetection()+
public void startListening()+
public void stopListening()+
public void registerListener(SignificantMotionDetection.SignificantMotionDetectionListener listener)+
protected void notifyListeners()+
public interface State
+Modifier and Type | +Method and Description | +
---|---|
void |
+onEnter(Event event)
+Called by the framework when a state is entered.
+ |
+
void |
+onExit(Event event)
+Called by the framework when a state is exited.
+ |
+
void onEnter(Event event)+
event
- The event that generated the transition.void onExit(Event event)+
event
- The event that generated the transition.public class StateMachine
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
protected State |
+currentState |
+
protected java.util.ArrayList<Event> |
+maskList |
+
protected java.util.HashMap<State,java.util.ArrayList<StateTransition>> |
+stateGraph |
+
Constructor and Description | +
---|
StateMachine() |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+addTransition(StateTransition transition)
+addTransition
+
+ Adds a transition to the state machine.
+ |
+
State |
+consumeEvent(Event event)
+consumeEvent
+
+ Executes a state transition and returns the new state.
+ |
+
void |
+maskEvent(Event event) |
+
protected void |
+start(State state)
+start
+
+ Define the start state of the state machine.
+ |
+
java.lang.String |
+toString() |
+
protected State |
+transition(Event event) |
+
void |
+unMaskEvent(Event event) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
protected State currentState+
protected java.util.HashMap<State,java.util.ArrayList<StateTransition>> stateGraph+
protected java.util.ArrayList<Event> maskList+
protected void start(State state)+
state
- The initial state.public void addTransition(StateTransition transition)+
transition
- the transition to add.public State consumeEvent(Event event)+
event
- The event to consumepublic void maskEvent(Event event)+
public void unMaskEvent(Event event)+
public java.lang.String toString()+
toString
in class java.lang.Object
public class StateTransition
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
protected Event |
+event |
+
protected State |
+from |
+
protected State |
+to |
+
Constructor and Description | +
---|
StateTransition(State from,
+ Event event,
+ State to) |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public interface Supplier<T>
+Modifier and Type | +Method and Description | +
---|---|
T |
+get() |
+
public static interface Telemetry.Item
+Telemetry.Item
represent an item of data on the drive station telemetry display.#addData(String, Object)}
Modifier and Type | +Method and Description | +
---|---|
<T> Telemetry.Item |
+addData(java.lang.String caption,
+ Func<T> valueProducer)
+Adds a new data item in the associated
+Telemetry immediately following the receiver. |
+
Telemetry.Item |
+addData(java.lang.String caption,
+ java.lang.Object value)
+Adds a new data item in the associated
+Telemetry immediately following the receiver. |
+
<T> Telemetry.Item |
+addData(java.lang.String caption,
+ java.lang.String format,
+ Func<T> valueProducer)
+Adds a new data item in the associated
+Telemetry immediately following the receiver. |
+
Telemetry.Item |
+addData(java.lang.String caption,
+ java.lang.String format,
+ java.lang.Object... args)
+Adds a new data item in the associated
+Telemetry immediately following the receiver. |
+
java.lang.String |
+getCaption()
+Returns the caption associated with this item.
+ |
+
boolean |
+isRetained()
+Returns whether the item is to be retained in a clear() operation.
+ |
+
Telemetry.Item |
+setCaption(java.lang.String caption)
+Sets the caption associated with this item.
+ |
+
Telemetry.Item |
+setRetained(java.lang.Boolean retained)
+Sets whether the item is to be retained in clear() operation or not.
+ |
+
<T> Telemetry.Item |
+setValue(Func<T> valueProducer)
+Updates the value of this item to be the indicated value producer.
+ |
+
Telemetry.Item |
+setValue(java.lang.Object value)
+Updates the value of this item to be the result of applying
+Object.toString()
+ to the indicated object. |
+
<T> Telemetry.Item |
+setValue(java.lang.String format,
+ Func<T> valueProducer)
+Updates the value of this item to be the indicated value producer.
+ |
+
Telemetry.Item |
+setValue(java.lang.String format,
+ java.lang.Object... args)
+Updates the value of this item to be the result of the indicated string formatting operation.
+ |
+
java.lang.String getCaption()+
setCaption(String)
,
+addData(String, Object)
Telemetry.Item setCaption(java.lang.String caption)+
caption
- the new caption associated with this item.getCaption()
Telemetry.Item setValue(java.lang.String format, + java.lang.Object... args)+
format
- the format of the dataargs
- the arguments associated with the formataddData(String, String, Object...)
Telemetry.Item setValue(java.lang.Object value)+
Object.toString()
+ to the indicated object.value
- the object to which Object.toString()
should be appliedaddData(String, Object)
<T> Telemetry.Item setValue(Func<T> valueProducer)+
valueProducer
- an object that produces values to be rendered.addData(String, Func)
<T> Telemetry.Item setValue(java.lang.String format, + Func<T> valueProducer)+
format
- this string used to format values producedvalueProducer
- an object that produces values to be rendered.addData(String, String, Func)
Telemetry.Item setRetained(java.lang.Boolean retained)+
retained
- if true, then the value will be retained during a clear(). Null will
+ return the setting to its initial value.Telemetry.clear()
,
+isRetained()
boolean isRetained()+
setRetained(Boolean)
Telemetry.Item addData(java.lang.String caption, + java.lang.String format, + java.lang.Object... args)+
Telemetry
immediately following the receiver.addData(String, String, Object...)
Telemetry.Item addData(java.lang.String caption, + java.lang.Object value)+
Telemetry
immediately following the receiver.addData(String, Object)
<T> Telemetry.Item addData(java.lang.String caption, + Func<T> valueProducer)+
Telemetry
immediately following the receiver.addData(String, Func)
<T> Telemetry.Item addData(java.lang.String caption, + java.lang.String format, + Func<T> valueProducer)+
Telemetry
immediately following the receiver.addData(String, String, Func)
public static interface Telemetry.Line
+Telemetry.Line
build lines of data on the driver station telemetry display.Modifier and Type | +Method and Description | +
---|---|
<T> Telemetry.Item |
+addData(java.lang.String caption,
+ Func<T> valueProducer)
+Adds a new data item at the end of the line which is the receiver.
+ |
+
Telemetry.Item |
+addData(java.lang.String caption,
+ java.lang.Object value)
+Adds a new data item at the end of the line which is the receiver.
+ |
+
<T> Telemetry.Item |
+addData(java.lang.String caption,
+ java.lang.String format,
+ Func<T> valueProducer)
+Adds a new data item at the end of the line which is the receiver.
+ |
+
Telemetry.Item |
+addData(java.lang.String caption,
+ java.lang.String format,
+ java.lang.Object... args)
+Adds a new data item at the end of the line which is the receiver.
+ |
+
Telemetry.Item addData(java.lang.String caption, + java.lang.String format, + java.lang.Object... args)+
Telemetry.addData(String, String, Object...)
Telemetry.Item addData(java.lang.String caption, + java.lang.Object value)+
Telemetry.addData(String, Object)
<T> Telemetry.Item addData(java.lang.String caption, + Func<T> valueProducer)+
Telemetry.addData(String, Func)
<T> Telemetry.Item addData(java.lang.String caption, + java.lang.String format, + Func<T> valueProducer)+
Telemetry.addData(String, String, Func)
public static enum Telemetry.Log.DisplayOrder +extends java.lang.Enum<Telemetry.Log.DisplayOrder>+
Telemetry.Log.DisplayOrder
instances indicate the desired ordering of a Telemetry.log()
.Enum Constant and Description | +
---|
NEWEST_FIRST |
+
OLDEST_FIRST |
+
Modifier and Type | +Method and Description | +
---|---|
static Telemetry.Log.DisplayOrder |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static Telemetry.Log.DisplayOrder[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final Telemetry.Log.DisplayOrder NEWEST_FIRST+
public static final Telemetry.Log.DisplayOrder OLDEST_FIRST+
public static Telemetry.Log.DisplayOrder[] values()+
+for (Telemetry.Log.DisplayOrder c : Telemetry.Log.DisplayOrder.values()) + System.out.println(c); +
public static Telemetry.Log.DisplayOrder valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static interface Telemetry.Log
+Telemetry.Log
in a Telemetry
instance provides an append-only list of messages
+ that appear on the driver station below the Telemetry.Item
s of the Telemetry
.Telemetry.log()
,
+Telemetry.addData(String, Object)
Modifier and Type | +Interface and Description | +
---|---|
static class |
+Telemetry.Log.DisplayOrder
+Telemetry.Log.DisplayOrder instances indicate the desired ordering of a Telemetry.log() . |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+add(java.lang.String entry)
+Adds a new entry the the log.
+ |
+
void |
+add(java.lang.String format,
+ java.lang.Object... args)
+Adds a new entry to the log.
+ |
+
void |
+clear()
+Removes all entries from this
+Telemetry.Log |
+
int |
+getCapacity()
+Returns the maximum number of lines which will be retained in a
+Telemetry.log()() and
+ shown on the driver station display. |
+
Telemetry.Log.DisplayOrder |
+getDisplayOrder()
+Returns the order in which data in log is to be displayed on the driver station.
+ |
+
void |
+setCapacity(int capacity) |
+
void |
+setDisplayOrder(Telemetry.Log.DisplayOrder displayOrder) |
+
int getCapacity()+
Telemetry.log()()
and
+ shown on the driver station display.Telemetry.log()()
setCapacity(int)
void setCapacity(int capacity)+
getCapacity()
Telemetry.Log.DisplayOrder getDisplayOrder()+
setDisplayOrder(DisplayOrder)
void setDisplayOrder(Telemetry.Log.DisplayOrder displayOrder)+
getDisplayOrder()
void add(java.lang.String entry)+
entry
- the new log entry to addvoid add(java.lang.String format, + java.lang.Object... args)+
format
- the format string used to format the log entryargs
- the data used to format the log entryvoid clear()+
Telemetry.Log
public interface Telemetry
+Telemetry
provide a means by which data can be transmitted from the
+ robot controller to the driver station and displayed on the driver station screen.
+
+ Simple use of Telemetry
consists of a series of addData()
calls, followed by a call to update()
. For example:
+ // LinearOpMode + telemetry.addData("count", currentCount); + telemetry.addData("elapsedTime", "%.3f", elapsedSeconds); + telemetry.update(); ++ +
In the 2015/16 season, the call to update()
was not required; now, however,
+ in a LinearOpMode
, unless update()
is called, nothing will appear on the
+ driver station screen. In other, loop-based opmodes, update()
continues to be called
+ automatically at the end of OpMode.loop()
and OpMode.init_loop()
; no call to
+ update()
is required in loop-based opmodes.
+ // loop-based opmode + telemetry.addData("count", currentCount); + telemetry.addData("elapsedTime", "%.3f", elapsedSeconds); ++ +
By default (but see setAutoClear()
), data is cleared from the
+ telemetry after each call to update()
; thus, you need to issue addData()
for the entire contents of the telemetry screen on each update cycle.
+ This behavior is just as it was in the 2015/16 season.
A more complicated use of Telemetry
might have different parts of the program update
+ different items on the display in a decoupled, decentralized manner. Such situations might
+ usefully avail themselves of turning off the auto-clear setting. For example:
+ telemetry.setAutoClear(false); + Telemetry.Item countItem = telemetry.addData("count", 0); + Telemetry.Item elapsedItem = telemetry.addData("elapsedTime", 0); + + void onePartOfYourCode() { + ... + countItem.setValue(0); + telemetry.update(); + ... + } + + void anotherPartOfYourCode() { + ... + elapsedItem.setValue("%.3f", elapsedSeconds); + telemetry.update(); + ... + } ++ +
In this way different parts of the code can update only a portion of the telemetry screen + without disturbing other parts.
+ +Below the list of caption, value, pairs, on the screen a Telemetry
also displays
+ a short, unstructured log of messages. Use log().add()
+ to add to the log. See also log()
.
Actual transmission to the driver station is throttled to avoid use of excessive bandwidth.
+ By default, transmission will occur at most every 250ms. This interval can be controlled with
+ setMsTransmissionInterval()
. Any update()
s which
+ occur more frequently will not be transmitted if superseded by a subsequent update()
+ before the transmission interval expires.
As mentioned above, by default, after each call to update()
, the method clear()
+ is automatically called. Thus, in simple usage, after each update()
, you'll want to issue
+ addData()
calls to rebuild the entire driver station telemetry
+ screen that you wish to observe. This simple usage can be modified in two ways.
First, the automatic issuance of calls to clear()
can be altered by means of
+ setAutoClear(boolean)
. If auto clearing is set to false, previously added telemetry
+ items remain present from update()
to update()
, but their value can still be altered
+ using Item.setValue()
, items can be removed using removeItem(Item)
,
+ and new items can be added using addData()
and Item.addData()
.
Second, telemetry items created in a functional form using addData(String, Func)
or
+ Telemetry.Item.addData(String, Func)
are not automatically removed when clear()
+ is called, either implicitly or explicitly (though they are removed when clearAll()
is
+ called). The intent of such items is allow a one-time specification of telemetry items by
+ providing a function that can produce a value to be displayed rather than providing the
+ actual value itself. Such functions are evaluated only when it is known that telemetry is going to
+ be transmitted to the driver station (and so a value is required). This approach can be particularly
+ useful if the acquisition of the data to be displayed is relatively expensive or time consuming, as
+ that cost is only expended when actually useful.
+
+ In addition to one-item-per-line display on the driver station, multiple items per line can
+ be displayed by starting with a call to addLine()
and then following up with one or more
+ addData(String, Object)
calls. For example:
+
+
+ telemetry.addLine() + .addData("count", currentCount) + .addData("elapsedTime", "%.3f", seconds); + telemetry.addLine() + .addData("voltage", "%.1f", getCurrentVoltage()) + .addData("orientation", "%s", getOrientation()); + telemetry.update(); ++ +
Items on the same line are separated by the item separator
. Caption
+ and value within an item are separated by the caption value separator
.
Note: in the 2015/16 season, it was possible for Telemetry
instances to be automatically
+ sorted in alphabetical order by caption. This functionality is no longer supported.
Modifier and Type | +Interface and Description | +
---|---|
static interface |
+Telemetry.Item
+Instances of
+Telemetry.Item represent an item of data on the drive station telemetry display. |
+
static interface |
+Telemetry.Line
+Instances of
+Telemetry.Line build lines of data on the driver station telemetry display. |
+
static interface |
+Telemetry.Log
+The
+Telemetry.Log in a Telemetry instance provides an append-only list of messages
+ that appear on the driver station below the Telemetry.Item s of the Telemetry . |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.Object |
+addAction(java.lang.Runnable action)
+In addition to items and lines, a telemetry may also contain a list of actions.
+ |
+
<T> Telemetry.Item |
+addData(java.lang.String caption,
+ Func<T> valueProducer)
+Adds an item to the end of the telemetry being built for driver station display.
+ |
+
Telemetry.Item |
+addData(java.lang.String caption,
+ java.lang.Object value)
+Adds an item to the end if the telemetry being built for driver station display.
+ |
+
<T> Telemetry.Item |
+addData(java.lang.String caption,
+ java.lang.String format,
+ Func<T> valueProducer)
+Adds an item to the end of the telemetry being built for driver station display.
+ |
+
Telemetry.Item |
+addData(java.lang.String caption,
+ java.lang.String format,
+ java.lang.Object... args)
+Adds an item to the end of the telemetry being built for driver station display.
+ |
+
Telemetry.Line |
+addLine()
+Creates and returns a new line in the receiver
+Telemetry . |
+
Telemetry.Line |
+addLine(java.lang.String lineCaption)
+Creates and returns a new line in the receiver
+Telemetry . |
+
void |
+clear()
+Removes all items from the receiver whose value is not to be retained.
+ |
+
void |
+clearAll()
+Removes all items, lines, and actions from the receiver
+ |
+
java.lang.String |
+getCaptionValueSeparator()
+Returns the string which is used to separate caption from value within a
+Telemetry
+ Telemetry.Item . |
+
java.lang.String |
+getItemSeparator()
+Returns the string which is used to separate
+Telemetry.Item s contained within a line. |
+
int |
+getMsTransmissionInterval()
+Returns the minimum interval between
+Telemetry transmissions from the robot controller
+ to the driver station |
+
boolean |
+isAutoClear()
+
+ |
+
Telemetry.Log |
+log()
+Returns the log of this
+Telemetry to which log entries may be appended. |
+
boolean |
+removeAction(java.lang.Object token)
+Removes a previously added action from the receiver.
+ |
+
boolean |
+removeItem(Telemetry.Item item)
+Removes an item from the receiver telemetry, if present.
+ |
+
boolean |
+removeLine(Telemetry.Line line)
+Removes a line from the receiver telemetry, if present.
+ |
+
void |
+setAutoClear(boolean autoClear)
+
+ |
+
void |
+setCaptionValueSeparator(java.lang.String captionValueSeparator) |
+
void |
+setItemSeparator(java.lang.String itemSeparator) |
+
void |
+setMsTransmissionInterval(int msTransmissionInterval)
+Sets the minimum interval between
+Telemetry transmissions from the robot controller
+ to the driver station. |
+
boolean |
+update()
+Sends the receiver
+Telemetry to the driver station if more than the transmission interval has elapsed since the last transmission, or schedules the transmission
+ of the receiver should no subsequent Telemetry state be scheduled for transmission before
+ the transmission interval expires. |
+
Telemetry.Item addData(java.lang.String caption, + java.lang.String format, + java.lang.Object... args)+
String.format()
+ with the indicated format and arguments. The caption and value are shown on the driver station
+ separated by the caption value separator
. The item
+ is removed if clear()
or clearAll()
is called.caption
- the caption to useformat
- the string by which the arguments are to be formattedargs
- the arguments to formatTelemetry.Item
that can be used to update the value or append further Telemetry.Item
saddData(String, Object)
,
+addData(String, Func)
Telemetry.Item addData(java.lang.String caption, + java.lang.Object value)+
toString()
on the provided value
+ object. The caption and value are shown on the driver station separated by the caption value separator
. The item is removed if clear()
+ or clearAll()
is called.caption
- the caption to usevalue
- the value to displayTelemetry.Item
that can be used to update the value or append further Telemetry.Item
saddData(String, String, Object...)
,
+addData(String, Func)
<T> Telemetry.Item addData(java.lang.String caption, + Func<T> valueProducer)+
toString()
on the object which is
+ returned from invoking valueProducer.Func.value()
value()}. The caption and value are
+ shown on the driver station separated by the caption value
+ separator
. The item is removed if clearAll()
is called, but not if
+ clear()
is called.
+
+ The valueProducer is evaluated only if actual transmission to the driver station + is to occur. This is important, as it provides a means of displaying telemetry which + is relatively expensive to evaluate while avoiding computation or delay on evaluations + which won't be transmitted due to transmission interval throttling.
caption
- the caption to usevalueProducer
- the object which will provide the value to displayTelemetry.Item
that can be used to update the value or append further Telemetry.Item
saddData(String, String, Object...)
,
+addData(String, Object)
,
+addData(String, String, Func)
,
+getMsTransmissionInterval()
<T> Telemetry.Item addData(java.lang.String caption, + java.lang.String format, + Func<T> valueProducer)+
String.format(java.lang.String, java.lang.Object...)
on the object which is returned from invoking
+ valueProducer.Func.value()
value()}. The caption and value are shown on the driver station
+ separated by the caption value separator
. The item is removed
+ if clearAll()
is called, but not if clear()
is called.
+
+ The valueProducer is evaluated only if actual transmission to the driver station + is to occur. This is important, as it provides a means of displaying telemetry which + is relatively expensive to evaluate while avoiding computation or delay on evaluations + which won't be transmitted due to transmission interval throttling.
caption
- the caption to usevalueProducer
- the object which will provide the value to displayTelemetry.Item
that can be used to update the value or append further Telemetry.Item
saddData(String, String, Object...)
,
+addData(String, Object)
,
+addData(String, Func)
,
+getMsTransmissionInterval()
boolean removeItem(Telemetry.Item item)+
item
- the item to removevoid clear()+
void clearAll()+
clear()
java.lang.Object addAction(java.lang.Runnable action)+
Actions are cleared with clearAll()
, and can be removed with removeAction()
.
action
- the action to execute before composing the lines telemetryaddData(String, Object)
,
+removeAction(Object)
,
+addLine()
,
+update()
boolean removeAction(java.lang.Object token)+
token
- the token previously returned from addAction()
.boolean update()+
Telemetry
to the driver station if more than the transmission interval
has elapsed since the last transmission, or schedules the transmission
+ of the receiver should no subsequent Telemetry
state be scheduled for transmission before
+ the transmission interval
expires.Telemetry.Line addLine()+
Telemetry
.Telemetry
Telemetry.Line addLine(java.lang.String lineCaption)+
Telemetry
.lineCaption
- the caption for the lineTelemetry
boolean removeLine(Telemetry.Line line)+
line
- the line to be removedboolean isAutoClear()+ +
clear()
is automatically called after each call to update()
.setAutoClear(boolean)
void setAutoClear(boolean autoClear)+ + +
int getMsTransmissionInterval()+
Telemetry
transmissions from the robot controller
+ to the driver stationTelemetry
transmissions from the robot controller to the diver stationsetMsTransmissionInterval(int)
void setMsTransmissionInterval(int msTransmissionInterval)+
Telemetry
transmissions from the robot controller
+ to the driver station.msTransmissionInterval
- the minimum interval between Telemetry
transmissions
+ from the robot controller to the driver stationgetMsTransmissionInterval()
java.lang.String getItemSeparator()+
Telemetry.Item
s contained within a line. The default
+ separator is " | ".Telemetry.Item
s contained within a line.setItemSeparator(String)
,
+addLine()
void setItemSeparator(java.lang.String itemSeparator)+
setItemSeparator(String)
java.lang.String getCaptionValueSeparator()+
Telemetry
+ Telemetry.Item
. The default separator is " : ";Telemetry
Telemetry.Item
.void setCaptionValueSeparator(java.lang.String captionValueSeparator)+
getCaptionValueSeparator()
Telemetry.Log log()+
Telemetry
to which log entries may be appended.Telemetry
to which log entries may be appended.addData(String, Object)
public interface ThrowingCallable<VALUE,EXCEPTION extends java.lang.Throwable>
+Runnable
,
+Callable
Modifier and Type | +Method and Description | +
---|---|
VALUE |
+call() |
+
public class AndroidAccelerometer
+extends java.lang.Object
+implements android.hardware.SensorEventListener
+Constructor and Description | +
---|
AndroidAccelerometer() |
+
Modifier and Type | +Method and Description | +
---|---|
Acceleration |
+getAcceleration()
+Returns an Acceleration object representing acceleration in X, Y and Z axes.
+ |
+
DistanceUnit |
+getDistanceUnit()
+Returns the DistanceUnit being used.
+ |
+
double |
+getX()
+Returns the acceleration in the x-axis.
+ |
+
double |
+getY()
+Returns the acceleration in the y-axis.
+ |
+
double |
+getZ()
+Returns the acceleration in the z-axis.
+ |
+
boolean |
+isAvailable()
+Returns true if the Android device has a accelerometer.
+ |
+
void |
+onAccuracyChanged(android.hardware.Sensor sensor,
+ int accuracy) |
+
void |
+onSensorChanged(android.hardware.SensorEvent sensorEvent) |
+
void |
+setDistanceUnit(DistanceUnit distanceUnit)
+Sets the DistanceUnit to be used.
+ |
+
void |
+startListening()
+Start listening to events from the Android accelerometer.
+ |
+
void |
+stopListening()
+Stop listening to events from the Android accelerometer.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public void onAccuracyChanged(android.hardware.Sensor sensor, + int accuracy)+
onAccuracyChanged
in interface android.hardware.SensorEventListener
public void onSensorChanged(android.hardware.SensorEvent sensorEvent)+
onSensorChanged
in interface android.hardware.SensorEventListener
public void setDistanceUnit(DistanceUnit distanceUnit)+
public DistanceUnit getDistanceUnit()+
public double getX()+
public double getY()+
public double getZ()+
public Acceleration getAcceleration()+
public boolean isAvailable()+
public void startListening()+
public void stopListening()+
public class AndroidGyroscope
+extends java.lang.Object
+implements android.hardware.SensorEventListener
+Constructor and Description | +
---|
AndroidGyroscope() |
+
Modifier and Type | +Method and Description | +
---|---|
AngleUnit |
+getAngleUnit()
+Returns the AngleUnit being used.
+ |
+
AngularVelocity |
+getAngularVelocity()
+Returns an AngularVelocity object representing the rate of rotation around the device's local
+ X, Y and Z axis.
+ |
+
float |
+getX()
+Returns the angular speed around the x-axis.
+ |
+
float |
+getY()
+Returns the angular speed around the y-axis.
+ |
+
float |
+getZ()
+Returns the angular speed around the z-axis.
+ |
+
boolean |
+isAvailable()
+Returns true if the Android device has a gyroscope.
+ |
+
void |
+onAccuracyChanged(android.hardware.Sensor sensor,
+ int accuracy) |
+
void |
+onSensorChanged(android.hardware.SensorEvent sensorEvent) |
+
void |
+setAngleUnit(AngleUnit angleUnit)
+Sets the AngleUnit to be used.
+ |
+
void |
+startListening()
+Start listening to events from the Android gyroscope.
+ |
+
void |
+stopListening()
+Stop listening to events from the Android gyroscope.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public void onAccuracyChanged(android.hardware.Sensor sensor, + int accuracy)+
onAccuracyChanged
in interface android.hardware.SensorEventListener
public void onSensorChanged(android.hardware.SensorEvent sensorEvent)+
onSensorChanged
in interface android.hardware.SensorEventListener
public void setAngleUnit(AngleUnit angleUnit)+
public AngleUnit getAngleUnit()+
public float getX()+
public float getY()+
public float getZ()+
public AngularVelocity getAngularVelocity()+
public boolean isAvailable()+
public void startListening()+
public void stopListening()+
public class AndroidOrientation
+extends java.lang.Object
+implements android.hardware.SensorEventListener
+Constructor and Description | +
---|
AndroidOrientation() |
+
Modifier and Type | +Method and Description | +
---|---|
double |
+getAngle()
+Returns the angle in which the orientation sensor is tilted, treating Roll as the x-coordinate
+ and Pitch as the y-coordinate.
+ |
+
AngleUnit |
+getAngleUnit()
+Returns the AngleUnit being used.
+ |
+
double |
+getAzimuth()
+Returns the azimuth.
+ |
+
double |
+getMagnitude()
+Returns a number between 0 and 1, indicating how much the device is tilted.
+ |
+
double |
+getPitch()
+Returns the pitch.
+ |
+
double |
+getRoll()
+Returns the roll.
+ |
+
boolean |
+isAvailable()
+Returns true if the Android device has the sensors required for orientation.
+ |
+
void |
+onAccuracyChanged(android.hardware.Sensor sensor,
+ int accuracy) |
+
void |
+onSensorChanged(android.hardware.SensorEvent sensorEvent) |
+
void |
+setAngleUnit(AngleUnit angleUnit)
+Sets the AngleUnit to be used.
+ |
+
void |
+startListening()
+Start listening to events from the Android sensors.
+ |
+
void |
+stopListening()
+Stop listening to events from the Android sensors.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public void onAccuracyChanged(android.hardware.Sensor sensor, + int accuracy)+
onAccuracyChanged
in interface android.hardware.SensorEventListener
public void onSensorChanged(android.hardware.SensorEvent sensorEvent)+
onSensorChanged
in interface android.hardware.SensorEventListener
public void setAngleUnit(AngleUnit angleUnit)+
public AngleUnit getAngleUnit()+
public double getAzimuth()+
public double getPitch()+
public double getRoll()+
public double getAngle()+
public double getMagnitude()+
public boolean isAvailable()+
public void startListening()+
public void stopListening()+
public class AndroidSoundPool
+extends java.lang.Object
+Constructor and Description | +
---|
AndroidSoundPool() |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close()
+Unloads all the sounds and releases the SoundPool.
+ |
+
int |
+getLoop()
+Returns the number of repeats.
+ |
+
float |
+getRate()
+Returns the playback rate.
+ |
+
float |
+getVolume()
+Returns the current volume.
+ |
+
void |
+initialize(SoundPoolIntf soundPool)
+Initializes the SoundPool.
+ |
+
boolean |
+play(java.lang.String soundName)
+Plays the sound with the given name.
+ |
+
boolean |
+preloadSound(java.lang.String soundName)
+Preloads the sound with the given name.
+ |
+
void |
+setLoop(int loop)
+Sets the number of repeats.
+ |
+
void |
+setRate(float rate)
+Sets the playback rate.
+ |
+
void |
+setVolume(float volume)
+Sets the volume.
+ |
+
void |
+stop()
+Stops the playback.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public void initialize(SoundPoolIntf soundPool)+
public boolean preloadSound(java.lang.String soundName)+
java.lang.IllegalStateException
- if initialized has not been called yet.public boolean play(java.lang.String soundName)+
public void stop()+
public float getVolume()+
public void setVolume(float volume)+
public float getRate()+
public void setRate(float rate)+
public int getLoop()+
public void setLoop(int loop)+
public void close()+
public class AndroidTextToSpeech
+extends java.lang.Object
+Constructor and Description | +
---|
AndroidTextToSpeech() |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close()
+Shuts down the TextToSpeech engine.
+ |
+
java.lang.String |
+getCountryCode()
+Returns the current country code.
+ |
+
java.lang.String |
+getLanguageCode()
+Returns the current language code.
+ |
+
java.lang.String |
+getStatus()
+Returns the TextToSpeech initialization status.
+ |
+
void |
+initialize()
+Initialize the TextToSpeech engine.
+ |
+
boolean |
+isLanguageAndCountryAvailable(java.lang.String languageCode,
+ java.lang.String countryCode)
+Returns true if the given language is supported.
+ |
+
boolean |
+isLanguageAvailable(java.lang.String languageCode)
+Returns true if the given language is supported.
+ |
+
boolean |
+isSpeaking()
+Returns true if the TextToSpeech engine is busy speaking.
+ |
+
void |
+setLanguage(java.lang.String languageCode)
+Sets the language.
+ |
+
void |
+setLanguageAndCountry(java.lang.String languageCode,
+ java.lang.String countryCode)
+Sets the language and country.
+ |
+
void |
+setPitch(float pitch)
+Sets the speech pitch.
+ |
+
void |
+setSpeechRate(float speechRate)
+Sets the speech rate.
+ |
+
void |
+speak(java.lang.String text)
+Speaks the given text.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public void initialize()+
public java.lang.String getStatus()+
public java.lang.String getLanguageCode()+
java.lang.IllegalStateException
- if initialized has not been called yet.public java.lang.String getCountryCode()+
java.lang.IllegalStateException
- if initialized has not been called yet.public boolean isSpeaking()+
java.lang.IllegalStateException
- if initialized has not been called yet.public void setPitch(float pitch)+
java.lang.IllegalStateException
- if initialized has not been called yet.public void setSpeechRate(float speechRate)+
java.lang.IllegalStateException
- if initialized has not been called yet.public boolean isLanguageAvailable(java.lang.String languageCode)+
java.lang.IllegalStateException
- if initialized has not been called yet.public boolean isLanguageAndCountryAvailable(java.lang.String languageCode, + java.lang.String countryCode)+
java.lang.IllegalStateException
- if initialized has not been called yet.public void setLanguage(java.lang.String languageCode)+
java.lang.IllegalStateException
- if initialized has not been called yet.public void setLanguageAndCountry(java.lang.String languageCode, + java.lang.String countryCode)+
java.lang.IllegalStateException
- if initialized has not been called yet.public void speak(java.lang.String text)+
java.lang.IllegalStateException
- if initialized has not been called yet.public void close()+
Class | +Description | +
---|---|
AndroidAccelerometer | +
+ A class that provides access to the Android Accelerometer.
+ |
+
AndroidGyroscope | +
+ A class that provides access to the Android Gyroscope.
+ |
+
AndroidOrientation | +
+ A class that provides access to the Android sensors for Orientation.
+ |
+
AndroidSoundPool | +
+ A class that provides access to the Android SoundPool.
+ |
+
AndroidTextToSpeech | +
+ A class that provides access to the Android TextToSpeech.
+ |
+
public abstract class ColumnMajorMatrixF +extends DenseMatrixF+
ColumnMajorMatrixF
is a dense matrix whose entries are arranged in
+ column-major order.Constructor and Description | +
---|
ColumnMajorMatrixF(int nRows,
+ int nCols) |
+
Modifier and Type | +Method and Description | +
---|---|
protected int |
+indexFromRowCol(int row,
+ int col)
+Given a row and column index into the matrix, returns the corresponding index
+ into the underlying float[] array.
+ |
+
VectorF |
+toVector()
+If the receiver is one-dimensional in one of its dimensions, returns a vector
+ containing the data of the receiver; otherwise, an exception is thrown.
+ |
+
get, getData, put
adaptHomogeneous, add, add, add, added, added, added, diagonalMatrix, diagonalMatrix, dimensionsError, dimensionsError, emptyMatrix, formatAsTransform, formatAsTransform, getColumn, getRow, getTranslation, identityMatrix, inverted, multiplied, multiplied, multiplied, multiplied, multiply, multiply, multiply, multiply, numCols, numRows, slice, slice, subtract, subtract, subtract, subtracted, subtracted, subtracted, toString, transform, transposed
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public ColumnMajorMatrixF(int nRows, + int nCols)+
protected int indexFromRowCol(int row, + int col)+
DenseMatrixF
indexFromRowCol
in class DenseMatrixF
row
- the row whose index is desiredcol
- the column whose index is desiredDenseMatrixF.getData()
public class ColumnMatrixF +extends MatrixF+
ColumnMatrixF
is a matrix that converts a VectorF into a 1xn matrixConstructor and Description | +
---|
ColumnMatrixF(VectorF vector) |
+
Modifier and Type | +Method and Description | +
---|---|
MatrixF |
+emptyMatrix(int numRows,
+ int numCols)
+Returns a new empty matrix of the indicated dimensions.
+ |
+
float |
+get(int row,
+ int col)
+Returns a particular element of this matrix
+ |
+
void |
+put(int row,
+ int col,
+ float value)
+Updates a particular element of this matrix
+ |
+
adaptHomogeneous, add, add, add, added, added, added, diagonalMatrix, diagonalMatrix, dimensionsError, dimensionsError, formatAsTransform, formatAsTransform, getColumn, getRow, getTranslation, identityMatrix, inverted, multiplied, multiplied, multiplied, multiplied, multiply, multiply, multiply, multiply, numCols, numRows, slice, slice, subtract, subtract, subtract, subtracted, subtracted, subtracted, toString, toVector, transform, transposed
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public float get(int row, + int col)+
MatrixF
get
in class MatrixF
row
- the index of the row of the element to returncol
- the index of the column of the element to returnMatrixF.put(int, int, float)
public void put(int row, + int col, + float value)+
MatrixF
public MatrixF emptyMatrix(int numRows, + int numCols)+
MatrixF
emptyMatrix
in class MatrixF
OpenGLMatrix.emptyMatrix(int, int)
public abstract class DenseMatrixF +extends MatrixF+
DenseMatrixF
is a matrix of floats whose storage is a contiguous float[] array. It may
+ logically be ranged arranged either in row or column major order.MatrixF
,
+RowMajorMatrixF
,
+ColumnMajorMatrixF
,
+SliceMatrixF
Modifier | +Constructor and Description | +
---|---|
protected |
+DenseMatrixF(int nRows,
+ int nCols) |
+
Modifier and Type | +Method and Description | +
---|---|
float |
+get(int row,
+ int col)
+Returns a particular element of this matrix
+ |
+
abstract float[] |
+getData()
+Returns the contiguous array of floats which is the storage for this matrix
+ |
+
protected abstract int |
+indexFromRowCol(int row,
+ int col)
+Given a row and column index into the matrix, returns the corresponding index
+ into the underlying float[] array.
+ |
+
void |
+put(int row,
+ int col,
+ float value)
+Updates a particular element of this matrix
+ |
+
adaptHomogeneous, add, add, add, added, added, added, diagonalMatrix, diagonalMatrix, dimensionsError, dimensionsError, emptyMatrix, formatAsTransform, formatAsTransform, getColumn, getRow, getTranslation, identityMatrix, inverted, multiplied, multiplied, multiplied, multiplied, multiply, multiply, multiply, multiply, numCols, numRows, slice, slice, subtract, subtract, subtract, subtracted, subtracted, subtracted, toString, toVector, transform, transposed
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
protected DenseMatrixF(int nRows, + int nCols)+
public float get(int row, + int col)+
MatrixF
get
in class MatrixF
row
- the index of the row of the element to returncol
- the index of the column of the element to returnMatrixF.put(int, int, float)
public void put(int row, + int col, + float value)+
MatrixF
public abstract float[] getData()+
protected abstract int indexFromRowCol(int row, + int col)+
row
- the row whose index is desiredcol
- the column whose index is desiredgetData()
public class GeneralMatrixF +extends RowMajorMatrixF+
GeneralMatrixF
is a concrete matrix implementation that is supported by
+ a backing store consisting of an array of floats. The matrix is stored in row-major order.Constructor and Description | +
---|
GeneralMatrixF(int numRows,
+ int numCols) |
+
GeneralMatrixF(int numRows,
+ int numCols,
+ float[] data) |
+
Modifier and Type | +Method and Description | +
---|---|
MatrixF |
+emptyMatrix(int numRows,
+ int numCols)
+Returns a new empty matrix of the indicated dimensions.
+ |
+
float[] |
+getData()
+Returns the contiguous array of floats which is the storage for this matrix
+ |
+
GeneralMatrixF |
+transposed()
+Returns a matrix which is the transposition of the receiver matrix.
+ |
+
indexFromRowCol, toVector
get, put
adaptHomogeneous, add, add, add, added, added, added, diagonalMatrix, diagonalMatrix, dimensionsError, dimensionsError, formatAsTransform, formatAsTransform, getColumn, getRow, getTranslation, identityMatrix, inverted, multiplied, multiplied, multiplied, multiplied, multiply, multiply, multiply, multiply, numCols, numRows, slice, slice, subtract, subtract, subtract, subtracted, subtracted, subtracted, toString, transform
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public GeneralMatrixF(int numRows, + int numCols)+
public GeneralMatrixF(int numRows, + int numCols, + float[] data)+
public float[] getData()+
DenseMatrixF
getData
in class DenseMatrixF
public MatrixF emptyMatrix(int numRows, + int numCols)+
MatrixF
emptyMatrix
in class MatrixF
OpenGLMatrix.emptyMatrix(int, int)
public GeneralMatrixF transposed()+
MatrixF
transposed
in class MatrixF
public abstract class MatrixF
+extends java.lang.Object
+MatrixF
represents a matrix of floats of a defined dimensionality but abstracts
+ the means by which a particular element of the matrix is retrieved or updated. MatrixF
+ is an abstract class: it is never instantiated; rather, only instances of its subclasses are
+ made.OpenGLMatrix
,
+GeneralMatrixF
,
+SliceMatrixF
Modifier and Type | +Field and Description | +
---|---|
protected int |
+numCols |
+
protected int |
+numRows |
+
Constructor and Description | +
---|
MatrixF(int numRows,
+ int numCols)
+Creates a matrix containing the indicated number of rows and columns.
+ |
+
Modifier and Type | +Method and Description | +
---|---|
protected VectorF |
+adaptHomogeneous(VectorF him)
+Automatically adapts vectors to and from homogeneous coordinates according to the
+ size of the receiver matrix.
+ |
+
void |
+add(float[] him) |
+
void |
+add(MatrixF addend)
+Adds a matrix, in place, to the receiver
+ |
+
void |
+add(VectorF him) |
+
MatrixF |
+added(float[] him) |
+
MatrixF |
+added(MatrixF addend)
+Returns a new matrix whose elements are the sum of the corresponding elements of
+ the receiver and the addend
+ |
+
MatrixF |
+added(VectorF him) |
+
static MatrixF |
+diagonalMatrix(int dim,
+ float scale)
+Returns a new matrix which is zero everywhere except on the diagonal, where it has
+ an indicated value.
+ |
+
static MatrixF |
+diagonalMatrix(VectorF vector)
+Returns a new matrix which is zero everywhere, except on the diagonal, where its
+ values are taken from an indicated vector
+ |
+
protected java.lang.RuntimeException |
+dimensionsError() |
+
protected static java.lang.RuntimeException |
+dimensionsError(int numRows,
+ int numCols) |
+
abstract MatrixF |
+emptyMatrix(int numRows,
+ int numCols)
+Returns a new empty matrix of the indicated dimensions.
+ |
+
java.lang.String |
+formatAsTransform()
+A simple utility that extracts positioning information from a transformation matrix
+ and formats it in a form palatable to a human being.
+ |
+
java.lang.String |
+formatAsTransform(AxesReference axesReference,
+ AxesOrder axesOrder,
+ AngleUnit unit)
+A simple utility that extracts positioning information from a transformation matrix
+ and formats it in a form palatable to a human being.
+ |
+
abstract float |
+get(int row,
+ int col)
+Returns a particular element of this matrix
+ |
+
VectorF |
+getColumn(int col)
+Returns a vector containing data of a particular column of the receiver.
+ |
+
VectorF |
+getRow(int row)
+Returns a vector containing data of a particular row of the receiver.
+ |
+
VectorF |
+getTranslation()
+Assumes that the receiver is non-perspective transformation matrix.
+ |
+
static MatrixF |
+identityMatrix(int dim)
+Returns an identity matrix of the indicated dimension.
+ |
+
MatrixF |
+inverted()
+Returns a matrix which is the matrix-multiplication inverse of the receiver.
+ |
+
MatrixF |
+multiplied(float scale)
+Returns a new matrix in which all the entries of the receiver have been scaled
+ by an indicated value.
+ |
+
VectorF |
+multiplied(float[] him)
+Multiplies the receiver by the indicated vector, considered as a column matrix.
+ |
+
MatrixF |
+multiplied(MatrixF him)
+Returns a matrix which is the multiplication of the recevier with another matrix.
+ |
+
VectorF |
+multiplied(VectorF him)
+Multiplies the receiver by the indicated vector, considered as a column matrix.
+ |
+
void |
+multiply(float scale) |
+
void |
+multiply(float[] him) |
+
void |
+multiply(MatrixF him)
+Updates the receiver to be the product of itself and another matrix.
+ |
+
void |
+multiply(VectorF him) |
+
int |
+numCols()
+Returns the number of columns in this matrix
+ |
+
int |
+numRows()
+Returns the number of rows in this matrix
+ |
+
abstract void |
+put(int row,
+ int col,
+ float value)
+Updates a particular element of this matrix
+ |
+
SliceMatrixF |
+slice(int numRows,
+ int numCols)
+Returns a matrix which is a submatrix of the receiver starting at (0,0)
+ |
+
SliceMatrixF |
+slice(int row,
+ int col,
+ int numRows,
+ int numCols)
+Returns a matrix which a submatrix of the receiver.
+ |
+
void |
+subtract(float[] him) |
+
void |
+subtract(MatrixF subtrahend)
+Subtracts a matrix, in place, from the receiver.
+ |
+
void |
+subtract(VectorF him) |
+
MatrixF |
+subtracted(float[] him) |
+
MatrixF |
+subtracted(MatrixF subtrahend)
+Returns a new matrix whose elements are the difference of the corresponding elements of
+ the receiver and the subtrahend
+ |
+
MatrixF |
+subtracted(VectorF him) |
+
java.lang.String |
+toString() |
+
VectorF |
+toVector()
+If the receiver is one-dimensional in one of its dimensions, returns a vector
+ containing the data of the receiver; otherwise, an exception is thrown.
+ |
+
VectorF |
+transform(VectorF him)
+Transforms the vector according to this matrix interpreted as a transformation matrix.
+ |
+
MatrixF |
+transposed()
+Returns a matrix which is the transposition of the receiver matrix.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
protected int numRows+
protected int numCols+
public MatrixF(int numRows, + int numCols)+
@Const +public SliceMatrixF slice(int row, + int col, + int numRows, + int numCols)+
row
- the row in the receiver at which the submatrix is to startcol
- the column in the receiver at which the submatrix is to startnumRows
- the number of rows in the submatrixnumCols
- the number of columns in the submatrixslice(int, int)
@Const +public SliceMatrixF slice(int numRows, + int numCols)+
numRows
- the number of rows in the submatrixnumCols
- the number of columns in the submatrixslice(int, int, int, int)
public static MatrixF identityMatrix(int dim)+
dim
- the size of the indentity matrix to returnpublic static MatrixF diagonalMatrix(int dim, + float scale)+
dim
- the size of the matrix to returnscale
- the value to place on its diagonalpublic static MatrixF diagonalMatrix(VectorF vector)+
vector
- the values to place on the diagonal@Const +public abstract MatrixF emptyMatrix(int numRows, + int numCols)+
OpenGLMatrix.emptyMatrix(int, int)
@Const +public int numRows()+
@Const +public int numCols()+
@Const +public abstract float get(int row, + int col)+
row
- the index of the row of the element to returncol
- the index of the column of the element to returnput(int, int, float)
@NonConst +public abstract void put(int row, + int col, + float value)+
row
- the index of the row of the element to updatecol
- the index of the column of the element to updatevalue
- the new value for the indicated element@Const +public VectorF getRow(int row)+
row
- the row to extract@Const +public VectorF getColumn(int col)+
col
- the column to extract@Const +public java.lang.String toString()+
toString
in class java.lang.Object
@Const +public VectorF transform(VectorF him)+
him
- the 3D coordinate or 3D homogeneous coordinate that is to be transformedVectorF.normalized3D()
@Const +protected VectorF adaptHomogeneous(VectorF him)+
transform(VectorF)
,
+Homogeneous coordinatespublic java.lang.String formatAsTransform()+
formatAsTransform(AxesReference, AxesOrder, AngleUnit)
,
+Transformation Matrixpublic java.lang.String formatAsTransform(AxesReference axesReference, + AxesOrder axesOrder, + AngleUnit unit)+
axesReference
- the reference frame of the angles to use in reporting the transformationaxesOrder
- the order of the angles to use in reporting the transformationunit
- the angular unit to use in reporting the transformationformatAsTransform()
,
+Transformation Matrix@Const +public MatrixF transposed()+
@NonConst +public void multiply(MatrixF him)+
him
- the matrix with which the receiver is to be multiplied.@Const +public MatrixF multiplied(MatrixF him)+
him
- the matrix with which the receiver is to be multiplied.@Const +public MatrixF multiplied(float scale)+
scale
- the factor with which to scale each entry of the receiver@NonConst +public void multiply(float scale)+
@Const +public VectorF multiplied(VectorF him)+
him
- the vector with which the receiver is to be multiplied@Const +public VectorF multiplied(float[] him)+
him
- the vector with which the receiver is to be multiplied@NonConst +public void multiply(float[] him)+
@Const +public VectorF toVector()+
@Const +public MatrixF added(MatrixF addend)+
addend
- the matrix which is to be added to the receiver@NonConst +public void add(MatrixF addend)+
addend
- the matrix which is to be added to the receiver@Const +public MatrixF subtracted(MatrixF subtrahend)+
subtrahend
- the matrix which is to be subtracted from the receiver@NonConst +public void subtract(MatrixF subtrahend)+
subtrahend
- the matrix which is to be subtracted from the receiver@Const +public MatrixF added(VectorF him)+
added(MatrixF)
@Const +public MatrixF added(float[] him)+
added(VectorF)
@Const +public MatrixF subtracted(VectorF him)+
subtracted(MatrixF)
@Const +public MatrixF subtracted(float[] him)+
subtracted(VectorF)
@NonConst +public void add(VectorF him)+
add(MatrixF)
@NonConst +public void add(float[] him)+
add(VectorF)
@NonConst +public void subtract(VectorF him)+
subtract(MatrixF)
@NonConst +public void subtract(float[] him)+
subtract(VectorF)
@Const +public VectorF getTranslation()+
protected java.lang.RuntimeException dimensionsError()+
protected static java.lang.RuntimeException dimensionsError(int numRows, + int numCols)+
public class OpenGLMatrix +extends ColumnMajorMatrixF+
OpenGLMatrix
is a 4x4 matrix commonly used as a transformation matrix for 3D
+ homogeneous coordinates. The data layout of an OpenGLMatrix
is used heavily in the
+ OpenGL high performance graphics standard.Matrix
,
+Matrix
Constructor and Description | +
---|
OpenGLMatrix() |
+
OpenGLMatrix(float[] data) |
+
OpenGLMatrix(Matrix44F matrix) |
+
Modifier and Type | +Method and Description | +
---|---|
MatrixF |
+emptyMatrix(int numRows,
+ int numCols)
+Returns a new empty matrix of the indicated dimensions.
+ |
+
float[] |
+getData()
+Returns the contiguous array of floats which is the storage for this matrix
+ |
+
static OpenGLMatrix |
+identityMatrix() |
+
OpenGLMatrix |
+inverted()
+Returns a matrix which is the matrix-multiplication inverse of the receiver.
+ |
+
MatrixF |
+multiplied(MatrixF him)
+Returns a matrix which is the multiplication of the recevier with another matrix.
+ |
+
OpenGLMatrix |
+multiplied(OpenGLMatrix him) |
+
void |
+multiply(MatrixF him)
+Updates the receiver to be the product of itself and another matrix.
+ |
+
void |
+multiply(OpenGLMatrix him)
+Updates the receiver to be the product of itself and another matrix.
+ |
+
void |
+rotate(AngleUnit angleUnit,
+ float angle,
+ float dx,
+ float dy,
+ float dz) |
+
void |
+rotate(AxesReference axesReference,
+ AxesOrder axesOrder,
+ AngleUnit angleUnit,
+ float first,
+ float second,
+ float third) |
+
OpenGLMatrix |
+rotated(AngleUnit angleUnit,
+ float angle,
+ float dx,
+ float dy,
+ float dz) |
+
OpenGLMatrix |
+rotated(AxesReference axesReference,
+ AxesOrder axesOrder,
+ AngleUnit angleUnit,
+ float first,
+ float second,
+ float third) |
+
static OpenGLMatrix |
+rotation(AngleUnit angleUnit,
+ float angle,
+ float dx,
+ float dy,
+ float dz)
+Creates a matrix for rotation by the indicated angle around the indicated vector.
+ |
+
static OpenGLMatrix |
+rotation(AxesReference axesReference,
+ AxesOrder axesOrder,
+ AngleUnit angleUnit,
+ float first,
+ float second,
+ float third)
+Creates a matrix for a rotation specified by three successive rotation angles.
+ |
+
void |
+scale(float scale) |
+
void |
+scale(float scaleX,
+ float scaleY,
+ float scaleZ) |
+
OpenGLMatrix |
+scaled(float scale) |
+
OpenGLMatrix |
+scaled(float scaleX,
+ float scaleY,
+ float scaleZ) |
+
void |
+translate(float dx,
+ float dy,
+ float dz) |
+
OpenGLMatrix |
+translated(float dx,
+ float dy,
+ float dz) |
+
static OpenGLMatrix |
+translation(float dx,
+ float dy,
+ float dz) |
+
OpenGLMatrix |
+transposed()
+Returns a matrix which is the transposition of the receiver matrix.
+ |
+
indexFromRowCol, toVector
get, put
adaptHomogeneous, add, add, add, added, added, added, diagonalMatrix, diagonalMatrix, dimensionsError, dimensionsError, formatAsTransform, formatAsTransform, getColumn, getRow, getTranslation, identityMatrix, multiplied, multiplied, multiplied, multiply, multiply, multiply, numCols, numRows, slice, slice, subtract, subtract, subtract, subtracted, subtracted, subtracted, toString, transform
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public OpenGLMatrix()+
public OpenGLMatrix(float[] data)+
public OpenGLMatrix(Matrix44F matrix)+
public MatrixF emptyMatrix(int numRows, + int numCols)+
MatrixF
emptyMatrix
in class MatrixF
emptyMatrix(int, int)
public static OpenGLMatrix rotation(AngleUnit angleUnit, + float angle, + float dx, + float dy, + float dz)+
public static OpenGLMatrix rotation(AxesReference axesReference, + AxesOrder axesOrder, + AngleUnit angleUnit, + float first, + float second, + float third)+
public static OpenGLMatrix translation(float dx, + float dy, + float dz)+
public static OpenGLMatrix identityMatrix()+
public float[] getData()+
DenseMatrixF
getData
in class DenseMatrixF
@NonConst +public void scale(float scaleX, + float scaleY, + float scaleZ)+
@NonConst +public void scale(float scale)+
@NonConst +public void translate(float dx, + float dy, + float dz)+
@NonConst +public void rotate(AngleUnit angleUnit, + float angle, + float dx, + float dy, + float dz)+
@NonConst +public void rotate(AxesReference axesReference, + AxesOrder axesOrder, + AngleUnit angleUnit, + float first, + float second, + float third)+
@Const +public OpenGLMatrix scaled(float scaleX, + float scaleY, + float scaleZ)+
@Const +public OpenGLMatrix scaled(float scale)+
@Const +public OpenGLMatrix translated(float dx, + float dy, + float dz)+
@Const +public OpenGLMatrix rotated(AngleUnit angleUnit, + float angle, + float dx, + float dy, + float dz)+
@Const +public OpenGLMatrix rotated(AxesReference axesReference, + AxesOrder axesOrder, + AngleUnit angleUnit, + float first, + float second, + float third)+
@Const +public OpenGLMatrix inverted()+
MatrixF
@Const +public OpenGLMatrix transposed()+
MatrixF
transposed
in class MatrixF
@Const +public OpenGLMatrix multiplied(OpenGLMatrix him)+
@Const +public MatrixF multiplied(MatrixF him)+
MatrixF
multiplied
in class MatrixF
him
- the matrix with which the receiver is to be multiplied.@NonConst +public void multiply(OpenGLMatrix him)+
him
- the matrix with which the receiver is to be multiplied.public abstract class RowMajorMatrixF +extends DenseMatrixF+
RowMajorMatrixF
is a dense matrix whose entries are arranged in
+ row-major order.Constructor and Description | +
---|
RowMajorMatrixF(int nRows,
+ int nCols) |
+
Modifier and Type | +Method and Description | +
---|---|
protected int |
+indexFromRowCol(int row,
+ int col)
+Given a row and column index into the matrix, returns the corresponding index
+ into the underlying float[] array.
+ |
+
VectorF |
+toVector()
+If the receiver is one-dimensional in one of its dimensions, returns a vector
+ containing the data of the receiver; otherwise, an exception is thrown.
+ |
+
get, getData, put
adaptHomogeneous, add, add, add, added, added, added, diagonalMatrix, diagonalMatrix, dimensionsError, dimensionsError, emptyMatrix, formatAsTransform, formatAsTransform, getColumn, getRow, getTranslation, identityMatrix, inverted, multiplied, multiplied, multiplied, multiplied, multiply, multiply, multiply, multiply, numCols, numRows, slice, slice, subtract, subtract, subtract, subtracted, subtracted, subtracted, toString, transform, transposed
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public RowMajorMatrixF(int nRows, + int nCols)+
protected int indexFromRowCol(int row, + int col)+
DenseMatrixF
indexFromRowCol
in class DenseMatrixF
row
- the row whose index is desiredcol
- the column whose index is desiredDenseMatrixF.getData()
public class RowMatrixF +extends MatrixF+
ColumnMatrixF
is a matrix that converts a VectorF into a 1xn matrixConstructor and Description | +
---|
RowMatrixF(VectorF vector) |
+
Modifier and Type | +Method and Description | +
---|---|
MatrixF |
+emptyMatrix(int numRows,
+ int numCols)
+Returns a new empty matrix of the indicated dimensions.
+ |
+
float |
+get(int row,
+ int col)
+Returns a particular element of this matrix
+ |
+
void |
+put(int row,
+ int col,
+ float value)
+Updates a particular element of this matrix
+ |
+
adaptHomogeneous, add, add, add, added, added, added, diagonalMatrix, diagonalMatrix, dimensionsError, dimensionsError, formatAsTransform, formatAsTransform, getColumn, getRow, getTranslation, identityMatrix, inverted, multiplied, multiplied, multiplied, multiplied, multiply, multiply, multiply, multiply, numCols, numRows, slice, slice, subtract, subtract, subtract, subtracted, subtracted, subtracted, toString, toVector, transform, transposed
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public float get(int row, + int col)+
MatrixF
get
in class MatrixF
row
- the index of the row of the element to returncol
- the index of the column of the element to returnMatrixF.put(int, int, float)
public void put(int row, + int col, + float value)+
MatrixF
public MatrixF emptyMatrix(int numRows, + int numCols)+
MatrixF
emptyMatrix
in class MatrixF
OpenGLMatrix.emptyMatrix(int, int)
public class SliceMatrixF +extends MatrixF+
SliceMatrixF
is a matrix whose implementation is a submatrix of some other matrix.Modifier and Type | +Field and Description | +
---|---|
protected int |
+col |
+
protected MatrixF |
+matrix |
+
protected int |
+row |
+
Constructor and Description | +
---|
SliceMatrixF(MatrixF matrix,
+ int row,
+ int col,
+ int numRows,
+ int numCols)
+Creates a
+SliceMatrixF based on the indicated matrix whose upper left corner is at
+ (row, col) of that matrix and whose size is numRows x numCols. |
+
Modifier and Type | +Method and Description | +
---|---|
MatrixF |
+emptyMatrix(int numRows,
+ int numCols)
+Returns a new empty matrix of the indicated dimensions.
+ |
+
float |
+get(int row,
+ int col)
+Returns a particular element of this matrix
+ |
+
void |
+put(int row,
+ int col,
+ float value)
+Updates a particular element of this matrix
+ |
+
adaptHomogeneous, add, add, add, added, added, added, diagonalMatrix, diagonalMatrix, dimensionsError, dimensionsError, formatAsTransform, formatAsTransform, getColumn, getRow, getTranslation, identityMatrix, inverted, multiplied, multiplied, multiplied, multiplied, multiply, multiply, multiply, multiply, numCols, numRows, slice, slice, subtract, subtract, subtract, subtracted, subtracted, subtracted, toString, toVector, transform, transposed
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
protected MatrixF matrix+
protected int row+
protected int col+
public SliceMatrixF(MatrixF matrix, + int row, + int col, + int numRows, + int numCols)+
SliceMatrixF
based on the indicated matrix whose upper left corner is at
+ (row, col) of that matrix and whose size is numRows x numCols.matrix
- the matrix we are to take a slice ofrow
- the row in matrix in which the slice is to begincol
- the column in matrix in which the slice is to beginnumRows
- the number of rows that the slice should benumCols
- the number of columns that the slice should bepublic float get(int row, + int col)+
MatrixF
get
in class MatrixF
row
- the index of the row of the element to returncol
- the index of the column of the element to returnMatrixF.put(int, int, float)
public void put(int row, + int col, + float value)+
MatrixF
public MatrixF emptyMatrix(int numRows, + int numCols)+
MatrixF
emptyMatrix
in class MatrixF
OpenGLMatrix.emptyMatrix(int, int)
public class VectorF
+extends java.lang.Object
+VectorF
represents a single-dimensional vector of floats. It is not a matrix,
+ but can easily be converted into either a RowMatrixF
or a ColumnMatrixF
should
+ that be desired. That said, vectors can be multiplied by matrices to their left (or right); this
+ is commonly used to transform a set of coordinates (in the vector) by a transformation matrix.MatrixF
,
+RowMatrixF
,
+ColumnMatrixF
Modifier and Type | +Field and Description | +
---|---|
protected float[] |
+data |
+
Constructor and Description | +
---|
VectorF(float x) |
+
VectorF(float[] data) |
+
VectorF(float x,
+ float y) |
+
VectorF(float x,
+ float y,
+ float z) |
+
VectorF(float x,
+ float y,
+ float z,
+ float w) |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+add(VectorF addend) |
+
MatrixF |
+added(MatrixF addend)
+Adds this vector, taken as a row vector against, to the indicated matrix.
+ |
+
VectorF |
+added(VectorF addend) |
+
protected java.lang.RuntimeException |
+dimensionsError() |
+
protected static java.lang.RuntimeException |
+dimensionsError(int length) |
+
float |
+dotProduct(VectorF him)
+Returns the dot product of this vector and another.
+ |
+
float |
+get(int index) |
+
float[] |
+getData() |
+
int |
+length() |
+
static VectorF |
+length(int length)
+Creates a new vector of the indicated length.
+ |
+
float |
+magnitude() |
+
VectorF |
+multiplied(float scale)
+Returns a new vector containing the elements of this vector scaled by the indicated factor.
+ |
+
MatrixF |
+multiplied(MatrixF him)
+Multiplies this vector, taken as a row vector, against the indicated matrix.
+ |
+
void |
+multiply(float scale) |
+
VectorF |
+normalized3D()
+Consider this vector as a 3D coordinate or 3D homogeneous coordinate, and, if the
+ latter, return its normalized form.
+ |
+
void |
+put(int index,
+ float value) |
+
void |
+subtract(VectorF subtrahend) |
+
MatrixF |
+subtracted(MatrixF subtrahend)
+Subtracts the indicated matrix from this vector, taken as a row vector.
+ |
+
VectorF |
+subtracted(VectorF subtrahend) |
+
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public VectorF(float[] data)+
public VectorF(float x)+
public VectorF(float x, + float y)+
public VectorF(float x, + float y, + float z)+
public VectorF(float x, + float y, + float z, + float w)+
public static VectorF length(int length)+
length
- the length of the new vector to return@Const +public float[] getData()+
@Const +public int length()+
@Const +public float get(int index)+
@NonConst +public void put(int index, + float value)+
public java.lang.String toString()+
toString
in class java.lang.Object
@Const +public VectorF normalized3D()+
@Const +public float magnitude()+
@Const +public float dotProduct(VectorF him)+
him
- the other vector with whom the dot product is to be formed@Const +public MatrixF multiplied(MatrixF him)+
@Const +public MatrixF added(MatrixF addend)+
@Const +public MatrixF subtracted(MatrixF subtrahend)+
@Const +public VectorF multiplied(float scale)+
@NonConst +public void multiply(float scale)+
protected java.lang.RuntimeException dimensionsError()+
protected static java.lang.RuntimeException dimensionsError(int length)+
Class | +Description | +
---|---|
ColumnMajorMatrixF | +
+ A
+ColumnMajorMatrixF is a dense matrix whose entries are arranged in
+ column-major order. |
+
ColumnMatrixF | +
+ A
+ColumnMatrixF is a matrix that converts a VectorF into a 1xn matrix |
+
DenseMatrixF | +
+ A
+DenseMatrixF is a matrix of floats whose storage is a contiguous float[] array. |
+
GeneralMatrixF | +
+ A
+GeneralMatrixF is a concrete matrix implementation that is supported by
+ a backing store consisting of an array of floats. |
+
MatrixF | +
+MatrixF represents a matrix of floats of a defined dimensionality but abstracts
+ the means by which a particular element of the matrix is retrieved or updated. |
+
OpenGLMatrix | +
+ An
+OpenGLMatrix is a 4x4 matrix commonly used as a transformation matrix for 3D
+ homogeneous coordinates. |
+
RowMajorMatrixF | +
+ A
+RowMajorMatrixF is a dense matrix whose entries are arranged in
+ row-major order. |
+
RowMatrixF | +
+ A
+ColumnMatrixF is a matrix that converts a VectorF into a 1xn matrix |
+
SliceMatrixF | +
+ A
+SliceMatrixF is a matrix whose implementation is a submatrix of some other matrix. |
+
VectorF | +
+ A
+VectorF represents a single-dimensional vector of floats. |
+
public class Acceleration
+extends java.lang.Object
+Acceleration
represent the second derivative of Position
over time. This
+ is also to say that Position
is a double integration of Acceleration
with respect
+ to time.Modifier and Type | +Field and Description | +
---|---|
long |
+acquisitionTime
+the time on the System.nanoTime() clock at which the data was acquired.
+ |
+
static double |
+earthGravity
+The (nominal) acceleration due to Earth's gravity
+ The units are in m/s^2
+ |
+
DistanceUnit |
+unit
+The distance units in which this acceleration is expressed.
+ |
+
double |
+xAccel |
+
double |
+yAccel |
+
double |
+zAccel |
+
Constructor and Description | +
---|
Acceleration() |
+
Acceleration(DistanceUnit unit,
+ double xAccel,
+ double yAccel,
+ double zAccel,
+ long acquisitionTime) |
+
Modifier and Type | +Method and Description | +
---|---|
static Acceleration |
+fromGravity(double gx,
+ double gy,
+ double gz,
+ long acquisitionTime)
+Returns an acceleration constructed from measures in units of earth's gravity
+ rather than explicit distance units.
+ |
+
java.lang.String |
+toString() |
+
Acceleration |
+toUnit(DistanceUnit distanceUnit) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public static final double earthGravity+
public DistanceUnit unit+
public double xAccel+
public double yAccel+
public double zAccel+
public long acquisitionTime+
public Acceleration()+
public Acceleration(DistanceUnit unit, + double xAccel, + double yAccel, + double zAccel, + long acquisitionTime)+
public static Acceleration fromGravity(double gx, + double gy, + double gz, + long acquisitionTime)+
public Acceleration toUnit(DistanceUnit distanceUnit)+
public java.lang.String toString()+
toString
in class java.lang.Object
public enum AngleUnit +extends java.lang.Enum<AngleUnit>+
AngleUnit
represents angles in different units of measure and
+ provides utility methods to convert across units. AngleUnit
does not
+ maintain angle information information internally, but only helps organize
+ and use angle measures that may be maintained separately across various contexts.
+ + Angles can be distinguished along (at least) two axes: +
+ Unnormalized angles can be handy when the angular quantity is not a physical angle but some + related quantity such as an angular velocity or acceleration, where the + quantity in question lacks the 360-degree cyclical equivalence of a physical angle. +
+
+ AngleUnit
expresses normalized angles, while UnnormalizedAngleUnit
expresses unnormalized ones
+
Enum Constant and Description | +
---|
DEGREES |
+
RADIANS |
+
Modifier and Type | +Field and Description | +
---|---|
byte |
+bVal |
+
static float |
+Pif |
+
protected static double |
+TwoPi |
+
Modifier and Type | +Method and Description | +
---|---|
double |
+fromDegrees(double degrees) |
+
float |
+fromDegrees(float degrees) |
+
double |
+fromRadians(double radians) |
+
float |
+fromRadians(float radians) |
+
double |
+fromUnit(AngleUnit them,
+ double theirs) |
+
float |
+fromUnit(AngleUnit them,
+ float theirs) |
+
UnnormalizedAngleUnit |
+getUnnormalized() |
+
double |
+normalize(double mine) |
+
float |
+normalize(float mine) |
+
static double |
+normalizeDegrees(double degrees) |
+
static float |
+normalizeDegrees(float degrees) |
+
static double |
+normalizeRadians(double radians) |
+
static float |
+normalizeRadians(float radians) |
+
double |
+toDegrees(double inOurUnits) |
+
float |
+toDegrees(float inOurUnits) |
+
double |
+toRadians(double inOurUnits) |
+
float |
+toRadians(float inOurUnits) |
+
static AngleUnit |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static AngleUnit[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final AngleUnit DEGREES+
public static final AngleUnit RADIANS+
public final byte bVal+
protected static final double TwoPi+
public static final float Pif+
public static AngleUnit[] values()+
+for (AngleUnit c : AngleUnit.values()) + System.out.println(c); +
public static AngleUnit valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic double fromDegrees(double degrees)+
public float fromDegrees(float degrees)+
public double fromRadians(double radians)+
public float fromRadians(float radians)+
public double fromUnit(AngleUnit them, + double theirs)+
public float fromUnit(AngleUnit them, + float theirs)+
public double toDegrees(double inOurUnits)+
public float toDegrees(float inOurUnits)+
public double toRadians(double inOurUnits)+
public float toRadians(float inOurUnits)+
public double normalize(double mine)+
public float normalize(float mine)+
public static double normalizeDegrees(double degrees)+
public static float normalizeDegrees(float degrees)+
public static double normalizeRadians(double radians)+
public static float normalizeRadians(float radians)+
public UnnormalizedAngleUnit getUnnormalized()+
public class AngularVelocity
+extends java.lang.Object
+AngularVelocity
represent an instantaneous body-referenced 3D rotation rate.
+
+ The instantaneous rate of change of an Orientation
, which is what we are representing
+ here, has unexpected subtleties. As described in Section 9.3 of the MIT Kinematics Lecture below,
+ the instantaneous body-referenced rotation rate angles are decoupled (their order does not
+ matter) but their conversion into a corresponding instantaneous rate of change of a set of
+ related Euler angles (ie: Orientation
involves a non-obvious transformation on two
+ of the rotation rates.
Modifier and Type | +Field and Description | +
---|---|
long |
+acquisitionTime
+the time on the System.nanoTime() clock at which the data was acquired.
+ |
+
AngleUnit |
+unit
+the angular unit in which angular rates are expressed.
+ |
+
float |
+xRotationRate
+the instantaneous body-referenced rotation rate about the x-axis in units
+ of "
+unit s per second". |
+
float |
+yRotationRate
+the instantaneous body-referenced rotation rate about the y-axis in units
+ of "
+unit s per second". |
+
float |
+zRotationRate
+the instantaneous body-referenced rotation rate about the z-axis in units
+ of "
+unit s per second". |
+
Constructor and Description | +
---|
AngularVelocity() |
+
AngularVelocity(AngleUnit unit,
+ float xRotationRate,
+ float yRotationRate,
+ float zRotationRate,
+ long acquisitionTime) |
+
Modifier and Type | +Method and Description | +
---|---|
AngularVelocity |
+toAngleUnit(AngleUnit unit)
+Converts this
+AngularVelocity to one with the indicated angular units. |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public AngleUnit unit+
public float xRotationRate+
unit
s per second".public float yRotationRate+
unit
s per second".public float zRotationRate+
unit
s per second".public long acquisitionTime+
public AngularVelocity()+
public AngularVelocity(AngleUnit unit, + float xRotationRate, + float yRotationRate, + float zRotationRate, + long acquisitionTime)+
public AngularVelocity toAngleUnit(AngleUnit unit)+
AngularVelocity
to one with the indicated angular units.unit
- the units to use in the returned [@link AngularVelocity}public enum AxesOrder +extends java.lang.Enum<AxesOrder>+
AxesOrder
indicates the chronological order of axes about which the three rotations
+ of an Orientation
take place. The geometry of three space is such that there are
+ exactly twelve distinct rotational orders.Orientation
,
+AxesReference
,
+Euler AnglesEnum Constant and Description | +
---|
XYX |
+
XYZ |
+
XZX |
+
XZY |
+
YXY |
+
YXZ |
+
YZX |
+
YZY |
+
ZXY |
+
ZXZ |
+
ZYX |
+
ZYZ |
+
Modifier and Type | +Method and Description | +
---|---|
Axis[] |
+axes()
+
+ |
+
int[] |
+indices()
+Returns the numerical axes indices associated with this
+AxesOrder . |
+
AxesOrder |
+reverse()
+Returns the
+AxesOrder which is the chronological reverse of the receiver. |
+
static AxesOrder |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static AxesOrder[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final AxesOrder XZX+
public static final AxesOrder XYX+
public static final AxesOrder YXY+
public static final AxesOrder YZY+
public static final AxesOrder ZYZ+
public static final AxesOrder ZXZ+
public static final AxesOrder XZY+
public static final AxesOrder XYZ+
public static final AxesOrder YXZ+
public static final AxesOrder YZX+
public static final AxesOrder ZYX+
public static final AxesOrder ZXY+
public static AxesOrder[] values()+
+for (AxesOrder c : AxesOrder.values()) + System.out.println(c); +
public static AxesOrder valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic int[] indices()+
AxesOrder
.AxesOrder
.public enum AxesReference +extends java.lang.Enum<AxesReference>+
AxesReference
indicates whether we have intrinsic rotations, where the axes
+ move with the object that is rotating, or extrinsic rotations, where they remain fixed
+ in the world around the object.Orientation
,
+AxesOrder
,
+Euler AnglesEnum Constant and Description | +
---|
EXTRINSIC |
+
INTRINSIC |
+
Modifier and Type | +Method and Description | +
---|---|
AxesReference |
+reverse() |
+
static AxesReference |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static AxesReference[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final AxesReference EXTRINSIC+
public static final AxesReference INTRINSIC+
public static AxesReference[] values()+
+for (AxesReference c : AxesReference.values()) + System.out.println(c); +
public static AxesReference valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic AxesReference reverse()+
Enum Constant and Description | +
---|
UNKNOWN |
+
X |
+
Y |
+
Z |
+
Modifier and Type | +Method and Description | +
---|---|
static Axis |
+fromIndex(int index) |
+
static Axis |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static Axis[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final Axis X+
public static final Axis Y+
public static final Axis Z+
public static final Axis UNKNOWN+
public static Axis[] values()+
+for (Axis c : Axis.values()) + System.out.println(c); +
public static Axis valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static Axis fromIndex(int index)+
public enum DistanceUnit +extends java.lang.Enum<DistanceUnit>+
DistanceUnit
represents a unit of measure of distance.Enum Constant and Description | +
---|
CM |
+
INCH |
+
METER |
+
MM |
+
Modifier and Type | +Field and Description | +
---|---|
byte |
+bVal |
+
static double |
+infinity |
+
static double |
+mmPerInch |
+
static double |
+mPerInch |
+
Modifier and Type | +Method and Description | +
---|---|
double |
+fromCm(double cm) |
+
double |
+fromInches(double inches) |
+
double |
+fromMeters(double meters) |
+
double |
+fromMm(double mm) |
+
double |
+fromUnit(DistanceUnit him,
+ double his) |
+
double |
+toCm(double inOurUnits) |
+
double |
+toInches(double inOurUnits) |
+
double |
+toMeters(double inOurUnits) |
+
double |
+toMm(double inOurUnits) |
+
java.lang.String |
+toString() |
+
java.lang.String |
+toString(double inOurUnits) |
+
static DistanceUnit |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static DistanceUnit[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final DistanceUnit METER+
public static final DistanceUnit CM+
public static final DistanceUnit MM+
public static final DistanceUnit INCH+
public final byte bVal+
public static final double infinity+
public static final double mmPerInch+
public static final double mPerInch+
public static DistanceUnit[] values()+
+for (DistanceUnit c : DistanceUnit.values()) + System.out.println(c); +
public static DistanceUnit valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic double fromMeters(double meters)+
public double fromInches(double inches)+
public double fromCm(double cm)+
public double fromMm(double mm)+
public double fromUnit(DistanceUnit him, + double his)+
public double toMeters(double inOurUnits)+
public double toInches(double inOurUnits)+
public double toCm(double inOurUnits)+
public double toMm(double inOurUnits)+
public java.lang.String toString(double inOurUnits)+
public java.lang.String toString()+
toString
in class java.lang.Enum<DistanceUnit>
public class MagneticFlux
+extends java.lang.Object
+MagneticFlux
represent a three-dimensional magnetic strength vector. Units
+ are in tesla (NOT microtesla).Modifier and Type | +Field and Description | +
---|---|
long |
+acquisitionTime
+the time on the System.nanoTime() clock at which the data was acquired.
+ |
+
double |
+x
+the flux in the X direction
+ |
+
double |
+y
+the flux in the Y direction
+ |
+
double |
+z
+the flux in the Z direction
+ |
+
Constructor and Description | +
---|
MagneticFlux() |
+
MagneticFlux(double x,
+ double y,
+ double z,
+ long acquisitionTime) |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public double x+
public double y+
public double z+
public long acquisitionTime+
public static interface MotionDetection.MotionDetectionListener
+Modifier and Type | +Method and Description | +
---|---|
void |
+onMotionDetected(double vector) |
+
public class MotionDetection.Vector
+extends java.lang.Object
+Modifier and Type | +Method and Description | +
---|---|
double |
+magnitude() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public class MotionDetection
+extends java.lang.Object
+implements android.hardware.SensorEventListener
+Modifier and Type | +Class and Description | +
---|---|
static interface |
+MotionDetection.MotionDetectionListener |
+
class |
+MotionDetection.Vector |
+
Modifier and Type | +Field and Description | +
---|---|
protected MotionDetection.Vector |
+gravity |
+
Constructor and Description | +
---|
MotionDetection() |
+
MotionDetection(double detectionThreshold,
+ int rateLimitSeconds) |
+
Modifier and Type | +Method and Description | +
---|---|
protected MotionDetection.Vector |
+filter(android.hardware.SensorEvent sensorEvent)
+filter
+
+ Taken straight from the google documentation for implementing a low pass
+ filter for filtering out gravity.
+ |
+
boolean |
+isAvailable()
+Is the required sensor available on this device?
+ |
+
protected void |
+notifyListeners(double vector) |
+
void |
+onAccuracyChanged(android.hardware.Sensor sensor,
+ int i) |
+
void |
+onSensorChanged(android.hardware.SensorEvent sensorEvent)
+Internal implementations of the SensorEventListener interface.
+ |
+
void |
+purgeListeners()
+purgeListeners
+ |
+
void |
+registerListener(MotionDetection.MotionDetectionListener listener)
+registerListener
+ |
+
void |
+startListening()
+Start processing sensor data.
+ |
+
void |
+stopListening()
+Stop processing sensor data.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected MotionDetection.Vector gravity+
public MotionDetection()+
public MotionDetection(double detectionThreshold, + int rateLimitSeconds)+
protected MotionDetection.Vector filter(android.hardware.SensorEvent sensorEvent)+
sensorEvent
- The sensor data spit out by android for the accelerometer.public void registerListener(MotionDetection.MotionDetectionListener listener)+
public void purgeListeners()+
public boolean isAvailable()+
public void startListening()+
public void stopListening()+
protected void notifyListeners(double vector)+
public void onSensorChanged(android.hardware.SensorEvent sensorEvent)+
onSensorChanged
in interface android.hardware.SensorEventListener
public void onAccuracyChanged(android.hardware.Sensor sensor, + int i)+
onAccuracyChanged
in interface android.hardware.SensorEventListener
public class NavUtil
+extends java.lang.Object
+NavUtil
is a collection of utilities that provide useful manipulations of
+ objects related to navigation.Modifier and Type | +Method and Description | +
---|---|
static Velocity |
+integrate(Acceleration a,
+ double dt) |
+
static Position |
+integrate(Velocity v,
+ double dt) |
+
static Velocity |
+meanIntegrate(Acceleration cur,
+ Acceleration prev)
+Integrate between two accelerations to determine a change in velocity using an assumption
+ that the mean of the accelerations has been acting the entire interval.
+ |
+
static Position |
+meanIntegrate(Velocity cur,
+ Velocity prev)
+Integrate between two velocities to determine a change in position using an assumption
+ that the mean of the velocities has been acting the entire interval.
+ |
+
static Acceleration |
+minus(Acceleration a,
+ Acceleration b) |
+
static Position |
+minus(Position a,
+ Position b) |
+
static Velocity |
+minus(Velocity a,
+ Velocity b) |
+
static Acceleration |
+plus(Acceleration a,
+ Acceleration b) |
+
static Position |
+plus(Position a,
+ Position b) |
+
static Velocity |
+plus(Velocity a,
+ Velocity b) |
+
static Acceleration |
+scale(Acceleration a,
+ double scale) |
+
static Position |
+scale(Position p,
+ double scale) |
+
static Velocity |
+scale(Velocity v,
+ double scale) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static Acceleration plus(Acceleration a, + Acceleration b)+
public static Acceleration minus(Acceleration a, + Acceleration b)+
public static Acceleration scale(Acceleration a, + double scale)+
public static Velocity integrate(Acceleration a, + double dt)+
public static Position meanIntegrate(Velocity cur, + Velocity prev)+
cur
- the current velocityprev
- the previous velocitypublic static Velocity meanIntegrate(Acceleration cur, + Acceleration prev)+
cur
- the current accelerationprev
- the previous accelerationpublic static enum Orientation.AngleSet +extends java.lang.Enum<Orientation.AngleSet>+
Orientation.AngleSet
is used to distinguish between the two sets of angles that will produce
+ a given rotation in a given axes reference and a given axes orderEnum Constant and Description | +
---|
THEONE |
+
THEOTHER |
+
Modifier and Type | +Method and Description | +
---|---|
static Orientation.AngleSet |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static Orientation.AngleSet[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final Orientation.AngleSet THEONE+
public static final Orientation.AngleSet THEOTHER+
public static Orientation.AngleSet[] values()+
+for (Orientation.AngleSet c : Orientation.AngleSet.values()) + System.out.println(c); +
public static Orientation.AngleSet valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic class Orientation
+extends java.lang.Object
+Orientation
represent a rotated stance in three-dimensional space
+ by way of a set of three successive rotations.
+
+ There are several ways that a particular orientation in three-space can be represented.
+ One way is by specifying a (unit) directional vector about which the orientation is to occur,
+ together with a rotation angle about that axis. This representation is unique up to the sign of the
+ direction and angle; that is a rotation a
about a vector v
produces the same
+ rotation as a rotation -a
about the vector -v
. While this manner of specifying a
+ rotation is easy to visualize if the vector in question is one of the cardinal axes (ie: X,Y, or Z),
+ many find it more difficult to visualize more complex rotations in this manner.
An alternative, more common, way to represent a particular orientation in three-space is by means + of indicating three angles of rotation about three successive axes. You might for example be familiar + with the notions of heading, elevation, and bank angles for aircraft. Unfortunately, there are 24 + different yet equivalent ways that a set of three rotational angles about three axes can represent + the same effective rotation. As might be expected, this can be the source of much confusion. The + 24 different representations break down as follows.
+ +First is the matter of the axes reference: is the coordinate system in which the referred-to rotational
+ axes reside a coordinate system that moves with (and so remains fixed relative to) the object being rotated,
+ or do the axes remain fixed relative to the world around the object and are unaffected by the
+ object's rotational motion? The former situation is referred to as an intrinsic
+ reference perspective while the latter is an extrinsic
perspective.
+ Both points of view are equally valid methodologies, but one or the other may be more understandable
+ or useful in a given application situation.
+
The extrinsic-vs-intrinsic difference accounts for a factor of two in our list of 24 different
+ representations. The remaining factor of 12 breaks down into whether the three rotations all use
+ different axes (and so are a permutation of X, Y, and Z, of which there are six in number), or whether
+ the first and last axes are the same and the middle one different (e.g. Z-Y-Z); this has three
+ choices for the first axis (which is also used for the last) and two remaining choices for the
+ second axis, for a total, again, of six possibilities. The geometry of three-space is such that these
+ twelve choices are the only distinct representational possibilities. As with the extrinsic-vs-
+ intrinsic difference, all twelve of these axis order
s are equally valid ways of
+ indicating orientation, but in any given application, one way may be more useful or easier to
+ understand than another.
+
Even on top of all that, for a given intrinsic-vs-extrinsic distinction, and a given axes + ordering, there are two sets of angle rotation that will produce the same orientation. For example, + an extrinsic, XZX rotation of (in degrees) 90, -90, 0 is equivalent to an extrinsic, XZX rotation + of -90, 90, -180.
+ +As was mentioned, much confusion has historically arisen from talking about an orientation as
+ a set of three angles without also clearly indicating which of the 24 representational possibilities
+ one is working within. One aim of Orientation
is to reduce that confusion by being explicitly
+ clear about this issue: an Orientation
always carries along with it the indication of the
+ AxesReference
and AxesOrder
of the orientation. Methods are provided for converting
+ an Orientation
to and from its associated rotation matrix.
Modifier and Type | +Class and Description | +
---|---|
static class |
+Orientation.AngleSet
+Orientation.AngleSet is used to distinguish between the two sets of angles that will produce
+ a given rotation in a given axes reference and a given axes order |
+
Modifier and Type | +Field and Description | +
---|---|
long |
+acquisitionTime
+the time on the System.nanoTime() clock at which the data was acquired.
+ |
+
AngleUnit |
+angleUnit
+the unit in which the angles are expressed
+ |
+
AxesOrder |
+axesOrder
+the order of axes around which our three rotations occur
+ |
+
AxesReference |
+axesReference
+whether we have extrinsic or intrinsic rotations
+ |
+
float |
+firstAngle
+the chronologically first rotation made in the
+AxesOrder |
+
float |
+secondAngle
+the chronologically second rotation made in the
+AxesOrder |
+
float |
+thirdAngle
+the chronologically third rotation made in the
+AxesOrder |
+
Constructor and Description | +
---|
Orientation() |
+
Orientation(AxesReference axesReference,
+ AxesOrder axesOrder,
+ AngleUnit angleUnit,
+ float firstAngle,
+ float secondAngle,
+ float thirdAngle,
+ long acquisitionTime) |
+
Modifier and Type | +Method and Description | +
---|---|
static Orientation |
+getOrientation(MatrixF rot,
+ AxesReference axesReference,
+ AxesOrder axesOrder,
+ AngleUnit unit)
+Given a rotation matrix, and an
+AxesReference and AxesOrder , returns an orientation
+ that would produce that rotation matrix. |
+
static Orientation |
+getOrientation(MatrixF rot,
+ AxesReference axesReference,
+ AxesOrder axesOrder,
+ AngleUnit unit,
+ Orientation.AngleSet angleSet)
+Given a rotation matrix, and an
+AxesReference and AxesOrder , returns an orientation
+ that would produce that rotation matrix. |
+
OpenGLMatrix |
+getRotationMatrix()
+Returns the rotation matrix associated with the receiver
+Orientation . |
+
static OpenGLMatrix |
+getRotationMatrix(AxesReference axesReference,
+ AxesOrder axesOrder,
+ AngleUnit unit,
+ float firstAngle,
+ float secondAngle,
+ float thirdAngle)
+Returns the rotation matrix associated with a particular set of three rotational angles.
+ |
+
Orientation |
+toAngleUnit(AngleUnit angleUnit)
+Converts this
+Orientation to one with the indicated angular units. |
+
Orientation |
+toAxesOrder(AxesOrder axesOrder)
+Converst the
+Orientation to an equivalent one with the indicated ordering of axes |
+
Orientation |
+toAxesReference(AxesReference axesReference)
+Converts the
+Orientation to an equivalent one with the indicted point of view. |
+
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public AxesReference axesReference+
axesOrder
public AxesOrder axesOrder+
axesReference
public AngleUnit angleUnit+
public float firstAngle+
AxesOrder
public float secondAngle+
AxesOrder
public float thirdAngle+
AxesOrder
public long acquisitionTime+
public Orientation()+
public Orientation(AxesReference axesReference, + AxesOrder axesOrder, + AngleUnit angleUnit, + float firstAngle, + float secondAngle, + float thirdAngle, + long acquisitionTime)+
public Orientation toAngleUnit(AngleUnit angleUnit)+
Orientation
to one with the indicated angular units.angleUnit
- the units to use in the returned [@link Orientation}public Orientation toAxesReference(AxesReference axesReference)+
Orientation
to an equivalent one with the indicted point of view.axesReference
- whether we wish to consider rotations from an extrinsic or intrinsic point of viewpublic Orientation toAxesOrder(AxesOrder axesOrder)+
Orientation
to an equivalent one with the indicated ordering of axesaxesOrder
- the desired ordering of axespublic java.lang.String toString()+
toString
in class java.lang.Object
public OpenGLMatrix getRotationMatrix()+
Orientation
.Orientation
.getRotationMatrix(AxesReference, AxesOrder, AngleUnit, float, float, float)
,
+Rotation Matrixpublic static OpenGLMatrix getRotationMatrix(AxesReference axesReference, + AxesOrder axesOrder, + AngleUnit unit, + float firstAngle, + float secondAngle, + float thirdAngle)+
getRotationMatrix()
,
+Rotation Matrixpublic static Orientation getOrientation(MatrixF rot, + AxesReference axesReference, + AxesOrder axesOrder, + AngleUnit unit)+
AxesReference
and AxesOrder
, returns an orientation
+ that would produce that rotation matrix.rot
- the matrix whose orientation is to be determinedaxesReference
- whether wish an extrinsic or intrinsic reference for the axesaxesOrder
- the order in which the axes are to be rotatedunit
- the angle units in which the orientation is to be returnedOrientation
,
+getOrientation(MatrixF, AxesReference, AxesOrder, AngleUnit, AngleSet)
,
+Rotation Matrixpublic static Orientation getOrientation(MatrixF rot, + AxesReference axesReference, + AxesOrder axesOrder, + AngleUnit unit, + Orientation.AngleSet angleSet)+
AxesReference
and AxesOrder
, returns an orientation
+ that would produce that rotation matrix.rot
- the matrix whose orientation is to be determinedaxesReference
- whether wish an extrinsic or intrinsic reference for the axesaxesOrder
- the order in which the axes are to be rotatedunit
- the angle units in which the orientation is to be returnedangleSet
- which of the two sets angles which can produce the rotation matrix is desiredgetRotationMatrix(AxesReference, AxesOrder, AngleUnit, float, float, float)
,
+Rotation Matrixpublic class Position
+extends java.lang.Object
+Position
represent a three-dimensional distance in a particular distance unit.Acceleration
,
+Position
Modifier and Type | +Field and Description | +
---|---|
long |
+acquisitionTime
+the time on the System.nanoTime() clock at which the data was acquired.
+ |
+
DistanceUnit |
+unit |
+
double |
+x |
+
double |
+y |
+
double |
+z |
+
Constructor and Description | +
---|
Position() |
+
Position(DistanceUnit unit,
+ double x,
+ double y,
+ double z,
+ long acquisitionTime) |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+toString() |
+
Position |
+toUnit(DistanceUnit distanceUnit) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public DistanceUnit unit+
public double x+
public double y+
public double z+
public long acquisitionTime+
public Position()+
public Position(DistanceUnit unit, + double x, + double y, + double z, + long acquisitionTime)+
public Position toUnit(DistanceUnit distanceUnit)+
public java.lang.String toString()+
toString
in class java.lang.Object
public class Quaternion
+extends java.lang.Object
+Quaternion
can indicate an orientation in three-space without the trouble of
+ possible gimbal-lock.Modifier and Type | +Field and Description | +
---|---|
long |
+acquisitionTime
+the time on the System.nanoTime() clock at which the data was acquired.
+ |
+
float |
+w |
+
float |
+x |
+
float |
+y |
+
float |
+z |
+
Constructor and Description | +
---|
Quaternion() |
+
Quaternion(float w,
+ float x,
+ float y,
+ float z,
+ long acquisitionTime) |
+
Modifier and Type | +Method and Description | +
---|---|
Quaternion |
+congugate() |
+
float |
+magnitude() |
+
Quaternion |
+normalized() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public float w+
public float x+
public float y+
public float z+
public long acquisitionTime+
public Quaternion()+
public Quaternion(float w, + float x, + float y, + float z, + long acquisitionTime)+
public float magnitude()+
public Quaternion normalized()+
public Quaternion congugate()+
public enum RelicRecoveryVuMark +extends java.lang.Enum<RelicRecoveryVuMark>+
RelicRecoveryVuMark
represent the VuMarks used in the Relic Recovery
+ FTC competition of 2017-18.Enum Constant and Description | +
---|
CENTER |
+
LEFT |
+
RIGHT |
+
UNKNOWN |
+
Modifier and Type | +Method and Description | +
---|---|
static RelicRecoveryVuMark |
+from(VuforiaTrackable.Listener listener) |
+
static RelicRecoveryVuMark |
+from(VuforiaTrackable trackable) |
+
static RelicRecoveryVuMark |
+from(VuMarkInstanceId instanceId) |
+
static RelicRecoveryVuMark |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static RelicRecoveryVuMark[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final RelicRecoveryVuMark UNKNOWN+
public static final RelicRecoveryVuMark LEFT+
public static final RelicRecoveryVuMark CENTER+
public static final RelicRecoveryVuMark RIGHT+
public static RelicRecoveryVuMark[] values()+
+for (RelicRecoveryVuMark c : RelicRecoveryVuMark.values()) + System.out.println(c); +
public static RelicRecoveryVuMark valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static RelicRecoveryVuMark from(VuforiaTrackable trackable)+
public static RelicRecoveryVuMark from(VuforiaTrackable.Listener listener)+
public static RelicRecoveryVuMark from(VuMarkInstanceId instanceId)+
Enum Constant and Description | +
---|
CCW |
+
CW |
+
Modifier and Type | +Method and Description | +
---|---|
static Rotation |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static Rotation[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final Rotation CW+
public static final Rotation CCW+
public static Rotation[] values()+
+for (Rotation c : Rotation.values()) + System.out.println(c); +
public static Rotation valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullEnum Constant and Description | +
---|
CELSIUS |
+
FARENHEIT |
+
KELVIN |
+
Modifier and Type | +Field and Description | +
---|---|
byte |
+bVal |
+
static double |
+CperF |
+
static double |
+zeroCelsiusF |
+
static double |
+zeroCelsiusK |
+
Modifier and Type | +Method and Description | +
---|---|
double |
+fromCelsius(double celsius) |
+
double |
+fromFarenheit(double farenheit) |
+
double |
+fromKelvin(double kelvin) |
+
double |
+fromUnit(TempUnit him,
+ double his) |
+
static TempUnit |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static TempUnit[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final TempUnit CELSIUS+
public static final TempUnit FARENHEIT+
public static final TempUnit KELVIN+
public final byte bVal+
public static final double zeroCelsiusK+
public static final double zeroCelsiusF+
public static final double CperF+
public static TempUnit[] values()+
+for (TempUnit c : TempUnit.values()) + System.out.println(c); +
public static TempUnit valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic double fromCelsius(double celsius)+
public double fromKelvin(double kelvin)+
public double fromFarenheit(double farenheit)+
public double fromUnit(TempUnit him, + double his)+
public class Temperature
+extends java.lang.Object
+Temperature
represent a temperature in a particular temperature scale.Modifier and Type | +Field and Description | +
---|---|
long |
+acquisitionTime
+the time on the System.nanoTime() clock at which the data was acquired.
+ |
+
double |
+temperature |
+
TempUnit |
+unit |
+
Constructor and Description | +
---|
Temperature() |
+
Temperature(TempUnit unit,
+ double temperature,
+ long acquisitionTime) |
+
Modifier and Type | +Method and Description | +
---|---|
Temperature |
+toUnit(TempUnit tempUnit) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public TempUnit unit+
public double temperature+
public long acquisitionTime+
public Temperature()+
public Temperature(TempUnit unit, + double temperature, + long acquisitionTime)+
public Temperature toUnit(TempUnit tempUnit)+
public enum UnnormalizedAngleUnit +extends java.lang.Enum<UnnormalizedAngleUnit>+
UnnormalizedAngleUnit
represents angles in different units of measure and
+ provides utility methods to convert across units. UnnormalizedAngleUnit
does not
+ maintain angle information information internally, but only helps organize
+ and use angle measures that may be maintained separately across various contexts.
+ + Angles can be distinguished along (at least) two axes: +
+ Unnormalized angles can be handy when the angular quantity is not a physical angle but some + related quantity such as an angular velocity or acceleration, where the + quantity in question lacks the 360-degree cyclical equivalence of a physical angle. +
+
+ AngleUnit
expresses normalized angles, while UnnormalizedAngleUnit
expresses unnormalized ones
+
Enum Constant and Description | +
---|
DEGREES |
+
RADIANS |
+
Modifier and Type | +Method and Description | +
---|---|
double |
+fromDegrees(double degrees) |
+
float |
+fromDegrees(float degrees) |
+
double |
+fromRadians(double radians) |
+
float |
+fromRadians(float radians) |
+
double |
+fromUnit(UnnormalizedAngleUnit them,
+ double theirs) |
+
float |
+fromUnit(UnnormalizedAngleUnit them,
+ float theirs) |
+
AngleUnit |
+getNormalized() |
+
double |
+toDegrees(double inOurUnits) |
+
float |
+toDegrees(float inOurUnits) |
+
double |
+toRadians(double inOurUnits) |
+
float |
+toRadians(float inOurUnits) |
+
static UnnormalizedAngleUnit |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static UnnormalizedAngleUnit[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final UnnormalizedAngleUnit DEGREES+
public static final UnnormalizedAngleUnit RADIANS+
public static UnnormalizedAngleUnit[] values()+
+for (UnnormalizedAngleUnit c : UnnormalizedAngleUnit.values()) + System.out.println(c); +
public static UnnormalizedAngleUnit valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic double fromDegrees(double degrees)+
public float fromDegrees(float degrees)+
public double fromRadians(double radians)+
public float fromRadians(float radians)+
public double fromUnit(UnnormalizedAngleUnit them, + double theirs)+
public float fromUnit(UnnormalizedAngleUnit them, + float theirs)+
public double toDegrees(double inOurUnits)+
public float toDegrees(float inOurUnits)+
public double toRadians(double inOurUnits)+
public float toRadians(float inOurUnits)+
public AngleUnit getNormalized()+
public class Velocity
+extends java.lang.Object
+
+Position
,
+Acceleration
Modifier and Type | +Field and Description | +
---|---|
long |
+acquisitionTime
+the time on the System.nanoTime() clock at which the data was acquired.
+ |
+
DistanceUnit |
+unit
+The distance units in which this velocity is expressed.
+ |
+
double |
+xVeloc |
+
double |
+yVeloc |
+
double |
+zVeloc |
+
Constructor and Description | +
---|
Velocity() |
+
Velocity(DistanceUnit unit,
+ double xVeloc,
+ double yVeloc,
+ double zVeloc,
+ long acquisitionTime) |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+toString() |
+
Velocity |
+toUnit(DistanceUnit distanceUnit) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public DistanceUnit unit+
public double xVeloc+
public double yVeloc+
public double zVeloc+
public long acquisitionTime+
public Velocity()+
public Velocity(DistanceUnit unit, + double xVeloc, + double yVeloc, + double zVeloc, + long acquisitionTime)+
public Velocity toUnit(DistanceUnit distanceUnit)+
public java.lang.String toString()+
toString
in class java.lang.Object
public static enum VuMarkInstanceId.Type +extends java.lang.Enum<VuMarkInstanceId.Type>+
VuMarkInstanceId.Type
indicates the type of data that was found in the InstanceId
+ from which this data was decoded.VuMarkInstanceId.getType()
Enum Constant and Description | +
---|
DATA |
+
NUMERIC |
+
STRING |
+
UNKNOWN |
+
Modifier and Type | +Method and Description | +
---|---|
static VuMarkInstanceId.Type |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static VuMarkInstanceId.Type[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final VuMarkInstanceId.Type UNKNOWN+
public static final VuMarkInstanceId.Type NUMERIC+
public static final VuMarkInstanceId.Type STRING+
public static final VuMarkInstanceId.Type DATA+
public static VuMarkInstanceId.Type[] values()+
+for (VuMarkInstanceId.Type c : VuMarkInstanceId.Type.values()) + System.out.println(c); +
public static VuMarkInstanceId.Type valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic class VuMarkInstanceId
+extends java.lang.Object
+VuMarkInstanceId
captures the identifying state decoded from a particular instance
+ of a Vuforia VuMark.com.vuforia.VuMarkTarget
,
+com.vuforia.InstanceId
Modifier and Type | +Class and Description | +
---|---|
static class |
+VuMarkInstanceId.Type
+VuMarkInstanceId.Type indicates the type of data that was found in the InstanceId
+ from which this data was decoded. |
+
Modifier and Type | +Field and Description | +
---|---|
protected byte[] |
+dataValue |
+
protected int |
+numericValue |
+
protected java.lang.String |
+stringValue |
+
protected VuMarkInstanceId.Type |
+type |
+
Constructor and Description | +
---|
VuMarkInstanceId(InstanceId instanceId) |
+
Modifier and Type | +Method and Description | +
---|---|
protected static byte[] |
+dataFrom(InstanceId instanceId) |
+
boolean |
+equals(java.lang.Object o) |
+
VuMarkInstanceId.Type |
+getType() |
+
int |
+hashCode() |
+
java.lang.String |
+toString() |
+
protected static VuMarkInstanceId.Type |
+typeFrom(InstanceId instanceId) |
+
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
protected VuMarkInstanceId.Type type+
protected int numericValue+
protected java.lang.String stringValue+
protected byte[] dataValue+
public VuMarkInstanceId(InstanceId instanceId)+
public java.lang.String toString()+
toString
in class java.lang.Object
protected static byte[] dataFrom(InstanceId instanceId)+
protected static VuMarkInstanceId.Type typeFrom(InstanceId instanceId)+
public boolean equals(java.lang.Object o)+
equals
in class java.lang.Object
public int hashCode()+
hashCode
in class java.lang.Object
public VuMarkInstanceId.Type getType()+
public static class VuforiaBase.TrackingResults
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
boolean |
+isUpdatedRobotLocation |
+
boolean |
+isVisible |
+
OpenGLMatrix |
+matrix |
+
java.lang.String |
+name |
+
float |
+x |
+
float |
+xAngle |
+
float |
+y |
+
float |
+yAngle |
+
float |
+z |
+
float |
+zAngle |
+
Modifier | +Constructor and Description | +
---|---|
protected |
+TrackingResults(VuforiaBase.TrackingResults other) |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+formatAsTransform() |
+
java.lang.String |
+toJson() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public java.lang.String name+
public boolean isVisible+
public boolean isUpdatedRobotLocation+
public OpenGLMatrix matrix+
public float x+
public float y+
public float z+
public float xAngle+
public float yAngle+
public float zAngle+
protected TrackingResults(VuforiaBase.TrackingResults other)+
public abstract class VuforiaBase
+extends java.lang.Object
+Modifier and Type | +Class and Description | +
---|---|
static class |
+VuforiaBase.TrackingResults |
+
Modifier and Type | +Field and Description | +
---|---|
static float |
+MM_FTC_FIELD_WIDTH |
+
static float |
+MM_PER_INCH |
+
Modifier | +Constructor and Description | +
---|---|
protected |
+VuforiaBase(java.lang.String assetName,
+ java.lang.String[] trackableNames,
+ OpenGLMatrix[] locationsOnField) |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+activate()
+Activates all trackables, so that it is actively seeking their presence.
+ |
+
void |
+close()
+Deactivates the trackables and cleans up.
+ |
+
static VuforiaLocalizer.Parameters |
+createParameters() |
+
void |
+deactivate()
+Deactivates all trackables, causing it to no longer see their presence.
+ |
+
VuforiaBase.TrackingResults |
+emptyTrackingResults(java.lang.String name) |
+
protected VuforiaTrackableDefaultListener |
+getListener(java.lang.String name) |
+
VuforiaLocalizer |
+getVuforiaLocalizer() |
+
void |
+initialize(java.lang.String vuforiaLicenseKey,
+ CameraName cameraName,
+ java.lang.String webcamCalibrationFilename,
+ boolean useExtendedTracking,
+ boolean enableCameraMonitoring,
+ VuforiaLocalizer.Parameters.CameraMonitorFeedback cameraMonitorFeedback,
+ float dx,
+ float dy,
+ float dz,
+ float xAngle,
+ float yAngle,
+ float zAngle,
+ boolean useCompetitionFieldTargetLocations)
+Initializes Vuforia, with a CameraName.
+ |
+
void |
+initialize(java.lang.String vuforiaLicenseKey,
+ VuforiaLocalizer.CameraDirection cameraDirection,
+ boolean useExtendedTracking,
+ boolean enableCameraMonitoring,
+ VuforiaLocalizer.Parameters.CameraMonitorFeedback cameraMonitorFeedback,
+ float dx,
+ float dy,
+ float dz,
+ float xAngle,
+ float yAngle,
+ float zAngle,
+ boolean useCompetitionFieldTargetLocations)
+Initializes Vuforia, with a CameraDirection.
+ |
+
java.lang.String |
+printTrackableNames() |
+
VuforiaBase.TrackingResults |
+track(java.lang.String name)
+Returns the TrackingResults of the trackable with the given name.
+ |
+
VuforiaBase.TrackingResults |
+trackPose(java.lang.String name)
+Returns the TrackingResults of the pose of the trackable with the given name.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final float MM_PER_INCH+
public static final float MM_FTC_FIELD_WIDTH+
protected VuforiaBase(java.lang.String assetName, + java.lang.String[] trackableNames, + OpenGLMatrix[] locationsOnField)+
public void initialize(java.lang.String vuforiaLicenseKey, + VuforiaLocalizer.CameraDirection cameraDirection, + boolean useExtendedTracking, + boolean enableCameraMonitoring, + VuforiaLocalizer.Parameters.CameraMonitorFeedback cameraMonitorFeedback, + float dx, + float dy, + float dz, + float xAngle, + float yAngle, + float zAngle, + boolean useCompetitionFieldTargetLocations)+
public void initialize(java.lang.String vuforiaLicenseKey, + CameraName cameraName, + java.lang.String webcamCalibrationFilename, + boolean useExtendedTracking, + boolean enableCameraMonitoring, + VuforiaLocalizer.Parameters.CameraMonitorFeedback cameraMonitorFeedback, + float dx, + float dy, + float dz, + float xAngle, + float yAngle, + float zAngle, + boolean useCompetitionFieldTargetLocations)+
public static VuforiaLocalizer.Parameters createParameters()+
public VuforiaLocalizer getVuforiaLocalizer()+
public void activate()+
java.lang.IllegalStateException
- if initialized has not been called yet.public void deactivate()+
java.lang.IllegalStateException
- if initialized has not been called yet.public VuforiaBase.TrackingResults track(java.lang.String name)+
java.lang.IllegalStateException
- if initialized has not been called yet.java.lang.IllegalArgumentException
- if name is not the name of a trackable.public VuforiaBase.TrackingResults trackPose(java.lang.String name)+
java.lang.IllegalStateException
- if initialized has not been called yet.java.lang.IllegalArgumentException
- if name is not the name of a trackable.public VuforiaBase.TrackingResults emptyTrackingResults(java.lang.String name)+
protected VuforiaTrackableDefaultListener getListener(java.lang.String name)+
public void close()+
public java.lang.String printTrackableNames()+
public static enum VuforiaLocalizer.CameraDirection +extends java.lang.Enum<VuforiaLocalizer.CameraDirection>+
VuforiaLocalizer.CameraDirection
enumerates the identities of the builtin phone cameras that Vuforia can use.Enum Constant and Description | +
---|
BACK |
+
DEFAULT
+
+ |
+
FRONT |
+
UNKNOWN
+A direction whose particulars are not actually known
+ |
+
Modifier and Type | +Field and Description | +
---|---|
protected int |
+direction |
+
Modifier and Type | +Method and Description | +
---|---|
static VuforiaLocalizer.CameraDirection |
+from(java.lang.String string)
+Converts a string to the corresponding camera direction.
+ |
+
int |
+getDirection() |
+
static VuforiaLocalizer.CameraDirection |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static VuforiaLocalizer.CameraDirection[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final VuforiaLocalizer.CameraDirection BACK+
public static final VuforiaLocalizer.CameraDirection FRONT+
public static final VuforiaLocalizer.CameraDirection DEFAULT+ +
public static final VuforiaLocalizer.CameraDirection UNKNOWN+
public static VuforiaLocalizer.CameraDirection[] values()+
+for (VuforiaLocalizer.CameraDirection c : VuforiaLocalizer.CameraDirection.values()) + System.out.println(c); +
public static VuforiaLocalizer.CameraDirection valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic int getDirection()+
public static VuforiaLocalizer.CameraDirection from(java.lang.String string)+
public static class VuforiaLocalizer.CloseableFrame
+extends Frame
+VuforiaLocalizer.CloseableFrame
exposes a close() method so that one can proactively
+ reduce memory pressure when we're done with a FrameConstructor and Description | +
---|
CloseableFrame(Frame frame)
+creating a CloseableFrame also has an effect equivalent to calling frame.clone()
+ |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+close() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static enum VuforiaLocalizer.Parameters.CameraMonitorFeedback +extends java.lang.Enum<VuforiaLocalizer.Parameters.CameraMonitorFeedback>+
VuforiaLocalizer.Parameters.CameraMonitorFeedback
enumerates the kinds of positioning feedback that
+ may be drawn in the camera monitor window.Enum Constant and Description | +
---|
AXES |
+
BUILDINGS |
+
NONE |
+
TEAPOT |
+
Modifier and Type | +Method and Description | +
---|---|
static VuforiaLocalizer.Parameters.CameraMonitorFeedback |
+valueOf(java.lang.String name)
+Returns the enum constant of this type with the specified name.
+ |
+
static VuforiaLocalizer.Parameters.CameraMonitorFeedback[] |
+values()
+Returns an array containing the constants of this enum type, in
+the order they are declared.
+ |
+
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static final VuforiaLocalizer.Parameters.CameraMonitorFeedback NONE+
public static final VuforiaLocalizer.Parameters.CameraMonitorFeedback AXES+
public static final VuforiaLocalizer.Parameters.CameraMonitorFeedback TEAPOT+
public static final VuforiaLocalizer.Parameters.CameraMonitorFeedback BUILDINGS+
public static VuforiaLocalizer.Parameters.CameraMonitorFeedback[] values()+
+for (VuforiaLocalizer.Parameters.CameraMonitorFeedback c : VuforiaLocalizer.Parameters.CameraMonitorFeedback.values()) + System.out.println(c); +
public static VuforiaLocalizer.Parameters.CameraMonitorFeedback valueOf(java.lang.String name)+
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static class VuforiaLocalizer.Parameters
+extends java.lang.Object
+VuforiaLocalizer.Parameters
provides configuration information for instantiating the Vuforia localizerModifier and Type | +Class and Description | +
---|---|
static class |
+VuforiaLocalizer.Parameters.CameraMonitorFeedback
+VuforiaLocalizer.Parameters.CameraMonitorFeedback enumerates the kinds of positioning feedback that
+ may be drawn in the camera monitor window. |
+
Modifier and Type | +Field and Description | +
---|---|
android.app.Activity |
+activity
+The activity in which the localizer is to run.
+ |
+
Camera |
+camera
+If non-null, then this indicates the
+Camera to use with Vuforia. |
+
VuforiaLocalizer.CameraDirection |
+cameraDirection
+If
+camera is null and cameraName is the 'unknown' camera name, then
+ this value is used to indicate the camera to use with Vuforia. |
+
VuforiaLocalizer.Parameters.CameraMonitorFeedback |
+cameraMonitorFeedback
+Indicates the style of camera monitoring feedback to use.
+ |
+
int |
+cameraMonitorViewIdParent
+The resource id of the view within
+activity that will be used
+ as the parent for a live monitor which provides feedback as to what the
+ camera is seeing. |
+
android.view.ViewGroup |
+cameraMonitorViewParent
+The view that will be used as the parent for a live monitor which provides
+ feedback as to what the the camera is seeing.
+ |
+
CameraName |
+cameraName
+If
+camera is non-null, this value is ignored. |
+
boolean |
+fillCameraMonitorViewParent
+Controls whether the camera monitor should entirely fill the camera monitor view parent
+ or not.
+ |
+
double |
+maxWebcamAspectRatio
+Controls the aspect ratios used with webcams.
+ |
+
double |
+minWebcamAspectRatio
+Controls the aspect ratios used with webcams.
+ |
+
int |
+secondsUsbPermissionTimeout
+How long to wait for USB permissions when connecting to a webcam.
+ |
+
boolean |
+useExtendedTracking
+Indicates whether to use Vuforia's extended tracking mode.
+ |
+
java.lang.String |
+vuforiaLicenseKey
+The license key with which to use Vuforia.
+ |
+
java.io.File[] |
+webcamCalibrationFiles
+Camera calibrations resident in files instead of resources.
+ |
+
int[] |
+webcamCalibrationResources
+The resources (if any, may be empty or null) used to provide additional camera calibration data for
+ webcams used with Vuforia.
+ |
+
Constructor and Description | +
---|
Parameters() |
+
Parameters(int cameraMonitorViewIdParent) |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+addWebcamCalibrationFile(java.io.File file) |
+
void |
+addWebcamCalibrationFile(java.lang.String name) |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public java.lang.String vuforiaLicenseKey+
VuforiaLocalizer.Parameters
instance with which you initialize Vuforia.public Camera camera+
Camera
to use with Vuforia. Otherwise,
+ the camera is determined using cameraName
and cameraDirection
.cameraName
,
+cameraDirection
public CameraName cameraName+
camera
is non-null, this value is ignored.
+
+ Otherwise, if this value is neither null nor the 'unknown' camera name, the it indicates
+ the name of the camera to use with Vuforia. It will be opened as needed.
+
+ Otherwise, if this value is the 'unknown' camera name, then this value is ignored and
+ cameraDirection
is used to indicate the camera.
+
+ Otherwise, this value is null, and an error has occurred.camera
,
+cameraDirection
public VuforiaLocalizer.CameraDirection cameraDirection+
camera
is null and cameraName
is the 'unknown' camera name, then
+ this value is used to indicate the camera to use with Vuforia. Note that this value
+ can only indicate the use of built-in cameras found on a phone.camera
,
+cameraName
public boolean useExtendedTracking+
public VuforiaLocalizer.Parameters.CameraMonitorFeedback cameraMonitorFeedback+
None
indicates
+ that the camera monitoring is to be provided, but no feedback is to be drawn thereon.public int cameraMonitorViewIdParent+
activity
that will be used
+ as the parent for a live monitor which provides feedback as to what the
+ camera is seeing. If both cameraMonitorViewIdParent
and cameraMonitorViewParent
+ are specified, cameraMonitorViewParent
is used and cameraMonitorViewIdParent
+ is ignored. Optional: if no view monitor parent is indicated, then no camera
+ monitoring is provided. The default is zero, which does not indicate a view parent.cameraMonitorViewParent
,
+fillCameraMonitorViewParent
public android.view.ViewGroup cameraMonitorViewParent+
cameraMonitorViewIdParent
+ and cameraMonitorViewParent
are specified, cameraMonitorViewParent
is used
+ and cameraMonitorViewIdParent
is ignored. Optional: if no view monitor parent is
+ indicated, then no camera monitoring is provided. The default is null.cameraMonitorViewIdParent
,
+fillCameraMonitorViewParent
public boolean fillCameraMonitorViewParent+
cameraMonitorViewIdParent
,
+cameraMonitorViewParent
public android.app.Activity activity+
public int[] webcamCalibrationResources+
webcamCalibrationFiles
public java.io.File[] webcamCalibrationFiles+
webcamCalibrationResources
public double maxWebcamAspectRatio+
minWebcamAspectRatio
public double minWebcamAspectRatio+
maxWebcamAspectRatio
public int secondsUsbPermissionTimeout+
public interface VuforiaLocalizer
+VuforiaLocalizer
interface provides
+ an interface for interacting with subsystems that can help support localization through
+ visual means.Modifier and Type | +Interface and Description | +
---|---|
static class |
+VuforiaLocalizer.CameraDirection
+VuforiaLocalizer.CameraDirection enumerates the identities of the builtin phone cameras that Vuforia can use. |
+
static class |
+VuforiaLocalizer.CloseableFrame
+VuforiaLocalizer.CloseableFrame exposes a close() method so that one can proactively
+ reduce memory pressure when we're done with a Frame |
+
static class |
+VuforiaLocalizer.Parameters
+VuforiaLocalizer.Parameters provides configuration information for instantiating the Vuforia localizer |
+
Modifier and Type | +Method and Description | +
---|---|
android.graphics.Bitmap |
+convertFrameToBitmap(Frame frame)
+(Advanced) A helper utility that converts a Vuforia
+Frame into an Android Bitmap . |
+
void |
+enableConvertFrameToBitmap()
+(Advanced) Ensures that Vuforia exposes necessary data formats in
+Frame s that allows
+ convertFrameToBitmap(Frame) to function |
+
boolean[] |
+enableConvertFrameToFormat(int... pixelFormats)
+(Advanced) Ask Vuforia to convert frames to the given requested formats.
+ |
+
Camera |
+getCamera()
+Provides access to the
+Camera used by Vuforia. |
+
CameraCalibration |
+getCameraCalibration()
+(Advanced) Returns information about Vuforia's knowledge of the camera that it is using.
+ |
+
CameraName |
+getCameraName()
+Provides access to the name of the camera used by Vuforia.
+ |
+
void |
+getFrameOnce(<any> frameConsumer)
+(Advanced) Calls the indicated code with a frame from the video stream, exactly once.
+ |
+
java.util.concurrent.BlockingQueue<VuforiaLocalizer.CloseableFrame> |
+getFrameQueue()
+(Advanced) Returns a queue into which, if requested, Vuforia
+Frame s are placed
+ as they become available. |
+
int |
+getFrameQueueCapacity()
+(Advanced) Returns the current capacity of the frame queue.
+ |
+
VuforiaTrackables |
+loadTrackablesFromAsset(java.lang.String assetName)
+Loads a Vuforia dataset from the indicated application asset, which must be of
+ type .XML.
+ |
+
VuforiaTrackables |
+loadTrackablesFromFile(java.lang.String absoluteFileName)
+Loads a Vuforia dataset from the indicated file, which must be a .XML file
+ and contain the full file path.
+ |
+
void |
+setFrameQueueCapacity(int capacity)
+(Advanced) Sets the maximum number of
+Frame s that will simultaneously be stored in the
+ frame queue. |
+
VuforiaTrackables loadTrackablesFromAsset(java.lang.String assetName)+
Datasets are created using the Vuforia Target Manager
assetName
- the name of the .XML dataset asset to loadloadTrackablesFromFile(String)
VuforiaTrackables loadTrackablesFromFile(java.lang.String absoluteFileName)+
Datasets are created using the Vuforia Target Manager
absoluteFileName
- the full path to the .XML file of the datasetloadTrackablesFromAsset(String)
Camera getCamera()+
Camera
used by Vuforia. Will be null if a built-in camera
+ is in use. Note that Vuforia is usually actively interacting with this Camera
; users
+ should on their own not initiate streaming, close the camera, or the like.CameraName getCameraName()+
CameraCalibration getCameraCalibration()+
com.vuforia.Tool#getProjectionGL(CameraCalibration, float, float)
java.util.concurrent.BlockingQueue<VuforiaLocalizer.CloseableFrame> getFrameQueue()+
Frame
s are placed
+ as they become available. This provides a means by which camera image data can be accessed
+ even while the Vuforia engine is running.
+
+ While the Vuforia engine is running, it takes exclusive ownership of the camera it is
+ using. This impedes the ability to also use that camera image data in alternative visual
+ processing algorithms. However, periodically (at a rate of tens of Hz), the Vuforia engine
+ makes available Frame
s containing snapshots from the camera, and through which
+ camera image data can be retrieved. These can optionally be retrieved through the frame
+ queue.
To access these Frame
s, call setFrameQueueCapacity(int)
to enable the
+ frame queue. Once enabled, the frame queue can be accessed using getFrameQueue()
+ and the methods thereon used to access Frame
s as they become available.
When setFrameQueueCapacity(int)
is called, any frame queue returned previously by
+ getFrameQueue()
becomes invalid and must be re-fetched.
Frame
s may be retrieved.setFrameQueueCapacity(int)
,
+Frame (Java),
+Frame (C++),
+BlockingQueuevoid setFrameQueueCapacity(int capacity)+
Frame
s that will simultaneously be stored in the
+ frame queue. If the queue is full and new Frame
s become available, older frames
+ will be discarded. The frame queue initially has a capacity of zero.
+
+ Note that calling this method invalidates any frame queue retrieved previously
+ through getFrameQueue()
.
capacity
- the maximum number of items that may be stored in the frame queuegetFrameQueue()
,
+getFrameQueueCapacity()
int getFrameQueueCapacity()+
setFrameQueueCapacity(int)
,
+getFrameQueue()
void getFrameOnce(<any> frameConsumer)+
frameConsumer
- the code to call with the to-be-processed frame.void enableConvertFrameToBitmap()+
Frame
s that allows
+ convertFrameToBitmap(Frame)
to functionboolean[] enableConvertFrameToFormat(int... pixelFormats)+
pixelFormats
- Formats to request Vuforia to convert to.android.graphics.Bitmap convertFrameToBitmap(Frame frame)+
Frame
into an Android Bitmap
.public static class VuforiaRelicRecovery.TrackingResults +extends VuforiaBase.TrackingResults+
Modifier and Type | +Field and Description | +
---|---|
RelicRecoveryVuMark |
+relicRecoveryVuMark |
+
Modifier and Type | +Method and Description | +
---|---|
java.lang.String |
+toJson() |
+
formatAsTransform
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public RelicRecoveryVuMark relicRecoveryVuMark+
public java.lang.String toJson()+
toJson
in class VuforiaBase.TrackingResults
public class VuforiaRelicRecovery +extends VuforiaBase+
Modifier and Type | +Class and Description | +
---|---|
static class |
+VuforiaRelicRecovery.TrackingResults |
+
MM_FTC_FIELD_WIDTH, MM_PER_INCH
Constructor and Description | +
---|
VuforiaRelicRecovery() |
+
Modifier and Type | +Method and Description | +
---|---|
VuforiaBase.TrackingResults |
+emptyTrackingResults(java.lang.String name) |
+
VuforiaBase.TrackingResults |
+track(java.lang.String name)
+Returns the TrackingResults of the trackable with the given name.
+ |
+
VuforiaBase.TrackingResults |
+trackPose(java.lang.String name)
+Returns the TrackingResults of the pose of the trackable with the given name.
+ |
+
activate, close, createParameters, deactivate, getListener, getVuforiaLocalizer, initialize, initialize, printTrackableNames
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public VuforiaBase.TrackingResults track(java.lang.String name)+
VuforiaBase
track
in class VuforiaBase
public VuforiaBase.TrackingResults trackPose(java.lang.String name)+
VuforiaBase
trackPose
in class VuforiaBase
public VuforiaBase.TrackingResults emptyTrackingResults(java.lang.String name)+
emptyTrackingResults
in class VuforiaBase
public class VuforiaRoverRuckus +extends VuforiaBase+
VuforiaBase.TrackingResults
Modifier and Type | +Field and Description | +
---|---|
static java.lang.String[] |
+TRACKABLE_NAMES |
+
MM_FTC_FIELD_WIDTH, MM_PER_INCH
Constructor and Description | +
---|
VuforiaRoverRuckus() |
+
activate, close, createParameters, deactivate, emptyTrackingResults, getListener, getVuforiaLocalizer, initialize, initialize, printTrackableNames, track, trackPose
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static interface VuforiaTrackable.Listener
+Modifier and Type | +Method and Description | +
---|---|
void |
+addTrackable(VuforiaTrackable trackable)
+Adds a trackable on which this
+VuforiaTrackable.Listener is listening. |
+
void |
+onNotTracked()
+Called by the system to inform the trackable that it is no longer visible.
+ |
+
void |
+onTracked(TrackableResult trackableResult,
+ CameraName cameraName,
+ Camera camera,
+ VuforiaTrackable child)
+onTracked(TrackableResult, CameraName, Camera, org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable) is called by the system to notify the listener that its associated trackable is currently visible. |
+
void onTracked(TrackableResult trackableResult, + CameraName cameraName, + Camera camera, + VuforiaTrackable child)+
onTracked(TrackableResult, CameraName, Camera, org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable)
is called by the system to notify the listener that its associated trackable is currently visible.trackableResult
- the Vuforia trackable result object in which we were locatedcameraName
- the name of the camera used by Vuforia to track this objectcamera
- the Camera
instance used in the tracking. Will be null if
+ a built-in camera is usedvoid onNotTracked()+
void addTrackable(VuforiaTrackable trackable)+
VuforiaTrackable.Listener
is listening. May not be
+ called once tracking has begun. If the VuforiaTrackable.Listener
is already listening
+ to this trackable, then the call has no effect.public interface VuforiaTrackable
+VuforiaTrackable
provides access to an individual trackable Vuforia target.Modifier and Type | +Interface and Description | +
---|---|
static interface |
+VuforiaTrackable.Listener |
+
Modifier and Type | +Method and Description | +
---|---|
OpenGLMatrix |
+getFtcFieldFromTarget()
+Returns the location of the trackable in the FTC Field Coordinate System.
+ |
+
VuforiaTrackable.Listener |
+getListener()
+Returns the current listener associated with this trackable.
+ |
+
OpenGLMatrix |
+getLocation()
+Returns the location of the trackable in the FTC Field Coordinate System.
+ |
+
java.lang.String |
+getName()
+Returns the user-determined name associated with this trackable.
+ |
+
VuforiaTrackable |
+getParent()
+Returns the parent trackable with which this trackable is associated, if any.
+ |
+
VuforiaTrackables |
+getTrackables()
+Returns the
+VuforiaTrackables of which this VuforiaTrackable is a member |
+
java.lang.Object |
+getUserData()
+Retreives user data previously associated with this trackable object.
+ |
+
void |
+setListener(VuforiaTrackable.Listener listener)
+Sets an object that will receive notifications as the
+VuforiaTrackable
+ is tracked and is not tracked. |
+
void |
+setLocation(OpenGLMatrix location)
+A synonym for
+setLocationFtcFieldFromTarget(OpenGLMatrix) |
+
void |
+setLocationFtcFieldFromTarget(OpenGLMatrix ftcFieldFromTarget)
+Sets the location of the trackable in the the FTC Field Coordinate System.
+ |
+
void |
+setName(java.lang.String name)
+Sets a user-determined name associated with this trackable.
+ |
+
void |
+setUserData(java.lang.Object object)
+Sets user data to be associated with this trackable object.
+ |
+
void setListener(VuforiaTrackable.Listener listener)+
VuforiaTrackable
+ is tracked and is not tracked. If no listener is provided, then a default listener
+ is used.listener
- the object which is to receive tracking notifications regarding this trackable.
+ If this is null, then a default listener is used. Thus, there is always
+ a listener associated with a VuforiaTrackable
.getListener()
,
+VuforiaTrackableDefaultListener
VuforiaTrackable.Listener getListener()+
setListener(Listener)
,
+VuforiaTrackableDefaultListener
void setLocationFtcFieldFromTarget(OpenGLMatrix ftcFieldFromTarget)+
ftcFieldFromTarget
- the location of the trackable in the FTC Field Coordinate System. This
+ transformation maps coordinates in the Target Coordinate System
+ to coordinates in the FTC Field Coordinate System.getLocation()
,
+VuforiaTrackableDefaultListener.getRobotLocation()
,
+setLocation(OpenGLMatrix)
void setLocation(OpenGLMatrix location)+
setLocationFtcFieldFromTarget(OpenGLMatrix)
OpenGLMatrix getFtcFieldFromTarget()+
setLocationFtcFieldFromTarget(OpenGLMatrix)
,
+getLocation()
OpenGLMatrix getLocation()+
getFtcFieldFromTarget()
.void setUserData(java.lang.Object object)+
object
- user data to be associated with this trackable object.getUserData()
java.lang.Object getUserData()+
setUserData(Object)
VuforiaTrackables getTrackables()+
VuforiaTrackables
of which this VuforiaTrackable
is a memberVuforiaTrackables
of which this VuforiaTrackable
is a memberVuforiaTrackables
void setName(java.lang.String name)+
name
- a user-determined namegetName()
,
+setUserData(Object)
java.lang.String getName()+
setName(String)
,
+VuforiaTrackables.setName(String)
VuforiaTrackable getParent()+
protected static class VuforiaTrackableDefaultListener.PoseAndCamera
+extends java.lang.Object
+Modifier and Type | +Field and Description | +
---|---|
CameraName |
+cameraName |
+
VuforiaPoseMatrix |
+pose |
+
Constructor and Description | +
---|
PoseAndCamera(VuforiaPoseMatrix pose,
+ CameraName cameraName) |
+
Modifier and Type | +Method and Description | +
---|---|
VuforiaLocalizer.CameraDirection |
+getCameraDirection() |
+
java.lang.String |
+toString() |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public final VuforiaPoseMatrix pose+
public final CameraName cameraName+
public PoseAndCamera(VuforiaPoseMatrix pose, + CameraName cameraName)+
public VuforiaLocalizer.CameraDirection getCameraDirection()+
public java.lang.String toString()+
toString
in class java.lang.Object
public class VuforiaTrackableDefaultListener +extends java.lang.Object +implements VuforiaTrackable.Listener+
VuforiaTrackableDefaultListener
is the default listener used for VuforiaTrackable
+ implementations. This listener facilitates polling for results of the tracking. (Advanced:) Alternate
+ listeners could make use of event-driven results by taking actions in the VuforiaTrackable.Listener
+ methods.VuforiaTrackable
,
+VuforiaTrackable.getListener()
Modifier and Type | +Class and Description | +
---|---|
protected static class |
+VuforiaTrackableDefaultListener.PoseAndCamera |
+
Constructor and Description | +
---|
VuforiaTrackableDefaultListener() |
+
VuforiaTrackableDefaultListener(VuforiaTrackable trackable)
+If a null
+VuforiaTrackable is provided, then addTrackable(VuforiaTrackable)
+ must be called later, before tracking actually begins. |
+
Modifier and Type | +Method and Description | +
---|---|
void |
+addTrackable(VuforiaTrackable trackable)
+Adds a trackable on which this
+VuforiaTrackable.Listener is listening. |
+
VuforiaLocalizer.CameraDirection |
+getCameraDirection()
+Deprecated.
+
+This is of little use if a non-builtin camera is in use.
+ |
+
OpenGLMatrix |
+getCameraLocationOnRobot(CameraName cameraName)
+Returns information previously set in
+setCameraLocationOnRobot(CameraName, OpenGLMatrix) |
+
CameraName |
+getCameraName()
+Returns the name of the camera most recently tracked, or null if tracking has never occurred.
+ |
+
protected OpenGLMatrix |
+getFtcCameraFromRobot(CameraName cameraName) |
+
OpenGLMatrix |
+getFtcCameraFromTarget()
+Returns the pose of the trackable if it is currently visible.
+ |
+
OpenGLMatrix |
+getFtcFieldFromRobot()
+Returns the
+OpenGLMatrix transform that represents the location of the robot
+ on in the FTC Field Coordinate System, or null if that cannot be computed. |
+
OpenGLMatrix |
+getLastTrackedPoseVuforiaCamera()
+Returns the pose associated with the last known tracked location of this trackable, if any.
+ |
+
OpenGLMatrix |
+getLastTrackedRawPose()
+Deprecated.
+
+use
+getLastTrackedPoseVuforiaCamera() instead |
+
protected OpenGLMatrix |
+getPhoneFromVuforiaCamera(VuforiaLocalizer.CameraDirection direction)
+
+ |
+
OpenGLMatrix |
+getPhoneLocationOnRobot()
+Deprecated.
+
+Using
+getCameraLocationOnRobot(CameraName) is a better choice. |
+
OpenGLMatrix |
+getPose()
+A synonym for
+getPosePhone() , the latter being more descriptive of the
+ coordinate system of the value returned. |
+
OpenGLMatrix |
+getPoseCorrectionMatrix(VuforiaLocalizer.CameraDirection direction)
+Deprecated.
+
+These phone-based matrices are no longer of much relevance, as the
+ correct values, when of interest, are fixed and known.
+ |
+
OpenGLMatrix |
+getPosePhone()
+Returns the pose of the trackable if it is currently visible.
+ |
+
OpenGLMatrix |
+getRawPose()
+Deprecated.
+
+use
+getVuforiaCameraFromTarget() instead |
+
OpenGLMatrix |
+getRawUpdatedPose()
+Deprecated.
+
+use
+getUpdatedVuforiaCameraFromTarget() instead |
+
OpenGLMatrix |
+getRobotLocation()
+Synonym for
+getFtcFieldFromRobot() |
+
OpenGLMatrix |
+getUpdatedRobotLocation()
+Returns the location of the robot, but only if a new location has been detected since
+ the last call to
+getUpdatedRobotLocation() . |
+
OpenGLMatrix |
+getUpdatedVuforiaCameraFromTarget()
+Returns the raw pose of the trackable, but only if a new pose is available since the last call
+ to
+getUpdatedVuforiaCameraFromTarget() . |
+
OpenGLMatrix |
+getVuforiaCameraFromTarget()
+Returns the raw pose of the trackable as reported by Vuforia.
+ |
+
VuMarkInstanceId |
+getVuMarkInstanceId()
+Returns the instance id of the currently visible VuMark associated with this
+ VuMark template, if any presently exists.
+ |
+
boolean |
+isVisible()
+Answers whether the associated trackable is currently visible or not
+ |
+
void |
+onNotTracked()
+Called by the system to inform the trackable that it is no longer visible.
+ |
+
void |
+onTracked(TrackableResult trackableResult,
+ CameraName cameraName,
+ Camera camera,
+ VuforiaTrackable child)
+onTracked(TrackableResult, CameraName, Camera, org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable) is called by the system to notify the listener that its associated trackable is currently visible. |
+
void |
+setCameraLocationOnRobot(CameraName cameraName,
+ OpenGLMatrix robotFromFtcCamera)
+Informs the
+VuforiaTrackableDefaultListener of the location of a particular camera
+ on the robot. |
+
void |
+setPhoneInformation(OpenGLMatrix robotFromPhone,
+ VuforiaLocalizer.CameraDirection cameraDirection)
+Informs the listener of the location of the phone on the robot and the identity of
+ the camera being used.
+ |
+
void |
+setPoseCorrectionMatrix(VuforiaLocalizer.CameraDirection direction,
+ OpenGLMatrix matrix)
+Deprecated.
+ |
+
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final java.lang.String TAG+
protected final java.lang.Object lock+
protected VuforiaTrackable trackable+
protected boolean newPoseAvailable+
protected boolean newLocationAvailable+
protected VuforiaTrackableDefaultListener.PoseAndCamera currentPoseAndCamera+
protected VuforiaTrackableDefaultListener.PoseAndCamera lastTrackedPoseAndCamera+
protected VuMarkInstanceId vuMarkInstanceId+
protected final OpenGLMatrix phoneFromVuforiaCameraFront+
protected final OpenGLMatrix phoneFromVuforiaCameraBack+
protected final OpenGLMatrix vuforiaCameraFrontFromVuforiaCameraBack+
protected final OpenGLMatrix ftcCameraFromVuforiaCamera+
protected final OpenGLMatrix vuforiaCameraFromFtcCamera+
protected final OpenGLMatrix phoneFromFtcCameraFront+
protected final OpenGLMatrix phoneFromFtcCameraBack+
protected final OpenGLMatrix ftcCameraFrontFromPhone+
protected final OpenGLMatrix ftcCameraBackFromPhone+
protected final java.util.Map<CameraName,OpenGLMatrix> ftcCameraFromRobotCoords+
protected final java.util.Map<CameraName,OpenGLMatrix> robotFromFtcCameraCoords+
protected final CameraName cameraNameFront+
protected final CameraName cameraNameBack+
public VuforiaTrackableDefaultListener()+
public VuforiaTrackableDefaultListener(VuforiaTrackable trackable)+
VuforiaTrackable
is provided, then addTrackable(VuforiaTrackable)
+ must be called later, before tracking actually begins.public void setPhoneInformation(OpenGLMatrix robotFromPhone, + VuforiaLocalizer.CameraDirection cameraDirection)+
robotFromPhone
- the location of the phone on the robot. Maps phone coordinates to robot coordinates.cameraDirection
- which camera on the phone is in usepublic void setCameraLocationOnRobot(CameraName cameraName, + OpenGLMatrix robotFromFtcCamera)+
VuforiaTrackableDefaultListener
of the location of a particular camera
+ on the robot.cameraName
- the name of the camera in questionrobotFromFtcCamera
- the location of that camera; it transforms FTC camera coordiantes
+ to robot coordinates@Deprecated +public OpenGLMatrix getPhoneLocationOnRobot()+
getCameraLocationOnRobot(CameraName)
is a better choice.public OpenGLMatrix getCameraLocationOnRobot(CameraName cameraName)+
setCameraLocationOnRobot(CameraName, OpenGLMatrix)
cameraName
- the camera whose location is soughtprotected OpenGLMatrix getFtcCameraFromRobot(CameraName cameraName)+
@Deprecated +public VuforiaLocalizer.CameraDirection getCameraDirection()+
public CameraName getCameraName()+
public OpenGLMatrix getFtcFieldFromRobot()+
Returns the OpenGLMatrix
transform that represents the location of the robot
+ on in the FTC Field Coordinate System, or null if that cannot be computed. The returned
+ transformation will map coordinates in the Robot Coordinate System to coordinates in the
+ FTC Field Coordinate System.
The pose will be null if the trackable is not currently visible. The location of the trackable
+ will be null if a location wasn't previously provided with VuforiaTrackable.setLocation(OpenGLMatrix)
.
+ The camera location on the robot will be null if setCameraLocationOnRobot(CameraName, org.firstinspires.ftc.robotcore.external.matrices.OpenGLMatrix)
+ has not been called. All three must be non-null for the location to be computable.
getUpdatedRobotLocation()
,
+getPosePhone()
,
+setPhoneInformation(OpenGLMatrix, VuforiaLocalizer.CameraDirection)
,
+VuforiaTrackable.setLocation(OpenGLMatrix)
,
+getRobotLocation()
public OpenGLMatrix getRobotLocation()+
getFtcFieldFromRobot()
@Deprecated +public OpenGLMatrix getPoseCorrectionMatrix(VuforiaLocalizer.CameraDirection direction)+
protected OpenGLMatrix getPhoneFromVuforiaCamera(VuforiaLocalizer.CameraDirection direction)+ +
@Deprecated +public void setPoseCorrectionMatrix(VuforiaLocalizer.CameraDirection direction, + OpenGLMatrix matrix)+
public OpenGLMatrix getUpdatedRobotLocation()+
getUpdatedRobotLocation()
.getRobotLocation()
public OpenGLMatrix getPosePhone()+
getFtcCameraFromTarget()
for a better choice.
+
+ Note that whether a trackable is visible or not is constantly dynamically changing + in the background as the phone is moved about. Thus, just because one call to getPose() + returns a non-null matrix doesn't a second call a short time later will return the same + result.
getPhoneFromVuforiaCamera(VuforiaLocalizer.CameraDirection)
,
+getVuforiaCameraFromTarget()
,
+isVisible()
,
+getPose()
public OpenGLMatrix getPose()+
getPosePhone()
, the latter being more descriptive of the
+ coordinate system of the value returned. Note that this function is of little use
+ if a webcam is used instead of a builtin phone camera.public OpenGLMatrix getFtcCameraFromTarget()+
getPosePhone()
public OpenGLMatrix getVuforiaCameraFromTarget()+
getPosePhone()
because of the differing coordinate systems
+ used by Vuforia and FTCgetPhoneFromVuforiaCamera(VuforiaLocalizer.CameraDirection)
,
+getRawPose()
@Deprecated +public OpenGLMatrix getRawPose()+
getVuforiaCameraFromTarget()
insteadpublic OpenGLMatrix getUpdatedVuforiaCameraFromTarget()+
getUpdatedVuforiaCameraFromTarget()
.getVuforiaCameraFromTarget()
,
+getRawUpdatedPose()
@Deprecated +public OpenGLMatrix getRawUpdatedPose()+
getUpdatedVuforiaCameraFromTarget()
insteadpublic boolean isVisible()+
getVuforiaCameraFromTarget()
public OpenGLMatrix getLastTrackedPoseVuforiaCamera()+
getVuforiaCameraFromTarget()
@Deprecated +public OpenGLMatrix getLastTrackedRawPose()+
getLastTrackedPoseVuforiaCamera()
insteadpublic VuMarkInstanceId getVuMarkInstanceId()+
public void onTracked(TrackableResult trackableResult, + CameraName cameraName, + Camera camera, + VuforiaTrackable child)+
onTracked(TrackableResult, CameraName, Camera, org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable)
is called by the system to notify the listener that its associated trackable is currently visible.onTracked
in interface VuforiaTrackable.Listener
trackableResult
- the Vuforia trackable result object in which we were locatedcameraName
- the name of the camera used by Vuforia to track this objectcamera
- the Camera
instance used in the tracking. Will be null if
+ a built-in camera is usedpublic void onNotTracked()+
onNotTracked
in interface VuforiaTrackable.Listener
public void addTrackable(VuforiaTrackable trackable)+
VuforiaTrackable.Listener
VuforiaTrackable.Listener
is listening. May not be
+ called once tracking has begun. If the VuforiaTrackable.Listener
is already listening
+ to this trackable, then the call has no effect.addTrackable
in interface VuforiaTrackable.Listener
public interface VuforiaTrackables +extends java.util.List<VuforiaTrackable>+
VuforiaTrackables
represents a set of targets that can be visually tracked.Modifier and Type | +Method and Description | +
---|---|
void |
+activate()
+Activates this trackables so that its localizer is actively seeking the presence
+ of the trackables that it contains.
+ |
+
void |
+deactivate()
+Deactivates this trackables, causing its localizer to no longer see the presence
+ of the trackables it contains.
+ |
+
VuforiaLocalizer |
+getLocalizer()
+Returns the
+VuforiaLocalizer which manages this list of trackables. |
+
java.lang.String |
+getName()
+Returns the user-specified name for this trackables.
+ |
+
void |
+setName(java.lang.String name)
+Sets the name for this
+VuforiaTrackables and any of its contained
+ trackables which do not already have a user-specified name |
+
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
parallelStream, removeIf, stream
forEach
void setName(java.lang.String name)+
VuforiaTrackables
and any of its contained
+ trackables which do not already have a user-specified namename
- the name for this trackablesgetName()
java.lang.String getName()+
setName(String)
void activate()+
deactivate()
void deactivate()+
activate()
VuforiaLocalizer getLocalizer()+
VuforiaLocalizer
which manages this list of trackables.VuforiaLocalizer
which manages this list of trackables.Interface | +Description | +
---|---|
MotionDetection.MotionDetectionListener | ++ |
VuforiaLocalizer | +
+ Robot "localization" denotes a robot's ability to establish its own position and
+ orientation within its frame of reference.
+ |
+
VuforiaTrackable | +
+VuforiaTrackable provides access to an individual trackable Vuforia target. |
+
VuforiaTrackable.Listener | ++ |
VuforiaTrackables | +
+VuforiaTrackables represents a set of targets that can be visually tracked. |
+
Class | +Description | +
---|---|
Acceleration | +
+ Instances of
+Acceleration represent the second derivative of Position over time. |
+
AngularVelocity | +
+ Instances of
+AngularVelocity represent an instantaneous body-referenced 3D rotation rate. |
+
MagneticFlux | +
+ Instances of
+MagneticFlux represent a three-dimensional magnetic strength vector. |
+
MotionDetection | +
+ A class that will notify listeners when a phone is in motion.
+ |
+
NavUtil | +
+NavUtil is a collection of utilities that provide useful manipulations of
+ objects related to navigation. |
+
Orientation | +
+ Instances of
+Orientation represent a rotated stance in three-dimensional space
+ by way of a set of three successive rotations. |
+
Position | +
+ Instances of
+Position represent a three-dimensional distance in a particular distance unit. |
+
Quaternion | +
+ A
+Quaternion can indicate an orientation in three-space without the trouble of
+ possible gimbal-lock. |
+
Temperature | +
+ Instances of
+Temperature represent a temperature in a particular temperature scale. |
+
Velocity | ++ + | +
VuforiaBase | +
+ An abstract base class that provides simplified access to Vuforia.
+ |
+
VuforiaBase.TrackingResults | ++ |
VuforiaLocalizer.CloseableFrame | +
+VuforiaLocalizer.CloseableFrame exposes a close() method so that one can proactively
+ reduce memory pressure when we're done with a Frame |
+
VuforiaLocalizer.Parameters | +
+VuforiaLocalizer.Parameters provides configuration information for instantiating the Vuforia localizer |
+
VuforiaRelicRecovery | +
+ A class that provides simplified access to Vuforia for the Relic Recovery game (2017-2018).
+ |
+
VuforiaRelicRecovery.TrackingResults | ++ |
VuforiaRoverRuckus | +
+ A class that provides simplified access to Vuforia for the Rover Ruckus game (2018-2019).
+ |
+
VuforiaTrackableDefaultListener | +
+VuforiaTrackableDefaultListener is the default listener used for VuforiaTrackable
+ implementations. |
+
VuforiaTrackableDefaultListener.PoseAndCamera | ++ |
VuMarkInstanceId | +
+VuMarkInstanceId captures the identifying state decoded from a particular instance
+ of a Vuforia VuMark. |
+
Enum | +Description | +
---|---|
AngleUnit | +
+ An
+AngleUnit represents angles in different units of measure and
+ provides utility methods to convert across units. |
+
AxesOrder | +
+AxesOrder indicates the chronological order of axes about which the three rotations
+ of an Orientation take place. |
+
AxesReference | +
+AxesReference indicates whether we have intrinsic rotations, where the axes
+ move with the object that is rotating, or extrinsic rotations, where they remain fixed
+ in the world around the object. |
+
Axis | +
+Axis enumerates the common X,Y,Z three-dimensional orthogonal axes. |
+
DistanceUnit | +
+DistanceUnit represents a unit of measure of distance. |
+
Orientation.AngleSet | +
+Orientation.AngleSet is used to distinguish between the two sets of angles that will produce
+ a given rotation in a given axes reference and a given axes order |
+
RelicRecoveryVuMark | +
+ Instances of
+RelicRecoveryVuMark represent the VuMarks used in the Relic Recovery
+ FTC competition of 2017-18. |
+
Rotation | +
+Rotation captures an angluar direction of movement |
+
TempUnit | +
+ Instances of
+TempUnit enumerate a known different temperature scales |
+
UnnormalizedAngleUnit | +
+ An
+UnnormalizedAngleUnit represents angles in different units of measure and
+ provides utility methods to convert across units. |
+
VuforiaLocalizer.CameraDirection | +
+VuforiaLocalizer.CameraDirection enumerates the identities of the builtin phone cameras that Vuforia can use. |
+
VuforiaLocalizer.Parameters.CameraMonitorFeedback | +
+VuforiaLocalizer.Parameters.CameraMonitorFeedback enumerates the kinds of positioning feedback that
+ may be drawn in the camera monitor window. |
+
VuMarkInstanceId.Type | +
+VuMarkInstanceId.Type indicates the type of data that was found in the InstanceId
+ from which this data was decoded. |
+
Interface | +Description | +
---|---|
Consumer<T> | +
+ Instances of
+Consumer are functions that act on an instance of a indicated type |
+
Event | +
+ A state machine event.
+ |
+
Func<T> | +
+ Instances of
+Func are nullary producers of values. |
+
Function<T,R> | +
+ If we were running Java8, we'd just use the built-in interface
+ |
+
Predicate<T> | ++ |
SignificantMotionDetection.SignificantMotionDetectionListener | ++ |
State | +
+ A state for a given state machine.
+ |
+
Supplier<T> | +
+ Represents a supplier of results.
+ |
+
Telemetry | +
+ Instances of
+Telemetry provide a means by which data can be transmitted from the
+ robot controller to the driver station and displayed on the driver station screen. |
+
Telemetry.Item | +
+ Instances of
+Telemetry.Item represent an item of data on the drive station telemetry display. |
+
Telemetry.Line | +
+ Instances of
+Telemetry.Line build lines of data on the driver station telemetry display. |
+
Telemetry.Log | +
+ The
+Telemetry.Log in a Telemetry instance provides an append-only list of messages
+ that appear on the driver station below the Telemetry.Item s of the Telemetry . |
+
ThrowingCallable<VALUE,EXCEPTION extends java.lang.Throwable> | +
+ An interface for workers that has a specialized exception set
+ |
+
Class | +Description | +
---|---|
ClassFactory | +
+ClassFactory provides a means by which various objects in the SDK may be logically
+ instantiated without exposing their external class identities to user's programs. |
+
ClassFactory.InstanceHolder | ++ |
JavaUtil | +
+ A class that provides utility methods used in FTC Java code generated from blocks.
+ |
+
SignificantMotionDetection | ++ |
StateMachine | +
+ Infrastructure for a very simple generic state machine.
+ |
+
StateTransition | ++ |
Enum | +Description | +
---|---|
JavaUtil.AtMode | ++ |
JavaUtil.SortDirection | ++ |
JavaUtil.SortType | ++ |
JavaUtil.TrimMode | ++ |
Telemetry.Log.DisplayOrder | +
+Telemetry.Log.DisplayOrder instances indicate the desired ordering of a Telemetry.log() . |
+
Annotation Type | +Description | +
---|---|
Const | +
+Const documents a method that promises not to change the internal state
+ of the method receiver. |
+
NonConst | +
+NonConst documents a method that performs its function by updating internal
+ state of the method receiver. |
+
+ + diff --git a/doc/javadoc/overview-summary.html b/doc/javadoc/overview-summary.html new file mode 100644 index 00000000000..6456f4b31b6 --- /dev/null +++ b/doc/javadoc/overview-summary.html @@ -0,0 +1,176 @@ + + + + + +
Package | +Description | +
---|---|
com.qualcomm.ftccommon | +
+ Classes common to FTC aps
+ |
+
com.qualcomm.robotcore.eventloop | +
+ RobotCore event loop library.
+ |
+
com.qualcomm.robotcore.eventloop.opmode | ++ |
com.qualcomm.robotcore.exception | +
+ RobotCore exception library.
+ |
+
com.qualcomm.robotcore.hardware | +
+ RobotCore hardware library.
+ |
+
com.qualcomm.robotcore.util | ++ |
org.firstinspires.ftc.robotcore.external | ++ |
org.firstinspires.ftc.robotcore.external.android | ++ |
org.firstinspires.ftc.robotcore.external.matrices | ++ |
org.firstinspires.ftc.robotcore.external.navigation | ++ |
java.lang.String serialNumberString+