Network

class ingenialink.canopen.network.CAN_BAUDRATE(value)[source]

Baudrates.

Baudrate_100K = 100000

100 Kbit/s

Baudrate_125K = 125000

125 Kbit/s

Baudrate_1M = 1000000

1 Mbit/s

Baudrate_250K = 250000

250 Kbit/s

Baudrate_500K = 500000

500 Kbit/s

Baudrate_50K = 50000

50 Kbit/s

class ingenialink.canopen.network.CAN_DEVICE(value)[source]

CAN Device.

class ingenialink.canopen.network.CanopenNetwork(device, channel=0, baudrate=CAN_BAUDRATE.Baudrate_1M)[source]

Network of the CANopen communication.

Parameters
  • device (CAN_DEVICE) – Targeted device to connect.

  • channel (int) – Targeted channel number of the transceiver.

  • baudrate (CAN_BAUDRATE) – Baudrate to communicate through.

change_baudrate(target_node, new_target_baudrate, vendor_id, product_code, rev_number, serial_number)[source]

Changes the node ID of a given target node ID.

Note

The servo must be disconnected after this operation in order to make the changes visible and update all the internal data. It is also needed a power cycle of the servo otherwise the changes will not be applied.

Parameters
  • target_node (int) – Node ID of the targeted device.

  • new_target_baudrate (CAN_BAUDRATE) – New baudrate for the targeted device.

  • vendor_id (int) – Vendor ID of the targeted device.

  • product_code (int) – Product code of the targeted device.

  • rev_number (int) – Revision number of the targeted device.

  • serial_number (int) – Serial number of the targeted device.

Returns

Indicates if the operation was successful.

Return type

bool

change_node_id(target_node, new_target_node, vendor_id, product_code, rev_number, serial_number)[source]

Changes the node ID of a given target node ID.

Note

The servo must be disconnected after this operation in order to make the changes visible and update all the internal data.

Parameters
  • target_node (int) – Node ID of the targeted device.

  • new_target_node (int) – New node ID for the targeted device.

  • vendor_id (int) – Vendor ID of the targeted device.

  • product_code (int) – Product code of the targeted device.

  • rev_number (int) – Revision number of the targeted device.

  • serial_number (int) – Serial number of the targeted device.

Returns

Indicates if the operation was successful.

Return type

bool

connect_to_slave(target, dictionary=None, eds=None, servo_status_listener=True, net_status_listener=True)[source]

Connects to a drive through a given target node ID.

Parameters
  • target (int) – Targeted node ID to be connected.

  • dictionary (str) – Path to the dictionary file.

  • eds (str) – Path to the EDS file.

  • servo_status_listener (bool) – Toggle the listener of the servo for its status, errors, faults, etc.

  • net_status_listener (bool) – Toggle the listener of the network status, connection and disconnection.

disconnect_from_slave(servo)[source]

Disconnects the slave from the network.

Parameters

servo (CanopenServo) – Instance of the servo connected.

load_firmware(target, fw_file, callback_status_msg=None, callback_progress=None, callback_errors_enabled=None)[source]

Loads a given firmware file to a target.

Warning

It is needed to disconnect the drive(disconnect_from_slave()) after loading the firmware since the Servo object’s data will become obsolete.

Parameters
  • target (int) – Targeted node ID to be loaded.

  • fw_file (str) – Path to the firmware file.

  • callback_status_msg (object) – Subscribed callback function for the status message when loading a firmware.

  • callback_progress (object) – Subscribed callback function for the live progress when loading a firmware.

  • callback_errors_enabled (object) – Subscribed callback function for knowing when to toggle the error detection when loading firmware.

Raises

ILFirmwareLoadError – The firmware load process fails with an error message.

scan_slaves()[source]

Scans for nodes in the network.

Returns

Containing all the detected node IDs.

Return type

list

start_status_listener(servo)[source]

Start monitoring network events (CONNECTION/DISCONNECTION).

stop_status_listener()[source]

Stops the NetStatusListener from listening to the drive.

subscribe_to_status(callback)[source]

Subscribe to network state changes.

Parameters

callback (function) – Callback function.

unsubscribe_from_status(callback)[source]

Unsubscribe from network state changes.

Parameters

callback (function) – Callback function.

property baudrate

Current baudrate of the network.

Type

int

property channel

Current device of the network.

Type

int

property device

Current device of the network.

Type

CAN_DEVICE

property network

Returns the instance of the CANopen Network.

Type

canopen.Network

property protocol

Obtain network protocol.

Type

NET_PROT

servos

List of the connected servos in the network.

Type

list

property status

Network state.

Type

NET_STATE

class ingenialink.canopen.network.NetStatusListener(network, node)[source]

Network status listener thread to check if the drive is alive.

Parameters
  • network (CanopenNetwork) – Network instance of the CANopen communication.

  • node (canopen.RemoteNode) – Identifier for the targeted node ID.

run()[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.