mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[examples] Enable NT Flush in Field2d examples (#3013)
This commit is contained in:
committed by
GitHub
parent
78b542737a
commit
8651aa73e8
@@ -14,6 +14,10 @@
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
void RobotInit() override {
|
||||
// Flush NetworkTables every loop. This ensures that robot pose and other
|
||||
// values are sent during every iteration.
|
||||
SetNetworkTablesFlushEnabled(true);
|
||||
|
||||
m_trajectory = frc::TrajectoryGenerator::GenerateTrajectory(
|
||||
frc::Pose2d(2_m, 2_m, 0_rad), {}, frc::Pose2d(6_m, 4_m, 0_rad),
|
||||
frc::TrajectoryConfig(2_mps, 2_mps_sq));
|
||||
|
||||
@@ -9,7 +9,11 @@
|
||||
#include <frc/smartdashboard/SmartDashboard.h>
|
||||
#include <frc2/command/CommandScheduler.h>
|
||||
|
||||
void Robot::RobotInit() {}
|
||||
void Robot::RobotInit() {
|
||||
// Flush NetworkTables every loop. This ensures that robot pose and other
|
||||
// values are sent during every iteration.
|
||||
SetNetworkTablesFlushEnabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called every robot packet, no matter the mode. Use
|
||||
|
||||
@@ -33,6 +33,10 @@ public class Robot extends TimedRobot {
|
||||
|
||||
@Override
|
||||
public void robotInit() {
|
||||
// Flush NetworkTables every loop. This ensures that robot pose and other values
|
||||
// are sent during every iteration.
|
||||
setNetworkTablesFlushEnabled(true);
|
||||
|
||||
m_trajectory =
|
||||
TrajectoryGenerator.generateTrajectory(
|
||||
new Pose2d(2, 2, new Rotation2d()),
|
||||
|
||||
@@ -26,6 +26,10 @@ public class Robot extends TimedRobot {
|
||||
// Instantiate our RobotContainer. This will perform all our button bindings, and put our
|
||||
// autonomous chooser on the dashboard.
|
||||
m_robotContainer = new RobotContainer();
|
||||
|
||||
// Flush NetworkTables every loop. This ensures that robot pose and other values
|
||||
// are sent during every loop iteration.
|
||||
setNetworkTablesFlushEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user