MotionLib  1.0.0
SamBuCa motion library
Public Types | Public Member Functions | List of all members
smc::Axis Class Referenceabstract
Inheritance diagram for smc::Axis:
Inheritance graph
[legend]
Collaboration diagram for smc::Axis:
Collaboration graph
[legend]

Public Types

enum  State { UNKNOWN , IDLE , RUNNING , ERROR }
 Axis State. More...
 
typedef std::shared_ptr< AxisShared
 
- Public Types inherited from smc::DeviceBase
typedef smc::DeviceType DeviceType
 
typedef std::shared_ptr< DeviceBaseShared
 

Public Member Functions

 Axis (const std::string &address)
 Construct a new Axis Device at given location on given platform. More...
 
DeviceType type () const override
 Get device type. More...
 
virtual std::future< void > moveTo (const units::Value &position) const =0
 Move this axis to given position. More...
 
virtual std::future< void > moveBy (const units::Value &distance) const =0
 Move this axis by given distance. More...
 
virtual std::future< void > stop () const =0
 Stop any ongoing motion, flush the motion-queue. More...
 
virtual std::future< void > pause () const
 Pause ongoing motion, prevent queued motions from running. More...
 
virtual std::future< void > resume () const
 Resume paused motion. More...
 
virtual std::future< units::value_tgetPosition (units::unit_t unit) const =0
 Get current position of this axis. More...
 
virtual units::value_t lastPosition (units::unit_t unit) const =0
 Get last known position of the axis. More...
 
virtual std::future< void > setActualPosition (const units::Value &position) const
 Set current axis position. More...
 
virtual std::future< void > takeReference (const std::chrono::milliseconds &timeout=std::chrono::seconds{ 120}) const
 Start a homing sequence. More...
 
virtual std::future< StategetState () const =0
 Get the current axis state. More...
 
- Public Member Functions inherited from smc::DeviceBase
DeviceId uid () const
 Get the address of device. More...
 
virtual std::future< std::set< std::string > > listConfig () const
 list device configuration options
 
virtual std::future< std::string > getConfig (const std::string &name) const
 get device configuration value More...
 
virtual std::future< void > setConfig (const std::string &name, const std::string &value) const
 set device configuration value More...
 
virtual bool canConvert (const units::Value &value, units::unit_t unit) const
 Check if unit conversion is possible in a manner specific to this device. More...
 
virtual bool convert (units::Value &value, units::unit_t unit) const
 Convert value in a manner specific to this device. More...
 
std::string toString () const
 debug and logging operation
 

Additional Inherited Members

- Public Attributes inherited from smc::DeviceBase
ccut::Signal< const DeviceBase::Shared & > updateSignal
 device update signal More...
 
- Protected Member Functions inherited from smc::DeviceBase
 DeviceBase (const std::string &uid)
 Construct a new ABaseDevice, linking pointer to platform object. More...
 
- Protected Attributes inherited from smc::DeviceBase
const std::string m_uid
 

Detailed Description

Definition at line 42 of file Axis.hpp.

Member Enumeration Documentation

◆ State

Axis State.

Axis State Enum, state can be: Idle, Run, Error or Unknown

See also
getState

Definition at line 53 of file Axis.hpp.

Constructor & Destructor Documentation

◆ Axis()

smc::Axis::Axis ( const std::string &  address)

Construct a new Axis Device at given location on given platform.

Parameters
addressUnique address of the axis
platformPlatform on which axis is located
configoptional config platform

Member Function Documentation

◆ getPosition()

virtual std::future<units::value_t> smc::Axis::getPosition ( units::unit_t  unit) const
pure virtual

Get current position of this axis.

Returns
future<mm> Future completed with value when command executed.

Implemented in smc::internal::MockAxis, smc::internal::MGrblAxis, and smc::internal::GrblAxis.

◆ getState()

virtual std::future<State> smc::Axis::getState ( ) const
pure virtual

Get the current axis state.

Get the state of the axis: Idle, Run, Error, Unknown

Returns
future<State> Future completed with status when command executed

Implemented in smc::internal::MockAxis, smc::internal::MGrblAxis, and smc::internal::GrblAxis.

◆ lastPosition()

virtual units::value_t smc::Axis::lastPosition ( units::unit_t  unit) const
pure virtual

Get last known position of the axis.

Returns
units::value_t

updateSignal is emitted whenever this value updated

Implemented in smc::internal::MockAxis, smc::internal::MGrblAxis, and smc::internal::GrblAxis.

◆ moveBy()

virtual std::future<void> smc::Axis::moveBy ( const units::Value distance) const
pure virtual

Move this axis by given distance.

Parameters
distanceDistance to move by
Returns
future<void> Future completed when command executed

Implemented in smc::internal::MockAxis, smc::internal::MGrblAxis, and smc::internal::GrblAxis.

◆ moveTo()

virtual std::future<void> smc::Axis::moveTo ( const units::Value position) const
pure virtual

Move this axis to given position.

Parameters
positionPosition to move to
Returns
future<void> Future completed when command executed

Implemented in smc::internal::MockAxis, smc::internal::MGrblAxis, and smc::internal::GrblAxis.

◆ pause()

virtual std::future<void> smc::Axis::pause ( ) const
virtual

Pause ongoing motion, prevent queued motions from running.

Pauses ongoing motion using proper deceleration, motion may be resumed using Axis::resume.

Returns
future<void> Future completed when motion is stopped

Reimplemented in smc::internal::MockAxis, smc::internal::MGrblAxis, and smc::internal::GrblAxis.

◆ resume()

virtual std::future<void> smc::Axis::resume ( ) const
virtual

Resume paused motion.

resumes paused motion using proper acceleration.

Returns
std::future<void>

Reimplemented in smc::internal::MockAxis, smc::internal::MGrblAxis, and smc::internal::GrblAxis.

◆ setActualPosition()

virtual std::future<void> smc::Axis::setActualPosition ( const units::Value position) const
virtual

Set current axis position.

Parameters
positionnew position for axis
Returns
future<void> Future completed when command executed

Reimplemented in smc::internal::MockAxis, smc::internal::MGrblAxis, smc::internal::MFEAxis, and smc::internal::GrblAxis.

◆ stop()

virtual std::future<void> smc::Axis::stop ( ) const
pure virtual

Stop any ongoing motion, flush the motion-queue.

Stop ongoing motion using proper deceleration, reject pending promises. This may stop other axis depending on motion-queue implementation (ex: axis bound to the same Grbl instance).

Returns
future<void> Future completed when everything has been cleared

Implemented in smc::internal::MockAxis, smc::internal::MGrblAxis, and smc::internal::GrblAxis.

◆ takeReference()

virtual std::future<void> smc::Axis::takeReference ( const std::chrono::milliseconds &  timeout = std::chrono::seconds{ 120}) const
virtual

Start a homing sequence.

Parameters
timeoutTimeout for homing sequence request
Returns
future<void> Future completed when command executed

Reimplemented in smc::internal::MGrblAxis, smc::internal::GrblAxis, and smc::internal::MockAxis.

◆ type()

DeviceType smc::Axis::type ( ) const
overridevirtual

Get device type.

Returns
DeviceType AXIS device type

Implements smc::DeviceBase.


The documentation for this class was generated from the following file: