Overview
NetworkTables is WPILib’s primary communication protocol, enabling:- Automatic data synchronization across network
- Publisher-subscriber pattern for loose coupling
- Type-safe data exchange
- Dashboard integration (Shuffleboard, SmartDashboard)
- Vision coprocessor communication
- Robot-to-robot communication
Architecture
Core Concepts
Topics
Named data channels for publishing/subscribing
Publishers
Send data to a topic
Subscribers
Receive data from a topic
Entries
Combined publisher and subscriber
Basic Usage
Java API
C++ API
Topics
Topics are named data channels. Each topic has a specific data type.Topic Types
| Type | Java | C++ | Description |
|---|---|---|---|
| Boolean | BooleanTopic | BooleanTopic | true/false values |
| Integer | IntegerTopic | IntegerTopic | 64-bit integers |
| Float | FloatTopic | FloatTopic | 32-bit floating point |
| Double | DoubleTopic | DoubleTopic | 64-bit floating point |
| String | StringTopic | StringTopic | Text strings |
| Boolean Array | BooleanArrayTopic | BooleanArrayTopic | Array of booleans |
| Integer Array | IntegerArrayTopic | IntegerArrayTopic | Array of integers |
| Float Array | FloatArrayTopic | FloatArrayTopic | Array of floats |
| Double Array | DoubleArrayTopic | DoubleArrayTopic | Array of doubles |
| String Array | StringArrayTopic | StringArrayTopic | Array of strings |
| Raw | RawTopic | RawTopic | Binary data |
| Struct | StructTopic<T> | StructTopic<T> | Serialized structs |
| Protobuf | ProtobufTopic<T> | ProtobufTopic<T> | Protocol buffers |
Getting Topics
Publishers
Publishers send data to a topic.Publishing Data
Array Publishers
Subscribers
Subscribers receive data from a topic.Subscribing to Data
Reading All Updates
Entries
Entries combine publisher and subscriber functionality.Struct Topics
Publish custom structs with type safety.NetworkTableInstance
Manages NetworkTables connections and configuration.Client/Server Mode
Connection Listeners
Listeners
Value Change Listeners
Topic Listeners
Querying Topics
Properties
Topic Properties
Data Logging
NetworkTables can log data to DataLog files.Best Practices
Naming Conventions
Performance Tips
Resource Management
Integration with Dashboards
Shuffleboard
SmartDashboard
Vision Processing
C API
For C programs, ntcore provides a C API.Source Code
View the full source code on GitHub:Related Documentation
WPIUtil
Utilities including data logging
WPILibJ
Java robot API using NetworkTables
WPILibC
C++ robot API using NetworkTables