Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
somanet_procedures.cc File Reference
#include "node/somanet_procedures.h"
#include <spdlog/spdlog.h>
#include <algorithm>
#include <array>
#include <chrono>
#include <cstdint>
#include <expected>
#include <filesystem>
#include <format>
#include <fstream>
#include <initializer_list>
#include <limits>
#include <nlohmann/json.hpp>
#include <optional>
#include <span>
#include <string>
#include <string_view>
#include <system_error>
#include <thread>
#include <utility>
#include <vector>
#include "comm/al_status_codes.h"
#include "comm/foe_error.h"
#include "comm/sii.h"
#include "core/base64.h"
#include "core/platform.h"
#include "core/user_cache.h"
#include "node/somanet_control.h"
Include dependency graph for somanet_procedures.cc:

Namespaces

namespace  mm
 
namespace  mm::node
 

Functions

std::expected< OsCommandRequest, std::string > mm::node::parseOsCommandRequest (const nlohmann::json &body)
 Parses and validates a client's OS command request body.
 
std::vector< ProcedureParametermm::node::osCommandParameters ()
 What the OS command procedure accepts, as its descriptor advertises it.
 
void mm::node::to_json (nlohmann::json &j, const OsCommandResult &result)
 
std::vector< ProgressStepmm::node::osCommandSteps ()
 The OS command procedure's step template — one step, all idle.
 
std::expected< void, std::string > mm::node::runOsCommandProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop, const OsCommandRequest &request)
 Runs one raw OS command as a procedure body.
 
std::expected< EncoderRegisterRequest, std::string > mm::node::parseEncoderRegisterRequest (const nlohmann::json &body)
 Parses and validates a client's encoder register request body.
 
std::vector< ProcedureParametermm::node::encoderRegisterParameters ()
 What encoder register communication accepts, as its descriptor advertises it.
 
std::vector< ProgressStepmm::node::encoderRegisterSteps ()
 Encoder register communication's step template — one step, idle.
 
std::expected< void, std::string > mm::node::runEncoderRegisterProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop, const EncoderRegisterRequest &request)
 Runs one encoder register access as a procedure body.
 
std::expected< IcMuCalibrationModeRequest, std::string > mm::node::parseIcMuCalibrationModeRequest (const nlohmann::json &body)
 Parses and validates a client's iC-MU calibration mode request body.
 
std::vector< ProcedureParametermm::node::icMuCalibrationModeParameters ()
 What setting an iC-MU calibration mode accepts, as its descriptor advertises it.
 
std::vector< ProgressStepmm::node::icMuCalibrationModeSteps ()
 The iC-MU calibration mode procedure's step template — one step, idle.
 
std::expected< void, std::string > mm::node::runIcMuCalibrationModeProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop, const IcMuCalibrationModeRequest &request)
 Sets an iC-MU encoder's calibration mode as a procedure body.
 
std::expected< HrdStreamingRequest, std::string > mm::node::parseHrdStreamingRequest (const nlohmann::json &body)
 Parses and validates a client's HRD streaming request body.
 
std::vector< ProcedureParametermm::node::hrdStreamingParameters ()
 What HRD streaming accepts, as its descriptor advertises it.
 
std::vector< ProgressStepmm::node::hrdStreamingSteps ()
 The HRD streaming procedure's step template — configure, then record.
 
std::expected< void, std::string > mm::node::runHrdStreamingProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop, const HrdStreamingRequest &request)
 Records one high resolution data stream as a procedure body.
 
std::vector< ProgressStepmm::node::openPhaseDetectionSteps ()
 Open phase detection's step template — prepare, check, restore, all idle.
 
std::expected< void, std::string > mm::node::runOpenPhaseDetectionProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop)
 Runs open phase detection as a procedure body.
 
std::vector< ProgressStepmm::node::polePairDetectionSteps ()
 Pole pair detection's step template — prepare, release the brake, detect, restore.
 
std::expected< void, std::string > mm::node::runPolePairDetectionProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop)
 Runs pole pair detection as a procedure body.
 
std::vector< ProgressStepmm::node::motorPhaseOrderDetectionSteps ()
 Motor phase order detection's step template — prepare, release the brake, detect, restore.
 
std::expected< void, std::string > mm::node::runMotorPhaseOrderDetectionProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop)
 Runs motor phase order detection as a procedure body.
 
std::vector< ProgressStepmm::node::offsetDetectionSteps ()
 The commissioning sequence's step template — every command in the order it runs, plus the shared prepare, brake and restore steps.
 
std::expected< void, std::string > mm::node::runOffsetDetectionProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop)
 Runs the whole commissioning sequence as one procedure body.
 
std::vector< ProgressStepmm::node::commutationOffsetMeasurementSteps ()
 Commutation offset measurement's step template — prepare, release the brake, measure, restore.
 
std::expected< void, std::string > mm::node::runCommutationOffsetMeasurementProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop)
 Runs commutation offset measurement as a procedure body — OS command 5 and nothing else.
 
std::vector< ProgressStepmm::node::phaseResistanceMeasurementSteps ()
 Phase resistance measurement's step template — prepare, measure, restore, all idle.
 
std::expected< void, std::string > mm::node::runPhaseResistanceMeasurementProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop)
 Runs phase resistance measurement as a procedure body.
 
std::vector< ProgressStepmm::node::phaseInductanceMeasurementSteps ()
 Phase inductance measurement's step template — prepare, measure, restore, all idle.
 
std::expected< void, std::string > mm::node::runPhaseInductanceMeasurementProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop)
 Runs phase inductance measurement as a procedure body.
 
std::expected< KueblerRegisterRequest, std::string > mm::node::parseKueblerRegisterRequest (const nlohmann::json &body)
 Parses and validates a client's Kübler register request body.
 
std::vector< ProcedureParametermm::node::kueblerRegisterParameters ()
 What a Kübler register access accepts, as its descriptor advertises it.
 
std::vector< ProgressStepmm::node::kueblerRegisterSteps ()
 The Kübler register procedure's step template — one step, idle.
 
std::expected< void, std::string > mm::node::runKueblerRegisterProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop, const KueblerRegisterRequest &request)
 Reads or writes one Integro internal-encoder register as a procedure body.
 
std::expected< VelocitySourceRequest, std::string > mm::node::parseVelocitySourceRequest (const nlohmann::json &body)
 Parses and validates a client's velocity source request body.
 
std::vector< ProcedureParametermm::node::velocitySourceParameters ()
 What choosing the velocity source accepts, as its descriptor advertises it.
 
std::vector< ProgressStepmm::node::velocitySourceSteps ()
 The velocity-source procedure's step template — one step, idle.
 
std::expected< void, std::string > mm::node::runVelocitySourceProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop, const VelocitySourceRequest &request)
 Chooses the velocity loop's feedback source as a procedure body.
 
std::optional< FirmwareLatencyActionmm::node::parseFirmwareLatencyAction (std::string_view token)
 Parses a firmware latency action token. std::nullopt if it names none of them.
 
std::expected< FirmwareLatencyRequest, std::string > mm::node::parseFirmwareLatencyRequest (const nlohmann::json &body)
 Parses and validates a client's firmware latency request body.
 
std::vector< ProcedureParametermm::node::firmwareLatencyParameters ()
 What measuring a firmware latency accepts, as its descriptor advertises it.
 
std::vector< ProgressStepmm::node::firmwareLatencySteps ()
 The firmware latency procedure's step template — start, observe, read, stop.
 
std::expected< void, std::string > mm::node::runFirmwareLatencyProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop, const FirmwareLatencyRequest &request)
 Measures one internal firmware latency as a procedure body.
 
std::expected< TriggerErrorRequest, std::string > mm::node::parseTriggerErrorRequest (const nlohmann::json &body)
 Parses and validates a client's trigger-error request body.
 
std::vector< ProcedureParametermm::node::triggerErrorParameters ()
 What provoking a firmware error accepts, as its descriptor advertises it.
 
std::vector< ProgressStepmm::node::triggerErrorSteps ()
 The trigger-error procedure's step template — one step, idle.
 
std::expected< void, std::string > mm::node::runTriggerErrorProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop, const TriggerErrorRequest &request)
 Provokes a firmware error in a control service as a procedure body.
 
std::expected< SystemIdentificationRequest, std::string > mm::node::parseSystemIdentificationRequest (const nlohmann::json &body)
 Parses and validates a client's system identification request body.
 
std::vector< ProcedureParametermm::node::systemIdentificationParameters ()
 What system identification accepts, as its descriptor advertises it.
 
std::vector< ProgressStepmm::node::systemIdentificationSteps ()
 The system identification procedure's step template — configure, then arm.
 
std::expected< void, std::string > mm::node::runSystemIdentificationProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop, const SystemIdentificationRequest &request)
 Configures and optionally arms a system identification run as a procedure body.
 
std::expected< IgnoreBissStatusBitsRequest, std::string > mm::node::parseIgnoreBissStatusBitsRequest (const nlohmann::json &body)
 Parses and validates a client's ignore-BiSS-status-bits request body.
 
std::vector< ProcedureParametermm::node::ignoreBissStatusBitsParameters ()
 What ignoring BiSS status bits accepts, as its descriptor advertises it.
 
std::vector< ProgressStepmm::node::ignoreBissStatusBitsSteps ()
 The ignore-BiSS-status-bits procedure's step template — one step, idle.
 
std::expected< void, std::string > mm::node::runIgnoreBissStatusBitsProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop, const IgnoreBissStatusBitsRequest &request)
 Starts or stops ignoring a BiSS encoder's status bits as a procedure body.
 
std::expected< SkippedCyclesRequest, std::string > mm::node::parseSkippedCyclesRequest (const nlohmann::json &body)
 Parses and validates a client's skipped cycles request body.
 
std::vector< ProcedureParametermm::node::skippedCyclesParameters ()
 What reading a skipped cycles counter accepts, as its descriptor advertises it.
 
std::vector< ProgressStepmm::node::skippedCyclesSteps ()
 The skipped cycles procedure's step template — one step, idle.
 
std::expected< void, std::string > mm::node::runSkippedCyclesProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop, const SkippedCyclesRequest &request)
 Reads one control loop's skipped-cycle counter as a procedure body.
 
std::vector< ProgressStepmm::node::readObjectDictionarySteps ()
 The read-object-dictionary procedure's step template — one step, idle.
 
std::expected< void, std::string > mm::node::runReadObjectDictionaryProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop)
 Reads every object dictionary value in one transfer, as a procedure body.
 
std::vector< ProgressStepmm::node::torqueConstantMeasurementSteps ()
 Torque constant measurement's step template — prepare, release the brake, measure, restore.
 
std::expected< void, std::string > mm::node::runTorqueConstantMeasurementProcedure (Device &device, ProgressReporter &reporter, std::stop_token stop)
 Runs torque constant measurement as a procedure body.
 
std::filesystem::path mm::node::firmwareCacheDir ()
 Where installed packages are kept: a firmwares subdirectory of the per-user cache.
 
std::vector< ProcedureParametermm::node::firmwareInstallationParameters ()
 What the procedure accepts, as its descriptor advertises it.
 
std::vector< ProgressStepmm::node::firmwareInstallationSteps ()
 The procedure's step template, in order.
 
std::expected< FirmwareInstallationRequest, std::string > mm::node::parseFirmwareInstallationRequest (const nlohmann::json &body)
 Parses and validates a client's installation request.
 
std::expected< void, std::string > mm::node::runFirmwareInstallationProcedure (DeviceManager &deviceManager, uint16_t devicePosition, ProgressReporter &reporter, std::stop_token stop, const FirmwareInstallationRequest &request)
 Installs request's package on the device at devicePosition.
 

Variable Documentation

◆ procedure

std::string_view procedure

◆ releaseBrake

bool releaseBrake = false

◆ step

std::string_view step

◆ timeout

std::chrono::milliseconds timeout {30000}

◆ what

std::string_view what