本文整理汇总了Java中org.firstinspires.ftc.robotcore.external.Telemetry类的典型用法代码示例。如果您正苦于以下问题:Java Telemetry类的具体用法?Java Telemetry怎么用?Java Telemetry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Telemetry类属于org.firstinspires.ftc.robotcore.external包,在下文中一共展示了Telemetry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HalDashboard
import org.firstinspires.ftc.robotcore.external.Telemetry; //导入依赖的package包/类
/**
* Constructor: Creates an instance of the object. There should only be one global instance of this object.
* Typically, only the FtcOpMode object should construct an instance of this object via getInstance(telemetry)
* and nobody else.
*
* @param telemetry specifies the Telemetry object.
* @param numLines specifies the number of display lines.
*/
private HalDashboard(Telemetry telemetry, int numLines)
{
if (debugEnabled)
{
dbgTrace = new TrcDbgTrace(moduleName, tracingEnabled, traceLevel, msgLevel);
}
this.telemetry = telemetry;
this.numLines = numLines;
telemetry.clearAll();
telemetry.setAutoClear(false);
display = new Telemetry.Item[numLines];
for (int i = 0; i < display.length; i++)
{
display[i] = telemetry.addData(String.format(Locale.US, displayKeyFormat, i), "");
}
telemetry.update();
}
示例2: execute
import org.firstinspires.ftc.robotcore.external.Telemetry; //导入依赖的package包/类
/**
* Executes the current state once by running the {@link State#execute()}, then checks to see if
* the state needs to be changed by running the {@link State#changeState(Enum)} method of the
* currently running state
*/
public void execute() {
if (index == -1) {
return;
}
STATE state = states.get(index);
if (state.name().equalsIgnoreCase("NOTHING"))
// Inject requested variables
inject(state, "hardwareMap", HardwareMap.class, opMode.hardwareMap);
inject(state, "gamepad1", Gamepad.class, opMode.gamepad1);
inject(state, "gamepad2", Gamepad.class, opMode.gamepad2);
inject(state, "telemetry", Telemetry.class, opMode.telemetry);
inject(state, "opMode", opMode.getClass(), opMode);
state.execute();
if (state.stateChange()) {
index = ++index;
if (index > states.size()) {
index = -1;
}
}
}
示例3: execute
import org.firstinspires.ftc.robotcore.external.Telemetry; //导入依赖的package包/类
/**
* Executes the current state once by running the {@link State#execute()}, then checks to see if
* the state needs to be changed by running the {@link State#changeState(Enum)} method of the
* currently running state
*/
public void execute() {
if (index == -1) {
return;
}
STATE state = states.get(index);
if (state.name().equalsIgnoreCase("NOTHING"))
// Inject requested variables
inject(state, "hardwareMap", HardwareMap.class, opMode.hardwareMap);
inject(state, "gamepad1", Gamepad.class, opMode.gamepad1);
inject(state, "gamepad2", Gamepad.class, opMode.gamepad2);
inject(state, "telemetry", Telemetry.class, opMode.telemetry);
inject(state, "opMode", opMode.getClass(), opMode);
state.execute();
}
示例4: execute
import org.firstinspires.ftc.robotcore.external.Telemetry; //导入依赖的package包/类
/**
* Executes the current state once by running the {@link State#execute()}, then checks to see if
* the state needs to be changed by running the {@link State#changeState(Enum)} method of the
* currently running state
*/
public void execute() {
if (index == -1) {
return;
}
STATE state = states.get(index);
if (state.name().equalsIgnoreCase("NOTHING"))
// Inject requested variables
inject(state, "hardwareMap", HardwareMap.class, opMode.hardwareMap);
inject(state, "gamepad1", Gamepad.class, opMode.gamepad1);
inject(state, "gamepad2", Gamepad.class, opMode.gamepad2);
inject(state, "telemetry", Telemetry.class, opMode.telemetry);
inject(state, "opMode", opMode.getClass(), opMode);
state.execute();
index = state.stateChange().ordinal();
}
示例5: RobotCore
import org.firstinspires.ftc.robotcore.external.Telemetry; //导入依赖的package包/类
public RobotCore(Telemetry telemetry, HardwareMap hardwareMap, Gamepad gamepad1, Gamepad gamepad2) {
//Instantiate all static instances
this.telemetry = telemetry;
this.hardwareMap = hardwareMap;
this.gamepad1 = gamepad1;
this.gamepad2 = gamepad2;
}
示例6: createInstance
import org.firstinspires.ftc.robotcore.external.Telemetry; //导入依赖的package包/类
/**
* This static methods creates an instance of the object if none already exist. If the object exists previously,
* that instance is returned.
*
* @param telemetry specifies the Telemetry object.
* @param numLines specifies the number of display lines.
* @return existing instance or newly created instance of the object.
*/
public static HalDashboard createInstance(Telemetry telemetry, int numLines)
{
if (instance == null)
{
instance = new HalDashboard(telemetry, numLines);
}
return instance;
}
示例7: testNonAutoClear
import org.firstinspires.ftc.robotcore.external.Telemetry; //导入依赖的package包/类
void testNonAutoClear() throws InterruptedException
{
((TelemetryInternal)telemetry).resetTelemetryForOpMode();
telemetry.setAutoClear(false);
Telemetry.Item counting = telemetry.addData("counting", 1).setRetained(true);
telemetry.addData("unretained", "red");
telemetry.addData("retained", new Func<String>() {
@Override public String value() {
return String.format(Locale.getDefault(), "%dms", System.currentTimeMillis());
}});
telemetry.addData("unretained", "green");
telemetry.update();
delay();
counting.setValue(2);
telemetry.update();
delay();
counting.setValue(3);
telemetry.update();
delay();
telemetry.clear();
delay();
counting.setValue(4);
telemetry.update();
delay();
}
示例8: ArmController
import org.firstinspires.ftc.robotcore.external.Telemetry; //导入依赖的package包/类
/**
* Constructi an arm controller
*
* @param robot robot
* @param telemetry telemetry for logging
*/
public ArmController(Dutchess robot, Telemetry telemetry) {
this.robot = robot;
this.telemetry = telemetry;
this.position = (maxPosition - minPosition) / 2;
// setPosition(this.position);
}
示例9: ShootingController
import org.firstinspires.ftc.robotcore.external.Telemetry; //导入依赖的package包/类
public ShootingController(Dutchess robot, Telemetry telemetry, boolean stopped, double power) {
Preconditions.checkArgument(robot != null, "robot must be non-null");
Preconditions.checkArgument((power >= -1.0) && (power <= 1.0), "power must be between -1 and 1, inclusive");
this.robot = robot;
this.telemetry = telemetry;
this.stopped = stopped;
setTargetPower(power);
}
示例10: ExtensibleTelemetry
import org.firstinspires.ftc.robotcore.external.Telemetry; //导入依赖的package包/类
@Deprecated
private ExtensibleTelemetry(int dataPointsToSend, @NotNull Telemetry telemetry) {
this(telemetry);
//this.dataPointsToSend = dataPointsToSend;
// cache = CacheBuilder.newBuilder().
// concurrencyLevel(4).
// expireAfterAccess(250, TimeUnit.MILLISECONDS).
// maximumSize(dataPointsToSend).build();
//
// dataCache = new SynchronousArrayQueue<>(50);
// data = LinkedHashMultimap.create();
// log = new LinkedList<>();
}
示例11: prepare
import org.firstinspires.ftc.robotcore.external.Telemetry; //导入依赖的package包/类
@Override
public void prepare(Context ctx, HardwareMap basicHardwareMap, Gamepad gamepad1, Gamepad gamepad2, Telemetry telemetry) {
checkArgument(ctx instanceof Activity, "Invalid context; it must be of an activity context type");
bindAppContext(ctx);
bindHardwareMap(checkNotNull(basicHardwareMap));
this.gamepad1 = checkNotNull(gamepad1, "Gamepad 1 is null");
this.gamepad2 = checkNotNull(gamepad2, "Gamepad 2 is null");
extensibleTelemetry = new ExtensibleTelemetry(checkNotNull(telemetry, "telemetry is null"));
layout = ((Activity) appContext()).findViewById(controllerBindings().integers().get(DataBinder.RC_VIEW));
cameraViewParent = ((Activity) appContext()).findViewById(controllerBindings().integers().get(DataBinder.CAMERA_VIEW));
eventManager.run();
}
示例12: runOpMode
import org.firstinspires.ftc.robotcore.external.Telemetry; //导入依赖的package包/类
@Override public void runOpMode() {
/* we keep track of how long it's been since the OpMode was started, just
* to have some interesting data to show */
ElapsedTime opmodeRunTime = new ElapsedTime();
// We show the log in oldest-to-newest order, as that's better for poetry
telemetry.log().setDisplayOrder(Telemetry.Log.DisplayOrder.OLDEST_FIRST);
// We can control the number of lines shown in the log
telemetry.log().setCapacity(6);
// The interval between lines of poetry, in seconds
double sPoemInterval = 0.6;
/**
* Wait until we've been given the ok to go. For something to do, we emit the
* elapsed time as we sit here and wait. If we didn't want to do anything while
* we waited, we would just call {@link #waitForStart()}.
*/
while (!isStarted()) {
telemetry.addData("time", "%.1f seconds", opmodeRunTime.seconds());
telemetry.update();
idle();
}
// Ok, we've been given the ok to go
/**
* As an illustration, the first line on our telemetry display will display the battery voltage.
* The idea here is that it's expensive to compute the voltage (at least for purposes of illustration)
* so you don't want to do it unless the data is <em>actually</em> going to make it to the
* driver station (recall that telemetry transmission is throttled to reduce bandwidth use.
* Note that getBatteryVoltage() below returns 'Infinity' if there's no voltage sensor attached.
*
* @see Telemetry#getMsTransmissionInterval()
*/
telemetry.addData("voltage", "%.1f volts", new Func<Double>() {
@Override public Double value() {
return getBatteryVoltage();
}
});
// Reset to keep some timing stats for the post-'start' part of the opmode
opmodeRunTime.reset();
int loopCount = 1;
// Go go gadget robot!
while (opModeIsActive()) {
// Emit poetry if it's been a while
if (poemElapsed.seconds() > sPoemInterval) {
emitPoemLine();
}
// As an illustration, show some loop timing information
telemetry.addData("loop count", loopCount);
telemetry.addData("ms/loop", "%.3f ms", opmodeRunTime.milliseconds() / loopCount);
// Show joystick information as some other illustrative data
telemetry.addLine("left joystick | ")
.addData("x", gamepad1.left_stick_x)
.addData("y", gamepad1.left_stick_y);
telemetry.addLine("right joystick | ")
.addData("x", gamepad1.right_stick_x)
.addData("y", gamepad1.right_stick_y);
/**
* Transmit the telemetry to the driver station, subject to throttling.
* @see Telemetry#getMsTransmissionInterval()
*/
telemetry.update();
/** Update loop info and play nice with the rest of the {@link Thread}s in the system */
loopCount++;
}
}
示例13: FTCDebug
import org.firstinspires.ftc.robotcore.external.Telemetry; //导入依赖的package包/类
public FTCDebug(Telemetry telemetry){
this.telemetry = telemetry;
}
示例14: runOpMode
import org.firstinspires.ftc.robotcore.external.Telemetry; //导入依赖的package包/类
@Override public void runOpMode() throws InterruptedException {
/* we keep track of how long it's been since the OpMode was started, just
* to have some interesting data to show */
ElapsedTime opmodeRunTime = new ElapsedTime();
// We show the log in oldest-to-newest order, as that's better for poetry
telemetry.log().setDisplayOrder(Telemetry.Log.DisplayOrder.OLDEST_FIRST);
// We can control the number of lines shown in the log
telemetry.log().setCapacity(6);
// The interval between lines of poetry, in seconds
double sPoemInterval = 0.6;
/**
* Wait until we've been given the ok to go. For something to do, we emit the
* elapsed time as we sit here and wait. If we didn't want to do anything while
* we waited, we would just call {@link #waitForStart()}.
*/
while (!isStarted()) {
telemetry.addData("time", "%.1f seconds", opmodeRunTime.seconds());
telemetry.update();
idle();
}
// Ok, we've been given the ok to go
/**
* As an illustration, the first line on our telemetry display will display the battery voltage.
* The idea here is that it's expensive to compute the voltage (at least for purposes of illustration)
* so you don't want to do it unless the data is <em>actually</em> going to make it to the
* driver station (recall that telemetry transmission is throttled to reduce bandwidth use.
* Note that getBatteryVoltage() below returns 'Infinity' if there's no voltage sensor attached.
*
* @see Telemetry#getMsTransmissionInterval()
*/
telemetry.addData("voltage", "%.1f volts", new Func<Double>() {
@Override public Double value() {
return getBatteryVoltage();
}
});
// Reset to keep some timing stats for the post-'start' part of the opmode
opmodeRunTime.reset();
int loopCount = 1;
// Go go gadget robot!
while (opModeIsActive()) {
// Emit poetry if it's been a while
if (poemElapsed.seconds() > sPoemInterval) {
emitPoemLine();
}
// As an illustration, show some loop timing information
telemetry.addData("loop count", loopCount);
telemetry.addData("ms/loop", "%.3f ms", opmodeRunTime.milliseconds() / loopCount);
// Show joystick information as some other illustrative data
telemetry.addLine("left joystick | ")
.addData("x", gamepad1.left_stick_x)
.addData("y", gamepad1.left_stick_y);
telemetry.addLine("right joystick | ")
.addData("x", gamepad1.right_stick_x)
.addData("y", gamepad1.right_stick_y);
/**
* Transmit the telemetry to the driver station, subject to throttling.
* @see Telemetry#getMsTransmissionInterval()
*/
telemetry.update();
/** Update loop info and play nice with the rest of the {@link Thread}s in the system */
loopCount++;
idle();
}
}
示例15: MovementController
import org.firstinspires.ftc.robotcore.external.Telemetry; //导入依赖的package包/类
public MovementController(Dutchess robot, Telemetry telemetry) {
this.robot = robot;
this.telemetry = telemetry;
setWheelPower(.6d); // default
state = State.WaitUntilNewMovement;
}