本文整理汇总了Java中org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable类的典型用法代码示例。如果您正苦于以下问题:Java VuforiaTrackable类的具体用法?Java VuforiaTrackable怎么用?Java VuforiaTrackable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VuforiaTrackable类属于org.firstinspires.ftc.robotcore.external.navigation包,在下文中一共展示了VuforiaTrackable类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setTargetInfo
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable; //导入依赖的package包/类
/**
* This method sets the properties of the specified target.
*
* @param index specifies the target index in the XML file.
* @param name specifies the target name.
* @param locationOnField specifies the target location on the field, can be null if no robot tracking.
* @param phoneLocationOnRobot specifies the phone location on the robot, can be null if no robot tracking.
*/
public void setTargetInfo(int index, String name, OpenGLMatrix locationOnField, OpenGLMatrix phoneLocationOnRobot)
{
if (targetList != null)
{
VuforiaTrackable target = targetList.get(index);
target.setName(name);
if (locationOnField != null)
{
target.setLocation(locationOnField);
}
if (phoneLocationOnRobot != null)
{
((VuforiaTrackableDefaultListener) target.getListener()).setPhoneInformation(
phoneLocationOnRobot, cameraDir);
}
}
}
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:28,代码来源:FtcVuforia.java
示例2: getTarget
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable; //导入依赖的package包/类
/**
* This method returns the target object with the specified target name.
*
* @param name specifies the name of the target.
* @return target.
*/
public VuforiaTrackable getTarget(String name)
{
VuforiaTrackable target = null;
if (targetList != null)
{
for (int i = 0; i < targetList.size(); i++)
{
target = targetList.get(i);
if (name.equals(target.getName()))
{
break;
} else
{
target = null;
}
}
}
return target;
}
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:28,代码来源:FtcVuforia.java
示例3: getVuMarkPosition
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable; //导入依赖的package包/类
public VectorF getVuMarkPosition()
{
VectorF targetPos = null;
VuforiaTrackable target = vuforia.getTarget(0);
RelicRecoveryVuMark vuMark = RelicRecoveryVuMark.from(target);
if (vuforia.isTargetVisible(target) && vuMark != RelicRecoveryVuMark.UNKNOWN)
{
OpenGLMatrix pose = vuforia.getTargetPose(target);
if (pose != null)
{
targetPos = pose.getTranslation();
robot.tracer.traceInfo("TargetPos", "%s: x=%6.2f, y=%6.2f, z=%6.2f",
vuMark.toString(),
targetPos.get(0)/RobotInfo.MM_PER_INCH,
targetPos.get(1)/RobotInfo.MM_PER_INCH,
-targetPos.get(2)/RobotInfo.MM_PER_INCH);
}
}
return targetPos;
}
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:23,代码来源:VuforiaVision.java
示例4: getVuMarkOrientation
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable; //导入依赖的package包/类
public Orientation getVuMarkOrientation()
{
Orientation targetAngle = null;
VuforiaTrackable target = vuforia.getTarget(0);
RelicRecoveryVuMark vuMark = RelicRecoveryVuMark.from(target);
if (vuforia.isTargetVisible(target) && vuMark != RelicRecoveryVuMark.UNKNOWN)
{
OpenGLMatrix pose = vuforia.getTargetPose(target);
if (pose != null)
{
targetAngle = Orientation.getOrientation(
pose, AxesReference.EXTRINSIC, AxesOrder.XYZ, AngleUnit.DEGREES);
robot.tracer.traceInfo("TargetRot", "%s: xRot=%6.2f, yRot=%6.2f, zRot=%6.2f",
vuMark.toString(),
targetAngle.firstAngle, targetAngle.secondAngle, targetAngle.thirdAngle);
}
}
return targetAngle;
}
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:22,代码来源:VuforiaVision.java
示例5: getVuMarkPosition
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable; //导入依赖的package包/类
private VectorF getVuMarkPosition()
{
VectorF targetPos = null;
VuforiaTrackable target = vuforia.getTarget(0);
RelicRecoveryVuMark vuMark = RelicRecoveryVuMark.from(target);
if (vuforia.isTargetVisible(target) && vuMark != RelicRecoveryVuMark.UNKNOWN)
{
OpenGLMatrix pose = vuforia.getTargetPose(target);
if (pose != null)
{
targetPos = pose.getTranslation();
}
}
return targetPos;
}
开发者ID:trc492,项目名称:FtcSamples,代码行数:18,代码来源:FtcTestVuMark.java
示例6: getVuMarkOrientation
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable; //导入依赖的package包/类
private Orientation getVuMarkOrientation()
{
Orientation targetAngle = null;
VuforiaTrackable target = vuforia.getTarget(0);
RelicRecoveryVuMark vuMark = RelicRecoveryVuMark.from(target);
if (vuforia.isTargetVisible(target) && vuMark != RelicRecoveryVuMark.UNKNOWN)
{
OpenGLMatrix pose = vuforia.getTargetPose(target);
if (pose != null)
{
targetAngle = Orientation.getOrientation(
pose, AxesReference.EXTRINSIC, AxesOrder.XYZ, AngleUnit.DEGREES);
}
}
return targetAngle;
}
开发者ID:trc492,项目名称:FtcSamples,代码行数:19,代码来源:FtcTestVuMark.java
示例7: runPeriodic
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable; //导入依赖的package包/类
@Override
public void runPeriodic(double elapsedTime)
{
double left = gamepad.getLeftStickY(true);
double right = gamepad.getRightStickY(true);
driveBase.tankDrive(left, right);
final int LABEL_WIDTH = 180;
dashboard.displayPrintf(1, LABEL_WIDTH, "Power(L/R) = ", "%.2f/%.2f", left, right);
dashboard.displayPrintf(2, LABEL_WIDTH, "GyroHeading = ", "%.2f", gyro.getZHeading().value);
dashboard.displayPrintf(3, LABEL_WIDTH, "SoundEnvelope = ", "%s", envelopeToggle.getState()? "ON": "OFF");
dashboard.displayPrintf(4, LABEL_WIDTH, "ToneDevice = ", "%s",
analogToneToggle.getState()? "AnalogOut": "Android");
dashboard.displayPrintf(5, LABEL_WIDTH, "Vision = ", "%s (%d)", visionEnabled, targetIndex);
if (isVisionEnabled())
{
boolean followTarget = followTargetToggle.getState();
for (int i = 0; i < targets.length; i++)
{
VuforiaTrackable target = vuforia.getTarget(i);
boolean visible = vuforia.isTargetVisible(target);
if (USE_SPEECH)
{
if (visible != targetsFound[i])
{
targetsFound[i] = visible;
String sentence = String.format(
"%s is %s.", target.getName(), visible ? "in view" : "out of view");
textToSpeech.speak(sentence, TextToSpeech.QUEUE_FLUSH, null);
}
}
if (visible)
{
String label = String.format(i == targetIndex ? "<%s> = " : "%s = ", target.getName());
OpenGLMatrix pose = vuforia.getTargetPose(target);
if (pose != null)
{
VectorF translation = pose.getTranslation();
float targetX = translation.get(0) / MM_PER_INCH;
float targetY = translation.get(1) / MM_PER_INCH;
float targetZ = -translation.get(2) / MM_PER_INCH;
dashboard.displayPrintf(
i + 5, LABEL_WIDTH, label, "%6.2f,%6.2f,%6.2f", targetX, targetY, targetZ);
if (followTarget && i == targetIndex)
{
// targetDistance = targetZ;
targetDistance = 24.0;
// TODO: doesn't work! Event won't fire until distance is satisfied.
if (visionEvent.isSignaled())
{
targetHeading = Math.toDegrees(Math.atan2(targetX, targetZ));
visionEvent.set(false);
visionPidDrive.setTarget(24.0, targetHeading, false, visionEvent);
}
}
}
OpenGLMatrix robotLocation = vuforia.getRobotLocation(target);
if (robotLocation != null)
{
lastKnownRobotLocation = robotLocation;
}
}
}
if (lastKnownRobotLocation != null)
{
dashboard.displayPrintf(9, LABEL_WIDTH, "RobotLoc = ", lastKnownRobotLocation.formatAsTransform());
}
}
}
开发者ID:trc492,项目名称:FtcSamples,代码行数:78,代码来源:FtcTeleOpWildThumper.java
示例8: runPeriodic
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable; //导入依赖的package包/类
@Override
public void runPeriodic(double elapsedTime)
{
final int LABEL_WIDTH = 120;
for (int i = 0; i < targets.length; i++)
{
VuforiaTrackable target = vuforia.getTarget(i);
boolean visible = vuforia.isTargetVisible(target);
if (SPEECH_ENABLED)
{
if (visible != targetsFound[i])
{
targetsFound[i] = visible;
String sentence = String.format(
"%s is %s.", target.getName(), visible? "in view": "out of view");
textToSpeech.speak(sentence, TextToSpeech.QUEUE_FLUSH, null);
}
}
OpenGLMatrix pose = vuforia.getTargetPose(target);
if (pose != null)
{
VectorF translation = pose.getTranslation();
dashboard.displayPrintf(
i + 1, LABEL_WIDTH, target.getName() + " = ", "%6.2f,%6.2f,%6.2f",
translation.get(0)/MM_PER_INCH,
translation.get(1)/MM_PER_INCH,
-translation.get(2)/MM_PER_INCH);
}
OpenGLMatrix robotLocation = vuforia.getRobotLocation(target);
if (robotLocation != null)
{
lastKnownRobotLocation = robotLocation;
}
}
if (lastKnownRobotLocation != null)
{
dashboard.displayPrintf(5, LABEL_WIDTH, "RobotLoc = ", lastKnownRobotLocation.formatAsTransform());
}
}
开发者ID:trc492,项目名称:FtcSamples,代码行数:45,代码来源:FtcTestVuforia.java
示例9: isTargetVisible
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable; //导入依赖的package包/类
/**
* This method determines if the target is visible.
*
* @param target specifies the target object.
* @return true if the target is in view, false otherwise.
*/
public boolean isTargetVisible(VuforiaTrackable target)
{
VuforiaTrackableDefaultListener listener = (VuforiaTrackableDefaultListener)target.getListener();
return listener.isVisible();
}
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:12,代码来源:FtcVuforia.java
示例10: getTargetPose
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable; //导入依赖的package包/类
/**
* This method returns the position matrix of the specified target.
*
* @param target specifies the target to get the position matrix.
* @return position matrix of the specified target.
*/
public OpenGLMatrix getTargetPose(VuforiaTrackable target)
{
VuforiaTrackableDefaultListener listener = (VuforiaTrackableDefaultListener)target.getListener();
return listener.getPose();
}
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:12,代码来源:FtcVuforia.java
示例11: getRobotLocation
import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable; //导入依赖的package包/类
/**
* This method determines the robot location by the given target.
*
* @param target specifies the target to be used to determine robot location.
* @return robot location matrix.
*/
public OpenGLMatrix getRobotLocation(VuforiaTrackable target)
{
VuforiaTrackableDefaultListener listener = (VuforiaTrackableDefaultListener)target.getListener();
return listener.getRobotLocation();
}
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:12,代码来源:FtcVuforia.java
注:本文中的org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论