Example Codes

Clear Fault

Clear Fault

This example code demonstrates how to use the FSA (Fourier Smart Actuator) SDK to clear faults in FSA actuators. It is a part of the FSA SDK’s collection of example scripts.

Code Description

The clear_fault.py script does the following:

  1. Discovers FSA actuators on the network.

  2. Retrieves the error code for each detected actuator.

  3. Clears any faults present in the actuators, if any.

Usage

To run the clear_fault.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connnecting FSA for details.

  3. Open a terminal and navigate to the directory containing clear_fault.py.

  4. Run the script using the following command:

    python clear_fault.py
    
  5. Running result:

    PS D:\work\gitee\actuator-fsa-wiki-master\actuator-fsa-wiki-master\sdk-python\examples> & C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_clear_fault.py
    File not exist:  config.json
    [2024.01.27 10:09:50.073.275]  Info:    FSA start listening for broadcast...
    [2024.01.27 10:09:50.074.275]  Info:    FSA start listening for broadcast...
    
    
    [2024.01.27 10:09:50.077.267]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}
    
    
    found servers
    ['192.168.137.101']
    lookup Finished!
    
    [2024.01.27 10:09:52.282.046]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/error_code", "property": ""}
    [2024.01.27 10:09:52.283.047]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/error_code","property":"","error_code":0}
    Error code = 0
    [2024.01.27 10:09:52.283.047]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/control_word", "property": "", "control_word": 134}
    [2024.01.27 10:09:52.284.040]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/control_word","property":""}
    

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

  3. Check if the actuators have any existing faults that need to be cleared.

Current Control Mode

Current Control Mode

This example code demonstrates how to use the FSA (Fourier Smart Actuator) SDK to operate FSA actuators in the current control mode. It is a part of the FSA SDK’s collection of example scripts.

This example code demonstrates how to use the FSA (Fourier Smart Actuator) SDK to command the FSA device to perform a current control operation. This operation involves setting a desired current before initiating the control process. Upon completion, the script provides a detailed response, including the current position, velocity, and current values.

Code Description

The current_control_mode.py script performs the following actions:

  1. Discovers FSA actuators on the network.

  2. Retrieves the state, configuration, and current position, velocity, and current (PVC) values for each detected actuator.

  3. Sets the current control current to 0.0 for all actuators.

  4. Switches the mode of operation to current close-loop control.

  5. Enables all motors for close-loop control.

  6. Runs a current control loop for a specified duration, commanding a constant current value.

  7. Disables the actuators.

  8. Switches the mode of operation to none.

Usage

To run the current_control_mode.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing current_control_mode.py.

  4. Run the script using the following command:

    python current_control_mode.py
    

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_control_current_mode.py
File not exist:  config.json
[2024.01.27 10:17:26.942.007]  Info:    FSA start listening for broadcast...
[2024.01.27 10:17:26.942.416]  Info:    FSA start listening for broadcast...


[2024.01.27 10:17:26.946.120]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 10:17:29.158.746]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/state", "property": ""}
[2024.01.27 10:17:29.160.196]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/state","property":"","state":0}
State = 0
[2024.01.27 10:17:30.160.748]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/config", "property": ""}
[2024.01.27 10:17:30.162.618]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/config","property":"","actuator_type":1,"actuator_direction":1,"actuator_reduction_ratio":36,"motor_type":8,"motor_hardware_type":4,"motor_vbus":36,"motor_direction":1,"motor_max_speed":1000,"motor_max_acceleration":10000,"motor_max_current":100}
[2024.01.27 10:17:31.163.818]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/measured", "position": true, "velocity": true, "current": true}
[2024.01.27 10:17:31.164.824]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/measured","property":null,"position":-0.000610389,"velocity":0.020928467,"current":0}
Position = -0.00, Velocity = 0.021, Current = 0.0000
[2024.01.27 10:17:32.177.150]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/current_control", "reply_enable": true, "current": 0.0}
[2024.01.27 10:17:32.178.964]  Info:    192.168.137.101 : Position = -0.00, Velocity = 0.146, Current = 0.0000

[2024.01.27 10:17:33.180.312]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/mode_of_operation", "mode_of_operation": 4}
[2024.01.27 10:17:33.182.184]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/mode_of_operation","property":null}
[2024.01.27 10:17:34.184.145]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/control_word", "property": "", "control_word": 15}
[2024.01.27 10:17:34.184.960]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/control_word","property":""}
[2024.01.27 10:17:35.186.883]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/current_control", "reply_enable": true, "current": 0.0}
[2024.01.27 10:17:35.187.725]  Info:    192.168.137.101 : Position = -0.00, Velocity = 0.147, Current = 0.0224

[2024.01.27 10:17:36.189.494]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/current_control", "reply_enable": true, "current": 0.4}
[2024.01.27 10:17:36.190.891]  Info:    192.168.137.101 : Position = -0.00, Velocity = 0.059, Current = 0.0109

[2024.01.27 10:17:36.201.545]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/current_control", "reply_enable": true, "current": 0.4}
[2024.01.27 10:17:36.203.292]  Info:    192.168.137.101 : Position = 0.04, Velocity = 6.886, Current = 0.3644


Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

  3. Check if there are any existing faults in the actuators that may affect their operation.

Position Feedforward Control Mode

Position FF Control Mode

This example code demonstrates how to use the FSA (Fourier Smart Actuator) SDK to operate FSA actuators in the position control mode with feedforward values. This operation involves setting a desired position and optional feedforward values before initiating the control process. After completion, the script delivers a detailed response, including the current position, velocity, and current values.

Code Description

The position_ff_control_mode.py script performs the following actions:

  1. Discovers FSA actuators on the network.

  2. Retrieves the state, configuration, and current position, velocity, and current (PVC) values for each detected actuator.

  3. Sets the current control position to 0.0 for all actuators.

  4. Enables all motors for position control.

  5. Switches the mode of operation to position control.

  6. Runs a position control loop with feedforward control using a constant current value.

  7. Disables the actuators.

  8. Switches the mode of operation to none.

Usage

To run the position_ff_control_mode.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing position_ff_control_mode.py.

  4. Run the script using the following command:

    python position_ff_control_mode.py
    

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_control_position_ff_mode.py
File not exist:  config.json
[2024.01.27 10:24:55.180.937]  Info:    FSA start listening for broadcast...
[2024.01.27 10:24:55.181.934]  Info:    FSA start listening for broadcast...


[2024.01.27 10:24:55.186.181]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 10:24:57.394.088]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/state", "property": ""}
[2024.01.27 10:24:57.396.064]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/state","property":"","state":0}
State = 0


[2024.01.27 10:24:58.398.092]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/config", "property": ""}
[2024.01.27 10:24:58.399.637]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/config","property":"","actuator_type":1,"actuator_direction":1,"actuator_reduction_ratio":36,"motor_type":8,"motor_hardware_type":4,"motor_vbus":36,"motor_direction":1,"motor_max_speed":3000,"motor_max_acceleration":60000,"motor_max_current":8}


[2024.01.27 10:24:59.402.913]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/measured", "position": true, "velocity": true, "current": true}
[2024.01.27 10:24:59.403.725]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/measured","property":null,"position":-0.002441555,"velocity":0.117436215,"current":0}
Position = -0.00, Velocity = 0.117, Current = 0.0000


[2024.01.27 10:25:00.416.185]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/position_control", "reply_enable": true, "position": 0.0, "velocity_ff": 0.0, "current_ff": 0.0}
[2024.01.27 10:25:00.418.052]  Info:    192.168.137.101 : Position = 0.00, Velocity = 0.101, Current = 0.0000



[2024.01.27 10:25:01.421.064]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/control_word", "property": "", "control_word": 15}
[2024.01.27 10:25:01.423.071]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/control_word","property":""}


[2024.01.27 10:25:02.426.270]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/mode_of_operation", "mode_of_operation": 1}
[2024.01.27 10:25:02.427.267]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/mode_of_operation","property":null}


[2024.01.27 10:25:03.428.101]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/position_control", "reply_enable": true, "position": 0.0, "velocity_ff": 0.0, "current_ff": 0.0}
[2024.01.27 10:25:03.429.875]  Info:    192.168.137.101 : Position = -0.00, Velocity = 0.087, Current = 0.0009

[2024.01.27 10:25:04.430.765]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/pid_param_imm", "property": "", "control_position_kp_imm": 0.0, "control_velocity_kp_imm": 0.0, "control_velocity_ki_imm": 0.0, "control_current_kp_imm": 7.25, "control_current_ki_imm": 0.08}
[2024.01.27 10:25:04.432.456]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/pid_param_imm","property":""}


[2024.01.27 10:25:05.433.438]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/position_control", "reply_enable": true, "position": 0, "velocity_ff": 0.0, "current_ff": 0.4}
[2024.01.27 10:25:05.436.300]  Info:    192.168.137.101 : Position = -0.00, Velocity = -0.019, Current = 0.0007

[2024.01.27 10:25:05.448.564]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/position_control", "reply_enable": true, "position": 0, "velocity_ff": 0.0, "current_ff": 0.4}
[2024.01.27 10:25:05.450.550]  Info:    192.168.137.101 : Position = 0.05, Velocity = 8.980, Current = 0.3711

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

  3. Check if there are any existing faults in the actuators that may affect their operation.

Position Control Mode

Position Control Mode

This example code demonstrates how to command the FSA device to perform a position control operation. This operation involves setting a desired position before initiating the control process. After completion, the script delivers a detailed response, including the current position, velocity, and current values.

Code Description

The position_control_mode.py script performs the following actions:

  1. Discovers FSA actuators on the network.

  2. Retrieves the state, configuration, and current position, velocity, and current (PVC) values for each detected actuator.

  3. Sets the current control position to 0.0 for all actuators.

  4. Enables all motors for position control.

  5. Switches the mode of operation to position control.

  6. Runs a position control loop with a sinusoidal wave as the target position.

  7. Disables the actuators.

  8. Switches the mode of operation to none.

Usage

To run the position_control_mode.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing position_control_mode.py.

  4. Run the script using the following command:

    python position_control_mode.py
    

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_control_position_mode.py
File not exist:  config.json
[2024.01.27 10:27:26.831.336]  Info:    FSA start listening for broadcast...
[2024.01.27 10:27:26.832.364]  Info:    FSA start listening for broadcast...


[2024.01.27 10:27:26.835.368]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 10:27:29.045.050]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/state", "property": ""}
[2024.01.27 10:27:29.046.763]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/state","property":"","state":0}
State = 0


[2024.01.27 10:27:30.048.150]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/config", "property": ""}
[2024.01.27 10:27:30.050.740]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/config","property":"","actuator_type":1,"actuator_direction":1,"actuator_reduction_ratio":36,"motor_type":8,"motor_hardware_type":4,"motor_vbus":36,"motor_direction":1,"motor_max_speed":3000,"motor_max_acceleration":60000,"motor_max_current":8}


[2024.01.27 10:27:31.053.489]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/measured", "position": true, "velocity": true, "current": true}
[2024.01.27 10:27:31.054.526]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/measured","property":null,"position":0.000610389,"velocity":-0.025581094,"current":0}
Position = 0.00, Velocity = -0.026, Current = 0.0000


[2024.01.27 10:27:32.067.166]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/position_control", "reply_enable": true, "position": 0.0, "velocity_ff": 0.0, "current_ff": 0.0}
[2024.01.27 10:27:32.068.983]  Info:    192.168.137.101 : Position = 0.00, Velocity = 0.020, Current = 0.0000



[2024.01.27 10:27:33.072.387]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/control_word", "property": "", "control_word": 15}
[2024.01.27 10:27:33.073.389]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/control_word","property":""}


[2024.01.27 10:27:34.075.599]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/mode_of_operation", "mode_of_operation": 1}
[2024.01.27 10:27:34.077.575]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/mode_of_operation","property":null}


[2024.01.27 10:27:35.079.990]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/position_control", "reply_enable": true, "position": 0.0, "velocity_ff": 0.0, "current_ff": 0.0}
[2024.01.27 10:27:35.081.032]  Info:    192.168.137.101 : Position = -0.00, Velocity = 0.090, Current = -0.0110

[2024.01.27 10:27:36.081.798]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/position_control", "reply_enable": true, "position": 0.0, "velocity_ff": 0.0, "current_ff": 0.0}
[2024.01.27 10:27:36.083.428]  Info:    192.168.137.101 : Position = -0.00, Velocity = 0.168, Current = -0.0179

[2024.01.27 10:27:36.095.027]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/position_control", "reply_enable": true, "position": 0.359999940000003, "velocity_ff": 0.0, "current_ff": 0.0}
[2024.01.27 10:27:36.096.020]  Info:    192.168.137.101 : Position = -0.00, Velocity = 0.060, Current = -0.0070

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

  3. Check for any mechanical obstructions or issues that may affect the actuators’ ability to reach the desired positions.

Velocity Control Mode

Velocity Control Mode

This example code demonstrates how to use the FSA (Fourier Smart Actuator) SDK to operate FSA actuators in the velocity control mode. It is a part of the FSA SDK’s collection of example scripts.

Code Description

The velocity_control_mode.py script performs the following actions:

  1. Discovers FSA actuators on the network.

  2. Retrieves the state, configuration, and current position, velocity, and current (PVC) values for each detected actuator.

  3. Sets the current control velocity to 0.0 for all actuators.

  4. Enables all motors for velocity control.

  5. Switches the mode of operation to velocity control.

  6. Runs a velocity control loop with a sinusoidal wave as the target velocity.

  7. Disables the actuators.

  8. Switches the mode of operation to none.

Usage

To run the velocity_control_mode.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing velocity_control_mode.py.

  4. Modify the script to set the desired target velocity:

    # create sine wave
    count_max = round(1000 * 2 * math.pi)
    reduction_ratio = 1.0
    for t in range(count_max):
        for i in range(len(server_ip_list)):
            # Set the desired target velocity here (replace 120.0 with your desired value)
            set_velocity = 120.0 * math.sin(t / 1000.0)  # [deg/s]
            fi_fsa.set_velocity_control(server_ip_list[i], set_velocity)
        time.sleep(0.01)
    
  5. Run the script using the following command:

    python velocity_control_mode.py
    

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_control_velocity_mode.py
File not exist:  config.json
[2024.01.27 10:34:54.395.598]  Info:    FSA start listening for broadcast...
[2024.01.27 10:34:54.395.598]  Info:    FSA start listening for broadcast...


[2024.01.27 10:34:54.397.592]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 10:34:56.607.212]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/state", "property": ""}
[2024.01.27 10:34:56.608.845]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/state","property":"","state":2}
State = 2


[2024.01.27 10:34:57.611.108]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/config", "property": ""}
[2024.01.27 10:34:57.613.153]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/config","property":"","actuator_type":1,"actuator_direction":1,"actuator_reduction_ratio":36,"motor_type":8,"motor_hardware_type":4,"motor_vbus":36,"motor_direction":1,"motor_max_speed":3000,"motor_max_acceleration":60000,"motor_max_current":8}


[2024.01.27 10:34:58.615.713]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/measured", "position": true, "velocity": true, "current": true}
[2024.01.27 10:34:58.617.330]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/measured","property":null,"position":-0.003051944,"velocity":0.169537753,"current":-0.004821913}
Position = -0.00, Velocity = 0.170, Current = -0.0048


[2024.01.27 10:34:59.629.252]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/velocity_control", "reply_enable": true, "velocity": 0.0, "current_ff": 0.0}
[2024.01.27 10:34:59.630.431]  Info:    192.168.137.101 : Position = -0.00, Velocity = 0.003, Current = 0.0070



[2024.01.27 10:35:00.632.171]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/control_word", "property": "", "control_word": 15}
[2024.01.27 10:35:00.633.177]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/control_word","property":""}


[2024.01.27 10:35:01.634.140]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/mode_of_operation", "mode_of_operation": 3}
[2024.01.27 10:35:01.636.186]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/mode_of_operation","property":null}


[2024.01.27 10:35:02.638.581]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/velocity_control", "reply_enable": true, "velocity": 0.0, "current_ff": 0.0}
[2024.01.27 10:35:02.640.587]  Info:    192.168.137.101 : Position = -0.00, Velocity = -0.087, Current = -0.0078

[2024.01.27 10:35:02.653.624]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/velocity_control", "reply_enable": true, "velocity": 0.119999980000001, "current_ff": 0.0}
[2024.01.27 10:35:02.655.662]  Info:    192.168.137.101 : Position = -0.00, Velocity = 0.032, Current = 0.0120

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

  3. Check for any mechanical obstructions or issues that may affect the actuators’ ability to reach the desired positions.

Get Absolute Encoder Value

Get Absolute Encoder Value

This example code demonstrates how to use the FSA (Fourier Smart Actuator) SDK to retrieve the absolute encoder angle. It is a part of the FSA SDK’s collection of example scripts.

Code Description

The get_abs_encoder_value.py script does the following:

  1. Manually sets the IP address of the FSA actuator in the server_ip_list.

  2. Continuously retrieves and prints the absolute encoder angle from the specified FSA actuator.

  3. The script runs for a specified number of iterations, with a 0.2-second delay between readings.

Usage

To run the get_abs_encoder_value.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Open a terminal and navigate to the directory containing get_abs_encoder_value.py.

  3. Optionally, modify the server_ip_list to include the IP address of your encoder.

  4. Run the script using the following command:Common Issues

    python get_abs_encoder_value.py
    
    

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

  3. Check if there are any existing faults in the actuators that may affect their operation.

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that the specified FSA actuator’s IP address is correct and accessible.

  3. Check the FSA actuator’s connection and ensure it is powered on.

Get Communication Configuration

Get Communication Configuration

This example code demonstrates how to use the FSA (Fourier Smart Actuator) SDK to retrieve the communication configuration from FSA actuators. It is a part of the FSA SDK’s collection of example scripts.

Code Description

The get_comm_config.py script does the following:

  1. Discovers FSA actuators on the network.

  2. Retrieves and prints the communication configuration of each detected FSA actuator.

Configuration Parameters

The communication configuration parameters include:

  • “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).

Usage

To run the get_comm_config.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Open a terminal and navigate to the directory containing get_comm_config.py.

  3. Run the script using the following command:

    python get_comm_config.py
    
    

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_comm_config_get.py
File not exist:  config.json
[2024.01.27 10:12:05.181.551]  Info:    FSA start listening for broadcast...
[2024.01.27 10:12:05.182.549]  Info:    FSA start listening for broadcast...


[2024.01.27 10:12:05.184.543]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 10:12:07.396.730]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/config", "property": ""}
[2024.01.27 10:12:07.398.546]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/config","property":"","DHCP_enable":false,"SSID":"fftai-6","password":"fftai2015","name":"FSA-0","static_IP":[192,168,137,101],"gateway":[192,168,137,1],"subnet_mask":[255,255,255,0],"dns_1":[114,114,114,114],"dns_2":[8,8,8,8]}

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

Get Control Configuration

Get Control Configuration

The example script is an example of how to use the FSA (Fourier Smart Actuator) SDK to retrieve configuration information from FSA actuators. It is part of the FSA SDK’s collection of example scripts.Code Description

Code Description

  1. Discovers FSA actuators on the network.

  2. Retrieves the configuration information for each detected actuator.

  3. Prints the configuration information, including actuator type, direction, reduction ratio, motor details, encoder direction, and more.

Usage

To run the get_config.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing get_config.py.

  4. Run the script using the following command:

    python get_config.py
    

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_ctrl_config_get.py
File not exist:  config.json
[2024.01.27 10:38:21.249.154]  Info:    FSA start listening for broadcast...
[2024.01.27 10:38:21.250.152]  Info:    FSA start listening for broadcast...


[2024.01.27 10:38:21.253.186]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 10:38:23.461.831]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/config", "property": ""}
[2024.01.27 10:38:23.463.946]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/config","property":"","actuator_type":1,"actuator_direction":1,"actuator_reduction_ratio":36,"motor_type":8,"motor_hardware_type":4,"motor_vbus":36,"motor_direction":1,"motor_max_speed":3000,"motor_max_acceleration":60000,"motor_max_current":8}

Get Flag of Operation

Get Flag of Operation

This example code demonstrates how to get the operation flags for the FSA (Fourier Smart Actuator) device. It is a part of the FSA SDK’s collection of example scripts.

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.

Code Description

The get_flag_of_operation.py script does the following:

  1. Discovers FSA actuators on the network.

  2. Retrieves and prints the configuration information of each detected FSA actuator.

Usage

To run the get_flag_of_operation.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quick Start.

  2. Open a terminal and navigate to the directory containing get_flag_of_operation.py.

  3. Run the script using the following command:

    python get_flag_of_operation.py
    
    

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

Get Home Offset

Get Home Offset

This script is an example of how to use the FSA (Fourier Smart Actuator) SDK to retrieve home offset information from FSA actuators. It is part of the FSA SDK’s collection of example scripts.

The “home offset” refers to an adjustment or offset value applied to the position of an actuator or motor when it is in its home position. The home position is a predefined reference point that the actuator returns to or starts from.

  • Home Position: The home position is a specific location or point that an actuator or motor is configured to consider as its starting or reference position. It’s a consistent and repeatable point in the motion system.

  • Home Offset: The home offset is a numerical value that represents the position offset from the defined home position. When an actuator is in its home position, the actual physical position might not align perfectly with the reference point due to mechanical tolerances or other factors. The home offset is used to compensate for this discrepancy.

For example, if an actuator is supposed to be at position 0 when at home, but due to mechanical variations, it is actually at position +5 units, the home offset would be +5. This offset is added to or subtracted from the actual position to determine the effective position relative to the home position.

Code Description

  1. Discovers FSA actuators on the network.

  2. Retrieves the home offset information for each detected actuator.

  3. Prints the home offset values, which indicate the position offset from the home position.

Usage

To run the get_home_offset.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing get_home_offset.py.

  4. Run the script using the following command:

    python get_home_offset.py
    

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_home_offset_set.py
File not exist:  config.json
[2024.01.27 10:58:28.493.875]  Info:    FSA start listening for broadcast...
[2024.01.27 10:58:28.493.875]  Info:    FSA start listening for broadcast...


[2024.01.27 10:58:28.495.873]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 10:58:30.711.961]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/home_offset", "home_offset": 10.0}
[2024.01.27 10:58:30.713.719]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/home_offset","property":null}


[2024.01.27 10:58:30.713.719]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/home_offset", "property": ""}
[2024.01.27 10:58:30.714.723]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/home_offset","property":"","home_offset":10}


[2024.01.27 10:58:30.714.723]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/reboot", "property": ""}
[2024.01.27 10:58:30.715.720]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/reboot","property":""}

Get Measured

Get Measured Values

This example code demonstrates how to use the FSA (Fourier Smart Actuator) SDK to retrieve the measured position, velocity, and current values from FSA actuators. It is a part of the FSA SDK’s collection of example scripts.

Code Description

The get_measured.py script performs the following tasks:

  1. Discovers FSA actuators on the network.

  2. Retrieves and prints the measured position, velocity, and current values for each detected actuator.

  3. Repeats the measurements in a loop for a specified duration.

Usage

To run the get_measured.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing get_measured.py.

  4. Run the script using the following command:

    python get_comm_config.py
    
  5. The script will continuously print the measured position, velocity, and current values of the detected FSA actuators.

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_get_measured.py
File not exist:  config.json
[2024.01.27 10:48:54.325.623]  Info:    FSA start listening for broadcast...
[2024.01.27 10:48:54.325.623]  Info:    FSA start listening for broadcast...


[2024.01.27 10:48:54.329.635]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 10:48:56.531.141]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/measured", "position": true, "velocity": true, "current": true}
[2024.01.27 10:48:56.533.040]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/measured","property":null,"position":0.001831166,"velocity":-0.065338254,"current":0}
Position = 0.001831, Velocity = -0.065338, Current = 0.0000
[2024.01.27 10:48:56.733.550]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/measured", "position": true, "velocity": true, "current": true}
[2024.01.27 10:48:56.735.552]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/measured","property":null,"position":-0.000610389,"velocity":0.117129743,"current":0}
Position = -0.000610, Velocity = 0.117130, Current = 0.0000

Notes

  • The script uses the fi_fsa.get_pvc() function to retrieve the measured position, velocity, and current values.

  • The loop runs for a specified duration (in this case, 10000 iterations with a sleep of 0.2 seconds between iterations). Adjust the loop parameters as needed for your application.

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

  3. Check if there are any communication or connectivity issues with the FSA actuators.

Get PID Parameter

Get PID Parameters

This example code demonstrates how to use the FSA (Fourier Smart Actuator) SDK to retrieve the Proportional-Integral-Derivative (PID) parameters of FSA actuators. It is a part of the FSA SDK’s collection of example scripts.

Code Description

The get_pid_param.py script performs the following tasks:

  1. Discovers FSA actuators on the network.

  2. Retrieves and prints the PID parameters (Proportional Gain, Integral Gain, and Derivative Gain) for each detected actuator.

  3. Pauses for a short duration between measurements.

Usage

To run the get_pid_param.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing get_pid_param.py.

  4. Run the script using the following command:

    python get_pid_param.py
    
  5. The script will print the PID parameters for each detected FSA actuator.

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_pid_param_get.py
File not exist:  config.json
[2024.01.27 11:24:29.263.057]  Info:    FSA start listening for broadcast...
[2024.01.27 11:24:29.264.054]  Info:    FSA start listening for broadcast...


[2024.01.27 11:24:29.267.054]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 11:24:31.469.040]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/pid_param", "property": ""}
[2024.01.27 11:24:31.472.047]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/pid_param","property":"","control_position_kp":0.02,"control_velocity_kp":0.01,"control_velocity_ki":9.999999747e-6,"control_current_kp":2.363734007,"control_current_ki":0.088781998}

Notes

  • The script uses the fi_fsa.get_pid_param() function to retrieve the PID parameters.

  • The loop iterates through each detected actuator to fetch and print the PID parameters.

  • Adjust the script as needed to meet the specific requirements of your application.

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

  3. Check if there are any communication or connectivity issues with the FSA actuators.

Get PVC

Get Position-Velocity-Current (PVC)

This example code demonstrates how to use the FSA (Fourier Smart Actuator) SDK to retrieve the Position-Velocity-Current (PVC) values of FSA actuators. It is a part of the FSA SDK’s collection of example scripts.

Code Description

The get_PVC.py script performs the following tasks:

  1. Discovers FSA actuators on the network.

  2. Retrieves and prints the Position, Velocity, and Current values for each detected actuator.

  3. Repeats the measurements for a specified number of iterations with a short delay between measurements.

Usage

To run the get_PVC.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing get_PVC.py.

  4. Run the script using the following command:

    python get_PVC.py
    
  5. The script will print the Position, Velocity, and Current values for each detected FSA actuator.

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_get_pvc.py
File not exist:  config.json
[2024.01.27 10:50:02.768.670]  Info:    FSA start listening for broadcast...
[2024.01.27 10:50:02.769.698]  Info:    FSA start listening for broadcast...


[2024.01.27 10:50:02.771.714]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 10:50:04.972.345]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/measured", "position": true, "velocity": true, "current": true}
[2024.01.27 10:50:04.974.027]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/measured","property":null,"position":0.000610389,"velocity":0.22807458,"current":0}
Position = 0.000610, Velocity = 0.228075, Current = 0.0000
[2024.01.27 10:50:05.174.566]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/measured", "position": true, "velocity": true, "current": true}
[2024.01.27 10:50:05.175.897]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/measured","property":null,"position":0,"velocity":-0.164399222,"current":0}
Position = 0.000000, Velocity = -0.164399, Current = 0.0000
[2024.01.27 10:50:05.377.020]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/measured", "position": true, "velocity": true, "current": true}
[2024.01.27 10:50:05.378.404]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/measured","property":null,"position":-0.000610389,"velocity":0.081223018,"current":0}
Position = -0.000610, Velocity = 0.081223, Current = 0.0000

Notes

  • The script uses the fi_fsa.get_pvc() function to retrieve the PVC values.

  • The loop iterates through each detected actuator to fetch and print the PVC values.

  • Adjust the script as needed to meet the specific requirements of your application.

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

  3. Check if there are any communication or connectivity issues with the FSA actuators.

Get PVCC

Get Position-Velocity-Current iq-Current id

This example code demonstrates how to use the FSA (Fourier Smart Actuator) SDK to retrieve the Position-Velocity-Current iq-Current id(PVCC) values of FSA actuators.

Current_iq and Current_id refer to the current components in a rotating coordinate system known as the dq (or dq0) reference frame. These components are often used to represent the currents in a two-dimensional space that rotates with the rotor of the motor.

Current_iq (Iq) represents the current component along the q-axis of the dq reference frame. The q-axis is aligned with the rotor magnetic field. In simpler terms, Current_iq represents the current flowing in the direction that is 90 degrees (in a clockwise direction) from the rotor magnetic field.

Current_id (Id) represents the current component along the d-axis of the dq reference frame. The d-axis is aligned with the rotor flux. In simpler terms, Current_id represents the current flowing in the same direction as the rotor magnetic field.

In a three-phase motor, the currents in the a-b-c coordinate system can be transformed into the dq coordinate system using Park or Clarke transformations. These transformations are commonly used in field-oriented control (FOC) algorithms, where controlling the currents in the dq reference frame simplifies the control strategy and improves performance, especially in variable-speed motor applications.

Code Description

The get_pvcc.py script performs the following tasks:

  1. Discovers FSA actuators on the network.

  2. Retrieves and prints the Position, Velocity, Current_iq, and Current_id values for each detected actuator.

  3. Repeats the measurements for a specified number of iterations with a short delay between measurements.

Usage

To run the get_pvcc.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing get_pvcc.py.

  4. Run the script using the following command:

    python get_pvcc.py
    
  5. The script will print the Position, Velocity, Current_iq, and Current_id values for each detected FSA actuator.

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_get_pvcc.py
File not exist:  config.json
[2024.01.27 10:51:46.432.478]  Info:    FSA start listening for broadcast...
[2024.01.27 10:51:46.433.476]  Info:    FSA start listening for broadcast...


[2024.01.27 10:51:46.435.726]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 10:51:48.638.242]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/measured", "position": true, "velocity": true, "current": true, "current_id": true}
[2024.01.27 10:51:48.640.360]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/measured","property":null,"position":0,"velocity":-0.271014631,"current":0,"current_id":0}
Position = 0.000000, Velocity = -0.271015, Current_iq = 0.0000, Current_id = 0.0000
[2024.01.27 10:51:48.841.874]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/measured", "position": true, "velocity": true, "current": true, "current_id": true}
[2024.01.27 10:51:48.843.987]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/measured","property":null,"position":0.001831166,"velocity":-0.099205151,"current":0,"current_id":0}
Position = 0.001831, Velocity = -0.099205, Current_iq = 0.0000, Current_id = 0.0000

Notes

  • The script uses the fi_fsa.get_pvcc() function to retrieve the PVCC values.

  • The loop iterates through each detected actuator to fetch and print the PVCC values.

  • Adjust the script as needed to meet the specific requirements of your application.

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

  3. Check if there are any communication or connectivity issues with the FSA actuators.

Get PVCCC

Get State

Get State

This example script demonstrates how to use the FSA (Fourier Smart Actuator) SDK to retrieve and display the state of FSA actuators.

The FSA has the following states:

  • IDLE= 0

  • INIT= 1

  • NORMAL= 2

  • FAULT= 3

  • ENCODER_CAIL= 4

Code Description

The get_state.py script performs the following tasks:

  1. Discovers FSA actuators on the network.

  2. Retrieves and prints the state of each detected actuator.

  3. Measures and prints the latency of the get_state function.

The script runs in a loop for 10,000 iterations with a sleep interval of 1 second between iterations. During each iteration, it queries the state of each actuator.

Output Parameters

The script prints the following information:

  • State (State): Represents the current state of the FSA actuator.

Usage

To run the get_state.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing get_state.py.

  4. Run the script using the following command:

    python get_state.py
    

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_get_state.py
File not exist:  config.json
[2024.01.27 10:56:09.093.709]  Info:    FSA start listening for broadcast...
[2024.01.27 10:56:09.094.707]  Info:    FSA start listening for broadcast...


[2024.01.27 10:56:09.096.657]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 10:56:11.306.942]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/state", "property": ""}
[2024.01.27 10:56:11.308.225]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/state","property":"","state":0}
State = 0
1.2829303741455078 ms
[2024.01.27 10:56:12.308.622]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/state", "property": ""}
[2024.01.27 10:56:12.310.472]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/state","property":"","state":0}
State = 0
2.684354782104492 ms

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

Lookup

Lookup

This script, lookup.py, demonstrates how to use the FSA (Fourier Smart Actuator) SDK to discover FSA actuators on the network and retrieve their communication root. It is part of the FSA SDK’s collection of example scripts.

Code Description

The script performs the following tasks:

  1. Discovers FSA actuators on the network using the broadcast_func function.

  2. Retrieves and prints the communication root of each detected actuator.

  3. Displays the communication root of the last detected actuator.

Output Parameters

The script prints the following information:

  • Communication Root (comm_root): Represents the communication root of the FSA actuator.

Usage

To run the lookup.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing lookup.py.

  4. Run the script using the following command:

python lookup.py

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_lookup.py
File not exist:  config.json
[2024.01.27 10:59:58.318.198]  Info:    FSA start listening for broadcast...
[2024.01.27 10:59:58.319.195]  Info:    FSA start listening for broadcast...


[2024.01.27 10:59:58.322.549]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 11:00:00.530.953]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/", "property": ""}
[2024.01.27 11:00:00.532.948]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/","property":"","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101","DHCP_enable":false,"SSID":"fftai-6","password":"fftai2015","static_IP":[192,168,137,101],"gateway":[192,168,137,1],"subnet_mask":[255,255,255,0],"dns_1":[114,114,114,114],"dns_2":[8,8,8,8],"OTAstatus":"HTTP_UPDATE_IDLE","OTADriverstatus":"HTTP_UPDATE_DRIVER_IDLE"}
The communication root is:  {'status': 'OK', 'reqTarget': '/', 'property': '', 'type': 'Actuator', 'model': '', 'name': 'FSA-0', 'serial_number': 'DCA17EE342A8', 'driver_version': '0.0.2.1', 'firmware_version': '2.13.2', 'connect_mode': 'ETH', 'mac_address': 'A8:42:E3:7E:A1:DF', 'ip_address': '192.168.137.101', 'IP': '192.168.137.101', 'DHCP_enable': False, 'SSID': 'fftai-6', 'password': 'fftai2015', 'static_IP': [192, 168, 137, 101], 'gateway': [192, 168, 137, 1], 'subnet_mask': [255, 255, 255, 0], 'dns_1': [114, 114, 114, 114], 'dns_2': [8, 8, 8, 8], 'OTAstatus': 'HTTP_UPDATE_IDLE', 'OTADriverstatus': 'HTTP_UPDATE_DRIVER_IDLE'}

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

Lookup Absolute Encoder

Lookup Absolute Encoder

This script, lookup_abs_encoder.py, showcases how to utilize the FSA (Fourier Smart Actuator) SDK to discover encoders on the network, retrieve their communication roots, and filter out those with the type “AbsEncoder.” It is part of the FSA SDK’s collection of example scripts.

Code Description

The script performs the following tasks:

  1. Discovers FSA actuators on the network using the broadcast_func function.

  2. Retrieves and prints the communication roots of all detected actuators.

  3. Filters out actuators with the type “AbsEncoder” and prints their IP addresses.

Output Parameters

The script prints the following information:

  • Communication Root List (comm_root_list): Represents the communication roots of all FSA actuators.

  • AbsEncoder IP List (filter_ip_list): Contains the IP addresses of FSA actuators with the filter type of “AbsEncoder.”

Usage

To run the lookup_abs_encoder.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing lookup_abs_encoder.py.

  4. Run the script using the following command:

python lookup_abs_encoder.py

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_lookup_abs_encoder.py
File not exist:  config.json
[2024.01.27 11:12:24.121.031]  Info:    FSA start listening for broadcast...
[2024.01.27 11:12:24.122.027]  Info:    FSA start listening for broadcast...


[2024.01.27 11:12:24.123.517]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 11:12:26.337.814]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/", "property": ""}
[2024.01.27 11:12:26.339.932]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/","property":"","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101","DHCP_enable":false,"SSID":"fftai-6","password":"fftai2015","static_IP":[192,168,137,101],"gateway":[192,168,137,1],"subnet_mask":[255,255,255,0],"dns_1":[114,114,114,114],"dns_2":[8,8,8,8],"OTAstatus":"HTTP_UPDATE_IDLE","OTADriverstatus":"HTTP_UPDATE_DRIVER_IDLE"}
The communication root list is:  [{'status': 'OK', 'reqTarget': '/', 'property': '', 'type': 'Actuator', 'model': '', 'name': 'FSA-0', 'serial_number': 'DCA17EE342A8', 'driver_version': '0.0.2.1', 'firmware_version': '2.13.2', 'connect_mode': 'ETH', 'mac_address': 'A8:42:E3:7E:A1:DF', 'ip_address': '192.168.137.101', 'IP': '192.168.137.101', 'DHCP_enable': False, 'SSID': 'fftai-6', 'password': 'fftai2015', 'static_IP': [192, 168, 137, 101], 'gateway': [192, 168, 137, 1], 'subnet_mask': [255, 255, 255, 0], 'dns_1': [114, 114, 114, 114], 'dns_2': [8, 8, 8, 8], 'OTAstatus': 'HTTP_UPDATE_IDLE', 'OTADriverstatus': 'HTTP_UPDATE_DRIVER_IDLE'}]


The AbsEncoder ip list is:  []

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

Lookup Actuator

Lookup Actuator

The script lookup_actuator.py demonstrates how to utilize the FSA (Fourier Smart Actuator) SDK to discover FSA actuators on the network, retrieve their communication roots, and filter out those with the type “Actuator.” It is part of the FSA SDK’s collection of example scripts.

Code Description

The script performs the following tasks:

  1. Discovers FSA actuators on the network using the broadcast_func function.

  2. Retrieves and prints the communication roots of all detected actuators.

  3. Filters out actuators with the type “Actuator” and prints their IP addresses.

Output Parameters

The script prints the following information:

  • Communication Root List (comm_root_list): Represents the communication roots of all FSA actuators.

  • Actuator IP List (filter_ip_list): Contains the IP addresses of FSA actuators with the type “Actuator.”

Usage

To run the lookup_actuator.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing lookup_actuator.py.

  4. Run the script using the following command:

python lookup_actuator.py

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_lookup_actuator.py
File not exist:  config.json
[2024.01.27 11:13:22.685.098]  Info:    FSA start listening for broadcast...
[2024.01.27 11:13:22.686.095]  Info:    FSA start listening for broadcast...


[2024.01.27 11:13:22.688.428]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 11:13:24.901.941]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/", "property": ""}
[2024.01.27 11:13:24.903.943]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/","property":"","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101","DHCP_enable":false,"SSID":"fftai-6","password":"fftai2015","static_IP":[192,168,137,101],"gateway":[192,168,137,1],"subnet_mask":[255,255,255,0],"dns_1":[114,114,114,114],"dns_2":[8,8,8,8],"OTAstatus":"HTTP_UPDATE_IDLE","OTADriverstatus":"HTTP_UPDATE_DRIVER_IDLE"}
The communication root list is:  [{'status': 'OK', 'reqTarget': '/', 'property': '', 'type': 'Actuator', 'model': '', 'name': 'FSA-0', 'serial_number': 'DCA17EE342A8', 'driver_version': '0.0.2.1', 'firmware_version': '2.13.2', 'connect_mode': 'ETH', 'mac_address': 'A8:42:E3:7E:A1:DF', 'ip_address': '192.168.137.101', 'IP': '192.168.137.101', 'DHCP_enable': False, 'SSID': 'fftai-6', 'password': 'fftai2015', 'static_IP': [192, 168, 137, 101], 'gateway': [192, 168, 137, 1], 'subnet_mask': [255, 255, 255, 0], 'dns_1': [114, 114, 114, 114], 'dns_2': [8, 8, 8, 8], 'OTAstatus': 'HTTP_UPDATE_IDLE', 'OTADriverstatus': 'HTTP_UPDATE_DRIVER_IDLE'}]


The Actuator ip list is:  ['192.168.137.101']

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

Lookup CtrlBox

Lookup CtrlBox

The script lookup_ctrlbox.py demonstrates how to use the FSA (Fourier Smart Actuator) SDK to discover FSA devices on the network, retrieve their communication roots, and filter out those with the type “CtrlBox.”

CtrlBox is a device similar to a hub which power cable and network cable of FSA connect to, the STM32F405 microcontroller of robot also connects to.

Code Description

The script performs the following tasks:

  1. Discovers FSA devices on the network using the broadcast_func function.

  2. Retrieves and prints the communication roots of all detected devices.

  3. Filters out devices with the type “CtrlBox” and prints their IP addresses.

Output Parameters

The script prints the following information:

  • Communication Root List (comm_root_list): Represents the communication roots of all FSA devices.

  • CtrlBox IP List (filter_ip_list): Contains the IP addresses of FSA devices with the type “CtrlBox.”

Usage

To run the lookup_ctrlbox.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing lookup_ctrlbox.py.

  4. Run the script using the following command:

python lookup_ctrlbox.py

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_lookup_ctrlbox.py
File not exist:  config.json
[2024.01.27 11:14:42.167.092]  Info:    FSA start listening for broadcast...
[2024.01.27 11:14:42.168.089]  Info:    FSA start listening for broadcast...


[2024.01.27 11:14:42.169.090]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 11:14:44.380.365]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/", "property": ""}
[2024.01.27 11:14:44.383.528]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/","property":"","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101","DHCP_enable":false,"SSID":"fftai-6","password":"fftai2015","static_IP":[192,168,137,101],"gateway":[192,168,137,1],"subnet_mask":[255,255,255,0],"dns_1":[114,114,114,114],"dns_2":[8,8,8,8],"OTAstatus":"HTTP_UPDATE_IDLE","OTADriverstatus":"HTTP_UPDATE_DRIVER_IDLE"}
The communication root list is:  [{'status': 'OK', 'reqTarget': '/', 'property': '', 'type': 'Actuator', 'model': '', 'name': 'FSA-0', 'serial_number': 'DCA17EE342A8', 'driver_version': '0.0.2.1', 'firmware_version': '2.13.2', 'connect_mode': 'ETH', 'mac_address': 'A8:42:E3:7E:A1:DF', 'ip_address': '192.168.137.101', 'IP': '192.168.137.101', 'DHCP_enable': False, 'SSID': 'fftai-6', 'password': 'fftai2015', 'static_IP': [192, 168, 137, 101], 'gateway': [192, 168, 137, 1], 'subnet_mask': [255, 255, 255, 0], 'dns_1': [114, 114, 114, 114], 'dns_2': [8, 8, 8, 8], 'OTAstatus': 'HTTP_UPDATE_IDLE', 'OTADriverstatus': 'HTTP_UPDATE_DRIVER_IDLE'}]


The CtrlBox ip list is:  []

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA devices are accessible.

OTA

Over-the-Air (OTA) Update

The script ota.py demonstrates how to use the FSA (Fourier Smart Actuator) SDK to perform Over-the-Air (OTA) updates on FSA Actuators. It is part of the FSA SDK’s collection of example scripts.

Code Description

The script performs the following tasks:

  1. Discovers FSA Actuators on the network using the broadcast_func_with_filter function with the filter type set to “Actuator.”

  2. Initiates an Over-the-Air (OTA) update for each detected Actuator using the ota function.

Usage

To run the ota.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing ota.py.

  4. Run the script using the following command:

python ota.py

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_ota.py
File not exist:  config.json
[2024.01.27 11:16:01.351.346]  Info:    FSA start listening for broadcast...
[2024.01.27 11:16:01.352.344]  Info:    FSA start listening for broadcast...


[2024.01.27 11:16:01.354.588]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 11:16:03.557.628]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/ota", "property": ""}
[2024.01.27 11:16:03.559.579]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/ota","property":"","OTAstatus":"HTTP_UPDATE_START"}

Note

  • Over-the-Air (OTA) updates may take some time, and the script provides a delay (time.sleep(1)) to allow the updates to complete.

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA Actuators are accessible.

  3. Confirm that the Actuators support Over-the-Air (OTA) updates and are in a state ready for updates.

OTA Cloud

Cloud-Based Over-the-Air (OTA) Update

The script ota_cloud.py demonstrates how to use the FSA (Fourier Smart Actuator) SDK to perform Cloud-Based Over-the-Air (OTA) updates on FSA Actuators. It is part of the FSA SDK’s collection of example scripts.

Code Description

The script performs the following tasks:

  1. Discovers FSA Actuators on the network using the broadcast_func_with_filter function with the filter type set to “Actuator.”

  2. Initiates a Cloud-Based Over-the-Air (OTA) update for each detected Actuator using the ota_cloud function.

Usage

To run the ota_cloud.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing ota_cloud.py.

  4. Run the script using the following command:

python ota_could.py

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_ota_cloud.py
File not exist:  config.json
[2024.01.27 11:16:48.287.669]  Info:    FSA start listening for broadcast...
[2024.01.27 11:16:48.288.666]  Info:    FSA start listening for broadcast...


[2024.01.27 11:16:48.292.459]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 11:16:50.507.701]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/ota_cloud", "property": ""}
[2024.01.27 11:16:50.509.459]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/ota_cloud","property":"","OTAstatus":"HTTP_UPDATE_START"}

Note

  • Cloud-Based Over-the-Air (OTA) updates may take some time, and the script provides a delay (time.sleep(1)) to allow the updates to complete.

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA Actuators are accessible.

  3. Confirm that the Actuators support Cloud-Based Over-the-Air (OTA) updates and are in a state ready for updates.

OTA Driver

Over-The-Air (OTA) Update for FSA Driver

The script ota_driver.py showcases how to utilize the FSA (Fourier Smart Actuator) SDK for performing Over-The-Air (OTA) updates specifically for the stable version of the FSA driver. This script is part of the FSA SDK’s example scripts collection.

Code Overview

The script accomplishes the following tasks:

  1. Locates FSA Actuators on the network using the broadcast_func_with_filter function with the filter type set to “Actuator.”

  2. Initiates an Over-The-Air (OTA) update for the stable version of the FSA driver on each identified Actuator using the ota_driver function.

Usage Instructions

Follow these steps to run the ota_driver.py script:

  1. Ensure that your Python environment is set up and the FSA SDK is installed as detailed in the Quickstart Guide.

  2. Establish a connection to the FSA; refer to Connecting to FSA for comprehensive instructions.

  3. Open a terminal and navigate to the directory containing ota_driver.py.

  4. Execute the script with the following command:

python ota_driver.py

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_ota_driver.py
File not exist:  config.json
[2024.01.27 11:21:50.690.712]  Info:    FSA start listening for broadcast...
[2024.01.27 11:21:50.691.709]  Info:    FSA start listening for broadcast...


[2024.01.27 11:21:50.693.703]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 11:21:52.894.470]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/ota_driver", "property": ""}
[2024.01.27 11:21:52.896.025]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/ota_driver","property":"","OTADriverstatus":"HTTP_DRIVER_UPDATE_START"}

Note

  • The OTA update process might take some time. The script incorporates a delay (time.sleep(1)) to allow sufficient time for the updates to conclude.

Common Issues

If you encounter any challenges during script execution, consider the following:

  1. Verify that you are employing a compatible Python version as indicated in the Quickstart Guide.

  2. Confirm that your network is properly configured, and the FSA Actuators are accessible.

  3. Ensure that the Actuators support Over-The-Air (OTA) updates and are in an update-ready state.

OTA Driver Cloud

Over-The-Air (OTA) Update for FSA Driver (Cloud Version)

The script ota_driver_cloud.py demonstrates how to perform an Over-The-Air (OTA) update for the FSA (Fourier Smart Actuator) driver from the cloud. This script is part of the FSA SDK’s example scripts collection.

Code Overview

The script accomplishes the following tasks:

  1. Discovers FSA Actuators on the network using the broadcast_func_with_filter function with the filter type set to “Actuator.”

  2. Initiates an Over-The-Air (OTA) update for the FSA driver on each identified Actuator using the ota_driver_cloud function.

Usage Instructions

Follow these steps to run the ota_driver_cloud.py script:

  1. Ensure that your Python environment is set up, and the FSA SDK is installed as detailed in the Quickstart Guide.

  2. Establish a connection to the FSA; refer to Connecting to FSA for comprehensive instructions.

  3. Open a terminal and navigate to the directory containing ota_driver_cloud.py.

  4. Execute the script with the following command:

python ota_driver_cloud.py

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_ota_driver_cloud.py
File not exist:  config.json
[2024.01.27 11:22:41.882.063]  Info:    FSA start listening for broadcast...
[2024.01.27 11:22:41.883.094]  Info:    FSA start listening for broadcast...


[2024.01.27 11:22:41.886.947]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 11:22:44.097.146]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/ota_driver_cloud", "property": ""}
[2024.01.27 11:22:44.099.351]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/ota_driver_cloud","property":"","OTADriverstatus":"HTTP_DRIVER_UPDATE_START"}

Note

  • The OTA update process may take some time. The script incorporates a delay (time.sleep(1)) to allow sufficient time for the updates to conclude.

Common Issues

If you encounter any challenges during script execution, consider the following:

  1. Verify that you are employing a compatible Python version as indicated in the Quickstart Guide.

  2. Confirm that your network is properly configured, and the FSA Actuators are accessible.

  3. Ensure that the Actuators support Over-The-Air (OTA) updates and are in an update-ready state.

Note: This script specifically targets the FSA driver for Over-The-Air updates from the cloud.

OTA Driver Test

Over-The-Air (OTA) Update for Testing Version of FSA Driver

The script ota_driver_test.py is designed to facilitate Over-The-Air (OTA) updates for the testing version of the FSA (Fourier Smart Actuator) driver. This script is part of the FSA SDK’s collection of example scripts.

Code Description

The script performs the following operations:

  1. Discovers FSA Actuators on the network using the broadcast_func_with_filter function with the filter type set to “Actuator.”

  2. Initiates an Over-The-Air (OTA) update for the testing version of the FSA driver on each identified Actuator using the ota_driver_test function.

Usage Instructions

Follow these steps to execute the ota_driver_test.py script:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as outlined in the Quickstart Guide.

  2. Establish a connection to the FSA. Refer to Connecting to FSA for detailed instructions.

  3. Open a terminal and navigate to the directory containing ota_driver_test.py.

  4. Run the script using the following command:

python ota_driver_test.py

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_ota_driver_test.py
File not exist:  config.json
[2024.01.27 11:23:44.162.996]  Info:    FSA start listening for broadcast...
[2024.01.27 11:23:44.163.993]  Info:    FSA start listening for broadcast...


[2024.01.27 11:23:44.168.016]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 11:23:46.376.676]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/ota_driver_test", "property": ""}
[2024.01.27 11:23:46.378.690]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/ota_driver_test","property":"","OTADriverstatus":"HTTP_DRIVER_UPDATE_START"}

Important Note

  • The Over-The-Air (OTA) update process may require some time to complete. The script includes a delay (time.sleep(1)) to allow sufficient time for the update test to conclude.

Common Issues

If you encounter any challenges while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python, as recommended in the Quickstart Guide.

  2. Verify that your network is correctly configured, and the FSA Actuators are reachable.

  3. Confirm that the Actuators support Over-The-Air (OTA) updates and are in an update-ready state.

Note: This script specifically targets the testing version of the FSA driver for Over-The-Air update tests.

OTA Test

Over-The-Air (OTA) Testing Update Script

The script ota_test.py is designed for conducting Over-The-Air (OTA) updates on the testing version of Fourier Smart Actuator (FSA). This script is part of the FSA SDK’s example scripts collection.

Code Description

The script performs the following tasks:

  1. Discovers FSA Actuators on the network using the broadcast_func_with_filter function with the filter type set to “Actuator.”

  2. Initiates an Over-The-Air (OTA) update for the testing version on each identified Actuator using the ota_test function.

Usage Instructions

Follow these steps to execute the ota_test.py script:

  1. Ensure that you have set up your Python environment and installed the FSA SDK, as outlined in the Quickstart Guide.

  2. Connect to the FSA. Refer to Connecting to FSA for detailed connection instructions.

  3. Open a terminal and navigate to the directory containing ota_test.py.

  4. Run the script using the following command:

python ota_test.py

Running Result

Important Note

  • The Over-The-Air (OTA) testing update process may require some time to complete. The script includes a delay (time.sleep(1)) to allow sufficient time for the update to conclude.

Common Issues

If you encounter any challenges while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python, as recommended in the Quickstart Guide.

  2. Verify that your network is correctly configured, and the FSA Actuators are reachable.

  3. Confirm that the Actuators support Over-The-Air (OTA) updates and are in an OTA update-ready state.

Note: This script is specifically designed for conducting Over-The-Air (OTA) updates on the testing version of Fourier Smart Actuator (FSA).

Reboot

Reboot

The script reboot.py is part of the FSA SDK’s example scripts collection, designed to reboot both the Fourier Smart Actuators (FSAs) and associated encoders found on the network.

Code Description

The script performs the following tasks:

  1. Discovers both FSA Actuators and associated encoders on the network using the broadcast_func function.

  2. Initiates a reboot operation on each identified Actuator using the reboot function.

  3. Initiates a reboot operation on each identified encoder using the reboot function.

Usage Instructions

Follow these steps to execute the reboot.py script:

  1. Ensure that you have set up your Python environment and installed the FSA SDK, as outlined in the Quickstart Guide.

  2. Connect to the FSA. Refer to Connecting to FSA for detailed connection instructions.

  3. Open a terminal and navigate to the directory containing reboot.py.

  4. Run the script using the following command:

python reboot.py

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_reboot.py
File not exist:  config.json
[2024.01.27 11:29:24.161.194]  Info:    FSA start listening for broadcast...
[2024.01.27 11:29:24.161.520]  Info:    FSA start listening for broadcast...


[2024.01.27 11:29:24.165.215]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 11:29:26.372.024]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/reboot", "property": ""}
[2024.01.27 11:29:26.374.038]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/reboot","property":""}

Note

  • The reboot operation may result in a temporary loss of connection to the Actuators and encoders as they restart.

Common Issues

If you encounter any challenges while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python, as recommended in the Quickstart Guide.

  2. Verify that your network is correctly configured, and the FSA Actuators and encoders are reachable.

  3. Confirm that the Actuators and encoders are in a state where rebooting is acceptable.

Note: This script is specifically designed for initiating a reboot operation on Fourier Smart Actuators (FSAs) and their associated encoders.

Reboot Actuator

Reboot Actuator

The script reboot_actuator.py is part of the FSA SDK’s example scripts collection, designed to reboot Fourier Smart Actuators (FSAs) found on the network.

Code Description

The script performs the following tasks:

  1. Discovers FSA Actuators on the network using the broadcast_func_with_filter function, filtering based on the actuator type.

  2. Initiates a reboot operation on each identified Actuator using the reboot function.

Usage Instructions

Follow these steps to execute the reboot_actuator.py script:

  1. Ensure that you have set up your Python environment and installed the FSA SDK, as outlined in the Quickstart Guide.

  2. Connect to the FSA. Refer to Connecting to FSA for detailed connection instructions.

  3. Open a terminal and navigate to the directory containing reboot_actuator.py.

  4. Run the script using the following command:

python reboot_actuator.py

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_reboot_actuator.py
File not exist:  config.json
[2024.01.27 11:31:58.273.784]  Info:    FSA start listening for broadcast...
[2024.01.27 11:31:58.274.781]  Info:    FSA start listening for broadcast...


[2024.01.27 11:31:58.277.775]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 11:32:00.490.470]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/reboot", "property": ""}
[2024.01.27 11:32:00.492.316]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/reboot","property":""}

Important Note

  • The reboot operation may result in a temporary loss of connection to the Actuators as they restart.

Common Issues

If you encounter any challenges while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python, as recommended in the Quickstart Guide.

  2. Verify that your network is correctly configured, and the FSA Actuators are reachable.

  3. Confirm that the Actuators are in a state where rebooting is acceptable.

Note: This script is specifically designed for initiating a reboot operation on Fourier Smart Actuators (FSAs).

Save Control Configuration

Save Control Configuration

The script save_ctrl_config.py is part of the FSA SDK’s example scripts collection, designed to save the control configuration of Fourier Smart Actuators (FSAs) found on the network.

It 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 to persistently store the current setup for future use or reference.

Code Description

The script performs the following tasks:

  1. Discovers FSA Actuators on the network using the broadcast_func_with_filter function, filtering based on the actuator type.

  2. Saves the communication configuration of each identified Actuator using the save_config function.

Usage Instructions

Follow these steps to execute the save_ctrl_config.py script:

  1. Ensure that you have set up your Python environment and installed the FSA SDK, as outlined in the Quickstart Guide.

  2. Connect to the FSA. Refer to Connecting to FSA for detailed connection instructions.

  3. Open a terminal and navigate to the directory containing save_ctrl_config.py.

  4. Run the script using the following command:

python save_ctrl_config.py

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_ctrl_config_save.py
File not exist:  config.json
[2024.01.27 10:39:18.561.988]  Info:    FSA start listening for broadcast...
[2024.01.27 10:39:18.562.987]  Info:    FSA start listening for broadcast...


[2024.01.27 10:39:18.564.982]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 10:39:20.773.264]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/config", "property": "save"}
[2024.01.27 10:39:20.864.214]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/config","property":"save"}

Import Note

The control configuration of actuator, motor, endocer and pid cannot be saved unless the values of following parameters are set to “1” in the set_flag_of_operation.py

  • ‘flag_do_use_store_actuator_param’: fi_fsa.FSAFlagState.SET, (FSAFlagState.SET=1)

  • ‘flag_do_use_store_motor_param’: fi_fsa.FSAFlagState.SET, (FSAFlagState.SET=1)

  • ‘flag_do_use_store_encoder_param’: fi_fsa.FSAFlagState.SET, (FSAFlagState.SET=1)

  • ‘flag_do_use_store_pid_param’: fi_fsa.FSAFlagState.SET, (FSAFlagState.SET=1)

Common Issues

If you encounter any challenges while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python, as recommended in the Quickstart Guide.

  2. Verify that your network is correctly configured, and the FSA Actuators are reachable.

Note: This script is specifically designed for saving the control configuration of Fourier Smart Actuators (FSAs).

Set Calibrate Encoder

Save Control Configuration

The script save_ctrl_config.py is part of the FSA SDK’s example scripts collection, designed to save the control configuration of Fourier Smart Actuators (FSAs) found on the network.

It 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 to persistently store the current setup for future use or reference.

Code Description

The script performs the following tasks:

  1. Discovers FSA Actuators on the network using the broadcast_func_with_filter function, filtering based on the actuator type.

  2. Saves the communication configuration of each identified Actuator using the save_config function.

Usage Instructions

Follow these steps to execute the save_ctrl_config.py script:

  1. Ensure that you have set up your Python environment and installed the FSA SDK, as outlined in the Quickstart Guide.

  2. Connect to the FSA. Refer to Connecting to FSA for detailed connection instructions.

  3. Open a terminal and navigate to the directory containing save_ctrl_config.py.

  4. Run the script using the following command:

python save_ctrl_config.py

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_ctrl_config_save.py
File not exist:  config.json
[2024.01.27 10:39:18.561.988]  Info:    FSA start listening for broadcast...
[2024.01.27 10:39:18.562.987]  Info:    FSA start listening for broadcast...


[2024.01.27 10:39:18.564.982]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 10:39:20.773.264]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/config", "property": "save"}
[2024.01.27 10:39:20.864.214]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/config","property":"save"}

Import Note

The control configuration of actuator, motor, endocer and pid cannot be saved unless the values of following parameters are “SET” in the set_flag_of_operation.py

  • ‘flag_do_use_store_actuator_param’: fi_fsa.FSAFlagState.SET,

  • ‘flag_do_use_store_motor_param’: fi_fsa.FSAFlagState.SET,

  • ‘flag_do_use_store_encoder_param’: fi_fsa.FSAFlagState.SET,

  • ‘flag_do_use_store_pid_param’: fi_fsa.FSAFlagState.SET,

Common Issues

If you encounter any challenges while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python, as recommended in the Quickstart Guide.

  2. Verify that your network is correctly configured, and the FSA Actuators are reachable.

Note: This script is specifically designed for saving the control configuration of Fourier Smart Actuators (FSAs).

Set Communication Configuration

Set Communication Configuration

The script set_comm_config.py is part of the FSA SDK’s example scripts collection and is designed to set the communication configuration of Fourier Smart Actuators (FSAs) found on the network.

Code Description

The script performs the following tasks:

  1. Discovers FSA Actuators on the network using the broadcast_func_with_filter function, filtering based on the actuator type.

  2. Retrieves the existing communication configuration of each identified Actuator using the get_comm_config function.

  3. Sets a new communication configuration for each Actuator using the set_comm_config function. The new configuration includes parameters such as DHCP_enable, SSID, password, static_IP, gateway, subnet_mask, dns_1, and dns_2.

  4. Retrieves and prints the updated communication configuration of each Actuator.

  5. Reboots each Actuator to apply the new communication configuration.

Usage Instructions

Follow these steps to execute the set_comm_config.py script:

  1. Ensure that you have set up your Python environment and installed the FSA SDK, as outlined in the Quickstart Guide.

  2. Connect to the FSA. Refer to Connecting to FSA for detailed connection instructions.

  3. Open a terminal and navigate to the directory containing set_comm_config.py.

  4. Run the script using the following command:

python set_comm_config.py

Important Note

  • Before running the script, ensure that the provided parameters for communication configuration (SSID, password, etc.) are appropriate for your network.

  • Setting DHCP_enable to False is necessary when configuring a static IP. Ensure the correctness of the provided static IP, gateway, subnet mask, and DNS values.

Common Issues

If you encounter any challenges while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python, as recommended in the Quickstart Guide.

  2. Verify that your network is correctly configured, and the FSA Actuators are reachable.

Note: This script is specifically designed for setting the communication configuration of Fourier Smart Actuators (FSAs).

Set Control Parameter

Set Control Parameters Script

The script set_control_param.py is part of the FSA SDK’s example scripts collection. Its primary purpose is to set control parameters for Fourier Smart Actuators (FSAs) found on the network.

Code Description

The script performs the following tasks:

  1. Discovers FSA Actuators on the network using the broadcast_func_with_filter function, filtering based on the actuator type.

  2. Sets new control parameters for each Actuator using the set_control_param function. The control parameters include motor_max_speed, motor_max_acceleration, and motor_max_current.

  3. Retrieves and prints the updated control parameters of each Actuator using the get_control_param function.

  4. Reboots each Actuator to apply the new control parameters.

Usage Instructions

Follow these steps to execute the set_control_param.py script:

  1. Ensure that you have set up your Python environment and installed the FSA SDK, as outlined in the Quickstart Guide.

  2. Connect to the FSA. Refer to Connecting to FSA for detailed connection instructions.

  3. Open a terminal and navigate to the directory containing set_control_param.py.

  4. Set the value of motor_max_speed, motor_max_acceleration, and motor_max_current.

  5. Run the script using the following command:

python set_control_param.py

Important Note

  • Before running the script, ensure that the provided control parameters (motor_max_speed, motor_max_acceleration, and motor_max_current) are appropriate for your application.

  • It’s recommended to understand the impact of the chosen control parameters on the actuator’s behavior.

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python, as recommended in the Quickstart Guide.

  2. Verify that your network is correctly configured, and the FSA Actuators are reachable.

Set Immediate Control Parameter

Set Immediate Control Parameters Script

The script set_control_param_imm.py is part of the FSA SDK’s example scripts collection. Its primary purpose is to set immediate control parameters for Fourier Smart Actuators (FSAs) found on the network.

Immediate control parameters refer to the control parameters that can be adjusted and applied to the actuator immediately. These parameters affect the actuator’s behavior in real-time. They can be adjusted dynamically, and the changes take effect immediately. This is useful for tuning the performance of the actuator in real-time without the need for a system restart.

Code Description

The script performs the following tasks:

  1. Discovers FSA Actuators on the network using the broadcast_func_with_filter function, filtering based on the actuator type.

  2. Retrieves and prints the current control parameters of each Actuator using the get_control_param function.

  3. Sets new immediate control parameters for each Actuator using the set_control_param_imm function. The immediate control parameters include motor_max_speed_imm, motor_max_acceleration_imm, and motor_max_current_imm.

  4. Retrieves and prints the updated control parameters of each Actuator using the get_control_param function.

Usage Instructions

Follow these steps to execute the set_control_param_imm.py script:

  1. Ensure that you have set up your Python environment and installed the FSA SDK, as outlined in the Quickstart Guide.

  2. Connect to the FSA. Refer to Connecting to FSA for detailed connection instructions.

  3. Open a terminal and navigate to the directory containing set_control_param_imm.py.

  4. Set the value for the parameters: motor_max_speed_imm, motor_max_acceleration_imm, and motor_max_current_imm.

    for i in range(len(server_ip_list)):
                dict = {
                 # set the value for the following parameters:
                    'motor_max_speed_imm': 3000,
                    'motor_max_acceleration_imm': 60000,
                    'motor_max_current_imm': 8,
                }
    
  5. Run the script using the following command:

python set_control_param_imm.py

Important Note

  • Before running the script, ensure that the provided immediate control parameters (motor_max_speed_imm, motor_max_acceleration_imm, and motor_max_current_imm) are appropriate for your application.

  • Immediate control parameters are applied instantly without the need for a reboot. Be cautious with the values to prevent undesired effects on the actuator’s behavior.

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python, as recommended in the Quickstart Guide.

  2. Verify that your network is correctly configured, and the FSA Actuators are reachable.

Set Control Configuration

Set Disable

Set Disable

This script is part of the Fourier Smart Actuator (FSA) SDK’s collection of example scripts. It is used to disable all detected Actuators in the network. The script performs the following actions:

Code Description

  1. Detect Actuators:

    • Uses fi_fsa.broadcast_func_with_filter() to discover Actuators on the network based on the specified filter type (“Actuator”).

  2. Disable All Actuators:

    • For each detected Actuator, it sends a command to disable the Actuator using fi_fsa.set_disable().

  3. Wait for Confirmation:

    • Prints a message and waits for 1 second to allow time for the Actuators to disable.

Usage Instructions

To run the set_disable.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing set_disable.py.

  4. Run the script using the following command:

    python set_disable.py
    

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_disable_set.py
File not exist:  config.json
[2024.01.27 10:41:22.641.469]  Info:    FSA start listening for broadcast...
[2024.01.27 10:41:22.642.466]  Info:    FSA start listening for broadcast...


[2024.01.27 10:41:22.645.476]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 10:41:24.848.588]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/control_word", "property": "", "control_word": 6}
[2024.01.27 10:41:24.850.241]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/control_word","property":""}

Important Note

Disabling an Actuator will typically stop its motion and set it in a safe state. Ensure that you understand the consequences of disabling an Actuator before running this script.

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

Set Enable

Set Enable

This script is part of the Fourier Smart Actuator (FSA) SDK’s collection of example scripts. It is used to enable all detected Actuators in the network.

Code Description

  1. Detect Actuators:

    • Uses fi_fsa.broadcast_func_with_filter() to discover Actuators on the network based on the specified filter type (“Actuator”).

  2. Enable All Actuators:

    • For each detected Actuator, it sends a command to enable the Actuator using fi_fsa.set_enable().

  3. Wait for Confirmation:

    • Prints a message and waits for 1 second to allow time for the Actuators to enable.

Usage Instructions

To run the set_enable.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing set_enable.py.

  4. Run the script using the following command:

    python set_enable.py
    

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_enable_set.py
File not exist:  config.json
[2024.01.27 10:42:18.987.722]  Info:    FSA start listening for broadcast...
[2024.01.27 10:42:18.988.597]  Info:    FSA start listening for broadcast...


[2024.01.27 10:42:18.991.089]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 10:42:21.203.351]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/control_word", "property": "", "control_word": 15}
[2024.01.27 10:42:21.204.349]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/control_word","property":""}

Important Note

Enabling an Actuator will allow it to move according to its control parameters. Ensure that you understand the consequences of enabling an Actuator before running this script.

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

Set Encrypt

Set Encrypt

This script is part of the Fourier Smart Actuator (FSA) SDK’s collection of example scripts. It is used to set encryption parameters for all detected Actuators in the network.

Code Description

  1. Detect Actuators:

    • Uses fi_fsa.broadcast_func_with_filter() to discover Actuators on the network based on the specified filter type (“Actuator”).

  2. Set Encryption Parameters:

    • For each detected Actuator, it sends a command to set encryption parameters using fi_fsa.encrypt().

    • In this script, a dictionary with a username and password is provided for encryption.

  3. Reboot Actuators:

    • Reboots each Actuator after setting encryption parameters using fi_fsa.reboot().

Usage Instructions

To run the set_encrypt.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing set_encrypt.py.

  4. Set a username and password.

      for i in range(len(server_ip_list)):
                dict = {
                    'username': "test", # set a username here
                    'password': "test", # set a password here
                }
                fi_fsa.encrypt(server_ip_list[i], dict)
    
  5. Run the script using the following command:

    python set_encrypt.py
    

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_set_encrypt.py
File not exist:  config.json
[2024.01.27 11:42:43.609.990]  Info:    FSA start listening for broadcast...
[2024.01.27 11:42:43.610.987]  Info:    FSA start listening for broadcast...


[2024.01.27 11:42:43.613.207]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 11:42:45.813.762]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/encrypt", "property": "", "username": "test", "password": "test"}
[2024.01.27 11:42:45.815.127]  Info:    Received from ('192.168.137.101', 2334):{"status":"FAIL","reqTarget":"/encrypt","property":""}
[2024.01.27 11:42:45.815.127]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/reboot", "property": ""}
[2024.01.27 11:42:45.816.278]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/reboot","property":""}

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

Set Flag of Operation

Set Flag of Operation

This script is part of the Fourier Smart Actuator (FSA) SDK’s collection of example scripts. It is designed to set various flags of operation for all detected Actuators in the network.

Code Description

  1. Detect Actuators:

    • Uses fi_fsa.broadcast_func_with_filter() to discover Actuators on the network based on the specified filter type (“Actuator”).

  2. Get Current Configuration:

    • Retrieves the current communication configuration of each detected Actuator using fi_fsa.get_config().

  3. Set Flags of Operation:

    • For each Actuator, it sends a command to set flags of operation using fi_fsa.set_flag_of_operation().

    • In this script, various flags related to storing Actuator parameters, motor parameters, encoder parameters, and PID parameters are set to FSAFlagState.SET. You can customize these flags based on your requirements.

  4. Get Updated Configuration:

    • Retrieves the updated communication configuration of each Actuator using fi_fsa.get_config() after setting the flags.

  5. Reboot Actuators:

    • Reboots each Actuator after setting flags using fi_fsa.reboot().

Usage Instructions

To run the set_flag_of_operation.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing set_flag_of_operation.py.

  4. Set the operation flag value by editing the set_flag_of_operation.py.

    for i in range(len(server_ip_list)):
                dict = {
                 # set the value for following parameters. fi_fsa.FSAFlagState.SET=1, fi_fsa.FSAFlagState.CLEAR=0
                    'flag_do_use_store_actuator_param': fi_fsa.FSAFlagState.SET,
                    'flag_do_use_store_motor_param': fi_fsa.FSAFlagState.SET,
                    'flag_do_use_store_encoder_param': fi_fsa.FSAFlagState.SET,
                    'flag_do_use_store_pid_param': fi_fsa.FSAFlagState.CLEAR,
    
                    # 'flag_do_use_store_actuator_param': fi_fsa.FSAFlagState.SET,
                    # 'flag_do_use_store_motor_param': fi_fsa.FSAFlagState.SET,
                    # 'flag_do_use_store_encoder_param': fi_fsa.FSAFlagState.SET,
                    # 'flag_do_use_store_pid_param': fi_fsa.FSAFlagState.SET,
                }
    
  5. Run the script using the following command:

    python set_flag_of_operation.py
    

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_flag_of_operation_set.py
File not exist:  config.json
[2024.01.27 10:44:28.637.633]  Info:    FSA start listening for broadcast...
[2024.01.27 10:44:28.638.630]  Info:    FSA start listening for broadcast...


[2024.01.27 10:44:28.640.429]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 10:44:30.847.959]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/flag_of_operation", "property": "", "flag_do_use_store_actuator_param": 0, "flag_do_use_store_motor_param": 0, "flag_do_use_store_encoder_param": 0, "flag_do_use_store_pid_param": 0}
[2024.01.27 10:44:30.938.333]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/flag_of_operation","property":""}


[2024.01.27 10:44:31.939.943]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/flag_of_operation", "property": ""}
[2024.01.27 10:44:31.941.947]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/flag_of_operation","property":"","flag_do_use_store_motor_param":0,"flag_do_use_store_pid_param":0}


[2024.01.27 10:44:31.943.310]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/reboot", "property": ""}
[2024.01.27 10:44:31.945.320]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/reboot","property":""}

Important Note

Setting flags of operation can influence the behavior of the Actuator. Make sure to understand the implications of the flags you are setting.

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

Set Home Offset

Set Home Offset

This script is part of the Fourier Smart Actuator (FSA) SDK’s collection of example scripts. It is designed to set the home offset for Actuators and provides functionality to retrieve the updated home offset values.

The “home offset” refers to an adjustment or offset value applied to the position of an actuator or motor when it is in its home position. The home position is a predefined reference point that the actuator returns to or starts from.

  • Home Position: The home position is a specific location or point that an actuator or motor is configured to consider as its starting or reference position. It’s a consistent and repeatable point in the motion system.

  • Home Offset: The home offset is a numerical value that represents the position offset from the defined home position. When an actuator is in its home position, the actual physical position might not align perfectly with the reference point due to mechanical tolerances or other factors. The home offset is used to compensate for this discrepancy.

For example, if an actuator is supposed to be at position 0 when at home, but due to mechanical variations, it is actually at position +5 units, the home offset would be +5. This offset is added to or subtracted from the actual position to determine the effective position relative to the home position.

Code Description

  1. Detect Actuators:

    • Uses fi_fsa.broadcast_func_with_filter() to discover Actuators on the network based on the specified filter type (“Actuator”).

  2. Set Home Offset:

    • Generates an array (home_offset) of the same length as the detected Actuators, with each element set to 10.

    • Iterates through each Actuator and sets the home offset using fi_fsa.set_home_offset().

  3. Get Updated Home Offset:

    • Retrieves the updated home offset of each Actuator using fi_fsa.get_home_offset().

  4. Reboot Actuators:

    • Reboots each Actuator using fi_fsa.reboot().

Usage Instructions

To run the set_home_offset.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing set_home_offset.py.

  4. Run the script using the following command:

    python set_home_offset.py
    

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_home_offset_set.py
File not exist:  config.json
[2024.01.27 10:58:28.493.875]  Info:    FSA start listening for broadcast...
[2024.01.27 10:58:28.493.875]  Info:    FSA start listening for broadcast...


[2024.01.27 10:58:28.495.873]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 10:58:30.711.961]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/home_offset", "home_offset": 10.0}
[2024.01.27 10:58:30.713.719]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/home_offset","property":null}


[2024.01.27 10:58:30.713.719]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/home_offset", "property": ""}
[2024.01.27 10:58:30.714.723]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/home_offset","property":"","home_offset":10}


[2024.01.27 10:58:30.714.723]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/reboot", "property": ""}
[2024.01.27 10:58:30.715.720]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/reboot","property":""}

Important Note

The home offset configuration will only endure if saved using the following script:

         for i in range(len(server_ip_list)):
             fi_fse.save_config(server_ip_list[i])

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

Set Home Position

Set Home Position

This script is part of the Fourier Smart Actuator (FSA) SDK’s collection of example scripts. It is designed to set the home position for Actuators.

The “home offset” refers to an adjustment or offset value applied to the position of an actuator or motor when it is in its home position. The home position is a predefined reference point that the actuator returns to or starts from.

  • Home Position: The home position is a specific location or point that an actuator or motor is configured to consider as its starting or reference position. It’s a consistent and repeatable point in the motion system.

  • Home Offset: The home offset is a numerical value that represents the position offset from the defined home position. When an actuator is in its home position, the actual physical position might not align perfectly with the reference point due to mechanical tolerances or other factors. The home offset is used to compensate for this discrepancy.

For example, if an actuator is supposed to be at position 0 when at home, but due to mechanical variations, it is actually at position +5 units, the home offset would be +5. This offset is added to or subtracted from the actual position to determine the effective position relative to the home position.

Code Description

  1. Detect Actuators:

    • Uses fi_fsa.broadcast_func_with_filter() to discover Actuators on the network based on the specified filter type (“Actuator”).

  2. Set Home Position:

    • Iterates through each Actuator and sets the home position using fi_fsa.set_home_position().

Usage Instructions

To run the set_home_position.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing set_home_position.py.

  4. Run the script using the following command:

    python set_home_position.py
    

Important Note

The home position is the reference point used by the Actuator to determine its current position.

During motor initialization, calibration pins mark the home position, and the set_home_position function is subsequently invoked to establish this marked home position, designating it as the starting point or reference point.

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

Set PID Parameter

Set PID Parameter

This script is part of the Fourier Smart Actuator (FSA) SDK’s collection of example scripts. It is designed to set the PID parameters for Actuators based on predefined values for different motor types.

Code Description

  1. Predefined Motor Types:

    • Defines a class SpeedParamList that contains predefined PID parameters for different motor types.

  2. Detect Actuators:

    • Uses fi_fsa.broadcast_func_with_filter() to detect Actuators on the network based on the specified filter type (“Actuator”).

  3. Set PID Parameters:

    • Iterates through each Actuator in the list.

    • Retrieves existing PID parameters using fi_fsa.get_pid_param().

    • Sets new PID parameters based on the predefined values in the SpeedParamList class using fi_fsa.set_pid_param().

  4. Reboot Actuators:

    • Reboots all Actuators to apply the changes.

Usage Instructions

To run the set_pid_param.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing set_pid_param.py.

  4. Set the PID in the SpeedParamList class by editing the set_pid_param.py:

    class SpeedParamList :
        #         Pole Frequency of Current Loop| Feedforward Gain |   KP   |   KI       |  Wc   |   Wo   |   B0   |0PI/1LADRC |SPD_FC|bandwidth
        MOTOR_NULL = [     2,          0.0,    0.1   ,  0.01      ,   0   ,   0    ,    0    ,   0      , 5000 , 600  ]
        JioaLong   = [     2,          0.0,    0.005 ,  0.0001    ,   0   ,   0    ,    0    ,     0     , 5000 , 600  ]
        FSA13020V0 = [     2,          0.0,    0.055 ,  0.00005   ,  100  ,  200   ,   10000 ,   0      , 500  , 400  ]
        FSA10015V0 = [     2,          0.0,    0.05  ,  0.001     ,  100  ,  200   ,   10000 ,   0      , 1000 , 600  ]
        FSA8010V0  = [     2,          0.0,    0.005 ,  0.00001   ,  100  ,  200   ,   10000 ,   0      , 500  , 400  ]
        FSA6008V0  = [     2,          0.0,    0.04  ,  0.0001    ,   20  ,  100   ,   50000 ,   1      , 5000 , 600  ]
        FSA3608V0  = [     2,          0.0,    0.0025,  0.00001   ,  100  ,  200   ,   10000 ,   0      , 5000 , 600  ]
        FSA3610V0  = [     2,          0.0,    0.007 ,  0.00001   ,  100  ,  200   ,   10000 ,   0      , 5000 , 600  ]
        FSA2508V0  = [     2,          0.0,    0.05  ,  0.0001    ,  200  ,  800   ,    5000 ,   0      , 5000 , 600  ]
    
  5. Run the script using the following command:

    python set_pid_param.py
    

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_pid_param_set.py
File not exist:  config.json
[2024.01.27 11:28:12.578.163]  Info:    FSA start listening for broadcast...
[2024.01.27 11:28:12.579.159]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/pid_param", "property": "", "control_position_kp": 0.5, "control_velocity_kp": 0.0025, "control_velocity_ki": 1e-05, "control_current_kp": 0.0, "control_current_ki": 0.0}
[2024.01.27 11:28:12.772.024]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/pid_param","property":""}


[2024.01.27 11:28:13.773.182]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/pid_param", "property": ""}
[2024.01.27 11:28:13.774.681]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/pid_param","property":"","control_position_kp":0.5,"control_velocity_kp":0.0025,"control_velocity_ki":9.999999747e-6,"control_current_kp":0,"control_current_ki":0}


[2024.01.27 11:28:13.774.681]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/reboot", "property": ""}
[2024.01.27 11:28:13.776.315]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/reboot","property":""}

Note

Ensure that you understand the implications of changing PID parameters and use the predefined values based on your specific motor type.

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.

Set Immediate PID Parameter

Set Immediate PID Parameter

This script is part of the Fourier Smart Actuator (FSA) SDK’s collection of example scripts. It is designed to set immediate (temporary) PID parameters for Actuators based on predefined values for different motor types.

Code Description

  1. Predefined Motor Types:

    • Defines a class SpeedParamList that contains predefined PID parameters for different motor types.

  2. Detect Actuators:

    • Uses fi_fsa.broadcast_func_with_filter() to detect Actuators on the network based on the specified filter type (“Actuator”).

  3. Set Immediate PID Parameters:

    • Iterates through each Actuator in the list.

    • Retrieves existing PID parameters using fi_fsa.get_pid_param().

    • Sets immediate (temporary) PID parameters based on the predefined values in the SpeedParamList class using fi_fsa.set_pid_param_imm().

  4. Revert to Default Parameters:

    • Retrieves the PID parameters again to show that immediate changes are not saved.

Usage

To run the set_pid_param_imm.py script, follow these steps:

  1. Ensure that you have set up your Python environment and installed the FSA SDK as mentioned in the Quickstart Guide.

  2. Connect to the FSA, see Connecting FSA for details.

  3. Open a terminal and navigate to the directory containing set_pid_param_imm.py.

  4. Set the PID parameter through the SpeedParamList class by editing the set_pid_param_imm.py:

    class SpeedParamList :
        #         Pole Frequency of Current Loop| Feedforward Gain |   KP   |   KI       |  Wc   |   Wo   |   B0   |0PI/1LADRC |SPD_FC|bandwidth
        MOTOR_NULL = [     2,          0.0,    0.1   ,  0.01      ,   0   ,   0    ,    0    ,   0      , 5000 , 600  ]
        JioaLong   = [     2,          0.0,    0.005 ,  0.0001    ,   0   ,   0    ,    0    ,     0     , 5000 , 600  ]
        FSA13020V0 = [     2,          0.0,    0.055 ,  0.00005   ,  100  ,  200   ,   10000 ,   0      , 500  , 400  ]
        FSA10015V0 = [     2,          0.0,    0.05  ,  0.001     ,  100  ,  200   ,   10000 ,   0      , 1000 , 600  ]
        FSA8010V0  = [     2,          0.0,    0.005 ,  0.00001   ,  100  ,  200   ,   10000 ,   0      , 500  , 400  ]
        FSA6008V0  = [     2,          0.0,    0.04  ,  0.0001    ,   20  ,  100   ,   50000 ,   1      , 5000 , 600  ]
        FSA3608V0  = [     2,          0.0,    0.0025,  0.00001   ,  100  ,  200   ,   10000 ,   0      , 5000 , 600  ]
        FSA3610V0  = [     2,          0.0,    0.007 ,  0.00001   ,  100  ,  200   ,   10000 ,   0      , 5000 , 600  ]
        FSA2508V0  = [     2,          0.0,    0.05  ,  0.0001    ,  200  ,  800   ,    5000 ,   0      , 5000 , 600  ]
    
    
  5. Run the script using the following command:

    python set_pid_param_imm.py
    

Running Result

C:/Users/Fourier/AppData/Local/Programs/Python/Python312/python.exe d:/wiki-fsa-release/wiki-fsa-release/sdk-python/v3/demo_pid_param_imm_set.py
File not exist:  config.json
[2024.01.27 11:25:51.599.425]  Info:    FSA start listening for broadcast...
[2024.01.27 11:25:51.600.423]  Info:    FSA start listening for broadcast...


[2024.01.27 11:25:51.602.876]  Info:    Received from ('192.168.137.101', 2334):{"status":"OK","reqTarget":"/broadcast","property":"reply","type":"Actuator","model":"","name":"FSA-0","serial_number":"DCA17EE342A8","driver_version":"0.0.2.1","firmware_version":"2.13.2","connect_mode":"ETH","mac_address":"A8:42:E3:7E:A1:DF","ip_address":"192.168.137.101","IP":"192.168.137.101"}


found servers
['192.168.137.101']
lookup Finished!

[2024.01.27 11:25:53.809.592]  Info:    Send JSON Obj: {"method": "SET", "reqTarget": "/pid_param_imm", "property": "", "control_position_kp_imm": 0.0, "control_velocity_kp_imm": 0.1, "control_velocity_ki_imm": 0.001, "control_current_kp_imm": 0.0, "control_current_ki_imm": 0.0}
[2024.01.27 11:25:53.810.591]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/pid_param_imm","property":""}


[2024.01.27 11:25:54.811.949]  Info:    Send JSON Obj: {"method": "GET", "reqTarget": "/pid_param_imm", "property": ""}
[2024.01.27 11:25:54.813.935]  Info:    Received from ('192.168.137.101', 2333):{"status":"OK","reqTarget":"/pid_param_imm","property":"","control_position_kp_imm":0,"control_velocity_kp_imm":0.100000001,"control_velocity_ki_imm":0.001,"control_current_kp_imm":0,"control_current_ki_imm":0}

Important Note

Immediate (temporary) PID parameters are not saved in the flash memory and will be reverted to the default parameters upon reboot. Ensure that you understand the implications of using immediate PID parameters.

Common Issues

If you encounter any issues while running this script, consider the following:

  1. Ensure that you are using a compatible version of Python as recommended in the Quickstart Guide.

  2. Verify that your network is properly configured, and the FSA actuators are accessible.