DYNAMIXEL Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Classes | Namespaces | Enumerations | Functions | Variables
dynamixel_types.hpp File Reference

Public types of the DYNAMIXEL driver: errors, Result<T>, protocol enumerations, replies, statistics and the configuration. More...

#include <cstddef>
#include <cstdint>
#include <span>
#include "dynamixel_detail.hpp"
#include "dynamixel_tables.hpp"
#include "dynamixel_version.h"

Go to the source code of this file.

Classes

struct  dynamixel::Result< T >
 The value of a call, or why there is none. More...
 
struct  dynamixel::Result< void >
 The result of a call that returns no value. More...
 
struct  dynamixel::ReplyInfo
 An error byte, decoded. More...
 
struct  dynamixel::PingInfo
 The identity a ping returns. More...
 
struct  dynamixel::ServoRef
 A servo on the bus: its ID and its control-table family. More...
 
struct  dynamixel::DeviceReply
 The per-device outcome of a Sync Read, Bulk Read or Fast read. More...
 
struct  dynamixel::BulkReadItem
 One device of a Bulk Read request. More...
 
struct  dynamixel::BulkWriteItem
 One device of a Bulk Write request. More...
 
struct  dynamixel::Feedback
 Position, velocity, effort, voltage and temperature of a servo, read in one transfer. More...
 
struct  dynamixel::Stats
 What the driver counted since ResetStats(). More...
 
struct  dynamixel::Config
 Everything the driver needs to know about the bus. More...
 
class  dynamixel::CheckedConfig
 A configuration proven valid at build time. More...
 

Namespaces

namespace  dynamixel
 The DYNAMIXEL driver: everything it declares lives here; internals in detail.
 
namespace  dynamixel::p1_error
 Protocol 1.0 error flags (the error byte of a status packet).
 
namespace  dynamixel::hw_error
 Bits of the X-series Hardware Error Status register (address 70) and the Shutdown register.
 

Enumerations

enum class  dynamixel::Error : uint8_t {
  dynamixel::Error::Ok = 0 , dynamixel::Error::NotInitialized = 1 , dynamixel::Error::InvalidArgument = 2 , dynamixel::Error::Bus = 3 ,
  dynamixel::Error::Timeout = 4 , dynamixel::Error::DeviceIdMismatch , dynamixel::Error::Crc = 6 , dynamixel::Error::Busy = 7 ,
  dynamixel::Error::DeviceFault = 8 , dynamixel::Error::Unsupported = 9 , dynamixel::Error::DeviceError , dynamixel::Error::InvalidReply ,
  dynamixel::Error::EchoMismatch = 18 , dynamixel::Error::LineFault = 19 , dynamixel::Error::NotPermitted = 22
}
 Why a call failed. Every call of the driver returns one of these in its Result. More...
 
enum class  dynamixel::LogLevel : uint8_t { dynamixel::LogLevel::Error = 0 , dynamixel::LogLevel::Warning , dynamixel::LogLevel::Info , dynamixel::LogLevel::Debug }
 Severity passed to the optional Log() hook. More...
 
enum class  dynamixel::Protocol : uint8_t { dynamixel::Protocol::V1 = 0 , dynamixel::Protocol::V2 = 1 }
 The packet format of the bus: one per DYNAMIXEL object, because every servo on a bus shares it. More...
 
enum class  dynamixel::EchoMode : uint8_t { dynamixel::EchoMode::None = 0 , dynamixel::EchoMode::Loopback = 1 }
 Whether the transmitted bytes come back on the receive line (a single-wire loopback). More...
 
enum class  dynamixel::AlertPolicy : uint8_t { dynamixel::AlertPolicy::Report = 0 , dynamixel::AlertPolicy::Fail = 1 }
 What a reply with a hardware alert means for the call. More...
 
enum class  dynamixel::StatusReturn : uint8_t { dynamixel::StatusReturn::PingOnly = 0 , dynamixel::StatusReturn::ReadOnly = 1 , dynamixel::StatusReturn::All = 2 }
 How much a servo answers (the Status Return Level register, values 0 to 2). More...
 
enum class  dynamixel::ResetOption : uint8_t { dynamixel::ResetOption::KeepIdAndBaud = 0x02 , dynamixel::ResetOption::KeepId = 0x01 , dynamixel::ResetOption::All = 0xFF }
 The option byte of a Factory Reset instruction (protocol 2.0). More...
 
enum class  dynamixel::ClearOption : uint8_t { dynamixel::ClearOption::MultiTurn = 0x01 , dynamixel::ClearOption::Errors = 0x02 }
 The option of a Clear instruction (protocol 2.0). More...
 
enum class  dynamixel::BackupOption : uint8_t { dynamixel::BackupOption::Store = 0x01 , dynamixel::BackupOption::Restore = 0x02 }
 The option of a Control Table Backup instruction (protocol 2.0). More...
 
enum class  dynamixel::Protocol2Error : uint8_t {
  dynamixel::Protocol2Error::None = 0 , dynamixel::Protocol2Error::ResultFail = 1 , dynamixel::Protocol2Error::InstructionError = 2 , dynamixel::Protocol2Error::CrcError = 3 ,
  dynamixel::Protocol2Error::DataRangeError = 4 , dynamixel::Protocol2Error::DataLengthError = 5 , dynamixel::Protocol2Error::DataLimitError = 6 , dynamixel::Protocol2Error::AccessError
}
 Protocol 2.0 error numbers (bits 6..0 of the error byte of a status packet). More...
 

Functions

constexpr const char * dynamixel::ToString (Error error) noexcept
 The name of an error, for logs.
 
constexpr Config dynamixel::FastBusPreset () noexcept
 Calls on a bus of servos that all answer: the shortest sensible setup for a first test.
 
constexpr Config dynamixel::UsbAdapterPreset () noexcept
 A bus on a USB adapter whose receive buffer is flushed in 16 ms steps.
 
constexpr Config dynamixel::LegacyBusPreset () noexcept
 The legacy bus: protocol 1.0 at 1 Mbit/s with the single-wire loopback of a half-duplex adapter.
 
constexpr Error dynamixel::Validate (const Config &config) noexcept
 Check a configuration without touching the bus.
 
constexpr ReplyInfo dynamixel::Classify (Protocol protocol, uint8_t id, uint8_t error_byte) noexcept
 Decode the error byte of a status packet.
 
constexpr Protocol2Error dynamixel::ErrorNumber (uint8_t error_byte) noexcept
 The protocol 2.0 error number of an error byte.
 
void dynamixel::ConfigIsInvalid () noexcept
 Reached only when a CheckedConfig is built from an invalid configuration: it is never defined, so the build fails and names it (KB-CPP20-013).
 
constexpr const char * dynamixel::GetDriverVersion () noexcept
 
constexpr uint32_t dynamixel::GetDriverVersionMajor () noexcept
 
constexpr uint32_t dynamixel::GetDriverVersionMinor () noexcept
 
constexpr uint32_t dynamixel::GetDriverVersionPatch () noexcept
 

Variables

constexpr uint8_t dynamixel::p1_error::kInputVoltage
 Input voltage out of the configured range (condition).
 
constexpr uint8_t dynamixel::p1_error::kAngleLimit
 Goal position outside the angle limits (command fault).
 
constexpr uint8_t dynamixel::p1_error::kOverheating = 0x04
 Internal temperature above the limit (condition).
 
constexpr uint8_t dynamixel::p1_error::kRange = 0x08
 An instruction value out of range (command fault).
 
constexpr uint8_t dynamixel::p1_error::kChecksum
 The instruction's checksum was wrong (command fault).
 
constexpr uint8_t dynamixel::p1_error::kOverload
 Load beyond what the torque limit controls (condition).
 
constexpr uint8_t dynamixel::p1_error::kInstruction
 
constexpr uint8_t dynamixel::p1_error::kCommandFaults
 Flags that mean the instruction was not carried out.
 
constexpr uint8_t dynamixel::p1_error::kConditions
 Flags that report the servo's condition, not the instruction.
 
constexpr uint8_t dynamixel::kAlertBit = 0x80
 Protocol 2.0 alert bit of the error byte.
 
constexpr uint8_t dynamixel::hw_error::kInputVoltage = 0x01
 Input voltage out of range.
 
constexpr uint8_t dynamixel::hw_error::kOverheating = 0x04
 Temperature above the limit.
 
constexpr uint8_t dynamixel::hw_error::kMotorEncoder = 0x08
 Motor encoder malfunction (X430, X540, MX(2.0)).
 
constexpr uint8_t dynamixel::hw_error::kElectricalShock = 0x10
 Electrical shock or too little power.
 
constexpr uint8_t dynamixel::hw_error::kOverload = 0x20
 Persistent load above the maximum output.
 
constexpr uint8_t dynamixel::kBroadcastId = 0xFE
 The broadcast ID: an instruction to it reaches every servo and none answers.
 
constexpr uint8_t dynamixel::kMaxIdV2 = 252
 The largest valid servo ID of protocol 2.0.
 
constexpr uint8_t dynamixel::kMaxIdV1 = 253
 The largest valid servo ID of protocol 1.0.
 
constexpr uint32_t dynamixel::kMinTimeoutUs = 100
 Shortest and longest reply wait the driver accepts, microseconds (KB-CPP20-058).
 
constexpr uint32_t dynamixel::kMaxTimeoutUs = 1'000'000
 Longest timeout the driver accepts: one second.
 
constexpr uint32_t dynamixel::kMaxSettleUs = 10'000'000
 Longest settle time after a reboot or factory reset the driver accepts: 10 seconds.
 
constexpr uint32_t dynamixel::kMinBaud = 9'600
 Lowest and highest bit rate the driver accepts for Config::baud.
 
constexpr uint32_t dynamixel::kMaxBaud = 10'500'000
 Highest bit rate the driver accepts (the e-Manual lists up to 4.5 Mbit/s, the P series 10.5).
 
constexpr uint8_t dynamixel::kMaxRetries = 5
 The most repeats of an idempotent instruction Config::retries allows.
 

Detailed Description

Public types of the DYNAMIXEL driver: errors, Result<T>, protocol enumerations, replies, statistics and the configuration.

Everything here is plain data with no platform dependency, so handlers, tests and tools can include it without the driver template. The configuration defaults follow the ROBOTIS e-Manual (protocol 2.0 at 57 600 bit/s, status packets for every instruction) and the timing values that the manual does not give are documented knobs (docs/configuration.md).