Class RoboteqDriver

Inheritance Relationships

Base Types

  • public husarion_ugv_hardware_interfaces::DriverInterface (Class DriverInterface)

  • public lely::canopen::LoopDriver

Class Documentation

class RoboteqDriver : public husarion_ugv_hardware_interfaces::DriverInterface, public lely::canopen::LoopDriver

Hardware implementation of Driver with lely LoopDriver for Roboteq drivers control.

Public Functions

RoboteqDriver(const std::shared_ptr<lely::canopen::AsyncMaster> &async_master, const std::uint8_t id, const std::chrono::milliseconds &sdo_operation_timeout_ms)
virtual std::future<void> Boot() override

Triggers boot operations.

Throws:

std::runtime_error – if triggering boot fails

inline virtual bool IsCANError() const override

Returns true if CAN error was detected.

inline virtual bool IsHeartbeatTimeout() const override

Returns true if heartbeat timeout encountered.

virtual DriverState ReadState() override

Reads driver state data returned from Roboteq (PDO 3 and 4): error flags, battery voltage, battery currents (for channel 1 and 2, they are not the same as motor currents), temperatures. Also saves the last timestamps.

virtual void ResetScript() override
Throws:

std::runtime_error – if any operation returns error

virtual void TurnOnEStop() override
Throws:

std::runtime_error – if any operation returns error

virtual void TurnOffEStop() override
Throws:

std::runtime_error – if any operation returns error

virtual void AddMotorDriver(const MotorNames name, std::shared_ptr<MotorDriverInterface> motor_driver) override

Adds a motor driver to the driver.

virtual std::shared_ptr<MotorDriverInterface> GetMotorDriver(const MotorNames name) override

Returns a motor driver by name.

Throws:

std::runtime_error – if motor driver with the given name does not exist

template<typename T>
void SyncSDOWrite(const std::uint16_t index, const std::uint8_t subindex, const T data)

Blocking SDO write operation.

Throws:

std::runtime_error – if operation fails

inline timespec GetPositionTimestamp(const std::uint8_t channel)

Returns the last timestamp of the position data for the given channel.

inline timespec GetSpeedCurrentTimestamp(const std::uint8_t channel)

Returns the last timestamp of the speed and current data for the given channel.

Public Static Attributes

static constexpr std::uint8_t kChannel1 = 1
static constexpr std::uint8_t kChannel2 = 2