MotionLib  1.0.0
SamBuCa motion library
Public Member Functions | Protected Attributes | List of all members
smc::internal::MockAxis Class Reference
Inheritance diagram for smc::internal::MockAxis:
Inheritance graph
[legend]
Collaboration diagram for smc::internal::MockAxis:
Collaboration graph
[legend]

Public Member Functions

 MockAxis (const std::string &uid, const std::shared_ptr< MockPlatform > &platform)
 
std::future< void > moveTo (const units::Value &position) const override
 Move this axis to given position. More...
 
std::future< void > moveBy (const units::Value &distance) const override
 Move this axis by given distance. More...
 
std::future< void > stop () const override
 Stop any ongoing motion, flush the motion-queue. More...
 
std::future< void > pause () const override
 Pause ongoing motion, prevent queued motions from running. More...
 
std::future< void > resume () const override
 Resume paused motion. More...
 
std::future< units::value_tgetPosition (units::unit_t unit) const override
 Get current position of this axis. More...
 
units::value_t lastPosition (units::unit_t unit) const override
 Get last known position of the axis. More...
 
std::future< void > setActualPosition (const units::Value &position) const override
 Set current axis position. More...
 
std::future< void > takeReference (const std::chrono::milliseconds &timeout) const override
 Start a homing sequence. More...
 
std::future< StategetState () const override
 Get the current axis state. More...
 
- Public Member Functions inherited from smc::Axis
 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...
 
- 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
 

Protected Attributes

std::weak_ptr< MockPlatformm_mock
 
- Protected Attributes inherited from smc::DeviceBase
const std::string m_uid
 

Additional Inherited Members

- Public Types inherited from smc::Axis
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 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...
 

Detailed Description

Definition at line 36 of file MockAxis.hpp.

Member Function Documentation

◆ getPosition()

std::future< units::value_t > MockAxis::getPosition ( units::unit_t  unit) const
overridevirtual

Get current position of this axis.

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

Implements smc::Axis.

Definition at line 116 of file MockAxis.cpp.

◆ getState()

std::future< Axis::State > MockAxis::getState ( ) const
overridevirtual

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

Implements smc::Axis.

Definition at line 255 of file MockAxis.cpp.

◆ lastPosition()

units::value_t MockAxis::lastPosition ( units::unit_t  unit) const
overridevirtual

Get last known position of the axis.

Returns
units::value_t

updateSignal is emitted whenever this value updated

Implements smc::Axis.

Definition at line 219 of file MockAxis.cpp.

◆ moveBy()

std::future< void > MockAxis::moveBy ( const units::Value distance) const
overridevirtual

Move this axis by given distance.

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

Implements smc::Axis.

Definition at line 77 of file MockAxis.cpp.

◆ moveTo()

std::future< void > MockAxis::moveTo ( const units::Value position) const
overridevirtual

Move this axis to given position.

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

Implements smc::Axis.

Definition at line 41 of file MockAxis.cpp.

◆ pause()

std::future< void > MockAxis::pause ( ) const
overridevirtual

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 from smc::Axis.

Definition at line 154 of file MockAxis.cpp.

◆ resume()

std::future< void > MockAxis::resume ( ) const
overridevirtual

Resume paused motion.

resumes paused motion using proper acceleration.

Returns
std::future<void>

Reimplemented from smc::Axis.

Definition at line 168 of file MockAxis.cpp.

◆ setActualPosition()

std::future< void > MockAxis::setActualPosition ( const units::Value position) const
overridevirtual

Set current axis position.

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

Reimplemented from smc::Axis.

Definition at line 182 of file MockAxis.cpp.

◆ stop()

std::future< void > MockAxis::stop ( ) const
overridevirtual

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

Implements smc::Axis.

Definition at line 140 of file MockAxis.cpp.

◆ takeReference()

std::future< void > MockAxis::takeReference ( const std::chrono::milliseconds &  timeout) const
overridevirtual

Start a homing sequence.

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

Reimplemented from smc::Axis.

Definition at line 234 of file MockAxis.cpp.


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