spynnaker.pyNN.external_devices_models.push_bot.ethernet package

Module contents

class spynnaker.pyNN.external_devices_models.push_bot.ethernet.PushBotEthernetDevice(protocol, device, uses_payload, time_between_send, first_send_timestep=100)

Bases: AbstractMulticastControllableDevice

An arbitrary PushBot device.

Parameters:
  • protocol (MunichIoEthernetProtocol) – The protocol instance to get commands from

  • device (AbstractPushBotOutputDevice) – The Enum instance of the device to control

  • uses_payload (bool) – True if the device uses a payload for control

  • time_between_send (int) – The timesteps between sending

  • first_send_timestep (int) – The first timestep to send

property device_control_first_send_timestep

The first timestep that the device should send in (0 by default).

Return type:

int

property device_control_key

The key that must be sent to the device to control it.

Return type:

int

property device_control_max_value

The maximum value to send to the device.

Return type:

float

property device_control_min_value

The minimum value to send to the device.

Return type:

float

property device_control_partition_id

A partition ID to give to an outgoing edge partition that will control this device.

Return type:

str

property device_control_send_type

The type of data to be sent.

Return type:

SendType

property device_control_timesteps_between_sending

The number of timesteps between sending commands to the device. This defines the “sampling interval” for the device.

Return type:

int

property device_control_uses_payload

Whether the control of the device accepts an arbitrary valued payload, the value of which will change the devices behaviour.

Return type:

bool

property protocol

The protocol instance, for use in the subclass.

Return type:

MunichIoEthernetProtocol

abstract set_command_protocol(command_protocol)[source]

Set the protocol use to send setup and shutdown commands, separately from the protocol used to control the device.

Parameters:

command_protocol (MunichIoSpiNNakerLinkProtocol) – The protocol to use for this device

class spynnaker.pyNN.external_devices_models.push_bot.ethernet.PushBotEthernetLEDDevice(led, protocol, start_active_time_front=None, start_active_time_back=None, start_total_period=None, start_frequency=None, timesteps_between_send=None)

Bases: PushBotEthernetDevice, AbstractSendMeMulticastCommandsVertex

The LED of a PushBot.

Parameters:
  • led (PushBotLED) – The LED to control

  • protocol (MunichIoEthernetProtocol) – The protocol instance to get commands from

  • start_active_time_front (int) – The “active time” to set for the front LED at the start

  • start_active_time_back (int) – The “active time” to set for the back LED at the start

  • start_total_period (int) – The “total period” to set at the start

  • start_frequency (int) – The “frequency” to set at the start

  • timesteps_between_send (int) – The number of timesteps between sending commands to the device, or None to use the default

property pause_stop_commands

The commands needed when pausing or stopping simulation.

Return type:

iterable(MultiCastCommand)

set_command_protocol(command_protocol)[source]

Set the protocol use to send setup and shutdown commands, separately from the protocol used to control the device.

Parameters:

command_protocol (MunichIoSpiNNakerLinkProtocol) – The protocol to use for this device

property start_resume_commands

The commands needed when starting or resuming simulation.

Return type:

iterable(MultiCastCommand)

property timed_commands

The commands to be sent at given times in the simulation.

Return type:

list(MultiCastCommand)

class spynnaker.pyNN.external_devices_models.push_bot.ethernet.PushBotEthernetLaserDevice(laser, protocol, start_active_time=None, start_total_period=None, start_frequency=None, timesteps_between_send=None)

Bases: PushBotEthernetDevice, AbstractSendMeMulticastCommandsVertex

The Laser of a PushBot.

Parameters:
  • laser (PushBotLaser) – The PushBotLaser value to control

  • protocol (MunichIoEthernetProtocol) – The protocol instance to get commands from

  • start_active_time (int) – The “active time” value to send at the start

  • start_total_period (int) – The “total period” value to send at the start

  • start_frequency (int) – The “frequency” to send at the start

  • timesteps_between_send (int) – The number of timesteps between sending commands to the device, or None to use the default

property pause_stop_commands

The commands needed when pausing or stopping simulation.

Return type:

iterable(MultiCastCommand)

set_command_protocol(command_protocol)[source]

Set the protocol use to send setup and shutdown commands, separately from the protocol used to control the device.

Parameters:

command_protocol (MunichIoSpiNNakerLinkProtocol) – The protocol to use for this device

property start_resume_commands

The commands needed when starting or resuming simulation.

Return type:

iterable(MultiCastCommand)

property timed_commands

The commands to be sent at given times in the simulation.

Return type:

list(MultiCastCommand)

class spynnaker.pyNN.external_devices_models.push_bot.ethernet.PushBotEthernetMotorDevice(motor, protocol, timesteps_between_send=None)

Bases: PushBotEthernetDevice, AbstractSendMeMulticastCommandsVertex

The motor of a PushBot.

Parameters:
  • motor (PushBotMotor) – indicates which motor to control

  • protocol (MunichIoEthernetProtocol) – The protocol used to control the device

  • timesteps_between_send (int) – The number of timesteps between sending commands to the device, or None to use the default

property pause_stop_commands

The commands needed when pausing or stopping simulation.

Return type:

iterable(MultiCastCommand)

set_command_protocol(command_protocol)[source]

Set the protocol use to send setup and shutdown commands, separately from the protocol used to control the device.

Parameters:

command_protocol (MunichIoSpiNNakerLinkProtocol) – The protocol to use for this device

property start_resume_commands

The commands needed when starting or resuming simulation.

Return type:

iterable(MultiCastCommand)

property timed_commands

The commands to be sent at given times in the simulation.

Return type:

list(MultiCastCommand)

class spynnaker.pyNN.external_devices_models.push_bot.ethernet.PushBotEthernetRetinaDevice(protocol, resolution, pushbot_ip_address, pushbot_port=56000, injector_port=None, local_host=None, local_port=None, retina_injector_label='PushBotRetinaInjector')

Bases: AbstractPushBotRetinaDevice, AbstractEthernetSensor

Parameters:
get_database_connection()[source]

Get a Database Connection instance that this device uses to inject packets.

Return type:

SpynnakerLiveSpikesConnection

Return type:

PushBotRetinaConnection

get_injector_label()[source]

Get the label to give to the Spike Injector.

Return type:

str

get_injector_parameters()[source]

Get the parameters of the Spike Injector to use with this device.

Return type:

dict(str,Any)

get_n_neurons()[source]

Get the number of neurons that will be sent out by the device.

Return type:

int

get_translator()[source]

Get a translator of multicast commands to Ethernet commands.

Return type:

AbstractEthernetTranslator

class spynnaker.pyNN.external_devices_models.push_bot.ethernet.PushBotEthernetSpeakerDevice(speaker, protocol, start_active_time=0, start_total_period=0, start_frequency=0, start_melody=None, timesteps_between_send=None)

Bases: PushBotEthernetDevice, AbstractSendMeMulticastCommandsVertex

The Speaker of a PushBot.

Parameters:
  • speaker (PushBotSpeaker) – The speaker to control

  • protocol (MunichIoEthernetProtocol) – The protocol instance to get commands from

  • start_active_time (int) – The “active time” to set at the start

  • start_total_period (int) – The “total period” to set at the start

  • start_frequency (int) – The “frequency” to set at the start

  • start_melody (int) – The “melody” to set at the start

  • timesteps_between_send (int) – The number of timesteps between sending commands to the device, or None to use the default

property pause_stop_commands

The commands needed when pausing or stopping simulation.

Return type:

iterable(MultiCastCommand)

set_command_protocol(command_protocol)[source]

Set the protocol use to send setup and shutdown commands, separately from the protocol used to control the device.

Parameters:

command_protocol (MunichIoSpiNNakerLinkProtocol) – The protocol to use for this device

property start_resume_commands

The commands needed when starting or resuming simulation.

Return type:

iterable(MultiCastCommand)

property timed_commands

The commands to be sent at given times in the simulation.

Return type:

list(MultiCastCommand)

class spynnaker.pyNN.external_devices_models.push_bot.ethernet.PushBotRetinaConnection(retina_injector_label, pushbot_wifi_connection, resolution=PushBotRetinaResolution.NATIVE_128_X_128, local_host=None, local_port=None)

Bases: SpynnakerLiveSpikesConnection

A connection that sends spikes from the PushBot retina to a spike injector in SpiNNaker.

Note

This assumes a packet format of 16-bits per retina event.

Parameters:
class spynnaker.pyNN.external_devices_models.push_bot.ethernet.PushBotTranslator(protocol, pushbot_wifi_connection)

Bases: AbstractEthernetTranslator

Translates packets between PushBot Multicast packets and PushBot Wi-Fi Commands.

Parameters:
translate_control_packet(multicast_packet)[source]

Translate a multicast packet received over Ethernet and send appropriate messages to the external device.

Parameters:

multicast_packet (AbstractDataElement) – A received multicast packet

class spynnaker.pyNN.external_devices_models.push_bot.ethernet.PushBotWIFIConnection(remote_host, remote_port=56000)

Bases: Connection, Listenable

A connection to a PushBot via Wi-Fi.

Parameters:
  • remote_host (str) – The IP address of the PushBot

  • remote_port (int) – The port number of the PushBot (default 56000)

Raises:

SpinnmanIOException – If there is an error setting up the communication channel

RECV_SIZE = 1024
close()[source]

See spinnman.connections.Connection.close().

get_receive_method()[source]

Get the method that receives for this connection.

is_connected()[source]

See is_connected().

is_ready_to_receive(timeout=0)[source]

Determines if there is an SCP packet to be read without blocking.

Parameters:

timeout (int) – The time to wait before returning if the connection is not ready

Returns:

True if there is an SCP packet to be read

Return type:

bool

property local_ip_address

The local IP address to which the connection is bound, as a dotted string, e.g. 0.0.0.0.

Return type:

str

property local_port

The local port to which the connection is bound.

Return type:

int

receive(timeout=None)[source]

Receive data from the connection

Parameters:

timeout (float or None) – The timeout, or None to wait forever

Returns:

The data received

Return type:

bytes

Raises:
  • SpinnmanTimeoutException – If a timeout occurs before any data is received

  • SpinnmanIOException – If an error occurs receiving the data

property remote_ip_address

The remote IP address to which the connection is connected, as a dotted string, or None if not connected remotely.

Return type:

str or None

property remote_port

The remote port to which the connection is connected, or None if not connected remotely.

Return type:

int or None

send(data)[source]

Send data down this connection

Parameters:

data (bytearray) – The data to be sent

Raises:

SpinnmanIOException – If there is an error sending the data

spynnaker.pyNN.external_devices_models.push_bot.ethernet.get_pushbot_wifi_connection(remote_host, remote_port=56000)

Get an existing connection to a PushBot, or make a new one.

Parameters:
  • remote_host (str) – The IP address of the PushBot

  • remote_port (int) – The port number of the PushBot (default 56000)