Engee documentation

Software control of RITM

To work with the functions of the program control of the KPM "RITM" in Engee, install the Engee subsystem.Integrations:

engee.package.install("Engee-Device-Manager")

On this page all available functions of the program management of the KPM "RITM" in Engee are presented.

Methods RITM

RITM_API.Ritm(url::String)

Setting the address of the RITM machine.

Arguments

  • url::String: The address of the RITM machine, for example, "http://192.168.56.3:8000 /".

Examples

# Let's create the RITM object:

ritm = RITM_API.Ritm("http://192.168.56.3:8000/")
buildModel(ritm, model, is_interactive_mode::Bool=false)::Nothing

Collects and prepares the model for running on the beat.

Arguments

  • ritm::Any: an object of the target RITM platform.

  • model::Any: the structure of the model.

  • is_interactive_mode::Bool: a flag indicating the execution mode of the model: true — the model is executed interactively; false (by default) — the model runs in independent mode.

Examples

# We collect and run the RITM open on the canvas standalone-model:

model = engee.gcm()
RITM_API.buildModel(ritm, model, false)
RITM_API.runModel(ritm, model, false)
RITM_API.disableAutostart(ritm)::Dict{String, Union{String, Int64, Bool, Nothing}}

Removing the model from autorun.

Arguments

  • ritm::Any: an object of the target RITM platform.

Examples

RITM_API.disableAutostart(ritm)
RITM_API.getAutostart(ritm)::Union{Dict{String, Union{String, Int64, Bool, Nothing}}, Nothing}

Getting the model that is in autorun.

Arguments

  • ritm::Any: an object of the target RITM platform.

Examples

RITM_API.getAutostart(ritm)
RITM_API.getData(ritm::Any, model_name::String, file_path::String, in_file::Bool = false)

Returns the result of profiling the model based on the RITM. Depending on the value in_file the result can be returned as a string or saved to a file using the specified path.

Arguments

  • ritm::Any: an object of the target RITM platform.

  • model_name::String: the name of the model for which profiling data is requested.

  • file_path::String: the path to save the result (if in_file = true). If in_file = false, the value is ignored.

  • in_file::Bool = false: specifies how to return the result. If true, the data is saved to a file by file_path. If false, returns the result string.

Examples

# Gets profiling data as a string
result = RITM_API.getData(ritm, "newmodel_1", "", false)

# Saves data to a file at RITM
RITM_API.getData(ritm, "newmodel_1", "/user/profile.txt", true)
getDiagnostic(ritm)::Nothing

Downloads the ritm_diagnostic diagnostic archive.zip to the current Engee directory.

Arguments

  • ritm::Any: an object of the target RITM platform.

Examples

RITM_API.getDiagnostic(ritm)
RITM_API.getFile(ritm::Any, file_name::String; from=/mydir::String, to=::String)

Retrieves the specified file file_name from the directory /mydir.

Arguments

  • ritm::Any: an object of the target RITM platform.

  • file_name::String: the name of the file of interest.

  • from=/mydir::String: the path to the directory of interest (by default /home/ritm/).

  • to=::String: the path to the directory in Engee to save the file (by default in the current one).

Examples

# Getting the file install_manifest.txt from the directory /home/ritm/build/newmodel_1/build to the current directory Engee:

RITM_API.getFile(ritm, "install_manifest.txt"; from="/home/ritm/build/newmodel_1/build/", to="")
RITM_API.getLog(ritm::Any, num::Int64)

Returns the specified number of lines of model execution logs for the RITM.

Arguments

  • ritm::Any: an object of the target RITM platform.

  • num::Int64: the number of output lines from the logs.

Examples

RITM_API.getLog(ritm, 10)
getPtpSettings(ritm) -> Vector{String}

Retrieves the saved PTP settings. Returns the PTP settings — a vector of strings with the selected interface, delay mechanism, network transport, role, and attributes of the PTP clock.

Examples

getPtpSettings(ritm)
getPtpState(ritm) -> Vector{String}

Gets the state of a PTP vector of strings, usually with an interface, role, and state. Returns the current state of PTP: running or stopped, as well as the interface and role if PTP is running.

Examples

getPtpState(ritm)
RITM_API.getScreenshot(ritm::Any, filename::String = "screenshot.png")

Creates a screenshot on the target RITM platform, and returns the path to the saved image. The screenshot is saved in a temporary directory on the RITM machine. The name of the output file can be specified explicitly; by default, it is used "screenshot.png".

Arguments

  • ritm::Any: an object of the target RITM platform.

  • filename::String = "screenshot.png": the name of the file where the screenshot will be saved (on the RITM side).

Examples

# Creates a screenshot and gets the path to it
path = RITM_API.getScreenshot(ritm, "example.png")
RITM_API.isConnected(ritm::Any)

Checks the availability of the RITM.

Arguments

ritm::Any: an object of the target RITM platform.

Examples

RITM_API.isConnected(ritm)
RITM_API.isRunning(ritm::Any, model_name::String)

Checks whether the specified model is running on the target RITM platform. Returns true if the model with the specified name is currently in progress on the RITM machine, and false if it is not executed.

Arguments

  • ritm::Any: an object of the target RITM platform.

  • model_name::String: the name of the model whose condition needs to be checked.

Examples

# Checks whether the model is running "newmodel_1"
is_active = RITM_API.isRunning(ritm, "newmodel_1")
RITM_API.listFiles(ritm::Any, path::String)

Displays a list of files in the specified directory.

Arguments

  • ritm::Any: an object of the target RITM platform.

  • path::String: the path to the directory of interest.

Examples

RITM_API.listFiles(ritm, "/home/ritm/")
RITM_API.memInfo(ritm::Any, model::String)

Displays information about the memory consumed by the model.

Arguments

  • ritm::Any: an object of the target RITM platform.

  • model::String: the name of the model. If left empty "", then returns the result of profiling the system in the form [total, used, free]. If you specify the model name, it returns the number of bytes of memory consumed by the model.

Examples

RITM_API.memInfo(ritm, "newmodel_1")
RITM_API.poweroff(ritm)::Dict{String, Union{String, Int64, Bool, Nothing}}

Turns off the car.

Arguments

  • ritm::Any: an object of the target RITM platform.

Examples

RITM_API.poweroff(ritm)
RITM_API.readFile(ritm::Any, file_name::String; path=/mydir::String)

Outputs the contents of the specified file file_name from the directory /home/ritm/build/model_name/build/, where model_name — the name of the model in Engee.

Arguments

  • ritm::Any: an object of the target RITM platform.

  • file_name::String: the name of the file of interest.

  • path=/mydir::String: the path to the directory with the file of interest (by default /home/ritm/build/model_name/build/).

Examples

# We display the contents of the file install_manifest.txt from the directory /home/ritm/build/newmodel_1/build:

RITM_API.readFile(ritm, "install_manifest.txt"; path="/home/ritm/build/newmodel_1/build/")
RITM_API.reboot(ritm)::Dict{String, Union{String, Int64, Bool, Nothing}}

Restarts the machine.

Arguments

  • ritm::Any: an object of the target RITM platform.

Examples

RITM_API.reboot(ritm)
RITM_API.removeFile(ritm::Any, path::String)::String

Deletes the file using the specified path on the target RITM platform. Returns the file deletion status from the RITM.

Arguments

  • ritm::Any: an object of the target RITM platform.

  • path::String: the path to the file being deleted from the RITM.

Examples

# Delete a file newmodel_1 On RITM:
RITM_API.removeFile(ritm, "/home/ritm/newmodel_1.engee")
resetPtpSettings(ritm) -> Dict{String, Union{String, Int64, Bool, Nothing}}

Resets the saved PTP settings on the RITM. Returns the dictionary with the result of the operation: status and error message (if any).

After resetting, before starting PTP, you need to re-configure the desired interface via setupEthPtp.

RITM_API.runModel(
    ritm,
    model,
    is_interactive_mode::Bool=false;
    simulation_uuid=string(uuid4()),
    status_callback=(args...) -> nothing,
    termination_callback=(args...) -> nothing,
) -> Union{Channel{TargetSimulationStatus}, Nothing}

Run a previously assembled model on the RITM.

Arguments

  • ritm::Any: an object of the target RITM platform.

  • model::Any: the structure of the model.

  • is_interactive_mode::Bool: a flag indicating the execution mode of the model: true — the model is executed interactively; false (by default) — the model runs in independent mode.

  • simulation_uuid::String: the launch ID for the interactive mode.

  • status_callback: the function is called for each received execution status.

  • termination_callback: the function is called upon completion of interactive execution.

Meaning nothing It is used for offline execution or for the interactive execution status channel.

Examples

RITM_API.runModel(ritm, model)
RITM_API.setAutostart(ritm, model_name::String)::Dict{String, Union{String, Int64, Bool, Nothing}}

Putting the model in autorun.

Arguments

  • ritm::Any: an object of the target RITM platform.

  • model_name::String: the name of the model.

Examples

RITM_API.setAutostart(ritm)

setupEthPtp(
    ritm,
    eth_number,
    role="Master";
    delay_mech="E2E",
    network_tr="UDPv4",
    priority1=128,
    priority2=128,
    clock_class=248,
    clock_accuracy=254,
) -> Dict{String, String}

Configures PTP on the selected RITM Ethernet interface. Returns the dictionary with the result of the operation: status and error message (if any).

Arguments

  • eth_number: the number of the RITM’s Ethernet interface, for example 1 for Ethernet 1.

  • role: sets the role of the local PTP clock: "Master" or "Slave".

  • delay_mech: PTP operating mode. Possible values "E2E", "P2P" or "Auto". Default value "E2E".

  • network_tr: network protocol. Possible values "UDPv4", "UDPv6" and "L2". Default value "UDPv4".

  • priority1: local clock attribute "Приоритет 1". Possible range 0 before 255. Default value 128.

  • priority2: local clock attribute "Приоритет 2". Possible range 0 before 255. Default value 128.

  • clock_class: local clock attribute "Класс". Possible range 0 before 255. Default value 248.

  • clock_accuracy: local clock attribute "Точность". Possible range 0 before 255. Default value 254.

RITM_API.setupEthernet(ritm, interface_id::Int64, ip::String, mask::Int64)::Dict{String, Union{String, Int64, Bool, Nothing}}

Configuring the machine’s Ethernet interface.

Arguments

  • ritm::Any: an object of the target RITM platform.

  • interface_id::Int64: ID of the Ethernet interface.

  • ip::String: The IP address of the interface.

  • mask::Int64: network mask.

Examples

RITM_API.setupEthernet(ritm, 0, "192.168.0.10", 24)
startPtp(ritm, eth_number) -> Dict{String, Union{String, Int64, Bool, Nothing}}

Launches PTP on the selected RITM Ethernet interface. Returns the dictionary with the result of the operation: status and error message (if any).

Before starting PTP, you need to configure the interface via setupEthPtp.

Arguments

  • eth_number: the number of the Ethernet interface. Possible values "HostTarget" or "1" — "max ethernet number".

Examples

startPtp(ritm, 1)
RITM_API.stopModel(ritm)::Nothing

Stops the model at the RITM.

Arguments

  • ritm::Any: an object of the target RITM platform.

Examples

RITM_API.stopModel(ritm)
stopPtp(ritm, eth_number) -> Dict{String, Union{String, Int64, Bool, Nothing}}

Stops PTP on the selected RITM Ethernet interface. Returns the dictionary with the result of the operation: status and error message (if any).

Arguments

  • eth_number: the number of the Ethernet interface. Possible values "HostTarget" or "1" — "max ethernet number".

Examples

stopPtp(ritm, 1)

RITM_API.updateFirmware(
    ritm,
    firmware_path::String="",
    checksum_path::String="";
    reboot::Bool=true,
    show_progress=false,
)::Nothing

Updates the RITM firmware.

Arguments

  • ritm::Any: an object of the target RITM platform.

  • firmware_path::String: the local path to the firmware file.

  • checksum_path::String: the local path to the checksum file.

  • reboot::Bool: Restart the RITM machine after a successful upgrade. Default value — true.

  • show_progress::Bool: output information about the update progress to the log.

Examples

RITM_API.updateFirmware(ritm; show_progress=true)
RITM_API.updateFirmware(ritm, "/user/firmware.raucb", "/user/firmware.raucb.checksum")
RITM_API.updateSupportPackage(ritm, support_package_path::String=""; show_progress=false)::Nothing

Updates the RITM support package.

If the argument is support_package_path not specified, a package corresponding to the current version of Engee is being installed. If the argument is support_package_path specified, the package is installed from the specified local file.

Arguments

  • ritm::Any: an object of the target RITM platform.

  • support_package_path::String: the local path to the support package.

  • show_progress::Bool: output information about the update progress to the log.

Examples

RITM_API.updateSupportPackage(ritm)
RITM_API.updateSupportPackage(ritm, "/user/ritm_support_package.tar.gz"; show_progress=true)
RITM_API.uploadFile(ritm::Any, filename::AbstractString; from::AbstractString=pwd(), to::AbstractString="/home/ritm")::String

Uploads a file from Engee to the target RITM platform.

Arguments

  • ritm::Any: an object of the target RITM platform.

  • filename::AbstractString: the name of the file uploaded to the server.

  • from::AbstractString = pwd(): the path in Engee to the directory where the downloaded file is located (by default, the current directory).

  • to::AbstractString = "/home/ritm": the path on the RITM where the file will be uploaded (by default — /home/ritm).

Examples

using Main.EngeeDeviceManager.Targets
using Main.EngeeDeviceManager.Targets.RITM.RITM_API

# Creates the RITM object and sets the address
ritm = Targets.RITM_API.Ritm("http://192.168.56.3:8000/")

# Uploads a file test.bin from the current directory Engee (pwd()) in /home/ritm On the RITM
res = RITM_API.uploadFile(ritm, "test.bin")

# Downloads a file from the specified directory Engee (/user/...) to the specified directory on RITM
res = RITM_API.uploadFile(ritm, "install_manifest.txt"; from="/user/project/", to="/home/ritm/data/")