本文整理汇总了Java中edu.wpi.first.wpilibj.networktables.NetworkTable.getTable方法的典型用法代码示例。如果您正苦于以下问题:Java NetworkTable.getTable方法的具体用法?Java NetworkTable.getTable怎么用?Java NetworkTable.getTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.wpi.first.wpilibj.networktables.NetworkTable
的用法示例。
在下文中一共展示了NetworkTable.getTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: VisionAlignment
import edu.wpi.first.wpilibj.networktables.NetworkTable; //导入方法依赖的package包/类
public VisionAlignment() {
table = NetworkTable.getTable("Vision");
double dist = table.getNumber("est_distance", 0);
double incr = 0.5;
int reps = (int) (dist / incr);
for(int i = 0; i<reps; i++) {
addSequential(new VisionGyroAlign(), 1.5);
addSequential(new WaitCommand(0.7));
addSequential(new DriveForwardDistance(-.2,-.2, -incr/1.5, -incr/1.5, true));
addSequential(new WaitCommand(0.5));
}
}
示例2: Vision
import edu.wpi.first.wpilibj.networktables.NetworkTable; //导入方法依赖的package包/类
/**
* Creates the instance of VisionSubsystem.
*/
public Vision() {
logger.trace("Initialize");
ledRing0 = new Relay(RobotMap.RELAY_LED_RING_0);
ledRing1 = new Relay(RobotMap.RELAY_LED_RING_1);
gearVision.table = NetworkTable.getTable("Vision_Gear");
boilerVision.table = NetworkTable.getTable("Vision_Boiler");
initPhoneVars(gearVision, DEFAULT_GEAR_TARGET_WIDTH, DEFAULT_GEAR_TARGET_HEIGHT);
initPhoneVars(boilerVision, DEFAULT_BOILER_TARGET_WIDTH, DEFAULT_BOILER_TARGET_HEIGHT);
Thread forwardThread = new Thread(this::packetForwardingThread);
forwardThread.setDaemon(true);
forwardThread.setName("Packet Forwarding Thread");
forwardThread.start();
Thread dataThread = new Thread(this::dataThread);
dataThread.setDaemon(true);
dataThread.setName("Vision Data Thread");
dataThread.start();
}
示例3: DFDSMove
import edu.wpi.first.wpilibj.networktables.NetworkTable; //导入方法依赖的package包/类
public DFDSMove(double speedL, double speedR, double distanceL, double distanceR) {
requires(Robot.driveTrain);
_initLeftSpeed = speedL;
_initRightSpeed = speedR;
_initDistanceL = distanceL*TICKSPERMETER;
_initDistanceR = distanceR*TICKSPERMETER;
table = NetworkTable.getTable("Console");
if(speedL > 0)
table.putString("Message", "Backwards DFD Speed");
else
table.putString("Message", "Forwards DFD Speed");
Robot.driveTrain.resetEnc();
Robot.driveTrain.resetGyro();
Robot.driveTrain.speedControl();
Robot.driveTrain.setBrakeMode();
}
示例4: init
import edu.wpi.first.wpilibj.networktables.NetworkTable; //导入方法依赖的package包/类
public static void init() {
nt = NetworkTable.getTable("vision");
nt.addTableListener((source, key, value, isNew) -> {
// System.out.println("Value changed. Key = " + key + ", Value = " + value);
switch (key) {
case FOUND_TARGET_KEY:
foundTarget = (Boolean) value;
break;
case AREA_KEY:
area = (Double) value;
break;
case OFFSET_KEY:
offset = (Double) value;
break;
case SKEW_KEY:
skew = (Double) value;
break;
case ANGLE_KEY:
angle = (Double) value;
break;
}
});
}
示例5: SplinePlannerWidget
import edu.wpi.first.wpilibj.networktables.NetworkTable; //导入方法依赖的package包/类
public SplinePlannerWidget()
{
super(false, 10);
setLayout(new BorderLayout());
mPanel = new SplinePlotterPanel();
add(mPanel);
mTable = NetworkTable.getTable(SmartDashBoardNames.sSPLINE_NAMESPACE);
mLastIndex = 0;
mIdealSplineName = SmartDashBoardNames.sSPLINE_IDEAL_POINTS;
mRealSplineName = SmartDashBoardNames.sSPLINE_REAL_POINT;
addPathListener();
}
示例6: AutonomousFactory
import edu.wpi.first.wpilibj.networktables.NetworkTable; //导入方法依赖的package包/类
public AutonomousFactory(Snobot2017 aSnobot, IDriverJoystick aDriverJoystick)
{
mPositionChooser = new SendableChooser<StartingPositions>();
mCommandParser = new CommandParser(aSnobot, mPositionChooser);
mAutoModeTable = NetworkTable.getTable(SmartDashBoardNames.sAUTON_TABLE_NAME);
mPositioner = aSnobot.getPositioner();
mAutonModeChooser = new SnobotAutonCrawler(Properties2017.sAUTON_FILE_FILTER.getValue())
.loadAutonFiles(Properties2017.sAUTON_DIRECTORY.getValue() + "/", Properties2017.sAUTON_DEFAULT_FILE.getValue());
SmartDashboard.putData(SmartDashBoardNames.sAUTON_CHOOSER, mAutonModeChooser);
for (StartingPositions pos : StartingPositions.values())
{
mPositionChooser.addObject(pos.toString(), pos);
}
SmartDashboard.putData(SmartDashBoardNames.sPOSITION_CHOOSER, mPositionChooser);
addListeners();
}
示例7: main
import edu.wpi.first.wpilibj.networktables.NetworkTable; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
NetworkTable.setClientMode();
InetAddress address = InetAddress.getByName("roborio-1458-frc.local");
NetworkTable.setIPAddress(address.getHostAddress());
NetworkTable SmartDashboard = NetworkTable.getTable("SmartDashboard");
Scanner s = new Scanner(System.in);
//SmartDashboard.putNumber("TestValueJetson", 42);
while(true) {
if(s.hasNextInt()) {
SmartDashboard.putNumber("TestValueJetson", s.nextInt());
}
}
}
示例8: AimWithCamera
import edu.wpi.first.wpilibj.networktables.NetworkTable; //导入方法依赖的package包/类
public AimWithCamera()
{
requires((Subsystem) driveTrain);
requires((Subsystem) shooterArticulator);
if (CommandBase.lightSystem != null)
requires((Subsystem) lightSystem);
table = NetworkTable.getTable("IMGPROC");
TOLERANCE = Double.parseDouble(BadPreferences.getValue(toleranceKey, "" + TOLERANCE));
TURN_SPEED = Double.parseDouble(BadPreferences.getValue(turnKey, "" + TURN_SPEED));
NUMBER_CYCLES_TO_VERIFY = Integer.parseInt(
BadPreferences.getValue(neededCyclesKey, "" + NUMBER_CYCLES_TO_VERIFY));
SWEET_SPOT_X = Double.parseDouble(BadPreferences.getValue(sweetXKey, "" + SWEET_SPOT_X));
SWEET_SPOT_Y = Double.parseDouble(BadPreferences.getValue(sweetYKey, "" + SWEET_SPOT_Y));
}
示例9: robotInit
import edu.wpi.first.wpilibj.networktables.NetworkTable; //导入方法依赖的package包/类
public void robotInit() {
// instantiate the command used for the autonomous period
//autonomousCommand = new ExampleCommand();
// Initialize all subsystems
CommandBase.init();
table = NetworkTable.getTable("CRIO");
table.putBoolean("bool", true);
table.putNumber("double", 3.1415927);
table.putString("sring", "a string");
LogDebugger.log("robot init!!!");
// LiveWindow.addActuator("compressor", "alt relay", RobotMap.testCompRelay);
// LiveWindow.addActuator("compressor", "act compressor", RobotMap.airCompressor);
// LiveWindow.addSensor("compressor", "sensor compressor", RobotMap.airCompressor);
}
示例10: getNetworkTable
import edu.wpi.first.wpilibj.networktables.NetworkTable; //导入方法依赖的package包/类
/**
* Setup Network Tables, and get the NetworkTable for the SmartDashboard.
* @return The network table for the SmartDashboard.
*/
private NetworkTable getNetworkTable()
{
NetworkTable.setTeam(1899);
NetworkTable.setServerMode();
try
{
NetworkTable.initialize();
}
catch (IOException exception)
{
Logger.log(exception);
}
return NetworkTable.getTable("SmartDashboard");
}
示例11: RightPeg
import edu.wpi.first.wpilibj.networktables.NetworkTable; //导入方法依赖的package包/类
public RightPeg() {
Robot.driveTrain.resetEnc();
table = NetworkTable.getTable("Vision");
addSequential(new DFDSpeed(-200, -200, 1.60, 1.60));
addSequential(new WaitCommand(0.2));
addSequential(new GyroTurn(-150, -50), 2); //CHECK + AND -
addSequential(new WaitCommand(0.2));
addSequential(new VisionGyroAlign(), 1);
addSequential(new WaitCommand(0.2));
addSequential(new MovingVisionAlignment(), 5); //removed timeout
addSequential(new WaitCommand(0.2));
//Move back retry
addSequential(new DFDSMove(200, 200, 1.0, 1.0), 2);
addSequential(new WaitCommand(0.1));
addSequential(new MovingVisionAlignment(), 5); //removed timeout
addSequential(new WaitCommand(0.1));
addSequential(new DFDSMove(200, 200, 1.0, 1.0), 2);
addSequential(new WaitCommand(0.1));
addSequential(new MovingVisionAlignment(), 5); //removed timeout
addSequential(new WaitCommand(0.1));
addSequential(new DFDSMove(200, 200, 1.0, 1.0), 2);
addSequential(new WaitCommand(0.1));
addSequential(new MovingVisionAlignment()); //removed timeout
addSequential(new WaitCommand(0.1));
addSequential(new GearOn(false, false), 1);
addSequential(new WaitCommand(0.5));
addSequential(new DFDSpeed(200, 200, 1.4, 1.4));
}
示例12: VisionGyroAlign
import edu.wpi.first.wpilibj.networktables.NetworkTable; //导入方法依赖的package包/类
public VisionGyroAlign () {
requires(Robot.driveTrain);
table = NetworkTable.getTable("Vision");
Robot.driveTrain.resetLeftEnc();
Robot.driveTrain.resetRightEnc();
Robot.driveTrain.resetGyro();
_turnPower = -125;
}
示例13: AutoDrive
import edu.wpi.first.wpilibj.networktables.NetworkTable; //导入方法依赖的package包/类
public AutoDrive(double speed) {
requires(Robot.driveTrain);
table = NetworkTable.getTable("Vision");
_leftSpeed = speed*1.15;
_rightSpeed = speed;
Robot.driveTrain.percentVbusControl();
}
示例14: DriveForwardDistance
import edu.wpi.first.wpilibj.networktables.NetworkTable; //导入方法依赖的package包/类
public DriveForwardDistance(double speedL, double speedR, double distanceL, double distanceR, boolean slow) {
requires(Robot.driveTrain);
_initLeftSpeed = speedL;
_initRightSpeed = speedR;
_initDistanceL = distanceL*TICKSPERMETER;
_initDistanceR = distanceR*TICKSPERMETER;
_slow = slow;
Robot.driveTrain.percentVbusControl();
table = NetworkTable.getTable("Console");
}
示例15: updateContoursReport
import edu.wpi.first.wpilibj.networktables.NetworkTable; //导入方法依赖的package包/类
/**
* Updates the local contoursReport table. WARNING, this has to be somewhat
* syncrhonized so one thing doesn't update the table while another tries to
* access an element that might not exist in the updated table
*
*/
public void updateContoursReport() {
// A contours report contains centerX[], centerY[], solidity[],
// height[], area[], and width[]
// I think that it publishes the contours with the smallest area first
// in the array
contoursReport = NetworkTable.getTable("GRIP/myContoursReport");
}