NetworkTables is a library for synchronizing variables over multiple machines in a network. It allows you to read what you publish from the RIO on your driver station, but it also allows the RIO to read values from another network device, and so can your driver station.
The RIO is the server. So, both the Pi and the driver station connect to the RIO. However, using NetworkTables is mostly the same regardless of whether you are on the client or the server. You can read values on the rio that the Pi publishes using something like this
Code:
NetworkTable gripTable = NetworkTable.getTable("path/to/grip/table");
double someValue = gripTable.getNumber("numberVariableName", defaultValue)
//Or getString, getBoolean, etc
You can read the documentation on Screensteps for more info on NetworkTables.
To center
- With a gyroscope: calculate the angle to the target and turn by that amount. If your camera is nice, use a simple pinhole camera model. If not, you're kind of screwed because the distortion correction functions of OpenCV aren't in GRIP last time I checked
- Without a gyroscope: turn until the target is centered. This will be much slower than if you had a gyro because the feedback is slower