I’m trying to write some python code to be run on the DS laptop and send values to the robot over NT4. I can’t seem to find any good example code for such a thing. If you/your team have something similar it would help a lot:)
I’ve come across this example, but it does not explain very well how it connects and to what address.
Another question: how do I connect it to localhost? I’ve tried using setServer with 127.0.0.1 but it didn’t work.
Using the hosts file I was able to redirect 10.59.90
2 to localhost.
Are you looking for something like this?
There are other examples? If they don’t make sense, file a bug and we can try to make them clearer?
Thanks.
Do you know whether it can connect to localhost?
Yes, it does connect to localhost. https://github.com/TheTripleV/robotpy-remoterepl/blob/main/remoterepl/__main__.py for example.
I made a program using python networktables last year heres what i used for changing the values (reformatted so its just the networktables stuff)
#network tables startup (rio ip address)
NetworkTables.initialize(server = "10.70.28.2")
#setup values
tgtColumn = ntproperty("/Target/Column", 0)
tgtRow = ntproperty("/Target/Row", 0)
#called this whenever i wanted to update the values
def updateNT():
tgtColumn = ntproperty("/Target/Column", (TargetValues.grid + TargetValues.column))
tgtRow = ntproperty("/Target/Row", TargetValues.row)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.