Class Motor402

Inheritance Relationships

Base Type

Class Documentation

class Motor402 : public ros2_canopen::MotorBase

Public Functions

inline Motor402(std::shared_ptr<LelyDriverBridge> driver, ros2_canopen::State402::InternalState switching_state)
virtual bool setTarget(double val)

Set target.

Parameters:

val[in] Target value

Returns:

true

Returns:

false

virtual bool enterModeAndWait(uint16_t mode)

Enter Operation Mode.

Parameters:

mode[in] Target Mode

Returns:

true

Returns:

false

virtual bool isModeSupported(uint16_t mode)

Check if Operation Mode is supported.

Parameters:

mode[in] Operation Mode to be checked

Returns:

true

Returns:

false

virtual uint16_t getMode()

Get current Mode.

Returns:

uint16_t

bool readState()
void handleDiag()

Updates the device diagnostic information.

This function updates the diagnostic information of the device by updating the diagnostic status message diagnostic_status_ and publishing it.

bool handleInit()

Initialise the drive.

This function initialises the drive. This means, it first attempts to bring the device to operational state (CIA402) and then executes the chosen homing method.

void handleRead()

Read objects of the drive.

This function should be called regularly. It reads the status word from the device and translates it into the devices state.

void handleWrite()

Writes objects to the drive.

This function should be called regularly. It writes the new command word to the drive

bool handleShutdown()

Shutdowns the drive.

This function shuts down the drive by bringing it into SwitchOn disabled state.

bool handleHalt()

Executes a quickstop.

The function executes a quickstop.

bool handleRecover()

Recovers the device from fault.

This function tries to reset faults and put the device back to operational state.

template<typename T, typename ...Args>
inline bool registerMode(uint16_t mode, Args&&... args)

Register a new operation mode for the drive.

This function will register an operation mode for the drive. It will check if the mode is supported by the drive by reading 0x6508 object.

Template Parameters:
  • T

  • Args

Parameters:
  • mode

  • args

Returns:

true

Returns:

false

inline virtual void registerDefaultModes()

Tries to register the standard operation modes defined in cia402.

inline double get_speed() const
inline double get_position() const
inline void set_diagnostic_status_msgs(std::shared_ptr<DiagnosticsCollector> status, bool enable)