Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
somanet_drive.cc File Reference
#include "node/somanet_drive.h"
#include <spdlog/spdlog.h>
#include <algorithm>
#include <bit>
#include <charconv>
#include <format>
#include <iterator>
#include <nlohmann/json.hpp>
#include <optional>
#include <span>
#include <string>
#include <string_view>
#include <thread>
#include <utility>
#include <variant>
#include <vector>
#include "comm/foe_error.h"
#include "core/util.h"
#include "node/kuebler_registers.h"
#include "node/synapticon.h"
Include dependency graph for somanet_drive.cc:

Namespaces

namespace  mm
 
namespace  mm::node
 
namespace  mm::node::somanet
 Pure SOMANET (Synapticon manufacturer-specific) vocabulary — object indices, sub-entry numbers and enumerations, with no dependency on Device.
 

Functions

std::optional< HrdDatamm::node::somanet::parseHrdData (std::string_view token)
 Parses an HRD data token ("encoder-raw" / "system-identification") — the inverse of toString. Returns std::nullopt for any other token.
 
std::optional< ChirpSignalTypemm::node::somanet::parseChirpSignalType (std::string_view token)
 Parses a signal-type token ("logarithmic" / "linear"). std::nullopt for any other.
 
std::optional< SystemIdentificationStartmm::node::somanet::parseSystemIdentificationStart (std::string_view token)
 Parses a start token ("none" / "immediately" / "after-hrd-stream-start").
 
std::optional< VelocitySourcemm::node::somanet::parseVelocitySource (std::string_view token)
 Parses a velocity source token ("firmware" / "encoder"). std::nullopt otherwise.
 
std::optional< FirmwareLatencymm::node::somanet::parseFirmwareLatency (std::string_view token)
 Parses a firmware latency token ("setpoint" / "feedback"). std::nullopt otherwise.
 
std::optional< FirmwareErrorTypemm::node::somanet::parseFirmwareErrorType (std::string_view token)
 Parses a firmware error type token — the inverse of toString.
 
std::optional< FirmwareServicemm::node::somanet::parseFirmwareService (std::string_view token)
 Parses a service token ("drive-control" / "motion-control") — the inverse of toString. Returns std::nullopt for any other token.
 
std::optional< IcMuCalibrationModemm::node::somanet::parseIcMuCalibrationMode (std::string_view token)
 Parses a mode token ("configuration" / "raw" / "standard") — the inverse of toString. Returns std::nullopt for any other token.
 
std::optional< FsBufferTransfermm::node::parseFsBufferTransfer (std::string_view token)
 Reads an fs-buffer direction back from its name. std::nullopt if token names none.
 
std::optional< std::string_view > mm::node::osCommandErrorName (uint8_t code)
 Names a general OS error code, or std::nullopt when code is command-specific.
 
void mm::node::to_json (nlohmann::json &j, const ObjectDictionaryValue &entry)
 
void mm::node::to_json (nlohmann::json &j, const ObjectDictionaryValues &values)
 
std::expected< ObjectDictionaryValues, std::string > mm::node::decodeObjectDictionaryValues (std::span< const uint8_t > data, const std::vector< DeviceParameter > &definitions)
 Splits what OS command 21 sent into one value per entry of definitions.
 
void mm::node::to_json (nlohmann::json &j, const BrakeState &state)
 
std::vector< DeviceFilemm::node::parseDeviceFileList (std::string_view text)
 Parses the body of a fs-getlist read into one entry per line.
 
void mm::node::to_json (nlohmann::json &j, const DeviceFile &file)
 
std::vector< std::string_view > mm::node::hrdColumns (somanet::HrdData data)
 The column names of one decoded sample of data, in the order a row carries them.
 
void mm::node::to_json (nlohmann::json &j, const HrdRecording &recording)
 
std::string mm::node::toCsv (const HrdRecording &recording)
 Renders a recording as CSV: one header row of column names, then one row per sample.
 
HrdSamples mm::node::decodeHrdSamples (std::span< const uint8_t > bytes, somanet::HrdData data)
 Decodes the concatenated contents of a recording's files into samples.
 
std::expected< void, std::string > mm::node::removeDeviceFile (Device &device, const std::string &filename)
 Deletes a file from a SOMANET drive's flash (FoE read of "fs-remove=<filename>").
 
void mm::node::to_json (nlohmann::json &j, const EncoderRegisterResult &result)
 
void mm::node::to_json (nlohmann::json &j, const OpenPhaseResult &result)
 
void mm::node::to_json (nlohmann::json &j, const MotorPhaseOrderResult &result)
 
void mm::node::to_json (nlohmann::json &j, const CommutationOffsetResult &result)
 
void mm::node::to_json (nlohmann::json &j, const PolePairResult &result)
 
void mm::node::to_json (nlohmann::json &j, const PhaseResistanceResult &result)
 
void mm::node::to_json (nlohmann::json &j, const PhaseInductanceResult &result)
 
void mm::node::to_json (nlohmann::json &j, const TorqueConstantResult &result)
 
void mm::node::to_json (nlohmann::json &j, const SkippedCyclesResult &result)
 
void mm::node::to_json (nlohmann::json &j, const TriggerErrorResult &result)
 
void mm::node::to_json (nlohmann::json &j, const KueblerRegisterResult &result)
 
void mm::node::to_json (nlohmann::json &j, const FirmwareLatencyResult &result)
 
std::expected< SomanetDrive, std::string > mm::node::createSomanetDrive (Device &device)
 Validates that device is a SOMANET drive, then binds a view to it.
 

Variables

constexpr size_t mm::node::kFirmwareServiceByte = 1
 
constexpr size_t mm::node::kBissIgnoreByte = 1
 
constexpr unsigned mm::node::kBissIgnoreEncoderShift = 1
 
constexpr uint8_t mm::node::kBissIgnoreTrigger = 0x01
 
constexpr size_t mm::node::kKueblerDirectionByte = 1
 
constexpr size_t mm::node::kKueblerAddressByte = 2
 
constexpr size_t mm::node::kKueblerLengthByte = 3
 
constexpr size_t mm::node::kKueblerValueLsbByte = 4
 
constexpr size_t mm::node::kVelocitySourceByte = 1
 
constexpr size_t mm::node::kFirmwareLatencyActionByte = 1
 
constexpr size_t mm::node::kFirmwareLatencyIndexByte = 2
 
constexpr size_t mm::node::kFirmwareLatencyMaximumOffset = 0
 
constexpr size_t mm::node::kFirmwareLatencyConfiguredOffset = 3
 
constexpr size_t mm::node::kFirmwareLatencyValueBytes = 3
 
constexpr uint8_t mm::node::kStartLatencyMeasurement = 0
 
constexpr uint8_t mm::node::kGetAndClearMaximumLatency = 1
 
constexpr uint8_t mm::node::kStopLatencyMeasurements = 2
 
constexpr uint32_t mm::node::kLatencyTickNanoseconds = 10
 
constexpr size_t mm::node::kTriggerErrorServiceByte = 1
 
constexpr size_t mm::node::kTriggerErrorTypeByte = 2
 
constexpr size_t mm::node::kSystemIdParameterByte = 1
 
constexpr size_t mm::node::kSystemIdValueMsbByte = 2