本文整理汇总了Java中edu.wpi.first.wpilibj.RobotBase类的典型用法代码示例。如果您正苦于以下问题:Java RobotBase类的具体用法?Java RobotBase怎么用?Java RobotBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RobotBase类属于edu.wpi.first.wpilibj包,在下文中一共展示了RobotBase类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runOnce
import edu.wpi.first.wpilibj.RobotBase; //导入依赖的package包/类
/**
* Runs the pipeline one time, giving it the next image from the video source specified
* in the constructor. This will block until the source either has an image or throws an error.
* If the source successfully supplied a frame, the pipeline's image input will be set,
* the pipeline will run, and the listener specified in the constructor will be called to notify
* it that the pipeline ran.
*
* <p>This method is exposed to allow teams to add additional functionality or have their own
* ways to run the pipeline. Most teams, however, should just use {@link #runForever} in its own
* thread using a {@link VisionThread}.</p>
*/
public void runOnce() {
if (Thread.currentThread().getId() == RobotBase.MAIN_THREAD_ID) {
throw new IllegalStateException(
"VisionRunner.runOnce() cannot be called from the main robot thread");
}
long frameTime = m_cvSink.grabFrame(m_image);
if (frameTime == 0) {
// There was an error, report it
String error = m_cvSink.getError();
DriverStation.reportError(error, true);
} else {
// No errors, process the image
m_pipeline.process(m_image);
m_listener.copyPipelineOutputs(m_pipeline);
}
}
示例2: startSimulation
import edu.wpi.first.wpilibj.RobotBase; //导入依赖的package包/类
public void startSimulation() throws InstantiationException, IllegalAccessException, ClassNotFoundException
{
RobotBase.initializeHardwareConfiguration();
loadConfig(sPROPERTIES_FILE);
// Do all of the stuff that
HAL.setWaitTime(.02);
createSimulator();
createRobot();
Thread robotThread = new Thread(createRobotThread(), "RobotThread");
Runnable guiThread = createGuiThread();
robotThread.start();
SwingUtilities.invokeLater(guiThread);
}
示例3: VisionManager
import edu.wpi.first.wpilibj.RobotBase; //导入依赖的package包/类
public VisionManager(IPositioner aPositioner, ISnobotActor aSnobotActor, IVisionJoystick aOperatorJoystick, RobotBase aSnobotState)
{
if (Properties2017.sENABLE_VISION.getValue())
{
mVisionServer = new VisionAdbServer(PortMappings2017.sADB_BIND_PORT, PortMappings2017.sAPP_MJPEG_PORT, PortMappings2017.sAPP_MJPEG_PORT);
}
mPositioner = aPositioner;
mSnobotActor = aSnobotActor;
mOperatorJoystick = aOperatorJoystick;
mSnobotState = aSnobotState;
mStateManager = new StateManager();
mLatestTargetInformation = new ArrayList<>();
mTargetMessage = "";
MjpegForwarder forwarder = new MjpegForwarder(PortMappings2017.sAPP_MJPEG_FORWARDED_PORT);
MjpegReceiver receiver = new MjpegReceiver();
receiver.addImageReceiver(forwarder);
receiver.start("http://127.0.0.01:" + PortMappings2017.sAPP_MJPEG_PORT);
}
示例4: VisionAdbServer
import edu.wpi.first.wpilibj.RobotBase; //导入依赖的package包/类
public VisionAdbServer(int aAppBindPort, int aAppMjpegBindPort, int aAppForwardedMjpegBindPort)
{
super(aAppBindPort, sTIMEOUT_PERIOD);
if(RobotBase.isSimulation())
{
mAdb = new NativeAdbBridge(Properties2017.sADB_LOCATION.getValue(), sAPP_PACKAGE, sAPP_MAIN_ACTIVITY, Properties2017.sKILL_OLD_ADBS);
}
else
{
mAdb = new RioDroidAdbBridge(sAPP_PACKAGE, sAPP_MAIN_ACTIVITY);
}
mAdb.reversePortForward(aAppBindPort, aAppBindPort);
mAdb.portForward(aAppMjpegBindPort, aAppForwardedMjpegBindPort);
mFreshImage = false;
}
示例5: Environment
import edu.wpi.first.wpilibj.RobotBase; //导入依赖的package包/类
/**
* Initializes systems
* @param robot the RobotBase to set
*/
public Environment(RobotBase robot) {
this.robot = robot;
this.input = new XboxInput();
this.accel = new AccelerometerSystem();
this.accel.init(this);
this.gyro = new GyroSystem();
this.gyro.init(this);
this.wheels = new WheelSystem();
this.wheels.init(this);
this.shooter = new ShooterSystem();
this.shooter.init(this);
this.intake = new IntakeSystem();
this.intake.init(this);
this.compressor = new Compressor(2, 1);
this.compressor.start();
}
示例6: setRobot
import edu.wpi.first.wpilibj.RobotBase; //导入依赖的package包/类
@Override
public void setRobot(RobotBase aRobot)
{
for (ISimulatorUpdater simulator : mSimulatorComponenets)
{
simulator.setRobot(aRobot);
}
}
示例7: createRobot
import edu.wpi.first.wpilibj.RobotBase; //导入依赖的package包/类
private void createRobot() throws InstantiationException, IllegalAccessException, ClassNotFoundException
{
System.out.println("*************************************************************");
System.out.println("* Starting Robot Code *");
System.out.println("*************************************************************");
mRobot = (RobotBase) Class.forName(mClassName).newInstance();
}
示例8: setRobot
import edu.wpi.first.wpilibj.RobotBase; //导入依赖的package包/类
@Override
public void setRobot(RobotBase mRobot)
{
}
示例9: setRobot
import edu.wpi.first.wpilibj.RobotBase; //导入依赖的package包/类
@Override
public void setRobot(RobotBase aRobot)
{
mPositioner = ((Snobot2017) aRobot).getPositioner();
}
示例10: runForever
import edu.wpi.first.wpilibj.RobotBase; //导入依赖的package包/类
/**
* A convenience method that calls {@link #runOnce()} in an infinite loop. This must
* be run in a dedicated thread, and cannot be used in the main robot thread because
* it will freeze the robot program.
*
* <p><strong>Do not call this method directly from the main thread.</strong></p>
*
* @throws IllegalStateException if this is called from the main robot thread
* @see VisionThread
*/
public void runForever() {
if (Thread.currentThread().getId() == RobotBase.MAIN_THREAD_ID) {
throw new IllegalStateException(
"VisionRunner.runForever() cannot be called from the main robot thread");
}
while (!Thread.interrupted()) {
runOnce();
}
}
示例11: RobotEnvironment
import edu.wpi.first.wpilibj.RobotBase; //导入依赖的package包/类
/**
* Set the RobotBase
* @param robot the RobotBase to set
*/
public RobotEnvironment(RobotBase robot) {
this.setRobot(robot);
}
示例12: getRobot
import edu.wpi.first.wpilibj.RobotBase; //导入依赖的package包/类
/**
* Accessor for robot
* @return the robot
*/
protected synchronized RobotBase getRobot() {
return robot;
}
示例13: setRobot
import edu.wpi.first.wpilibj.RobotBase; //导入依赖的package包/类
/**
* Mutator for robot
* @param robot the robot to set
*/
protected synchronized void setRobot(RobotBase robot) {
this.robot = robot;
}
示例14: setRobot
import edu.wpi.first.wpilibj.RobotBase; //导入依赖的package包/类
public abstract void setRobot(RobotBase mRobot);