This repository was archived by the owner on Jul 16, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
source/docs/programming/photonlib Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -29,12 +29,18 @@ The final step is to configure your code to connect to the NetworkTables server
29
29
30
30
.. code-block :: c++
31
31
32
- if(RobotBase.IsSimulation()) {
33
- auto inst = NetworkTableInstance.getDefault();
34
- inst.StopServer();
35
- // Change the IP address in the below function to the IP address you use to connect to the PhotonVision UI.
36
- inst.SetServer("photonvision.local");
37
- inst.StartClient4("Robot Simulation");
32
+ #include <frc/RobotBase.h>
33
+ #include <networktables/NetworkTable.h>
34
+
35
+ void Robot::RobotInit() {
36
+ if constexpr (frc::RobotBase: :IsSimulation()) {
37
+ auto inst = nt::NetworkTableInstance: :GetDefault();
38
+ inst.StopServer();
39
+ // Change the IP address in the below function to the IP address you use to
40
+ // connect to the PhotonVision UI.
41
+ inst.SetServer("localhost");
42
+ inst.StartClient4("Robot Simulation");
43
+ }
38
44
}
39
45
40
46
Now launch simulation, and you should be able to see the PhotonVision table on your simulation's NetworkTables dashboard.
You can’t perform that action at this time.
0 commit comments