Skip to main content

utils.farmng_sdo

ReqRepOpIds Objects​

class ReqRepOpIds()

Operation IDs for request and reply operations.

Must be in the range [0, 127] (7 bits).

ReqRepValIds Objects​

class ReqRepValIds()

Value IDs for request and reply operations.

Must be in the range [0, 2047] (11 bits) because we use 5 bits for encoding units.

Some codes:

  • NP: Not a persistent value (currently) This means it cannot be stored
  • UN: Not actually used in firmware (currently) This means it cannot be read, written, or stored

V_MAX​

NP

MAX_ANG_ACC​

max_accel in settings.csv

WHEEL_GEAR_RATIO​

NP

WHEEL_RADIUS​

NP

PTO_CUR_DEV​

NP | Current PTO device to change settings of

PTO_CUR_RPM​

NP

ReqRepValUnits Objects​

class ReqRepValUnits()

Units for request and reply values.

Must be in the range [0, 31] (5 bits). Uses the last 5 bits of the 2 bytes used for ReqRepValIds.

NA​

Unitless

M​

meters

MPS​

m/s

RADPS​

rad / s

RPM​

rpm

MS2​

m / s^2

RADS2​

rad / s^2

V​

volts

ReqRepValFmts Objects​

class ReqRepValFmts()

Data formats for request and reply values.

unpack_req_rep_value​

def unpack_req_rep_value(val_id: ReqRepValIds, payload: bytes)

Unpacks the request/reply value from the given payload based on the value ID.

Arguments:

  • val_id ReqRepValIds - The value ID.
  • payload bytes - The payload to unpack.

Returns:

The unpacked value.

FarmngRepReq Objects​

class FarmngRepReq(Packet)

Supervisor request class, farm-ng parallel to SDO protocol.

Attributes:

  • cob_id_req int - SDO command ID.
  • cob_id_rep int - SDO reply ID.
  • format str - The data format.

cob_id_req​

SDO command id

cob_id_rep​

SDO reply id

encode​

def encode()

Encodes the data contained by the class as CAN message data.

Returns:

  • bytes - The encoded CAN message data.

decode​

def decode(data)

Decodes CAN message data and populates the values of the class.

Arguments:

  • data bytes - The CAN message data to decode.