-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathremote_node_rx_test.py
30 lines (22 loc) · 1008 Bytes
/
remote_node_rx_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import nengo
import nengo_spinnaker
# Model network
model = nengo.Network()
with model:
nengo_spinnaker.add_spinnaker_params(model.config)
# Bind ip tag 2 to transmit data back to host
model.config[nengo_spinnaker.Simulator].remote_node_tx_iptags = { 2: ("192.168.167.217", 50007) }
# Create node for remote receiving of simulation data
remote_speed_rx_node = nengo.Node(size_in=1, label="speed")
model.config[remote_speed_rx_node].remote_tx_iptag = 2
remote_steer_rx_node = nengo.Node(size_in=1, label="steer")
model.config[remote_steer_rx_node].remote_tx_iptag = 2
# Create an input node and an ensemble
input_node = nengo.Node((0.01, 0.0), label="input")
ensemble = nengo.Ensemble(100, dimensions=2, radius=1.0)
# Connect everything together
nengo.Connection(input_node, ensemble)
nengo.Connection(ensemble[0], remote_speed_rx_node)
nengo.Connection(ensemble[1], remote_steer_rx_node)
sim = nengo_spinnaker.Simulator(model)
sim.run(20.0)