Reference Guide

fsa.fi_fsa module

FSA (Fourier Smart Actuator) Module

This module defines the core functionality and classes for interacting with FSA actuator. It includes classes for control, configuration, logging, and other related features.

Module Structure:
  • FSA: Main class representing the FSA actuator.

  • FSAConfig: Configuration class for FSA settings.

  • FSALogger: Logger class for capturing and managing log information.

  • FSAFunctionResult: Enumeration of function execution results.

  • FSAFlagState: Enumeration of flag states.

  • FSAActuatorType: Enumeration of FSA actuator types.

  • FSAActuatorDirection: Enumeration of FSA actuator directions.

  • FSAActuatorReductionRatio: Enumeration of FSA actuator reduction ratios.

  • FSAControlWord: Enumeration of FSA control words.

  • FSAModeOfOperation: Enumeration of FSA modes of operation.

  • FSAState: Enumeration of FSA states.

  • FSAErrorCode: Enumeration of FSA error codes.

  • FSAInputMode: Enumeration of FSA input modes.

  • FSAMotorType: Enumeration of FSA motor types.

  • FSAHardwareType: Enumeration of FSA PCB boards.

  • FSAMotorDirection: Enumeration of FSA motor directions.

  • FSAMotorVBUS: Enumeration of FSA motor VBUS options.

  • FSAMotorPolePairs: Enumeration of FSA motor pole pairs.

  • FSAMotorMaxSpeed: Enumeration of FSA motor maximum speeds.

  • FSAMotorMaxAcceleration: Enumeration of FSA motor maximum accelerations.

  • FSAMotorVIBCADCRatio: Constants for FSA motor VIBCA ADC ratio calculations.

  • FSAMotorVBUSADCRatio: Constants for FSA motor VBUS ADC ratio calculations.

  • FSAEncoderDirection: Enumeration of FSA encoder directions.

  • FSAEncoderResolution: Enumeration of FSA encoder resolutions.

For usage examples and detailed documentation, refer to the package documentation.

class fsa.fi_fsa.FSAActuatorDirection

Bases: object

Enumeration class for actuator directions.

DIRECTION_NORMAL

Represents the normal direction with a value of 1.

Type:

int

DIRECTION_REVERSE

Represents the reverse direction with a value of -1.

Type:

int

DIRECTION_NORMAL = 1
DIRECTION_REVERSE = -1
class fsa.fi_fsa.FSAActuatorReductionRatio

Bases: object

Enumeration class for actuator reduction ratios.

Each reduction ratio represents a specific gear configuration that influences the actuator’s performance.

REDUCTION_RATIO_7

Represents a reduction ratio of 7.

Type:

int

REDUCTION_RATIO_30

Represents a reduction ratio of 30.

Type:

int

REDUCTION_RATIO_36

Represents a reduction ratio of 36.

Type:

int

REDUCTION_RATIO_50

Represents a reduction ratio of 50.

Type:

int

REDUCTION_RATIO_70

Represents a reduction ratio of 70.

Type:

int

REDUCTION_RATIO_80

Represents a reduction ratio of 80.

Type:

int

REDUCTION_RATIO_100

Represents a reduction ratio of 100.

Type:

int

REDUCTION_RATIO_120

Represents a reduction ratio of 120.

Type:

int

REDUCTION_RATIO_100 = 100
REDUCTION_RATIO_120 = 120
REDUCTION_RATIO_30 = 30
REDUCTION_RATIO_36 = 36
REDUCTION_RATIO_50 = 50
REDUCTION_RATIO_7 = 7
REDUCTION_RATIO_80 = 80
class fsa.fi_fsa.FSAActuatorType

Bases: object

Enumeration class representing different types of Fourier Smart Actuator (FSA).

Constants:
  • TYPE_DEFAULT: Default actuator type (0x00000001).

TYPE_DEFAULT = 1
class fsa.fi_fsa.FSAControlWord

Bases: object

Enumeration class for FSA control words.

The FSAControlWord class defines control words used in the communication protocol to command and control Fourier Smart Actuators (FSAs). Each control word represents a specific action or command that can be sent to the FSAs for operations such as calibration, motion control, and fault handling.

NONE

Represents no specific control word (0).

Type:

int

CALIBRATE_PREPARE

Control word for calibrating preparation (0xA0).

Type:

int

CALIBRATE_ADC

Control word for calibrating ADC (0xA1).

Type:

int

CALIBRATE_MOTOR

Control word for calibrating motor (0xA2).

Type:

int

CALIBRATE_ENCODER

Control word for calibrating encoder (0xA3).

Type:

int

CALIBRATE_DIRECTION

Control word for calibrating direction (0xA4).

Type:

int

CALIBRATE_OFFSET

Control word for calibrating offset (0xA5).

Type:

int

OPEN_LOOP_CONTORL

Control word for open-loop control (0x04).

Type:

int

SERVO_OFF

Control word for turning off servo (0x06).

Type:

int

SERVO_ON

Control word for turning on servo (0x0F).

Type:

int

MOTION_ABS

Control word for absolute motion (0x103F).

Type:

int

CLEAR_FAULT

Control word for clearing faults (0x86).

Type:

int

CALIBRATE_ADC = 161
CALIBRATE_DIRECTION = 164
CALIBRATE_ENCODER = 163
CALIBRATE_MOTOR = 162
CALIBRATE_OFFSET = 165
CALIBRATE_PREPARE = 160
CLEAR_FAULT = 134
MOTION_ABS = 4159
NONE = 0
OPEN_LOOP_CONTORL = 4
SERVO_OFF = 6
SERVO_ON = 15
class fsa.fi_fsa.FSAEncoderDirection

Bases: object

Enumeration of encoder directions for the Fourier Smart Actuator (FSA).

This class defines two constants representing different encoder directions within the FSA.

Constants:

DIRECTION_CW (int): Represents a clockwise encoder direction with a value of -1. DIRECTION_CCW (int): Represents a counterclockwise encoder direction with a value of 1.

Note

  • Use FSAEncoderDirection.DIRECTION_CW when specifying a clockwise encoder direction (value: -1).

  • Use FSAEncoderDirection.DIRECTION_CCW when specifying a counterclockwise encoder direction (value: 1).

Example

>>> clockwise_direction = FSAEncoderDirection.DIRECTION_CW
>>> print(clockwise_direction)
-1
>>> counterclockwise_direction = FSAEncoderDirection.DIRECTION_CCW
>>> print(counterclockwise_direction)
1
DIRECTION_CCW = 1
DIRECTION_CW = -1
class fsa.fi_fsa.FSAEncoderResolution

Bases: object

Resolution Configuration for FSA Encoder

This class defines the resolution configuration for the encoder used in the Fourier Smart Actuator (FSA). The constant RESOLUTION_4000 is set to 4000 pulses per revolution, specifying the level of precision in counting pulses for each revolution of the encoder.

RESOLUTION_4000

The resolution setting for the encoder, providing 4000 pulses per revolution.

Type:

int

Note

The encoder resolution determines the precision and accuracy of position tracking in the FSA. A higher resolution results in finer position control.

Example

>>> resolution = FSAEncoderResolution.RESOLUTION_4000
>>> print(resolution)
4000
RESOLUTION_4000 = 4000
class fsa.fi_fsa.FSAErrorCode(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enumeration class for Fourier Smart Actuator (FSA) error codes.

This class defines symbolic names for different error codes that may occur in the operation of a Fourier Smart Actuator. Each error code is represented by a unique constant value.

ERROR_NONE

No error, represented by a value of 0x0.

Type:

int

ERROR_ADC_CAL_FAULT

ADC calibration fault, represented by a value of 0x01.

Type:

int

ERROR_CAN_COM_TIMEOUT

CAN communication timeout, represented by a value of 0x02.

Type:

int

ERROR_OVER_CURRENT

Over current error, represented by a value of 0x04.

Type:

int

ERROR_OVER_VBUS

Over VBUS error, represented by a value of 0x08.

Type:

int

ERROR_UNDER_VBUS

Under VBUS error, represented by a value of 0x10.

Type:

int

ERROR_OVER_TEMP_TRIP

Over temperature trip error, represented by a value of 0x20.

Type:

int

ERROR_OVER_TEMP_MOSFET

Over temperature MOSFET error, represented by a value of 0x40.

Type:

int

ERROR_OVER_PHASE_A_CURRENT

Over phase A current error, represented by a value of 0x80.

Type:

int

ERROR_OVER_PHASE_B_CURRENT

Over phase B current error, represented by a value of 0x100.

Type:

int

ERROR_OVER_PHASE_C_CURRENT

Over phase C current error, represented by a value of 0x200.

Type:

int

ERROR_OVER_HARD_PHASE_CURRENT

Over hard phase current error, represented by a value of 0x400.

Type:

int

ERROR_OPD_FAULT

OPD (Over Power Dissipation) fault error, represented by a value of 0x800.

Type:

int

ERROR_ENCODER_NOT_CALIBRATED

Encoder not calibrated error, represented by a value of 0x1000.

Type:

int

ERROR_ENCODER_LOSS

Encoder loss error, represented by a value of 0x2000.

Type:

int

ERROR_FLASH_ERROR

Flash memory error, represented by a value of 0x4000.

Type:

int

ERROR_MOTOR_STALL

Motor stall error, represented by a value of 0x8000.

Type:

int

ERROR_POSITION_LIMIT_ERROR

Position limit error, represented by a value of 0x10000.

Type:

int

ERROR_ENCODER_REVERSAL

Encoder reversal error, represented by a value of 0x20000.

Type:

int

ERROR_MOTOR_TYPE_NULL

Motor type is null error, represented by a value of 0x40000.

Type:

int

ERROR_HARDWARE_TYPE_NULL

Hardware type is null error, represented by a value of 0x80000.

Type:

int

Note

These attributes can be accessed using the class name, e.g., FSAErrorCode.ERROR_NONE.

Example

>>> error_code = FSAErrorCode.ERROR_OVER_CURRENT
>>> print(error_code)
<FSAErrorCode.ERROR_OVER_CURRENT: 4>
ERROR_ADC_CAL_FAULT = 1
ERROR_CAN_COM_TIMEOUT = 2
ERROR_ENCODER_LOSS = 8192
ERROR_ENCODER_NOT_CALIBRATED = 4096
ERROR_ENCODER_REVERSAL = 131072
ERROR_FLASH_ERROR = 16384
ERROR_HARDWARE_TYPE_NULL = 524288
ERROR_MOTOR_STALL = 32768
ERROR_MOTOR_TYPE_NULL = 262144
ERROR_NONE = 0
ERROR_OPD_FAULT = 2048
ERROR_OVER_CURRENT = 4
ERROR_OVER_HARD_PHASE_CURRENT = 1024
ERROR_OVER_PHASE_A_CURRENT = 128
ERROR_OVER_PHASE_B_CURRENT = 256
ERROR_OVER_PHASE_C_CURRENT = 512
ERROR_OVER_TEMP_MOSFET = 64
ERROR_OVER_TEMP_TRIP = 32
ERROR_OVER_VBUS = 8
ERROR_POSITION_LIMIT_ERROR = 65536
ERROR_UNDER_VBUS = 16
class fsa.fi_fsa.FSAFlagState

Bases: object

Enumeration class representing the possible states of a flag in Fourier Smart Actuator (FSA).

Constants:
  • CLEAR: The flag is in a cleared state (0).

  • SET: The flag is in a set state (1).

CLEAR = 0
SET = 1
class fsa.fi_fsa.FSAFunctionResult

Bases: object

Enumeration class representing the possible results of Fourier Smart Actuator (FSA) functions.

Constants:
  • SUCCESS: Operation completed successfully (0).

  • FAIL: Operation failed (-1).

  • RUNNING: Operation is currently running (1).

  • PREPARE: Operation is in preparation state (2).

  • EXECUTE: Operation is in execution state (3).

  • NOT_EXECUTE: Operation did not execute (4).

  • TIMEOUT: Operation timed out (5).

EXECUTE = 3
FAIL = -1
NOT_EXECUTE = 4
PREPARE = 2
RUNNING = 1
SUCCESS = 0
TIMEOUT = 5
class fsa.fi_fsa.FSAHardwareType

Bases: object

Enumeration of PCB board types for the Fourier Smart Actuator (FSA).

This class defines different PCB board types used within the FSA system.

Constants:
  • TYPE_HARDWARE_NULL (int): Represents a null or undefined PCB board type (0).

  • TYPE_ODrive_V36 (int): Represents the ODrive_V36 PCB board (1).

  • TYPE_H95V104 (int): Represents the H95V104 PCB board (2).

  • TYPE_H66V104 (int): Represents the H66V104 PCB board (3).

  • TYPE_H46V104 (int): Represents the H46V104 PCB board (4).

  • TYPE_H30V303 (int): Represents the H30V303 PCB board (5).

Note

These constants can be used to specify and identify different PCB board types within the Fourier Smart Actuator (FSA) system.

Example

>>> hardware_type = FSAHardwareType.TYPE_H66V104
>>> print(hardware_type)
3
TYPE_H30V303 = 5
TYPE_H46V104 = 4
TYPE_H66V104 = 3
TYPE_H95V104 = 2
TYPE_HARDWARE_NULL = 0
TYPE_ODrive_V36 = 1
class fsa.fi_fsa.FSAInputMode

Bases: object

Enumeration of input modes for the Fourier Smart Actuator (FSA).

This class defines different input modes that determine how the FSA responds to input commands.

INPUT_MODE_INACTIVE

The actuator is inactive or disabled (0).

Type:

int

INPUT_MODE_PASSTHROUGH

Passthrough mode, where input commands directly translate to actuator responses (1).

Type:

int

INPUT_MODE_VEL_RAMP

Velocity ramping for smoother motion control (2).

Type:

int

INPUT_MODE_POS_FILTER

Position filtering to reduce jitter in actuator motion (3).

Type:

int

INPUT_MODE_TRAP_TRAJ

Trapezoidal trajectory for precise and controlled motion (5).

Type:

int

INPUT_MODE_TORQUE_RAMP

Torque ramping to control the rate of applied torque (6).

Type:

int

Note

Each input mode serves a specific purpose and can be selected based on application requirements.

Example

>>> mode = FSAInputMode.INPUT_MODE_TRAP_TRAJ
>>> print(mode)
5
INPUT_MODE_INACTIVE = 0
INPUT_MODE_PASSTHROUGH = 1
INPUT_MODE_POS_FILTER = 3
INPUT_MODE_TORQUE_RAMP = 6
INPUT_MODE_TRAP_TRAJ = 5
INPUT_MODE_VEL_RAMP = 2
class fsa.fi_fsa.FSAModeOfOperation

Bases: object

Enumeration class representing the possible modes of operation for Fourier Smart Actuators (FSA).

These modes determine the type of control applied to the actuator, such as current close-loop control, velocity control, position control, and trapezoidal control.

Constants:
  • NONE (int): No specific mode of operation (0).

  • CURRENT_CLOSE_LOOP_CONTROL (int): Current close-loop control mode (4).

  • VELOCITY_CONTROL (int): Velocity control mode (3).

  • POSITION_CONTROL (int): Position control mode (1).

  • TRAPEZOIDAL_CONTROL (int): Trapezoidal control mode (5).

CURRENT_CLOSE_LOOP_CONTROL = 4
NONE = 0
POSITION_CONTROL = 1
POSITION_CONTROL_PD = 5
VELOCITY_CONTROL = 3
class fsa.fi_fsa.FSAMotorDirection

Bases: object

Enumeration of motor directions for the Fourier Smart Actuator (FSA).

This class defines two constants representing different motor directions within the FSA.

Constants:
  • ABC (int): Represents a clockwise motor direction with a value of 1.

  • ACB (int): Represents a counterclockwise (counter-clockwise) motor direction with a value of -1.

Note

  • Use FSAMotorDirection.ABC when specifying a clockwise motor direction (value: 1).

  • Use FSAMotorDirection.ACB when specifying a counterclockwise (counter-clockwise) motor direction (value: -1).

Example

>>> clockwise_direction = FSAMotorDirection.ABC
>>> print(clockwise_direction)
1
>>> counter_clockwise_direction = FSAMotorDirection.ACB
>>> print(counter_clockwise_direction)
-1
ABC = 1
ACB = -1
class fsa.fi_fsa.FSAMotorMaxAcceleration

Bases: object

Enumeration of motor maximum acceleration settings for the Fourier Smart Actuator (FSA).

This class defines constants representing different maximum acceleration settings for motors within the FSA.

Constants:
  • MAX_ACCELERATION_6000 (int): Represents a maximum acceleration setting of 6000 RPM/s (rotations per minute per second).

  • MAX_ACCELERATION_10000 (int): Represents a maximum acceleration setting of 10000 RPM/s (rotations per minute per second).

  • MAX_ACCELERATION_30000 (int): Represents a maximum acceleration setting of 30000 RPM/s (rotations per minute per second).

  • MAX_ACCELERATION_60000 (int): Represents a maximum acceleration setting of 60000 RPM/s (rotations per minute per second).

Example

>>> max_acceleration = FSAMotorMaxAcceleration.MAX_ACCELERATION_30000
>>> print(max_acceleration)
30000
MAX_ACCELERATION_10000 = 10000
MAX_ACCELERATION_30000 = 30000
MAX_ACCELERATION_6000 = 6000
MAX_ACCELERATION_60000 = 60000
class fsa.fi_fsa.FSAMotorMaxSpeed

Bases: object

Enumeration of motor maximum speed settings for the Fourier Smart Actuator (FSA).

This class defines constants representing different maximum speed settings for motors within the FSA system.

Constants:
  • MAX_SPEED_1000 (int): Represents a maximum speed setting of 1000 RPM (rotations per minute).

  • MAX_SPEED_2000 (int): Represents a maximum speed setting of 2000 RPM (rotations per minute).

  • MAX_SPEED_3000 (int): Represents a maximum speed setting of 3000 RPM (rotations per minute).

Example

>>> max_speed = FSAMotorMaxSpeed.MAX_SPEED_2000
>>> print(max_speed)
2000
MAX_SPEED_1000 = 1000
MAX_SPEED_2000 = 2000
MAX_SPEED_3000 = 3000
class fsa.fi_fsa.FSAMotorPolePairs

Bases: object

Enumeration of motor pole pairs for the Fourier Smart Actuator (FSA).

This class defines constants representing different pole pair configurations for motors within the FSA.

Constants:
  • POLE_PAIRS_7 (int): Represents a motor with 7 pole pairs.

  • POLE_PAIRS_10 (int): Represents a motor with 10 pole pairs.

  • POLE_PAIRS_21 (int): Represents a motor with 21 pole pairs.

Example

>>> pole_pairs = FSAMotorPolePairs.POLE_PAIRS_10
>>> print(pole_pairs)
10
POLE_PAIRS_10 = 10
POLE_PAIRS_21 = 21
POLE_PAIRS_7 = 7
class fsa.fi_fsa.FSAMotorType

Bases: object

Enumeration of motor types for the Fourier Smart Actuator (FSA).

This class defines different motor types used within the FSA system.

Constants:
  • TYPE_MOTOR_NULL (int): Represents a null or undefined motor type (0).

  • TYPE_JIOALONG (int): Represents the Jioalong motor type (1).

  • FSA130_20V0 (int): Represents the FSA130_20V0 motor type (2).

  • FSA100_15V0 (int): Represents the FSA100_15V0 motor type (3).

  • FSA80_10V0 (int): Represents the FSA80_10V0 motor type (4).

  • FSA60_08V0 (int): Represents the FSA60_08V0 motor type (5).

  • FSA36_08V0 (int): Represents the FSA36_08V0 motor type (6).

  • FSA25_08V0 (int): Represents the FSA25_08V0 motor type (7).

  • FSA36_10V0 (int): Represents the FSA36_10V0 motor type (8).

Note

These constants can be used to specify and identify different motor types within the Fourier Smart Actuator (FSA) system.

Example

>>> motor_type = FSAMotorType.FSA130_20V0
>>> print(motor_type)
2
FSA100_15V0 = 3
FSA130_20V0 = 2
FSA25_08V0 = 7
FSA36_08V0 = 6
FSA36_10V0 = 8
FSA60_08V0 = 5
FSA80_10V0 = 4
TYPE_JIOALONG = 1
TYPE_MOTOR_NULL = 0
class fsa.fi_fsa.FSAMotorVBUS

Bases: object

Enumeration of motor voltage bus (VBUS) options for the Fourier Smart Actuator (FSA).

This class defines constants representing different motor voltage bus (VBUS) configurations within the FSA.

Constants:
  • VBUS_DEFAULT (int): Represents the default motor voltage bus value, which is 48 volts.

  • VBUS_36V (int): Represents a motor voltage bus configuration with 36 volts.

  • VBUS_48V (int): Represents a motor voltage bus configuration with 48 volts.

Note

These constants can be used to specify and identify different VBUS configurations for the FSA motors.

Example

>>> vbus_config = FSAMotorVBUS.VBUS_DEFAULT
>>> print(vbus_config)
48
VBUS_36V = 36
VBUS_48V = 48
VBUS_DEFAULT = 48
class fsa.fi_fsa.FSAMotorVBUSADCRatio

Bases: object

Calculation of VBUS (Voltage Supply Bus) ADC (Analog-to-Digital Converter) ratio for the Fourier Smart Actuator (FSA).

This class calculates the VBUS ADC ratio based on specific parameters for the FSA.

Constants and Parameters:
  • _ADC_PRECISION (float): Precision of the ADC (Analog-to-Digital Converter) with a value of 4096.0.

  • _UP_SHUNT_RESISTANCE (int): Up shunt resistance with a value of 18000.

  • _DOWN_SHUNT_RESISTANCE (int): Down shunt resistance with a value of 1000.

  • _ADC_REF_V (float): Reference voltage with a value of 3.3 volts.

Calculation:

The VBUS ADC ratio is calculated using the formula:

VBUS_ADC_RATIO = (_ADC_REF_V / _ADC_PRECISION) * ((_UP_SHUNT_RESISTANCE + _DOWN_SHUNT_RESISTANCE) / _DOWN_SHUNT_RESISTANCE)

Note

  • This ratio is used for measuring or monitoring the voltage on the VBUS (Voltage Supply Bus) within the FSA.

  • It may be related to current measurement using shunt resistors and the ADC.

Example

>>> vbus_ratio = FSAMotorVBUSADCRatio.VBUS_ADC_RATIO
>>> print(vbus_ratio)
[calculated float value]

Important

The actual float value for the VBUS ADC ratio is calculated based on the provided constants and parameters.

VBUS_ADC_RATIO = 0.0153076171875
class fsa.fi_fsa.FSAMotorVIBCADCRatio

Bases: object

Calculation of the VIBC (Voltage and Current of B and C wires) ADC (Analog-to-Digital Converter) Ratio for the Fourier Smart Actuator (FSA).

This class calculates the VIBC ADC Ratio, representing the relationship between voltage and current measurements of the B and C wires of a three-phase motor, as converted by the ADC, for the FSA.

Constants and Parameters:
  • _ADC_PRECISION (float): Precision of the ADC (Analog-to-Digital Converter) with a value of 4096.0.

  • _ADC_SHUNT_RESISTANCE_2mR (float): Shunt resistance for 2 milliohms with a value of 0.002.

  • _ADC_SHUNT_RESISTANCE_05mR (float): Shunt resistance for 0.5 milliohms with a value of 0.0005.

  • _ADC_REF_V (float): Reference voltage with a value of 3.3 volts.

  • _ADC_AMPLIFIER (int): Amplifier factor with a value of 20.

Calculation:

The VIBC ADC Ratios for both 2 milliohm and 0.5 milliohm shunt resistances are calculated using the formula:

VIBC_ADC_RATIO_2mR = (_ADC_REF_V / _ADC_PRECISION / _ADC_SHUNT_RESISTANCE_2mR / _ADC_AMPLIFIER) VIBC_ADC_RATIO_05mR = (_ADC_REF_V / _ADC_PRECISION / _ADC_SHUNT_RESISTANCE_05mR / _ADC_AMPLIFIER)

Note

  • These ratios represent the conversion factors for voltage and current measurements in the context of the B and C wires of a three-phase motor, as obtained through the ADC.

  • The actual float values for these ratios are calculated based on the provided constants and parameters.

Example

>>> ratio_2mR = FSAMotorVIBCADCRatio.VIBC_ADC_RATIO_2mR
>>> print(ratio_2mR)
[calculated float value]
>>> ratio_05mR = FSAMotorVIBCADCRatio.VIBC_ADC_RATIO_05mR
>>> print(ratio_05mR)
[calculated float value]
VIBC_ADC_RATIO_05mR = 0.08056640624999999
VIBC_ADC_RATIO_2mR = 0.020141601562499997
class fsa.fi_fsa.FSAState

Bases: object

Enumeration class for Fourier Smart Actuator (FSA) states.

This class defines symbolic names for different states in a Fourier Smart Actuator. Each state is represented by a unique constant value.

IDLE

Represents the IDLE state with a value of 0.

Type:

int

INIT

Represents the INIT state with a value of 1.

Type:

int

NORMAL

Represents the NORMAL state with a value of 2.

Type:

int

FAULT

Represents the FAULT state with a value of 3.

Type:

int

ENCODER_CAIL

Represents the encoder calibration state with a value of 4.

Type:

int

Note

These attributes can be accessed using the class name, e.g., FSAState.IDLE.

Example

>>> current_state = FSAState.NORMAL
>>> print(current_state)
2
ENCODER_CAIL = 4
FAULT = 3
IDLE = 0
INIT = 1
NORMAL = 2
fsa.fi_fsa.broadcast_func()

Initiate a broadcast to discover Fourier Smart Actuators on the network.

The function sends a broadcast message to the specified network and port, searching for Fourier Smart Actuators. It listens for responses and returns a list of IP addresses of discovered FSAs.

Returns:
  • A list of discovered IP addresses if FSAs are found.

  • Returns False if no FSAs are discovered within the specified timeout.

Note

  • The function uses UDP communication and expects a simple text response from the FSAs.

  • It logs trace statements for debugging purposes.

Example

>>> discovered_actuators = broadcast_func()
>>> if discovered_actuators:
>>>     print("Discovered Fourier Smart Actuators:")
>>>     for actuator_ip in discovered_actuators:
>>>         print(f"- {actuator_ip}")
>>> else:
>>>     print("No Fourier Smart Actuator found on the network.")
fsa.fi_fsa.broadcast_func_with_filter(filter_type=None)

Broadcast a message to discover Fourier Smart Actuator (FSA) on the network and filters based on filter_type.

Args:

filter_type (str or None): The filter type can be “Actuator” or “AbsEncoder” or “CtrlBox” or “None”. If None, returns all discovered FSA motors and encoders.

Returns:

list: List of IP addresses of discovered FSA motors and encoders.

fsa.fi_fsa.clear_error_group(server_ips, motor_numbers=None)

Clear error messages for a group of FSA (Fourier Smart Actuator) devices.

Parameters:
  • server_ips (list): A list of strings, where each string represents the IP address of an FSA device.

  • motor_numbers (list of int, optional): A list of motor numbers corresponding to each motor of the FSAs. If not provided, defaults to all motors with motor number 1 for each FSA device.

Returns:

FSAFunctionResult (list of str): A list of results for clearing error messages on each FSA device. Each result is either “SUCCESS” if the operation was successful or “FAIL” if there was an error during the operation.

This function sends requests to each specified FSA device to clear error messages. It collects and returns a list of results, indicating whether the error clearing operation was successful for each device. If motor_numbers are not provided, all motors are assumed to have motor number 1 for each FSA device.

Example

>>> server_ips = ["192.168.1.100", "192.168.1.101", "192.168.1.102"]
>>> results = clear_error_group(server_ips)
>>> for i, result in enumerate(results):
>>>     if result == "SUCCESS":
>>>         print(f"Error messages cleared successfully on device at IP {server_ips[i]}.")
>>>     else:
>>>         print(f"Failed to clear error messages on device at IP {server_ips[i]}.")

Note

The status of each device’s error message clearing request is determined based on the JSON response received from the device.

See also

fsa.fi_fsa.clear_fault(server_ip)

Send Clear Fault Command to the Fourier Smart Actuator (FSA).

This function sends a clear fault command to the FSA specified by its server IP address. The clear fault command is formatted as a JSON object and transmitted over a socket connection. The response from the FSA is received and processed to determine the success or failure of the command.

The clear fault command instructs the FSA to clear any faults or errors in its operation, allowing it to resume normal operation.

Args:

server_ip (str): The IP address of the FSA actuator.

Returns:

FSAFunctionResult or None: Returns FSAFunctionResult.SUCCESS if the clear fault command is successful. Returns None if there’s an error or a timeout during communication.

Raises:

Raises an exception if communication fails or an unexpected error occurs.

fsa.fi_fsa.clear_flag_of_operation(server_ip)

Clear the operation flags and reset the configuration settings for the FSA (Fourier Smart Actuator).

Parameters:

server_ip (str): The IP address of the FSA device.

Returns:

FSAFunctionResult or None: Returns FSAFunctionResult.SUCCESS if successful, indicating that the operation flags and configurations have been cleared. Returns None in case of errors or if the operation did not succeed.

Note

This function clears any previously set operation flags and resets the configuration settings to their default values for the FSA.

fsa.fi_fsa.clear_pid_param(server_ip)

Clear the PID parameters of the FSA actuator.

This function clears the PID parameters for the FSA actuator.

Args:

server_ip (str): The IP address of the FSA actuator to clear PID parameters for.

Returns:

FSAFunctionResult: The result of clearing the PID parameters.

  • FSAFunctionResult.SUCCESS: The PID parameters were successfully cleared.

  • None: An error occurred during the operation.

Note

This function communicates with the FSA actuator to clear the PID parameters and returns the result.

Example

>>> result = clear_pid_param("192.168.1.100")
>>> if result == FSAFunctionResult.SUCCESS:
>>>     print("PID parameters cleared successfully.")
>>> else:
>>>     print("Error while clearing PID parameters.")
fsa.fi_fsa.disable_group(server_ips)

Disable a group of FSA (Fourier Smart Actuator) devices by sending control commands to each device.

Parameters:

server_ips (list): A list of strings, where each string represents the IP address of an FSA device.

Returns:

list of FSAFunctionResult: A list of results for each device’s control command. Each result is either FSAFunctionResult.SUCCESS if the device was successfully disabled, or FSAFunctionResult.FAIL if the operation failed for that device.

This function iterates over the list of specified FSA devices and sends a control command to set the control word property to FSAControlWord.SERVO_OFF, effectively disabling each device. It then collects the results of these commands and returns them as a list.

Example

>>> server_ips = ["192.168.1.100", "192.168.1.101", "192.168.1.102"]
>>> results = disable_group(server_ips)
>>> for i, result in enumerate(results):
>>>     if result == FSAFunctionResult.SUCCESS:
>>>         print(f"Device at IP {server_ips[i]} was successfully disabled.")
>>>     else:
>>>         print(f"Failed to disable device at IP {server_ips[i]}.")

Note

  • FSAFunctionResult is an enum representing the result of FSA functions and can be imported from the FSA module.

  • The status of each device’s control command is determined based on the JSON response received from the device.

fsa.fi_fsa.enable_group(server_ips)

Enable a group of FSA (Fourier Smart Actuator) devices by sending a command to turn on their servos.

Parameters:

server_ips (list of str): A list of IP addresses of the FSA devices to be enabled.

Returns:

list of FSAFunctionResult: Returns a list of FSAFunctionResult values, indicating the success or failure of enabling each FSA device.

This function sends a command to each FSA device specified in the server_ips list to enable their servos. The response includes the status of each device, indicating whether the servo was successfully turned on or not.

Example

>>> server_ips = ["192.168.1.100", "192.168.1.101"]
>>> results = enable_group(server_ips)
>>> for i, result in enumerate(results):
>>>     if result == FSAFunctionResult.SUCCESS:
>>>         print(f"Successfully enabled {server_ips[i]}.")
>>>     else:
>>>         print(f"Failed to enable {server_ips[i]}.")

Note

  • Ensure that the FSA devices are properly configured and connected.

  • The function returns a list of results corresponding to the provided IP addresses.

  • Each result can be compared to FSAFunctionResult.SUCCESS to check if the device was successfully enabled.

See also

fsa.fi_fsa.encrypt(server_ip, dict)

Set encryption credentials for Fourier Smart Actuator (FSA).

Parameters:
  • server_ip (str): IP address of the FSA.

  • credentials_dict (dict): Dictionary containing “username” and “password” for encryption.

Returns:

str: Status of the encryption configuration.

fsa.fi_fsa.erase_config(server_ip)

Erase the configuration settings of the FSA (Fourier Smart Actuator) device.

Parameters:

server_ip (str): The IP address of the FSA device.

Returns:

FSAFunctionResult or None: Returns FSAFunctionResult.SUCCESS if the configuration settings were successfully erased, otherwise returns None.

This function sends a command to the FSA device to erase its current configuration settings. Erasing the configuration will reset the device to its default settings, removing any custom parameters or setup. Use with caution, as it will permanently delete the current configuration.

fsa.fi_fsa.get_abs_encoder_angle(server_ip)

Retrieve the absolute encoder angle measurement from the Fourier Smart Encoder (FSE) specified by the IP address.

Parameters:

server_ip (str): The IP address of the FSE from which to retrieve the absolute encoder angle.

Returns:

float or str: The absolute encoder angle measurement if the request is successful (status “OK” in the response). Returns FSAFunctionResult.FAIL if the status is not “OK,” and FSAFunctionResult.TIMEOUT if a timeout occurs.

Note

  • The function uses UDP communication and expects a JSON response from the server.

  • It logs trace statements for debugging purposes when fsa_debug is set to True.

Example

>>> server = "192.168.1.100"
>>> angle_result = get_abs_encoder_angle(server)
>>> if isinstance(angle_result, float):
>>>     print(f"Absolute encoder angle from {server}: {angle_result} degrees.")
>>> else:
>>>     print(f"Failed to retrieve absolute encoder angle from {server}.")
fsa.fi_fsa.get_comm_config(server_ip)

Retrieve communication configuration from an FSA (Fourier Smart Actuator) device.

Parameters:

server_ip (str): The IP address of the FSA.

Returns:

str or None: If the communication configuration is successfully retrieved, returns FSAFunctionResult.SUCCESS’. Otherwise, returns None. In case of an error or timeout, it logs the details.

fsa.fi_fsa.get_comm_root(server_ip)

Retrieve information about the FSA communication root.

Parameters:
  • server_ip (str): IP address of the FSA.

Returns:
  • json_obj (dict or None): Dictionary containing information about the FSA communication root. If the request fails or times out, returns None.

Note

  • This function sends a GET request to the FSA to obtain information about the communication root.

  • The returned dictionary provides details about the communication root.

Example

>>> server_ip = "192.168.1.1"
>>> response = get_comm_root(server_ip)
This example retrieves information about the communication root from the FSA.
fsa.fi_fsa.get_config(server_ip)

Get the configuration settings for the FSA (Fourier Smart Actuator) device.

Parameters:

server_ip (str): The IP address of the FSA device.

Returns:

FSAFunctionResult or None: Returns FSAFunctionResult.SUCCESS if the configuration settings were successfully retrieved, otherwise returns None.

The configuration settings provide information about the current setup and parameters of the FSA device. These settings include details about the actuator, motor, encoder, PID control, and other relevant parameters.

fsa.fi_fsa.get_control_param(server_ip)

Get control parameters from the FSA (Fourier Smart Actuator).

Parameters:

server_ip (str): The IP address of the FSA actuator.

Returns:

FSAFunctionResult: The result of getting control parameters from the FSA.

  • FSAFunctionResult.SUCCESS: Parameters retrieved successfully.

  • None: An error occurred during the process.

Note

This function retrieves control parameters from the FSA, which include configuration settings for control loops, such as position, velocity, and current control.

fsa.fi_fsa.get_control_param_imm(server_ip)

Get immediate control parameters for a Fourier Smart Actuator (FSA).

This function sends a JSON request to retrieve immediate control parameters for an FSA device located at the specified server_ip address. The immediate control parameters are related to the FSA’s motor control settings and are returned as part of the response.

Parameters:

server_ip (str): The IP address of the FSA device from which to retrieve immediate control parameters.

Returns:

FSAFunctionResult or None: The function returns FSAFunctionResult.SUCCESS if the request to retrieve immediate control parameters was successful and the response from the FSA contains “OK” status. If there was an error or the response does not contain “OK” status, it returns None.

Raises:

This function handles potential exceptions, such as socket timeouts, and provides appropriate log messages in case of errors.

Note

Immediate control parameters refer to motor control settings that are applied immediately upon receipt of this request. These settings may affect the FSA’s behavior in real-time. The specific parameters returned and their interpretation depend on the FSA device’s firmware and configuration.

Example

>>> result = get_control_param_imm("192.168.1.100")
>>> if result == FSAFunctionResult.SUCCESS:
>>>     print("Immediate control parameters retrieved successfully.")
>>> else:
>>>     print("Failed to retrieve immediate control parameters.")
This example retrieves immediate control parameters from an FSA device.
fsa.fi_fsa.get_error_code(server_ip)

Retrieve and decode error codes from the FSA (Fourier Smart Actuator) device.

Parameters:

server_ip (str): The IP address of the FSA device.

Returns:

int or None: Returns an integer representing the error code retrieved from the FSA device, or None if there was an issue retrieving the error code.

The error codes are defined in the FSAErrorCode class, which includes symbolic names for different error codes, each represented by a unique constant value.

Example

>>> error_code = get_error_code("192.168.1.100")
>>> if error_code is not None:
>>>     print("Error Code:", hex(error_code))
>>>     if error_code & FSAErrorCode.ERROR_OVER_CURRENT:
>>>         print("Over Current Error Detected.")
>>>     if error_code & FSAErrorCode.ERROR_CAN_COM_TIMEOUT:
>>>         print("CAN Communication Timeout Error Detected.")
>>>     # Add more error type checks as needed.

Note

  • You can access error code constants using the FSAErrorCode class, e.g., FSAErrorCode.ERROR_OVER_CURRENT.

  • This function returns the raw error code integer, and you can decode specific error types based on bit positions.

See also

fsa.fi_fsa.get_error_group(server_ips, motor_numbers=None)

Retrieve error information for a group of FSA (Fourier Smart Actuator) devices.

Parameters:
  • server_ips (list of str): list of strings, where each string represents the IP address of an FSA device.

  • motor_numbers (list of int, optional): A list of motor numbers corresponding to each motor of the FSAs. If not provided, defaults to all motors with motor number 1 for each FSA device.

Returns:
  • axis (list of dict): A list of dictionaries containing axis error information.

  • motors (list of dict): A list of dictionaries containing motor error information.

  • encoders (list of dict): A list of dictionaries containing encoder error information.

This function sends requests to each specified FSA device to retrieve error information. It collects and returns separate lists of axis, motor, and encoder error messages for each device. If motor_numbers is not provided, all motors are assumed to have motor number 1 for each FSA device.

Example

>>> server_ips = ["192.168.1.100", "192.168.1.101", "192.168.1.102"]
>>> axis_errors, motor_errors, encoder_errors = get_error_group(server_ips)
>>> for i, ip in enumerate(server_ips):
>>>     print(f"Errors for device at IP {ip}:")
>>>     print(f"Axis Error: {axis_errors[i]}")
>>>     print(f"Motor Error: {motor_errors[i]}")
>>>     print(f"Encoder Error: {encoder_errors[i]}")

Note

The error information is retrieved based on the JSON response received from each device.

fsa.fi_fsa.get_flag_of_operation(server_ip)

Retrieve the flag of operation from a Fourier Smart Actuator (FSA) device.

This function sends a JSON request to retrieve the flag of operation from an FSA device located at the specified server_ip address. Operation flags are configuration settings that control various aspects of the FSA’s behavior and operation. These flags determine how the FSA behaves and operates in different modes.

Parameters:

server_ip (str): The IP address of the FSA device from which to retrieve the flag of operation.

Returns:

FSAFunctionResult or None: The function returns FSAFunctionResult.SUCCESS if the request to retrieve the flag of operation was successful and the response from the FSA contains “OK” status. If there was an error or the response does not contain “OK” status, it returns None.

Raises:

This function handles potential exceptions, such as socket timeouts, and provides appropriate log messages in case of errors.

Example

>>> result = get_flag_of_operation("192.168.1.100")
>>> if result == FSAFunctionResult.SUCCESS:
>>>     print("Flag of operation retrieved successfully.")
>>> else:
>>>     print("Failed to retrieve the flag of operation.")
This example retrieves the flag of operation from an FSA device.

See also

  • :class:‘FSAModeOfOperation’ : Enumeration of FSA modes of operation.

  • :class:’’

fsa.fi_fsa.get_home_offset(server_ip)

Get the home offset of the Fourier Smart Actuator (FSA).

This function sends a request to the FSA specified by its server IP address to retrieve the home offset configuration. The home offset represents the position where the actuator considers itself at the home or reference position.

Args:

server_ip (str): The IP address of the FSA actuator.

Returns:

FSAFunctionResult or None: Returns FSAFunctionResult.SUCCESS if the request is successful. Returns None if there’s an error or a timeout during communication.

Raises:

Raises an exception if communication fails or an unexpected error occurs.

fsa.fi_fsa.get_pid_param(server_ip)

Get the PID parameters of the FSA actuator.

This function retrieves the PID parameters for the FSA actuator.

Args:

server_ip (str): The IP address of the FSA actuator to retrieve PID parameters for.

Returns:

FSAFunctionResult: The result of retrieving the PID parameters.

  • FSAFunctionResult.SUCCESS: The PID parameters were successfully retrieved.

  • None: An error occurred during the operation.

Note

This function communicates with the FSA actuator to retrieve PID parameters and returns the result.

Example

>>> result = get_pid_param("192.168.1.100")
>>> if result == FSAFunctionResult.SUCCESS:
>>>     print("PID parameters retrieved successfully.")
>>> else:
>>>     print("Error while retrieving PID parameters.")
fsa.fi_fsa.get_pid_param_imm(server_ip)

Get the immediate PID parameters of the FSA actuator.

When you retrieve immediate PID parameters from the FSA actuator, you are obtaining the real-time values of P, I, and D, which are actively influencing the actuator’s behavior at that moment.

Parameters:

server_ip (str): The IP address of the FSA actuator to retrieve immediate PID parameters from.

Returns:

FSAFunctionResult: The result of retrieving immediate PID parameters.

  • FSAFunctionResult.SUCCESS: Immediate PID parameters were successfully retrieved.

  • None: An error occurred during the operation.

Note

This function communicates with the FSA actuator to retrieve immediate PID parameters and returns the result.

Example

>>> result = get_pid_param_imm("192.168.1.100")
>>> if result == FSAFunctionResult.SUCCESS:
>>>     print("Immediate PID parameters retrieved successfully.")
>>> else:
>>>     print("Error while retrieving immediate PID parameters.")
fsa.fi_fsa.get_pvc(server_ip)

Retrieve position, velocity, and current data from the FSA (Fourier Smart Actuator) device.

Parameters:

server_ip (str): The IP address of the FSA device.

Returns:

Tuple[float, float, float] or FSAFunctionResult: Returns a tuple containing position (float), velocity (float), and current (float) data retrieved from the FSA device if successful. If there’s an issue retrieving the data, it returns an appropriate FSAFunctionResult enum value.

This function sends a request to the FSA device to retrieve position, velocity, and current data. The response includes these values in the following format:

  • “position”: The current position of the actuator (float, in degrees or radians).

  • “velocity”: The current velocity of the actuator (float, in degrees/second or radians/second).

  • “current”: The current current (current intensity) of the actuator (float, in Amps).

Example

>>> data = get_pvc("192.168.1.100")
>>> if isinstance(data, tuple):
>>>     position, velocity, current = data
>>>     print("Position:", position, "degrees")
>>>     print("Velocity:", velocity, "degrees/second")
>>>     print("Current:", current, "Amps")
>>> else:
>>>     print("Failed to retrieve data:", data)

Note

  • Ensure that the FSA device is properly configured and connected to receive valid data.

  • If the data retrieval fails, the function returns an appropriate FSAFunctionResult enum value (e.g., FSAFunctionResult.FAIL or FSAFunctionResult.TIMEOUT).

fsa.fi_fsa.get_pvc_group(server_ips, motor_numbers=None)

Retrieve Position, Velocity, and Current (PVC) information from multiple FSA actuators.

Parameters:
  • server_ips (list): List of strings, where each string represents the IP address of an FSA device.

  • motor_numbers (list, optional): A list of motor numbers corresponding to each motor of the FSAs. If not provided, defaults to all motors with motor number 1 for each FSA device.

Returns:
  • positions (list): List of position values for each FSA actuator.

  • velocities (list): List of velocity values for each FSA actuator.

  • currents (list): List of current values for each FSA actuator.

Note

  • The returned values are in the same order as the input server_ips.

  • If an error occurs during communication with any actuator, the corresponding return value will be set to FSAFunctionResult.FAIL, and error details will be printed to the log.

Example

>>> server_ips = ["192.168.1.1", "192.168.1.2"]
>>> motor_numbers = [1, 2]
>>> positions, velocities, currents = get_pvc_group(server_ips, motor_numbers)
This example retrieves PVC information from two actuators with different motor numbers.
fsa.fi_fsa.get_pvcc(server_ip)

Retrieve position, velocity, current, and current ID data from the FSA (Fourier Smart Actuator) device.

Parameters:

server_ip (str): The IP address of the FSA device.

Returns:

Tuple[float, float, float, int] or FSAFunctionResult: Returns a tuple containing position (float), velocity (float), current (float), and current ID (int) data retrieved from the FSA device if successful. If there’s an issue retrieving the data, it returns an appropriate FSAFunctionResult enum value.

This function sends a request to the FSA device to retrieve position, velocity, current, and current ID data. The response includes these values in the following format:

  • “position”: The current position of the actuator (float, in degrees or radians).

  • “velocity”: The current velocity of the actuator (float, in degrees/second or radians/second).

  • “current”: The current current (current intensity) of the actuator (float, in Amps).

  • “current_id”: The current ID (int) indicating the current’s identity.

Example

>>> data = get_pvcc("192.168.1.100")
>>> if isinstance(data, tuple):
>>>     position, velocity, current, current_id = data
>>>     print("Position:", position, "degrees")
>>>     print("Velocity:", velocity, "degrees/second")
>>>     print("Current:", current, "Amps")
>>>     print("Current ID:", current_id)
>>> else:
>>>     print("Failed to retrieve data:", data)

Note

  • Ensure that the FSA device is properly configured and connected to receive valid data.

  • If the data retrieval fails, the function returns an appropriate FSAFunctionResult enum value (e.g., FSAFunctionResult.FAIL or FSAFunctionResult.TIMEOUT).

fsa.fi_fsa.get_pvcccc(server_ip)

Retrieve extended data including position, velocity, current, current ID, phase current (B and C) from the FSA (Fourier Smart Actuator) device.

Parameters:

server_ip (str): The IP address of the FSA device.

Returns:

Tuple[float, float, float, int, float, float] or FSAFunctionResult: Returns a tuple containing position (float), velocity (float), current (float), current ID (int), phase current B (float), and phase current C (float) data retrieved from the FSA device if successful. If there’s an issue retrieving the data, it returns an appropriate FSAFunctionResult enum value.

This function sends a request to the FSA device to retrieve extended data including position, velocity, current, current ID, phase current B, and phase current C. The response includes these values in the following format:

  • “position”: The current position of the actuator (float, in degrees or radians).

  • “velocity”: The current velocity of the actuator (float, in degrees/second or radians/second).

  • “current”: The current current (current intensity) of the actuator (float, in Amps).

  • “current_id”: The current ID (int) indicating the current’s identity.

  • “phase_current_ib”: The current of phase B (float, in Amps).

  • “phase_current_ic”: The current of phase C (float, in Amps).

Example

>>> data = get_pvcccc("192.168.1.100")
>>> if isinstance(data, tuple):
>>>     position, velocity, current, current_id, phase_current_ib, phase_current_ic = data
>>>     print("Position:", position, "degrees")
>>>     print("Velocity:", velocity, "degrees/second")
>>>     print("Current:", current, "Amps")
>>>     print("Current ID:", current_id)
>>>     print("Phase Current B:", phase_current_ib, "Amps")
>>>     print("Phase Current C:", phase_current_ic, "Amps")
>>> else:
>>>     print("Failed to retrieve data:", data)

Note

  • Ensure that the FSA device is properly configured and connected to receive valid data.

  • If the data retrieval fails, the function returns an appropriate FSAFunctionResult enum value (e.g., FSAFunctionResult.FAIL or FSAFunctionResult.TIMEOUT).

fsa.fi_fsa.get_root(server_ip)

Get root attributes of the FSA including serial number, bus voltage, motor temperature, etc.

Parameters:

server_ip (str): The IP address of the FSA actuator.

Raises:

Exception: Raises an exception if communication fails.

fsa.fi_fsa.get_state(server_ip)

Get the State of the Fourier Smart Actuator (FSA).

This function sends a request to the FSA specified by its server IP address to retrieve its current state. The state information is formatted as a JSON object and transmitted over a socket connection. The response from the FSA is received and processed to obtain the state information.

The state of the FSA typically includes information about its operational status and condition, such as whether it’s in a ready state, faulted, or any other relevant information.

Args:

server_ip (str): The IP address of the FSA actuator.

Returns:

dict or None: Returns a dictionary containing the state information of the FSA if the request is successful. Returns None if there’s an error or a timeout during communication.

Raises:

Raises an exception if communication fails or an unexpected error occurs.

fsa.fi_fsa.get_state_group(server_ips)

Retrieve the state information from a group of FSA (Fourier Smart Actuator) devices.

Parameters:

server_ips (list): A list of strings, where each string represents the IP address of an FSA device.

Returns:

list of FSAFunctionResult: A list of results for retrieving the state information from each device. Each result is either FSAFunctionResult.SUCCESS if the operation was successful, or FSAFunctionResult.FAIL if there was an error during the operation.

This function sends a request to each specified FSA device to retrieve its state information. It collects the results of these requests and returns them as a list.

Example

>>> server_ips = ["192.168.1.100", "192.168.1.101", "192.168.1.102"]
>>> results = get_state_group(server_ips)
>>> for i, result in enumerate(results):
>>>     if result == FSAFunctionResult.SUCCESS:
>>>         print(f"State information retrieved from device at IP {server_ips[i]}.")
>>>    else:
>>>        print(f"Failed to retrieve state information from device at IP {server_ips[i]}.")

Note

  • FSAFunctionResult is an enum representing the result of FSA functions and can be imported from the FSA module.

  • The status of each device’s state retrieval request is determined based on the JSON response received from the device.

fsa.fi_fsa.init(server_ip)

Initialize the FSA SDK with the specified server IP.

Parameters:

server_ip (str): The IP address of the FSA actuator.

Returns:

FSAFunctionResult: The initialization result.

fsa.fi_fsa.init_group(server_ips)

Initialize a group of FSAs with the specified server IPs.

Parameters:

server_ips (list): List of IP addresses for multiple FSAs.

Returns:

FSAFunctionResult: The initialization result.

fsa.fi_fsa.ota(server_ip)

Trigger Over-The-Air (OTA) update for Fourier Smart Actuator (FSA) firmware.

Parameters:
  • server_ip (str): IP address of the FSA.

Returns:
  • str: Status of the OTA update.

fsa.fi_fsa.ota_cloud(server_ip)

Trigger a cloud-based Over-The-Air (OTA) update for Fourier Smart Actuator (FSA).

Parameters:
  • server_ip (str): IP address of the FSA.

Returns:
  • str: Status of the cloud-based OTA update.

fsa.fi_fsa.ota_devel(server_ip)

Trigger a development Over-The-Air (OTA) update for Fourier Smart Actuator (FSA).

Parameters:
  • server_ip (str): IP address of the FSA.

Returns:
  • str: Status of the development OTA update.

fsa.fi_fsa.ota_driver(server_ip)

Trigger Over-The-Air (OTA) update for the stable version of the FSA driver.

Parameters:
  • server_ip (str): IP address of the Fourier Smart Actuator (FSA).

Returns:
  • str: Status of the OTA update process.

fsa.fi_fsa.ota_driver_cloud(server_ip)

Trigger Over-The-Air (OTA) update for the FSA driver from the cloud.

Parameters:
  • server_ip (str): IP address of the Fourier Smart Actuator (FSA).

Returns:
  • str: Status of the OTA update process.

fsa.fi_fsa.ota_driver_devel(server_ip)

Trigger Over-The-Air (OTA) update for the development version of the FSA driver.

Parameters:
  • server_ip (str): IP address of the Fourier Smart Actuator (FSA).

Returns:
  • str: Status of the OTA update process.

fsa.fi_fsa.ota_driver_test(server_ip)

Trigger Over-The-Air (OTA) update for the testing version of the FSA driver.

Parameters:
  • server_ip (str): IP address of the Fourier Smart Actuator (FSA).

Returns:
  • str: Status of the OTA update process.

fsa.fi_fsa.ota_test(server_ip)

Trigger an Over-The-Air (OTA) update for the testing version of Fourier Smart Actuator (FSA).

Parameters:
  • server_ip (str): IP address of the FSA.

Returns:
  • str: Status of the test OTA update.

fsa.fi_fsa.reboot(server_ip)

Reboot the FSA (Fourier Smart Actuator) device.

Parameters:

server_ip (str): The IP address of the FSA device.

Returns:

FSAFunctionResult or None: Returns FSAFunctionResult.SUCCESS if the FSA device was successfully rebooted, otherwise returns None.

This function sends a command to the FSA device to initiate a reboot. The device will restart, which may take some time to complete. After rebooting, the FSA device will retain its current effective settings.

fsa.fi_fsa.reboot_comm(server_ip)

Initiate a reboot operation by sending a JSON request to the specified server IP.

Parameters:
  • server_ip (str): The IP address of the fsa to which the reboot request is sent.

Returns:
  • FSAFunctionResult.SUCCESS: If the reboot request is successful (status “OK” in the response).

  • None: If there is an issue with the communication, timeout, or if the received status is not “OK”.

Note

  • The function uses UDP communication and expects a JSON response from the server.

  • It logs trace statements for debugging purposes when fsa_debug is set to True.

Example

>>> result = reboot_comm("192.168.1.100")
>>> if result == FSAFunctionResult.SUCCESS:
>>>     print("Reboot request successful.")
>>> else:
>>>     print("Reboot request failed.")
fsa.fi_fsa.reboot_comm_group(server_ips)

Initiate a reboot operation for a group of FSA devices by sending individual JSON requests.

Parameters:
  • server_ips (list): A list of IP addresses of the FSA devices to which reboot requests are sent.

Returns:

list: A list of results corresponding to each FSA’s response:

  • FSAFunctionResult.SUCCESS: If the reboot request is successful (status “OK” in the response).

  • FSAFunctionResult.FAIL: If there is an issue with the communication, timeout, or if the received status is not “OK”.

Note

  • The function uses UDP communication and expects a JSON response from each server.

  • It logs trace statements for debugging purposes when fsa_debug is set to True.

Example

>>> servers = ["192.168.1.100", "192.168.1.101", "192.168.1.102"]
>>> results = reboot_comm_group(servers)
>>> for i, result in enumerate(results):
>>>     if result == FSAFunctionResult.SUCCESS:
>>>         print(f"Reboot request to {servers[i]} successful.")
>>>     else:
>>>         print(f"Reboot request to {servers[i]} failed.")
fsa.fi_fsa.save_comm_config(server_ip)

Save the communication configuration for an FSA (Fourier Smart Actuator) device.

Parameters:
  • server_ip (str): The IP address of the FSA device.

Returns:
  • str or None: If the communication configuration is successfully saved, returns ‘FSAFunctionResult.SUCCESS’. Otherwise, returns None. In case of an error or timeout, it logs the details.

fsa.fi_fsa.save_config(server_ip)

Save the current configuration settings of the FSA (Fourier Smart Actuator) device.

Parameters:

server_ip (str): The IP address of the FSA device.

Returns:

FSAFunctionResult or None: Returns FSAFunctionResult.SUCCESS if the configuration settings were successfully saved, otherwise returns None.

This function sends a command to the FSA device to save its current configuration settings. These settings include parameters related to the actuator, motor, encoder, and other operational aspects of the FSA. Saving the configuration allows you to persistently store the current setup for future use or reference.

fsa.fi_fsa.set_calibrate_encoder(server_ip)

Send Calibrate Encoder Command to the Fourier Smart Actuator (FSA).

This function sends a calibrate encoder command to the FSA specified by its server IP address. The calibrate encoder command is formatted as a JSON object and transmitted over a socket connection. The response from the FSA is received and processed to determine the success or failure of the command.

The calibrate encoder command initiates an automatic rotation of the motor clockwise once and then changes direction to turn around, which is part of the encoder calibration process.

Args:

server_ip (str): The IP address of the FSA actuator.

Returns:

FSAFunctionResult or None: Returns FSAFunctionResult.SUCCESS if the calibrate encoder command is successful. Returns None if there’s an error or a timeout during communication.

Raises:

Raises an exception if communication fails or an unexpected error occurs.

fsa.fi_fsa.set_comm_config(server_ip, dict)

Set communication configuration for an FSA (Fourier Smart Actuator) device.

Parameters:
  • server_ip (str): The IP address of the FSA.

  • config_dict (dict): A dictionary containing the configuration parameters:
    • “name” (str): Name of the device.

    • “DHCP_enable” (bool): Enable DHCP (True) or use static IP (False).

    • “SSID” (str): SSID of the network.

    • “password” (str): Password for the network.

    • “static_IP” (str): Static IP address (if DHCP is disabled).

    • “gateway” (str): Gateway address (if DHCP is disabled).

    • “subnet_mask” (str): Subnet mask (if DHCP is disabled).

    • “dns_1” (str): Primary DNS server (if DHCP is disabled).

    • “dns_2” (str): Secondary DNS server (if DHCP is disabled).

Returns:

str or None: If the communication configuration is successfully set, returns ‘FSAFunctionResult.SUCCESS’. Otherwise, returns None. In case of an error or timeout, it logs the details.

fsa.fi_fsa.set_config(server_ip, dict)

Set the configuration settings for the FSA (Fourier Smart Actuator) device.

Parameters:
  • server_ip (str): The IP address of the FSA device.

  • dict (dict): A dictionary containing the configuration settings to be applied.

Returns:

FSAFunctionResult or None: Returns FSAFunctionResult.SUCCESS if the configuration settings were successfully applied, otherwise returns None.

The configuration settings allow you to specify various parameters for the FSA device. These settings include:

  • actuator_type (str): The type of actuator used.

  • actuator_direction (int): The direction of the actuator.

  • actuator_reduction_ratio (float): The reduction ratio of the actuator.

  • motor_type (str): The type of motor used.

  • motor_hardware_type (str): The PCB type of the motor.

  • motor_vbus (int): The motor’s VBUS voltage.

  • motor_direction (int): The direction of the motor.

  • motor_pole_pairs (int): The number of pole pairs in the motor.

  • motor_max_speed (float): The maximum speed of the motor.

  • motor_max_acceleration (float): The maximum acceleration of the motor.

  • motor_max_current (float): The maximum current of the motor.

  • encoder_direction (int): The direction of the encoder.

Note

These parameters configure the actuator, motor, and encoder behavior of the FSA device.

fsa.fi_fsa.set_control_param(server_ip, dict)

Set control parameters for the FSA (Fourier Smart Actuator).

This function constructs a JSON request to set control parameters for a target specified by “/control_param” on a FSA identified by the server_ip. The control parameters include maximum speed, maximum acceleration, and maximum current for FSA motor.

Parameters:
  • server_ip (str): The IP address of the FSA.

  • dict (dict): A dictionary containing the control parameters to be set.

    • “motor_max_speed” (float): Maximum speed for FSA motor.

    • “motor_max_acceleration” (float): Maximum acceleration for FSA motor.

    • “motor_max_current” (float): Maximum current for FSA motor.

Returns:

FSAFunctionResult or None: The function returns FSAFunctionResult.SUCCESS if the request to set control parameters was successful. If there was an error or the response from the remote system does not contain “OK” status, it returns None.

Raises:

This function handles potential exceptions such as socket timeouts and provides appropriate log messages in case of errors.

Note

The actual effect of these control parameters depends on the specific implementation of the FSA. This function sends the request to set parameters, but it does not directly control the behavior of the FSA.

Example

>>> control_params = {
>>>      "motor_max_speed": 100.0,
>>>      "motor_max_acceleration": 10.0,
>>>      "motor_max_current": 5.0
>>>  }
>>> result = set_control_param("192.168.1.100", control_params)
>>> if result == FSAFunctionResult.SUCCESS:
>>>      print("Control parameters set successfully.")
>>> else:
>>>      print("Failed to set control parameters.")
fsa.fi_fsa.set_control_param_imm(server_ip, dict)

Set immediate control parameters for a Fourier Smart Actuator (FSA) device.

This function sends a JSON request to set immediate control parameters for an FSA device located at the specified server_ip address. The immediate control parameters are related to the FSA’s motor control settings and are provided in the dict parameter.

Parameters:
  • server_ip (str): The IP address of the FSA device to which immediate control parameters will be applied.

  • dict (dict): A dictionary containing the immediate control parameters to be set. The dictionary should include the following keys:

    • “motor_max_speed_imm” (float): The maximum speed setting for the FSA’s motor (e.g., in RPM).

    • “motor_max_acceleration_imm” (float): The maximum acceleration setting for the FSA’s motor (e.g., in RPM/s^2).

    • “motor_max_current_imm” (float): The maximum current setting for the FSA’s motor (e.g., in A).

Returns:

FSAFunctionResult or None: The function returns FSAFunctionResult.SUCCESS if the request to set immediate control parameters was successful and the response from the FSA contains “OK” status. If there was an error or the response does not contain “OK” status, it returns None.

Raises:

This function handles potential exceptions, such as socket timeouts, and provides appropriate log messages in case of errors.

Note

Immediate control parameters refer to motor control settings that are applied immediately upon receipt of this request. These settings may affect the FSA’s behavior in real-time. The specific parameters to set and their interpretation depend on the FSA device’s firmware and configuration.

Example

>>> parameters = {
>>>     "motor_max_speed_imm": 1000.0,
>>>     "motor_max_acceleration_imm": 500.0,
>>>     "motor_max_current_imm": 5.0
>>>  }
>>> result = set_control_param_imm("192.168.1.100", parameters)
>>> if result == FSAFunctionResult.SUCCESS:
>>>      print("Immediate control parameters set successfully.")
>>> else:
>>>      print("Failed to set immediate control parameters.")
fsa.fi_fsa.set_current_control(server_ip, current)

Set the current control parameters for the FSA (Fourier Smart Actuator) device and request a current control operation.

Parameters:
  • server_ip (str): The IP address of the FSA device.

  • current (float): The desired current in Amperes (Amps) for the actuator.

Returns:

Tuple[float, float, float] or None: Returns a tuple containing the current position (float), current velocity (float), and current current (float) of the actuator if the current control operation was successful. If there’s an issue with the operation, it returns None.

This function sends a command to the FSA device to perform a current control operation. It sets the desired current before initiating the operation. The response includes the current position, velocity, and current values after the operation is complete.

Example

>>> data = set_current_control("192.168.1.100", 2.5)
>>> if data is not None:
>>>     position, velocity, current = data
>>>     print("Current Position:", position, "degrees")
>>>     print("Current Velocity:", velocity, "degrees/second")
>>>     print("Current Current:", current, "Amps")
>>> else:
>>>     print("Current control operation failed.")

Note

  • Ensure that the FSA device is properly configured and connected for current control.

  • If the operation fails, the function returns None.

fsa.fi_fsa.set_disable(server_ip)

Send Disable Command to the Fourier Smart Actuator (FSA).

This function sends a disable command to the FSA specified by its server IP address. The disable command is formatted as a JSON object and transmitted over a socket connection. The response from the FSA is received and processed to determine the success or failure of the command.

Args:

server_ip (str): The IP address of the FSA actuator.

Returns:

FSAFunctionResult or None: Returns FSAFunctionResult.SUCCESS if the disable command is successful. Returns None if there’s an error or a timeout during communication.

Raises:

Raises an exception if communication fails or an unexpected error occurs.

fsa.fi_fsa.set_enable(server_ip)

Enable the servo system for the specified FSA actuator.

This function sends a command to enable the servo system of the FSA actuator with the provided server IP.

Args:

server_ip (str): The IP address of the FSA actuator to enable.

Returns:

FSAFunctionResult: The result of the enable operation.

  • FSAFunctionResult.SUCCESS: The servo system was successfully enabled.

  • None: An error occurred during the operation.

Note

This function communicates with the FSA actuator to enable its servo system and returns the result.

Example

>>> result = set_enable("192.168.1.100")
>>> if result == FSAFunctionResult.SUCCESS:
>>>     print("Servo system enabled successfully.")
>>> else:
>>>     print("Error while enabling servo system.")
fsa.fi_fsa.set_flag_of_operation(server_ip, dict)

Set the operation flags for the FSA (Fourier Smart Actuator) device.

Parameters:
  • server_ip (str): The IP address of the FSA device.

  • dict (dict): A dictionary containing the operation flags to be set.

Returns:

FSAFunctionResult or None: Returns FSAFunctionResult.SUCCESS if the operation flags were successfully set, otherwise returns None.

Operation flags are configuration settings that control various aspects of the FSA’s behavior and operation. Each flag specifies whether the FSA should use stored configuration settings or apply new settings for different operational parameters:

  • flag_do_use_store_actuator_param: Set to “1” to use stored actuator parameters, or “0” to apply new parameters.

  • flag_do_use_store_motor_param: Set to “1” to use stored motor parameters, or “0” to apply new parameters.

  • flag_do_use_store_encoder_param: Set to “1” to use stored encoder parameters, or “0” to apply new parameters.

  • flag_do_use_store_pid_param: Set to “1” to use stored PID control parameters, or “0” to apply new parameters.

fsa.fi_fsa.set_home_offset(server_ip, home_offset)

Set the home offset of the FSA actuator.

This function sends a command to set the home offset of the FSA actuator with the provided server IP.

Args:
  • server_ip (str): The IP address of the FSA actuator to set the home offset for.

  • home_offset (int): The desired home offset value to set.

Returns:

FSAFunctionResult: The result of setting the home offset.

  • FSAFunctionResult.SUCCESS: The home offset was successfully set.

  • None: An error occurred during the operation.

Note

This function communicates with the FSA actuator to set the home offset and returns the result.

Example

>>> result = set_home_offset("192.168.1.100", 500)
>>> if result == FSAFunctionResult.SUCCESS:
>>>     print("Home offset set successfully.")
>>> else:
>>>     print("Error while setting home offset.")
fsa.fi_fsa.set_home_offset_group(server_ips, home_offsets=None)

Set the home offset for multiple FSA actuators.

Parameters:
  • server_ips (list): The IP addresses of the FSA devices for which home offsets will be set.

  • home_offsets (list, optional): List of home offset values corresponding to each FSA actuator. If not provided, home offsets will be set to zero for all actuators.

Returns:
  • func_result (list): List of function results indicating the success or failure of each operation. Possible values: [FSAFunctionResult.SUCCESS, FSAFunctionResult.FAIL]

Note:
  • The length of server_ips should be the same as the length of home_offsets (if provided).

  • Each home offset corresponds to the desired offset for the respective FSA actuator.

Example

>>> server_ips = ["192.168.1.1", "192.168.1.2"]
>>> home_offsets = [10.0, -5.0]
>>> results = set_home_offset_group(server_ips, home_offsets)
This example sets different home offsets for two actuators with different IP addresses.
fsa.fi_fsa.set_home_position(server_ip)

Set the home position of the FSA actuator.

This function sends a command to set the home position of the FSA actuator with the provided server IP.

Args:

server_ip (str): The IP address of the FSA actuator to set the home position for.

Returns:

FSAFunctionResult: The result of setting the home position.

  • FSAFunctionResult.SUCCESS: The home position was successfully set.

  • None: An error occurred during the operation.

Note

This function communicates with the FSA actuator to set the home position and returns the result.

Example

>>> result = set_home_position("192.168.1.100")
>>> if result == FSAFunctionResult.SUCCESS:
>>>     print("Home position set successfully.")
>>> else:
>>>     print("Error while setting home position.")
fsa.fi_fsa.set_mode_of_operation(server_ip, mode_of_operation)

Set the Mode of Operation for the Fourier Smart Actuator (FSA).

This function sends a request to the FSA specified by its server IP address to set its mode of operation. The mode of operation determines how the actuator behaves and responds to control commands.

Args:
  • server_ip (str): The IP address of the FSA actuator.

  • mode_of_operation (int): The desired mode of operation to be set for the FSA. Use values from the FSAModeOfOperation class:

  • FSAModeOfOperation.NONE: No specific mode (0).

  • FSAModeOfOperation.POSITION_CONTROL: Position control mode (1).

  • FSAModeOfOperation.VELOCITY_CONTROL: Velocity control mode (3).

  • FSAModeOfOperation.CURRENT_CLOSE_LOOP_CONTROL: Current closed-loop control mode (4).

  • FSAModeOfOperation.POSITION_CONTROL_PD: Position control with proportional-derivative (PD) compensation (5).

Returns:

FSAFunctionResult or None: Returns FSAFunctionResult.SUCCESS if the request is successful. Returns None if there’s an error or a timeout during communication.

Raises:

Raises an exception if communication fails or an unexpected error occurs.

fsa.fi_fsa.set_mode_of_operation_group(input_modes, server_ips)

Set the mode of operation for multiple FSA actuators.

Parameters:
  • input_modes (list): List of mode values to set for each FSA actuator.

  • server_ips (list): List of FSA IP addresses corresponding to each input mode.

Note

  • The length of input_modes and server_ips should be the same.

  • Each input mode corresponds to the desired mode of operation for the respective FSA actuator.

Example

>>> input_modes = [FSAModeOfOperation.CURRENT_CLOSE_LOOP_CONTROL, FSAModeOfOperation.VELOCITY_CONTROL]
>>> server_ips = ["192.168.1.1", "192.168.1.2"]
>>> set_mode_of_operation_group(input_modes, server_ips)
This example sets different modes of operation for two actuators with different IP addresses.
fsa.fi_fsa.set_pid_param(server_ip, dict)

Set the PID parameters of the FSA actuator.

This function sets the PID parameters for the FSA actuator.

Args:
  • server_ip (str): The IP address of the FSA actuator to set PID parameters for.

  • pid_params (dict): A dictionary containing the PID parameters to set.

    • control_position_kp (float): Proportional gain for position control.

    • control_velocity_kp (float): Proportional gain for velocity control.

    • control_velocity_ki (float): Integral gain for velocity control.

    • control_current_kp (float): Proportional gain for current control.

    • control_current_ki (float): Integral gain for current control.

Returns:

FSAFunctionResult: The result of setting the PID parameters.

  • FSAFunctionResult.SUCCESS: The PID parameters were successfully set.

  • None: An error occurred during the operation.

Note

This function communicates with the FSA actuator to set the specified PID parameters and returns the result.

Example

>>> pid_params = {
>>>     "control_position_kp": 1.0,
>>>     "control_velocity_kp": 0.5,
>>>     "control_velocity_ki": 0.2,
>>>     "control_current_kp": 0.1,
>>>     "control_current_ki": 0.05
>>> }
>>> result = set_pid_param("192.168.1.100", pid_params)
>>> if result == FSAFunctionResult.SUCCESS:
>>>     print("PID parameters set successfully.")
>>> else:
>>>     print("Error while setting PID parameters.")
fsa.fi_fsa.set_pid_param_imm(server_ip, dict)

Set immediate PI (Proportional-Integral) parameters for the FSA (Fourier Smart Actuator).

Parameters:
  • server_ip (str): The IP address of the FSA actuator.

  • dict (dict): A dictionary containing the immediate PI parameters for position, velocity, and current control. It should include the following keys:
    • “control_position_kp_imm” (float): Proportional gain for position control (immediate).

    • “control_velocity_kp_imm” (float): Proportional gain for velocity control (immediate).

    • “control_velocity_ki_imm” (float): Integral gain for velocity control (immediate).

    • “control_current_kp_imm” (float): Proportional gain for current control (immediate).

    • “control_current_ki_imm” (float): Integral gain for current control (immediate).

Returns:

FSAFunctionResult: The result of setting the immediate PI parameters.

  • FSAFunctionResult.SUCCESS: Parameters set successfully.

  • None: An error occurred during the process.

Note

  • This function sets the immediate PI parameters for the FSA to control position, velocity, and current.

  • The parameter D (Derivative) will be available for setting in a later update.

  • Immediate parameters are used for real-time control adjustments.

fsa.fi_fsa.set_position_control(server_ip, position, velocity_ff=0.0, current_ff=0.0)

Set the position control parameters for the FSA (Fourier Smart Actuator) device and request a position control operation.

Parameters:
  • server_ip (str): The IP address of the FSA device.

  • position (float): The desired position in degrees or radians to which the actuator should move.

  • velocity_ff (float, optional): Velocity feedforward value to be applied during the position control operation. Default is 0.0.

  • current_ff (float, optional): Current feedforward value to be applied during the position control operation. Default is 0.0.

Returns:

Tuple[float, float, float] or None: Returns a tuple containing the current position (float), current velocity (float), and current current (float) of the actuator if the position control operation was successful. If there’s an issue with the operation, it returns None.

This function sends a command to the FSA device to perform a position control operation. It sets the desired position and optional feedforward values before initiating the operation. The response includes the current position, velocity, and current values after the operation is complete.

Example

>>> data = set_position_control("192.168.1.100", 90.0, 0.1, 0.2)
>>> if data is not None:
>>>     position, velocity, current = data
>>>     print("Current Position:", position, "degrees")
>>>     print("Current Velocity:", velocity, "degrees/second")
>>>     print("Current Current:", current, "Amps")
>>> else:
>>>     print("Position control operation failed.")

Note

  • Ensure that the FSA device is properly configured and connected for position control.

  • If the operation fails, the function returns None.

  • The feedforward values (velocity_ff and current_ff) are optional and can be set to 0.0 if not needed.

fsa.fi_fsa.set_torque_control(server_ip, torque)

Set the torque control parameters for the FSA (Fourier Smart Actuator) device and request a torque control operation.

Parameters:
  • server_ip (str): The IP address of the FSA device.

  • torque (float): The desired torque in Newton-meters (N.m) for the actuator.

Returns:

Tuple[float, float, float] or None: Returns a tuple containing the current position (float), current velocity (float), and current torque (float) of the actuator if the torque control operation was successful. If there’s an issue with the operation, it returns None.

This function sends a command to the FSA device to perform a torque control operation. It sets the desired torque before initiating the operation. The response includes the current position, velocity, and torque values after the operation is complete.

Example:
>>> data = set_torque_control("192.168.1.100", 5.0)
>>> if data is not None:
>>>     position, velocity, torque = data
>>>     print("Current Position:", position, "degrees")
>>>     print("Current Velocity:", velocity, "degrees/second")
>>>     print("Current Torque:", torque, "N.m")
>>> else:
>>>     print("Torque control operation failed.")
Note:
  • Ensure that the FSA device is properly configured and connected for torque control.

  • If the operation fails, the function returns None.

fsa.fi_fsa.set_velocity_control(server_ip, velocity, current_ff=0.0)

Set the velocity control parameters for the FSA (Fourier Smart Actuator) device and request a velocity control operation.

Parameters:
  • server_ip (str): The IP address of the FSA device.

  • velocity (float): The desired velocity in degrees per second or radians per second for the actuator.

  • current_ff (float, optional): Current feedforward value to be applied during the velocity control operation. Default is 0.0.

Returns:

Tuple[float, float, float] or None: Returns a tuple containing the current position (float), current velocity (float), and current current (float) of the actuator if the velocity control operation was successful. If there’s an issue with the operation, it returns None.

This function sends a command to the FSA device to perform a velocity control operation. It sets the desired velocity and optional current feedforward value before initiating the operation. The response includes the current position, velocity, and current values after the operation is complete.

Example

>>> data = set_velocity_control("192.168.1.100", 45.0, 0.2)
>>> if data is not None:
>>>     position, velocity, current = data
>>>     print("Current Position:", position, "degrees")
>>>     print("Current Velocity:", velocity, "degrees/second")
>>>     print("Current Current:", current, "Amps")
>>> else:
>>>     print("Velocity control operation failed.")

Note

  • Ensure that the FSA device is properly configured and connected for velocity control.

  • If the operation fails, the function returns None.

  • The current feedforward value (current_ff) is optional and can be set to 0.0 if not needed.

fsa.fi_fsa_config module

class fsa.fi_fsa_config.RCSConfig(argv)

Bases: object

Represent the configuration settings for the RCS (Robot Control System).

This class is responsible for reading configuration parameters from either a default configuration file or a specified file path provided as a command-line argument.

Parameters:
  • argv (list): List of command-line arguments.

Attributes:
  • parameters (dict): Dictionary containing the configuration parameters.

Usage:
  • Create an instance of RCSConfig to access configuration parameters.

Example

>>> # Create an instance of RCSConfig
>>> gl_rcs_config = RCSConfig(sys.argv)
>>> # Access configuration parameters
>>> robot_type = gl_rcs_config.parameters["robot"]["type"]

Note

If a command-line argument specifying a configuration file is provided, the parameters are read from that file. Otherwise, the default configuration file (“config.json”) is used.

read_from_json(path='config.json')

Reads configuration parameters from a JSON file.

If the specified file path does not exist, an empty dictionary is returned.

Parameters:
  • path (str): File path to the JSON configuration file. Default is “config.json”.

Returns:
  • dict: Dictionary containing the configuration parameters.

fsa.fi_fsa_logger module

class fsa.fi_fsa_logger.Logger(enable_log_file=False)

Bases: object

Utility class for logging messages to the console and optionally to a log file.

- STATE_OFF

Constant representing the logging state as off (0x00).

Type:

int

- STATE_ON

Constant representing the logging state as on (0x01).

Type:

int

- LEVEL_NONE

Constant representing no logging level (0x00).

Type:

int

- LEVEL_TRANCE

Constant representing the logging level as trace (0x01).

Type:

int

- LEVEL_DEBUG

Constant representing the logging level as debug (0x02).

Type:

int

- LEVEL_WARNING

Constant representing the logging level as warning (0x03).

Type:

int

- LEVEL_ERROR

Constant representing the logging level as error (0x04).

Type:

int

- __init__(self, enable_log_file=False)

Constructor for the Logger class.

- __init_log(self)

Private method to initialize the log file.

- print_log_file_debug(self, str_temp)

Log a debug message to the file.

- print_log_file_info(self, str_temp)

Log an info message to the file.

- print_log_file_warning(self, str_temp)

Log a warning message to the file.

- print_log_file_error(self, str_temp)

Log an error message to the file.

- print_log_file_critical(self, str_temp)

Log a critical message to the file.

- __time(self, unit='us')

Private method to get the timestamp with specified unit.

- print(self, *objects, sep=' ', end='\n', file=sys.stdout, flush=False)

Log a message to the console.

- print_trace(self, *objects, sep=' ', end='\n', file=sys.stdout, flush=False)

Log a trace message to the console.

- print_trace_debug(self, *objects, sep=' ', end='\n', file=sys.stdout, flush=False)

Log a debug message to the console.

- print_trace_warning(self, *objects, sep=' ', end='\n', file=sys.stdout, flush=False)

Log a warning message to the console.

- print_trace_error(self, *objects, sep=' ', end='\n', file=sys.stdout, flush=False)

Log an error message to the console.

- print_file(self, *objects, sep=' ', end='\n', file=sys.stdout, flush=False)

Log a message to the console/file.

- print_file_trace(self, *objects, sep=' ', end='\n', file=sys.stdout, flush=False)

Log a trace message to the console/file.

Usage:
  • Create an instance of Logger to enable logging and use its methods to log messages.

Example

>>> # Create an instance of Logger
>>> logger = Logger()
>>> # Log messages
>>> logger.print("This is a general message.")
>>> logger.print_trace("This is a trace message.")
>>> logger.print_trace_debug("This is a debug message.")
>>> logger.print_trace_warning("This is a warning message.")
>>> logger.print_trace_error("This is an error message.")

Note

  • The Logger class provides methods to log messages with different levels to both the console and, if enabled, to a log file.

LEVEL_DEBUG = 2
LEVEL_ERROR = 4
LEVEL_NONE = 0
LEVEL_TRANCE = 1
LEVEL_WARNING = 3
STATE_OFF = 0
STATE_ON = 1
print(*objects, sep=' ', end='\n', file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, flush=False)
print_file(*objects, sep=' ', end='\n', file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, flush=False)
print_file_trace(*objects, sep=' ', end='\n', file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, flush=False)
print_line(*objects, sep=' ', end='\n', file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, flush=False)
print_log_file_critical(str_temp)
print_log_file_debug(str_temp)
print_log_file_error(str_temp)
print_log_file_info(str_temp)
print_log_file_warning(str_temp)
print_trace(*objects, sep=' ', end='\n', file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, flush=False)
print_trace_debug(*objects, sep=' ', end='\n', file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, flush=False)
print_trace_error(*objects, sep=' ', end='\n', file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, flush=False)
print_trace_warning(*objects, sep=' ', end='\n', file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, flush=False)