device.paschen_motor module

class device.paschen_motor.Arduino(serialbus, nodeid)[source]

Bases: object

Internal helper class for communication with Arduino.

Note: See ‘hardware/arduino_motor_emca/’ for Arduino sourcecode.

emcy_readcodes()[source]

Parse all buffered EMCY packets and return them as a list of 2-byte errorcodes in string format ‘0x0123’. EMCA-EC-C-HP.pdf page 255

fhpp_send(ccon, cpos, cdir, data1=0, data2=0, data2signed=True)[source]

Send basic FHPP packet (type RPDO1), see EMCA-EC-C-HP.pdf page 50.

Packet structure:

ccon, cpos, cdit, data1 - each size 1 byte, usigned int data2 - size 4 bytes, signed int (by default)

fhpp_state(actual2signed=True)[source]

Get most recent FHPP packet (type TPDO1) received from EMCA, see EMCA-EC-C-HP.pdf page 54.

Returns list of [SCON, SPOS, SDIR, actual1, actual2].

Note: actual2 is by default interpretted as signed int, actual1 is

always unsigned.

get_relay_states()[source]

Get current state of all three relays in a dict. The keys of the returned dict correspond to parameter which in toggle_relay_state().

other_readall()[source]

Return a list of all buffered uncathegorized packets. Packets are represented as tuples (packet type [str], packet data [bytes]).

sdo_read(index, subindex=1)[source]

Execute SDO read transaction.

Return bytes data:

little-endian representation of 1, 2, or 4 bytes

sdo_write(data, index, subindex=1)[source]

Execute SDO write transaction.

Parameters:

data (bytes) – little-endian representation of 1, 2, or 4 bytes

start()[source]

Bring Arduino and EMCA into an active state.

stop()[source]

Stop EMCA and Arduino.

toggle_relay_state(which)[source]

Toggle state of the relays connected to Arduino. All relays are initially switched off.

Parameters:

which (str) – one of RELAY_24_VALVE, RELAY_24_MOTOR, RELAY_230

class device.paschen_motor.PaschenMotor(serialbus, nodeid, **kwargs)[source]

Bases: HardwareBase

Motor that controls the distance of electrodes (Paschen experiment).

Model name: Festo EMCA-EC-67-M-1TE-CO

Communication:

  • CAN bus, using FHPP protocol (see documentation file EMCA-EC-C-HP.pdf)

  • CAN bus connects to Arduino that connects to RaspberryPi via serial (USB)

Note: See ‘hardware/arduino_motor_emca/’ for Arduino sourcecode.

close_valve()[source]

Close main chamber valve.

distance()[source]

Return distance of electrodes [mm].

homing()[source]

Execute homing procedure (calibration).

is_relay_on()[source]

Return state of power relay of the HV power suply device.

is_valve_open()[source]

Return the state of main chamber valve.

limits()[source]

Return limits on distance of electrodes [mm].

open_valve()[source]

Open main chamber valve.

pingpong()[source]
set_distance(distance)[source]

Set new distance of electrodes [mm].

Parameters:

distance (float) – value in range cca 0.5mm-90mm.

switch_relay_off()[source]

Switch off power for the HV power supply device.

switch_relay_on()[source]

Switch on power for the HV power supply device.

update_frontend(device_client)[source]