Motion Master 6.0.0-alpha.111
Next-generation motion control software
Loading...
Searching...
No Matches
somanet_procedures.h
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <chrono>
5#include <cstdint>
6#include <expected>
7#include <filesystem>
8#include <nlohmann/json_fwd.hpp>
9#include <optional>
10#include <stop_token>
11#include <string>
12#include <string_view>
13#include <vector>
14
16#include "node/device.h"
17#include "node/device_manager.h"
21#include "node/procedure.h"
23#include "node/somanet_drive.h"
24
25namespace mm::node {
26
35
37inline constexpr std::string_view kOsCommandProcedure = "os-command";
38
40inline constexpr std::string_view kOsCommandStep = "command";
41
50 std::vector<uint8_t> command;
51 std::chrono::milliseconds timeout{1000};
52 std::chrono::milliseconds pollInterval{10};
56};
57
75std::expected<OsCommandRequest, std::string> parseOsCommandRequest(const nlohmann::json& body);
76
82std::vector<ProcedureParameter> osCommandParameters();
83
89 uint8_t status = 0;
90 std::vector<uint8_t> data;
91 std::optional<uint8_t> errorCode;
94 std::vector<uint8_t> fsBuffer;
95};
96void to_json(nlohmann::json& j, const OsCommandResult& result);
97
99std::vector<ProgressStep> osCommandSteps();
100
115std::expected<void, std::string> runOsCommandProcedure(Device& device, ProgressReporter& reporter,
116 std::stop_token stop,
117 const OsCommandRequest& request);
118
121inline constexpr std::string_view kEncoderRegisterProcedure = "encoder-register-communication";
122
124inline constexpr std::string_view kEncoderRegisterStep = "register-access";
125
137
146std::expected<EncoderRegisterRequest, std::string> parseEncoderRegisterRequest(
147 const nlohmann::json& body);
148
150std::vector<ProcedureParameter> encoderRegisterParameters();
151
153std::vector<ProgressStep> encoderRegisterSteps();
154
173std::expected<void, std::string> runEncoderRegisterProcedure(Device& device,
174 ProgressReporter& reporter,
175 std::stop_token stop,
176 const EncoderRegisterRequest& request);
177
180inline constexpr std::string_view kIcMuCalibrationModeProcedure = "ic-mu-calibration-mode";
181
183inline constexpr std::string_view kIcMuCalibrationModeStep = "set-mode";
184
194
202std::expected<IcMuCalibrationModeRequest, std::string> parseIcMuCalibrationModeRequest(
203 const nlohmann::json& body);
204
206std::vector<ProcedureParameter> icMuCalibrationModeParameters();
207
209std::vector<ProgressStep> icMuCalibrationModeSteps();
210
224std::expected<void, std::string> runIcMuCalibrationModeProcedure(
225 Device& device, ProgressReporter& reporter, std::stop_token stop,
226 const IcMuCalibrationModeRequest& request);
227
231inline constexpr std::string_view kHrdStreamingProcedure = "hrd-streaming";
232
235inline constexpr std::string_view kHrdConfigureStep = "configure-stream";
236
238inline constexpr std::string_view kHrdRecordStep = "record";
239
250
261std::expected<HrdStreamingRequest, std::string> parseHrdStreamingRequest(
262 const nlohmann::json& body);
263
268std::vector<ProcedureParameter> hrdStreamingParameters();
269
271std::vector<ProgressStep> hrdStreamingSteps();
272
296std::expected<void, std::string> runHrdStreamingProcedure(Device& device,
297 ProgressReporter& reporter,
298 std::stop_token stop,
299 const HrdStreamingRequest& request);
300
303inline constexpr std::string_view kKueblerRegisterProcedure = "kuebler-register-communication";
304
306inline constexpr std::string_view kKueblerRegisterStep = "register-access";
307
310 uint8_t address = 0;
311 uint8_t length = 1;
312 bool write = false;
313 uint32_t value = 0;
314};
315
324std::expected<KueblerRegisterRequest, std::string> parseKueblerRegisterRequest(
325 const nlohmann::json& body);
326
328std::vector<ProcedureParameter> kueblerRegisterParameters();
329
331std::vector<ProgressStep> kueblerRegisterSteps();
332
345std::expected<void, std::string> runKueblerRegisterProcedure(Device& device,
346 ProgressReporter& reporter,
347 std::stop_token stop,
348 const KueblerRegisterRequest& request);
349
352inline constexpr std::string_view kVelocitySourceProcedure = "velocity-source";
353
355inline constexpr std::string_view kVelocitySourceStep = "set-source";
356
364
368std::expected<VelocitySourceRequest, std::string> parseVelocitySourceRequest(
369 const nlohmann::json& body);
370
372std::vector<ProcedureParameter> velocitySourceParameters();
373
375std::vector<ProgressStep> velocitySourceSteps();
376
389std::expected<void, std::string> runVelocitySourceProcedure(Device& device,
390 ProgressReporter& reporter,
391 std::stop_token stop,
392 const VelocitySourceRequest& request);
393
397inline constexpr std::string_view kFirmwareLatencyProcedure = "firmware-latency-measurement";
398
400inline constexpr std::string_view kFirmwareLatencyStartStep = "start-measurement";
401
404inline constexpr std::string_view kFirmwareLatencyObserveStep = "observe";
405
407inline constexpr std::string_view kFirmwareLatencyReadStep = "read-maximum";
408
410inline constexpr std::string_view kFirmwareLatencyStopStep = "stop-measurements";
411
420enum class FirmwareLatencyAction : uint8_t {
423 kMeasure,
425 kStart,
429 kStop,
430};
431
433constexpr std::string_view toString(FirmwareLatencyAction action) {
434 switch (action) {
436 return "measure";
438 return "start";
440 return "read-maximum";
442 return "stop";
443 }
444 return "unknown";
445}
446
448std::optional<FirmwareLatencyAction> parseFirmwareLatencyAction(std::string_view token);
449
462
470std::expected<FirmwareLatencyRequest, std::string> parseFirmwareLatencyRequest(
471 const nlohmann::json& body);
472
474std::vector<ProcedureParameter> firmwareLatencyParameters();
475
482std::vector<ProgressStep> firmwareLatencySteps();
483
506std::expected<void, std::string> runFirmwareLatencyProcedure(Device& device,
507 ProgressReporter& reporter,
508 std::stop_token stop,
509 const FirmwareLatencyRequest& request);
510
513inline constexpr std::string_view kTriggerErrorProcedure = "trigger-error";
514
516inline constexpr std::string_view kTriggerErrorStep = "trigger";
517
527
532std::expected<TriggerErrorRequest, std::string> parseTriggerErrorRequest(
533 const nlohmann::json& body);
534
536std::vector<ProcedureParameter> triggerErrorParameters();
537
539std::vector<ProgressStep> triggerErrorSteps();
540
557std::expected<void, std::string> runTriggerErrorProcedure(Device& device,
558 ProgressReporter& reporter,
559 std::stop_token stop,
560 const TriggerErrorRequest& request);
561
564inline constexpr std::string_view kSystemIdentificationProcedure = "system-identification";
565
567inline constexpr std::string_view kSystemIdConfigureStep = "configure-chirp";
568
570inline constexpr std::string_view kSystemIdArmStep = "arm";
571
584
599std::expected<SystemIdentificationRequest, std::string> parseSystemIdentificationRequest(
600 const nlohmann::json& body);
601
603std::vector<ProcedureParameter> systemIdentificationParameters();
604
606std::vector<ProgressStep> systemIdentificationSteps();
607
629std::expected<void, std::string> runSystemIdentificationProcedure(
630 Device& device, ProgressReporter& reporter, std::stop_token stop,
631 const SystemIdentificationRequest& request);
632
634inline constexpr std::string_view kPlantIdentificationProcedure = "plant-identification";
635
637inline constexpr std::string_view kPlantIdChirpStep = "chirp";
638
641inline constexpr std::string_view kPlantIdRecordStep = "record";
642
644inline constexpr std::string_view kPlantIdFitStep = "fit";
645
647inline constexpr std::string_view kPlantIdStoreStep = "store";
648
659
670std::expected<PlantIdentificationRequest, std::string> parsePlantIdentificationRequest(
671 const nlohmann::json& body);
672
674std::vector<ProcedureParameter> plantIdentificationParameters();
675
677std::vector<ProgressStep> plantIdentificationSteps();
678
720std::expected<void, std::string> runPlantIdentificationProcedure(
721 Device& device, ProgressReporter& reporter, std::stop_token stop,
722 const PlantIdentificationRequest& request, const PlantModelFitFn& fitPlantModel);
723
726inline constexpr std::string_view kIgnoreBissStatusBitsProcedure = "ignore-biss-status-bits";
727
729inline constexpr std::string_view kIgnoreBissStatusBitsStep = "set-ignore";
730
740
748std::expected<IgnoreBissStatusBitsRequest, std::string> parseIgnoreBissStatusBitsRequest(
749 const nlohmann::json& body);
750
752std::vector<ProcedureParameter> ignoreBissStatusBitsParameters();
753
755std::vector<ProgressStep> ignoreBissStatusBitsSteps();
756
774std::expected<void, std::string> runIgnoreBissStatusBitsProcedure(
775 Device& device, ProgressReporter& reporter, std::stop_token stop,
776 const IgnoreBissStatusBitsRequest& request);
777
780inline constexpr std::string_view kSkippedCyclesProcedure = "skipped-cycles-counter";
781
783inline constexpr std::string_view kSkippedCyclesStep = "read-counter";
784
791
802std::expected<SkippedCyclesRequest, std::string> parseSkippedCyclesRequest(
803 const nlohmann::json& body);
804
806std::vector<ProcedureParameter> skippedCyclesParameters();
807
809std::vector<ProgressStep> skippedCyclesSteps();
810
825std::expected<void, std::string> runSkippedCyclesProcedure(Device& device,
826 ProgressReporter& reporter,
827 std::stop_token stop,
828 const SkippedCyclesRequest& request);
829
832inline constexpr std::string_view kReadObjectDictionaryProcedure = "read-object-dictionary";
833
835inline constexpr std::string_view kReadObjectDictionaryStep = "read-dictionary";
836
838std::vector<ProgressStep> readObjectDictionarySteps();
839
859std::expected<void, std::string> runReadObjectDictionaryProcedure(Device& device,
860 ProgressReporter& reporter,
861 std::stop_token stop);
862
875inline constexpr std::string_view kPrepareStep = "prepare";
876inline constexpr std::string_view kReleaseBrakeStep = "release-brake";
877inline constexpr std::string_view kRestoreStep = "restore";
878
880inline constexpr std::string_view kOpenPhaseDetectionProcedure = "open-phase-detection";
881
883inline constexpr std::string_view kOpenPhaseDetectionStep = "open-phase-detection";
884
886std::vector<ProgressStep> openPhaseDetectionSteps();
887
917std::expected<void, std::string> runOpenPhaseDetectionProcedure(Device& device,
918 ProgressReporter& reporter,
919 std::stop_token stop);
920
922inline constexpr std::string_view kPolePairDetectionProcedure = "pole-pair-detection";
923
925inline constexpr std::string_view kPolePairDetectionStep = "pole-pair-detection";
926
928std::vector<ProgressStep> polePairDetectionSteps();
929
950std::expected<void, std::string> runPolePairDetectionProcedure(Device& device,
951 ProgressReporter& reporter,
952 std::stop_token stop);
953
956inline constexpr std::string_view kMotorPhaseOrderDetectionProcedure =
957 "motor-phase-order-detection";
958
960inline constexpr std::string_view kMotorPhaseOrderDetectionStep = "motor-phase-order-detection";
961
964std::vector<ProgressStep> motorPhaseOrderDetectionSteps();
965
985std::expected<void, std::string> runMotorPhaseOrderDetectionProcedure(Device& device,
986 ProgressReporter& reporter,
987 std::stop_token stop);
988
995inline constexpr std::string_view kOffsetDetectionProcedure = "offset-detection";
996
999std::vector<ProgressStep> offsetDetectionSteps();
1000
1034std::expected<void, std::string> runOffsetDetectionProcedure(Device& device,
1035 ProgressReporter& reporter,
1036 std::stop_token stop);
1037
1040inline constexpr std::string_view kCommutationOffsetMeasurementProcedure =
1041 "commutation-offset-measurement";
1042
1044inline constexpr std::string_view kCommutationOffsetMeasurementStep =
1045 "commutation-offset-measurement";
1046
1054inline constexpr std::string_view kSetBrakeStep = "set-brake";
1055
1058std::vector<ProgressStep> commutationOffsetMeasurementSteps();
1059
1093std::expected<void, std::string> runCommutationOffsetMeasurementProcedure(
1094 Device& device, ProgressReporter& reporter, std::stop_token stop);
1095
1098inline constexpr std::string_view kPhaseResistanceMeasurementProcedure =
1099 "phase-resistance-measurement";
1100
1102inline constexpr std::string_view kPhaseResistanceMeasurementStep = "phase-resistance-measurement";
1103
1105std::vector<ProgressStep> phaseResistanceMeasurementSteps();
1106
1127std::expected<void, std::string> runPhaseResistanceMeasurementProcedure(Device& device,
1128 ProgressReporter& reporter,
1129 std::stop_token stop);
1130
1133inline constexpr std::string_view kPhaseInductanceMeasurementProcedure =
1134 "phase-inductance-measurement";
1135
1137inline constexpr std::string_view kPhaseInductanceMeasurementStep = "phase-inductance-measurement";
1138
1140std::vector<ProgressStep> phaseInductanceMeasurementSteps();
1141
1153std::expected<void, std::string> runPhaseInductanceMeasurementProcedure(Device& device,
1154 ProgressReporter& reporter,
1155 std::stop_token stop);
1156
1159inline constexpr std::string_view kTorqueConstantMeasurementProcedure =
1160 "torque-constant-measurement";
1161
1163inline constexpr std::string_view kTorqueConstantMeasurementStep = "torque-constant-measurement";
1164
1167std::vector<ProgressStep> torqueConstantMeasurementSteps();
1168
1193std::expected<void, std::string> runTorqueConstantMeasurementProcedure(Device& device,
1194 ProgressReporter& reporter,
1195 std::stop_token stop);
1196
1197// ── Firmware installation ──────────────────────────────────────────────────────────────────────
1198//
1199// The one procedure here that changes AL state. Installing firmware *is* a sequence of transitions
1200// (BOOT, write the files, back), so it takes the manager and the position rather than one device.
1201
1208
1210inline constexpr std::string_view kFirmwareInstallationProcedure = "firmware-installation";
1211
1237
1244 std::vector<uint8_t> package;
1245 std::string filename;
1248 std::optional<FirmwarePackageName> name;
1249 std::vector<std::string> skipFiles;
1250 bool cachePackage = true;
1252
1260 std::chrono::milliseconds bootWarmUp{2000};
1261};
1262
1267std::filesystem::path firmwareCacheDir();
1268
1270std::vector<ProcedureParameter> firmwareInstallationParameters();
1271
1273std::vector<ProgressStep> firmwareInstallationSteps();
1274
1288std::expected<FirmwareInstallationRequest, std::string> parseFirmwareInstallationRequest(
1289 const nlohmann::json& body);
1290
1315std::expected<void, std::string> runFirmwareInstallationProcedure(
1316 DeviceManager& deviceManager, uint16_t devicePosition, ProgressReporter& reporter,
1317 std::stop_token stop, const FirmwareInstallationRequest& request);
1318
1319} // namespace mm::node
Represents a single node on the fieldbus.
Definition device.h:120
The handle a procedure body uses to report where it has got to.
Definition procedure.h:327
What a SOMANET firmware package is, offline: how its filename decodes, what its zip holds,...
The register map of the Integro's internal (Kübler) encoder — reference data for OS command 19,...
EtherCatState
EtherCAT Application Layer state values.
Definition fieldbus_driver.h:45
@ PreOp
PRE-OPERATIONAL — mailbox communication active.
IcMuCalibrationMode
How the BiSS service clocks and interprets an iC-MU encoder (OS command 1). The enum value is the "mo...
Definition somanet_drive.h:244
@ kStandard
Normal clocking — the mode an encoder runs in when nothing is being calibrated.
FirmwareService
One of the drive's two independently-scheduled control loops, as the firmware's FirmwareServiceId nam...
Definition somanet_drive.h:284
@ kDriveControl
The current/torque loop — the fast one, period per 0x60C2.
EncoderOrdinal
Which of a drive's two encoders a command addresses. The enum value is the ordinal the firmware expec...
Definition somanet_drive.h:223
@ kEncoder1
The encoder configured in 0x2110.
VelocitySource
Where the velocity control loop takes its feedback from (OS command 18). The enum value is the trigge...
Definition somanet_drive.h:346
ChirpSignalType
Which excitation the system-identification run sweeps with (parameter 4).
Definition somanet_drive.h:543
@ kLogarithmic
Logarithmic frequency sweep whose amplitude rises with it, from half the target to the target.
SystemIdentificationStart
What writing parameter 5 does — arm the run, and on what trigger.
Definition somanet_drive.h:565
FirmwareLatency
Which internal firmware latency OS command 22 measures. The enum value is the latency index byte the ...
Definition somanet_drive.h:376
FirmwareErrorType
The errors OS command 16 can provoke in a firmware service. The enum value is the error-type byte the...
Definition somanet_drive.h:408
HrdData
Which signal a high resolution data (HRD) stream records — OS command 3's data index....
Definition somanet_drive.h:658
Definition bus_health_source.h:7
std::expected< FirmwareLatencyRequest, std::string > parseFirmwareLatencyRequest(const nlohmann::json &body)
Parses and validates a client's firmware latency request body.
Definition somanet_procedures.cc:1748
std::vector< ProgressStep > hrdStreamingSteps()
The HRD streaming procedure's step template — configure, then record.
Definition somanet_procedures.cc:1176
std::expected< void, std::string > runEncoderRegisterProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop, const EncoderRegisterRequest &request)
Runs one encoder register access as a procedure body.
Definition somanet_procedures.cc:1000
std::filesystem::path firmwareCacheDir()
Where installed packages are kept: a firmwares subdirectory of the per-user cache.
Definition somanet_procedures.cc:2362
constexpr std::string_view kCommutationOffsetMeasurementStep
The step commutation offset measurement's own measurement reports against.
Definition somanet_procedures.h:1044
std::expected< HrdStreamingRequest, std::string > parseHrdStreamingRequest(const nlohmann::json &body)
Parses and validates a client's HRD streaming request body.
Definition somanet_procedures.cc:1111
constexpr std::string_view kPlantIdRecordStep
The step that records the response and reads it back. Occupies the chirp's duration plus its padding.
Definition somanet_procedures.h:641
std::expected< void, std::string > runPhaseResistanceMeasurementProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop)
Runs phase resistance measurement as a procedure body.
Definition somanet_procedures.cc:1473
std::expected< VelocitySourceRequest, std::string > parseVelocitySourceRequest(const nlohmann::json &body)
Parses and validates a client's velocity source request body.
Definition somanet_procedures.cc:1671
std::string_view toString(Cia402TargetKind kind)
The token parseCia402TargetKind reads, for a JSON answer.
Definition cia402_drive.cc:59
constexpr std::string_view kPlantIdFitStep
The step that sends the measurement to the auto-tuning program and checks the model.
Definition somanet_procedures.h:644
std::expected< void, std::string > runFirmwareLatencyProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop, const FirmwareLatencyRequest &request)
Measures one internal firmware latency as a procedure body.
Definition somanet_procedures.cc:1843
constexpr std::string_view kSystemIdArmStep
The step that arms the run — or disarms it.
Definition somanet_procedures.h:570
FirmwareLatencyAction
What one firmware latency run should do.
Definition somanet_procedures.h:420
@ kStart
Start measuring and leave it running, to be read by a later run.
@ kStop
Stop measuring — necessarily both latencies, as the command has no per-latency stop.
@ kReadMaximum
Read and clear the maximum of a measurement already running (or already stopped).
std::vector< ProcedureParameter > osCommandParameters()
What the OS command procedure accepts, as its descriptor advertises it.
Definition somanet_procedures.cc:852
std::expected< void, std::string > runSystemIdentificationProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop, const SystemIdentificationRequest &request)
Configures and optionally arms a system identification run as a procedure body.
Definition somanet_procedures.cc:2151
std::vector< ProgressStep > velocitySourceSteps()
The velocity-source procedure's step template — one step, idle.
Definition somanet_procedures.cc:1712
constexpr std::string_view kReadObjectDictionaryStep
The single step reading the whole object dictionary reports against.
Definition somanet_procedures.h:835
constexpr std::string_view kEncoderRegisterProcedure
Procedure name for encoder register communication, as it appears in its URL and its snapshot key.
Definition somanet_procedures.h:121
std::function< std::expected< PlantModelFit, std::string >(const PlantMeasurement &measurement, double startFrequencyHz, double endFrequencyHz)> PlantModelFitFn
Fits a plant model to a measurement.
Definition plant_identification.h:55
std::vector< ProgressStep > torqueConstantMeasurementSteps()
Torque constant measurement's step template — prepare, release the brake, measure,...
Definition somanet_procedures.cc:2340
constexpr std::string_view kSkippedCyclesStep
The single step reading a skipped cycles counter reports against.
Definition somanet_procedures.h:783
std::expected< PlantIdentificationRequest, std::string > parsePlantIdentificationRequest(const nlohmann::json &body)
Parses and validates a client's plant identification request body.
Definition somanet_procedures.cc:2755
std::vector< ProgressStep > firmwareInstallationSteps()
The procedure's step template, in order.
Definition somanet_procedures.cc:2426
constexpr std::string_view kTriggerErrorStep
The single step provoking a firmware error reports against.
Definition somanet_procedures.h:516
constexpr std::string_view kOpenPhaseDetectionStep
The step open phase detection's own measurement reports against.
Definition somanet_procedures.h:883
constexpr std::string_view kIcMuCalibrationModeProcedure
Procedure name for setting an iC-MU calibration mode, as it appears in its URL and its snapshot key.
Definition somanet_procedures.h:180
constexpr std::string_view kOsCommandProcedure
Procedure name for the raw OS command, as it appears in its URL and its snapshot key.
Definition somanet_procedures.h:37
constexpr std::string_view kHrdRecordStep
The step that records. Occupies the whole configured duration.
Definition somanet_procedures.h:238
constexpr std::string_view kHrdStreamingProcedure
Procedure name for recording a high resolution data stream, as it appears in its URL and its snapshot...
Definition somanet_procedures.h:231
std::vector< ProcedureParameter > encoderRegisterParameters()
What encoder register communication accepts, as its descriptor advertises it.
Definition somanet_procedures.cc:979
std::vector< ProgressStep > kueblerRegisterSteps()
The Kübler register procedure's step template — one step, idle.
Definition somanet_procedures.cc:1647
std::expected< void, std::string > runVelocitySourceProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop, const VelocitySourceRequest &request)
Chooses the velocity loop's feedback source as a procedure body.
Definition somanet_procedures.cc:1714
constexpr std::string_view kPhaseInductanceMeasurementProcedure
Procedure name for phase inductance measurement, as it appears in its URL and its snapshot key.
Definition somanet_procedures.h:1133
std::vector< ProgressStep > osCommandSteps()
The OS command procedure's step template — one step, all idle.
Definition somanet_procedures.cc:901
std::vector< ProcedureParameter > systemIdentificationParameters()
What system identification accepts, as its descriptor advertises it.
Definition somanet_procedures.cc:2092
std::vector< ProgressStep > phaseResistanceMeasurementSteps()
Phase resistance measurement's step template — prepare, measure, restore, all idle.
Definition somanet_procedures.cc:1469
std::expected< void, std::string > runMotorPhaseOrderDetectionProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop)
Runs motor phase order detection as a procedure body.
Definition somanet_procedures.cc:1287
constexpr std::string_view kSkippedCyclesProcedure
Procedure name for reading a skipped cycles counter, as it appears in its URL and its snapshot key.
Definition somanet_procedures.h:780
void to_json(nlohmann::json &j, const Cia402Status &s)
Serialises a Cia402Status. Emits state/modeName as human-readable strings alongside the numeric statu...
Definition cia402_drive.cc:13
std::vector< ProcedureParameter > plantIdentificationParameters()
What plant identification accepts, as its descriptor advertises it.
Definition somanet_procedures.cc:2773
std::expected< void, std::string > runOffsetDetectionProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop)
Runs the whole commissioning sequence as one procedure body.
Definition somanet_procedures.cc:1311
std::expected< void, std::string > runHrdStreamingProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop, const HrdStreamingRequest &request)
Records one high resolution data stream as a procedure body.
Definition somanet_procedures.cc:1180
constexpr std::string_view kIgnoreBissStatusBitsStep
The single step ignoring BiSS status bits reports against.
Definition somanet_procedures.h:729
std::vector< ProgressStep > polePairDetectionSteps()
Pole pair detection's step template — prepare, release the brake, detect, restore.
Definition somanet_procedures.cc:1262
constexpr std::string_view kKueblerRegisterStep
The single step a Kübler register access reports against.
Definition somanet_procedures.h:306
constexpr std::string_view kFirmwareLatencyReadStep
The step that reads and clears the recorded maximum.
Definition somanet_procedures.h:407
constexpr std::string_view kSystemIdentificationProcedure
Procedure name for configuring a system identification run, as it appears in its URL and its snapshot...
Definition somanet_procedures.h:564
std::vector< ProgressStep > firmwareLatencySteps()
The firmware latency procedure's step template — start, observe, read, stop.
Definition somanet_procedures.cc:1838
constexpr std::string_view kFirmwareInstallationProcedure
Procedure name, as it appears in its URL and its snapshot key.
Definition somanet_procedures.h:1210
constexpr std::string_view kPrepareStep
The step ids shared by every procedure that prepares a drive, measures, and puts it back.
Definition somanet_procedures.h:875
std::vector< ProcedureParameter > ignoreBissStatusBitsParameters()
What ignoring BiSS status bits accepts, as its descriptor advertises it.
Definition somanet_procedures.cc:2206
constexpr std::string_view kPlantIdStoreStep
The step that writes the model to the drive.
Definition somanet_procedures.h:647
std::vector< ProgressStep > skippedCyclesSteps()
The skipped cycles procedure's step template — one step, idle.
Definition somanet_procedures.cc:2291
constexpr std::string_view kFirmwareLatencyObserveStep
The step that lets the drive run while the measurement collects. Occupies the whole requested duratio...
Definition somanet_procedures.h:404
std::vector< ProgressStep > motorPhaseOrderDetectionSteps()
Motor phase order detection's step template — prepare, release the brake, detect, restore.
Definition somanet_procedures.cc:1283
constexpr std::string_view kTorqueConstantMeasurementStep
The step torque constant measurement's own measurement reports against.
Definition somanet_procedures.h:1163
constexpr std::string_view kTriggerErrorProcedure
Procedure name for provoking a firmware error, as it appears in its URL and its snapshot key.
Definition somanet_procedures.h:513
std::vector< ProgressStep > openPhaseDetectionSteps()
Open phase detection's step template — prepare, check, restore, all idle.
Definition somanet_procedures.cc:1216
std::optional< FirmwareLatencyAction > parseFirmwareLatencyAction(std::string_view token)
Parses a firmware latency action token. std::nullopt if it names none of them.
Definition somanet_procedures.cc:1738
constexpr std::string_view kOsCommandStep
The single step the OS command procedure reports against.
Definition somanet_procedures.h:40
constexpr std::string_view kReadObjectDictionaryProcedure
Procedure name for reading the whole object dictionary, as it appears in its URL and its snapshot key...
Definition somanet_procedures.h:832
constexpr std::string_view kVelocitySourceStep
The single step choosing the velocity source reports against.
Definition somanet_procedures.h:355
std::expected< TriggerErrorRequest, std::string > parseTriggerErrorRequest(const nlohmann::json &body)
Parses and validates a client's trigger-error request body.
Definition somanet_procedures.cc:1910
std::vector< ProcedureParameter > firmwareInstallationParameters()
What the procedure accepts, as its descriptor advertises it.
Definition somanet_procedures.cc:2364
constexpr std::string_view kPolePairDetectionStep
The step pole pair detection's own measurement reports against.
Definition somanet_procedures.h:925
constexpr std::string_view kPhaseInductanceMeasurementStep
The step phase inductance measurement's own measurement reports against.
Definition somanet_procedures.h:1137
constexpr std::string_view kFirmwareLatencyProcedure
Procedure name for measuring a firmware latency, as it appears in its URL and its snapshot key.
Definition somanet_procedures.h:397
constexpr std::string_view kFirmwareLatencyStopStep
The step that stops both measurements.
Definition somanet_procedures.h:410
std::vector< ProcedureParameter > kueblerRegisterParameters()
What a Kübler register access accepts, as its descriptor advertises it.
Definition somanet_procedures.cc:1624
constexpr std::string_view kSystemIdConfigureStep
The step that writes the chirp's five settings.
Definition somanet_procedures.h:567
constexpr std::string_view kFirmwareLatencyStartStep
The step that starts a measurement, and clears whatever the latency recorded.
Definition somanet_procedures.h:400
constexpr std::string_view kMotorPhaseOrderDetectionProcedure
Procedure name for motor phase order detection, as it appears in its URL and its snapshot key.
Definition somanet_procedures.h:956
std::expected< IcMuCalibrationModeRequest, std::string > parseIcMuCalibrationModeRequest(const nlohmann::json &body)
Parses and validates a client's iC-MU calibration mode request body.
Definition somanet_procedures.cc:1026
constexpr std::string_view kPhaseResistanceMeasurementProcedure
Procedure name for phase resistance measurement, as it appears in its URL and its snapshot key.
Definition somanet_procedures.h:1098
constexpr std::string_view kPlantIdentificationProcedure
Procedure name for plant identification, as it appears in its URL and its snapshot key.
Definition somanet_procedures.h:634
std::expected< SkippedCyclesRequest, std::string > parseSkippedCyclesRequest(const nlohmann::json &body)
Parses and validates a client's skipped cycles request body.
Definition somanet_procedures.cc:2247
std::vector< ProcedureParameter > hrdStreamingParameters()
What HRD streaming accepts, as its descriptor advertises it.
Definition somanet_procedures.cc:1149
std::expected< void, std::string > runFirmwareInstallationProcedure(DeviceManager &deviceManager, uint16_t devicePosition, ProgressReporter &reporter, std::stop_token stop, const FirmwareInstallationRequest &request)
Installs request's package on the device at devicePosition.
Definition somanet_procedures.cc:2521
std::vector< ProcedureParameter > triggerErrorParameters()
What provoking a firmware error accepts, as its descriptor advertises it.
Definition somanet_procedures.cc:1947
std::expected< void, std::string > runCommutationOffsetMeasurementProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop)
Runs commutation offset measurement as a procedure body — OS command 5 and nothing else.
Definition somanet_procedures.cc:1437
constexpr std::string_view kPhaseResistanceMeasurementStep
The step phase resistance measurement's own measurement reports against.
Definition somanet_procedures.h:1102
std::expected< void, std::string > runPolePairDetectionProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop)
Runs pole pair detection as a procedure body.
Definition somanet_procedures.cc:1266
std::expected< void, std::string > runIcMuCalibrationModeProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop, const IcMuCalibrationModeRequest &request)
Sets an iC-MU encoder's calibration mode as a procedure body.
Definition somanet_procedures.cc:1086
constexpr std::string_view kOpenPhaseDetectionProcedure
Procedure name for open phase detection, as it appears in its URL and its snapshot key.
Definition somanet_procedures.h:880
std::vector< ProgressStep > readObjectDictionarySteps()
The read-object-dictionary procedure's step template — one step, idle.
Definition somanet_procedures.cc:2315
constexpr std::string_view kTorqueConstantMeasurementProcedure
Procedure name for torque constant measurement, as it appears in its URL and its snapshot key.
Definition somanet_procedures.h:1159
std::expected< void, std::string > runTriggerErrorProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop, const TriggerErrorRequest &request)
Provokes a firmware error in a control service as a procedure body.
Definition somanet_procedures.cc:1989
constexpr std::string_view kPolePairDetectionProcedure
Procedure name for pole pair detection, as it appears in its URL and its snapshot key.
Definition somanet_procedures.h:922
constexpr std::string_view kSetBrakeStep
The step that puts the brake where the configured method needs it.
Definition somanet_procedures.h:1054
std::vector< ProcedureParameter > firmwareLatencyParameters()
What measuring a firmware latency accepts, as its descriptor advertises it.
Definition somanet_procedures.cc:1791
std::vector< ProgressStep > icMuCalibrationModeSteps()
The iC-MU calibration mode procedure's step template — one step, idle.
Definition somanet_procedures.cc:1082
constexpr std::string_view kEncoderRegisterStep
The single step encoder register communication reports against.
Definition somanet_procedures.h:124
std::expected< void, std::string > runPlantIdentificationProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop, const PlantIdentificationRequest &request, const PlantModelFitFn &fitPlantModel)
Identifies the plant model of a drive as a procedure body.
Definition somanet_procedures.cc:2973
constexpr std::string_view kKueblerRegisterProcedure
Procedure name for a Kübler encoder register access, as it appears in its URL and its snapshot key.
Definition somanet_procedures.h:303
std::vector< ProcedureParameter > icMuCalibrationModeParameters()
What setting an iC-MU calibration mode accepts, as its descriptor advertises it.
Definition somanet_procedures.cc:1058
std::vector< ProgressStep > commutationOffsetMeasurementSteps()
Commutation offset measurement's step template — prepare, release the brake, measure,...
Definition somanet_procedures.cc:1432
constexpr std::string_view kPlantIdChirpStep
The step that configures the chirp and arms it to start with the recording.
Definition somanet_procedures.h:637
std::vector< ProgressStep > encoderRegisterSteps()
Encoder register communication's step template — one step, idle.
Definition somanet_procedures.cc:998
std::expected< EncoderRegisterRequest, std::string > parseEncoderRegisterRequest(const nlohmann::json &body)
Parses and validates a client's encoder register request body.
Definition somanet_procedures.cc:946
std::expected< SystemIdentificationRequest, std::string > parseSystemIdentificationRequest(const nlohmann::json &body)
Parses and validates a client's system identification request body.
Definition somanet_procedures.cc:2011
std::expected< KueblerRegisterRequest, std::string > parseKueblerRegisterRequest(const nlohmann::json &body)
Parses and validates a client's Kübler register request body.
Definition somanet_procedures.cc:1566
std::expected< void, std::string > runPhaseInductanceMeasurementProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop)
Runs phase inductance measurement as a procedure body.
Definition somanet_procedures.cc:1489
constexpr std::string_view kVelocitySourceProcedure
Procedure name for choosing the velocity feedback source, as it appears in its URL and its snapshot k...
Definition somanet_procedures.h:352
constexpr std::string_view kReleaseBrakeStep
Definition somanet_procedures.h:876
std::expected< void, std::string > runReadObjectDictionaryProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop)
Reads every object dictionary value in one transfer, as a procedure body.
Definition somanet_procedures.cc:2319
std::expected< OsCommandRequest, std::string > parseOsCommandRequest(const nlohmann::json &body)
Parses and validates a client's OS command request body.
Definition somanet_procedures.cc:771
constexpr std::string_view kHrdConfigureStep
The step that arms the recording — chooses the signal and the duration, and clears the files the last...
Definition somanet_procedures.h:235
constexpr std::string_view kRestoreStep
Definition somanet_procedures.h:877
constexpr std::string_view kIgnoreBissStatusBitsProcedure
Procedure name for ignoring a BiSS encoder's status bits, as it appears in its URL and its snapshot k...
Definition somanet_procedures.h:726
std::expected< IgnoreBissStatusBitsRequest, std::string > parseIgnoreBissStatusBitsRequest(const nlohmann::json &body)
Parses and validates a client's ignore-BiSS-status-bits request body.
Definition somanet_procedures.cc:2182
std::vector< ProgressStep > ignoreBissStatusBitsSteps()
The ignore-BiSS-status-bits procedure's step template — one step, idle.
Definition somanet_procedures.cc:2218
std::vector< ProgressStep > offsetDetectionSteps()
The commissioning sequence's step template — every command in the order it runs, plus the shared prep...
Definition somanet_procedures.cc:1304
std::expected< void, std::string > runTorqueConstantMeasurementProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop)
Runs torque constant measurement as a procedure body.
Definition somanet_procedures.cc:2344
std::expected< void, std::string > runKueblerRegisterProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop, const KueblerRegisterRequest &request)
Reads or writes one Integro internal-encoder register as a procedure body.
Definition somanet_procedures.cc:1649
constexpr std::string_view kIcMuCalibrationModeStep
The single step setting an iC-MU calibration mode reports against.
Definition somanet_procedures.h:183
std::expected< FirmwareInstallationRequest, std::string > parseFirmwareInstallationRequest(const nlohmann::json &body)
Parses and validates a client's installation request.
Definition somanet_procedures.cc:2431
std::vector< ProgressStep > phaseInductanceMeasurementSteps()
Phase inductance measurement's step template — prepare, measure, restore, all idle.
Definition somanet_procedures.cc:1485
constexpr std::string_view kMotorPhaseOrderDetectionStep
The step motor phase order detection's own measurement reports against.
Definition somanet_procedures.h:960
std::vector< ProgressStep > systemIdentificationSteps()
The system identification procedure's step template — configure, then arm.
Definition somanet_procedures.cc:2147
std::vector< ProcedureParameter > skippedCyclesParameters()
What reading a skipped cycles counter accepts, as its descriptor advertises it.
Definition somanet_procedures.cc:2271
std::expected< void, std::string > runOsCommandProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop, const OsCommandRequest &request)
Runs one raw OS command as a procedure body.
Definition somanet_procedures.cc:903
std::expected< void, std::string > 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.
Definition somanet_procedures.cc:2222
std::expected< void, std::string > runSkippedCyclesProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop, const SkippedCyclesRequest &request)
Reads one control loop's skipped-cycle counter as a procedure body.
Definition somanet_procedures.cc:2293
std::vector< ProgressStep > plantIdentificationSteps()
The plant identification procedure's step template.
Definition somanet_procedures.cc:2796
std::vector< ProcedureParameter > velocitySourceParameters()
What choosing the velocity source accepts, as its descriptor advertises it.
Definition somanet_procedures.cc:1692
constexpr std::string_view kOffsetDetectionProcedure
Procedure name for the whole commissioning sequence, as it appears in its URL and its snapshot key.
Definition somanet_procedures.h:995
std::expected< void, std::string > runOpenPhaseDetectionProcedure(Device &device, ProgressReporter &reporter, std::stop_token stop)
Runs open phase detection as a procedure body.
Definition somanet_procedures.cc:1220
std::vector< ProgressStep > triggerErrorSteps()
The trigger-error procedure's step template — one step, idle.
Definition somanet_procedures.cc:1987
constexpr std::string_view kCommutationOffsetMeasurementProcedure
Procedure name for commutation offset measurement, as it appears in its URL and its snapshot key.
Definition somanet_procedures.h:1040
Plant identification: the model of a motor and its load that auto-tuning computes gains from,...
What one encoder register access was asked to do.
Definition somanet_procedures.h:131
uint8_t value
The byte to write; ignored when reading.
Definition somanet_procedures.h:135
bool write
Write the register rather than read it.
Definition somanet_procedures.h:133
uint8_t registerAddress
The register to access; no default, so a request must say.
Definition somanet_procedures.h:134
somanet::EncoderOrdinal encoder
Which encoder.
Definition somanet_procedures.h:132
Where an install leaves the device, as an AL state.
Definition somanet_procedures.h:1243
std::string filename
Definition somanet_procedures.h:1245
mm::comm::EtherCatState finalState
Definition somanet_procedures.h:1251
std::vector< std::string > skipFiles
Entries not to write; defaults per the descriptor.
Definition somanet_procedures.h:1249
std::optional< FirmwarePackageName > name
Definition somanet_procedures.h:1248
std::chrono::milliseconds bootWarmUp
Definition somanet_procedures.h:1260
std::vector< uint8_t > package
The package zip's bytes.
Definition somanet_procedures.h:1244
bool cachePackage
Keep a copy under firmwareCacheDir when named.
Definition somanet_procedures.h:1250
What one firmware latency run was asked to do.
Definition somanet_procedures.h:451
FirmwareLatencyAction action
Definition somanet_procedures.h:454
somanet::FirmwareLatency latency
Which latency. Ignored by FirmwareLatencyAction::kStop, which stops both.
Definition somanet_procedures.h:457
std::chrono::milliseconds duration
How long to let the measurement collect, used only by FirmwareLatencyAction::kMeasure.
Definition somanet_procedures.h:460
What one high resolution data recording was asked to capture.
Definition somanet_procedures.h:241
std::chrono::milliseconds duration
Definition somanet_procedures.h:248
somanet::HrdData data
Definition somanet_procedures.h:244
What one iC-MU calibration mode change was asked to do.
Definition somanet_procedures.h:186
somanet::EncoderOrdinal encoder
Which encoder.
Definition somanet_procedures.h:187
somanet::IcMuCalibrationMode mode
Definition somanet_procedures.h:192
Which encoder's status bits to act on, and which way.
Definition somanet_procedures.h:732
somanet::EncoderOrdinal encoder
Which encoder.
Definition somanet_procedures.h:733
bool ignore
Definition somanet_procedures.h:738
What one Kübler register access was asked to do.
Definition somanet_procedures.h:309
uint8_t length
Width in bytes, 1 to 4. Must match the register's real width.
Definition somanet_procedures.h:311
uint8_t address
Which register; no default, so a request must name one.
Definition somanet_procedures.h:310
uint32_t value
The value to write; ignored when reading.
Definition somanet_procedures.h:313
bool write
Write value rather than read.
Definition somanet_procedures.h:312
An OS command's fs-buffer transfer — the data that does not fit in the 8 command bytes.
Definition somanet_drive.h:1159
What one raw OS command run was asked to do.
Definition somanet_procedures.h:49
std::chrono::milliseconds pollInterval
Definition somanet_procedures.h:52
std::vector< uint8_t > command
The 8 request bytes (byte 0 = command ID).
Definition somanet_procedures.h:50
OsCommandFsBuffer fsBuffer
Definition somanet_procedures.h:55
std::chrono::milliseconds timeout
Ceiling on the whole command.
Definition somanet_procedures.h:51
What one raw OS command run produced — the step's value.
Definition somanet_procedures.h:88
std::vector< uint8_t > fsBuffer
Definition somanet_procedures.h:94
std::vector< uint8_t > data
Service response payload, if the drive sent one.
Definition somanet_procedures.h:90
uint8_t status
Terminal status byte (0x1023:03 byte 0).
Definition somanet_procedures.h:89
std::optional< uint8_t > errorCode
Definition somanet_procedures.h:91
One plant identification run, as a client describes it.
Definition somanet_procedures.h:650
SystemIdentificationRequest chirp
Definition somanet_procedures.h:653
std::chrono::milliseconds streamDuration
Definition somanet_procedures.h:657
Which control loop's counter to read.
Definition somanet_procedures.h:786
somanet::FirmwareService service
Definition somanet_procedures.h:789
One system identification run, as a client describes it.
Definition somanet_procedures.h:573
uint32_t targetFrequencyMilliHz
Where it ends. Required, and not below the start.
Definition somanet_procedures.h:575
somanet::ChirpSignalType signalType
Which chirp.
Definition somanet_procedures.h:578
uint32_t startFrequencyMilliHz
Where the sweep begins. Required.
Definition somanet_procedures.h:574
uint32_t targetAmplitudePermil
Peak excitation, per-mille of rated torque. Required.
Definition somanet_procedures.h:576
somanet::SystemIdentificationStart start
Definition somanet_procedures.h:582
uint32_t transitionTimeMs
How long the sweep takes. Required.
Definition somanet_procedures.h:577
Which service to break, and how.
Definition somanet_procedures.h:519
somanet::FirmwareService service
Definition somanet_procedures.h:520
somanet::FirmwareErrorType errorType
Definition somanet_procedures.h:525
Which velocity the control loop should use.
Definition somanet_procedures.h:358
somanet::VelocitySource source
Definition somanet_procedures.h:362