Skip to main content

load_from_robot

Function load_from_robot 

Source
pub fn load_from_robot(
    network: &Network,
    version: FciVersion,
) -> FrankaResult<Model>
Expand description

Downloads the robot’s model library over network and builds a Model.

Port of franka::Model::Model(Network&) (0.9.2), which is ModelLibrary(network) and therefore LibraryDownloader(network) followed by LibraryLoader.

§Temp-file lifecycle

The downloaded bytes are written to a uniquely named, mode 0600 file under std::env::temp_dir (libfranka: Poco::TemporaryFile::tempName()), which is dlopened and then removed when the returned Model is dropped — the file guard lives inside the SoModelBackend the model owns. The guard covers a normal drop and an unwind, but not SIGINT/SIGTERM, std::process::abort or std::process::exit; a control loop killed with Ctrl-C therefore leaves one ~330 KB file behind in the temp directory. Two concurrent downloads (in the same process or in different ones) cannot collide on the name.

§Platform limitation

The robot serves a native shared object, so this only works where the robot has a build for the current (architecture, system) pair and where the running process can load it. The request encodes whatever the host is (X64/X86/ARM64/ARM and Linux/Windows, from cfg!), but in practice only x86-64 Linux works: the FER control unit ships libfcimodels_x64.so. Cross-compiled or unusual targets get FrankaError::Model from the robot ("libfranka: Server reports error when loading model library.") or from dlopen.

§Errors