INOS
CINOSFollowAxis Class Reference

#include <cinosfollowaxis.h>

Public Member Functions

 CINOSFollowAxis (const char *apMasterAxis, const char *apFollowerAxis)
 
uint32 Setup (uint32 auFlags=0x00000000)
 
uint32 Enable (real64 arFactor=REAL64(1.0))
 
void Disable ()
 
uint32 GetError ()
 
bool IsSetup () const
 

Detailed Description

Used to let an axis, the "follower axis", to follow another axis, the master axis. Take note that the follower axis will always be behind the master axis by one cycle (i.e. 250us in case of a 4kHz axis). The two axes must either have the same cycletime or the master axis must have the lower cycletime. (If required otherwise, this class would need to be extended to support 'interpolation')

Object are usually long-living: They're created and Setup() once and are just Enable()-ed and Disable()-ed thereafter. They don't consume any resources while disabled.

Note that, if during following, any of the two axis runs into an error, such as an 'external controller errors', 'position check error' or whatever, both axes are emergency stopped according to their 'emergency stop' settings. Which is, either just 'inactivated', 'stopped and inactivated', etc. IOW: In case of an error, "following" will immediately be stopped and each axis is 'emergency stopped' according to their own settings. Keep that in mind, as it may not be what you need.

It is suggested to enable "axis limit checks" on the follower axis, to ensure that the move data do not exceed the physical limits of the axis. With that option set, the system automatically detects if the master axis is moved e.g. faster than the following axis is allowed to move - and the axes are emergency stopped.

The follower axis continues to follow unless one of the following conditions occur: a) A call to Disable() b) The master axis state goes into 'inactive'. In that case, the follower axis will be emergency stopped c) The ramp data couldn't be pushed to the follower axis. Both axes will be emergency stopped d) The master or follower axis encounters an error. Regardless of the reason, the Disable() function will be called. IOW: Upon the occurrence of one of these cases, the Enable() must be called again in order to re-enable "following". The GetError() function may be used to get the root cause of the 'Disabling': Either an error for b), c) or d) is reported or no error is reported and thus someone called Disable() - case a).

Note that even SetActPosition can be called on the "following axis" while the following mode is enabled. I.e. there's no need to temporarily disable it. While the usefulness of this is limited, it was implemented to support this, as it should make this class' behavior more robust in general.

pFollow->Enable(); // block for up to one cycle, so that the axis is guaranteed to be in 'pull' state
pFollowerAxis->SetActPosition(...);
pMasterAxis->Move(..., &Sync);
pFollowerAxis->SetActPosition(...);
Sync.Wait();
pFollow->Disable(); // blocks for at least one cycle, so that axis will not be in 'pull' state anymore
pFollowerAxis->Move(...);
Definition cinosmcmodule.h:1900

Constructor & Destructor Documentation

◆ CINOSFollowAxis()

CINOSFollowAxis::CINOSFollowAxis ( const char apMasterAxis,
const char apFollowerAxis 
)
Parameters
apMasterAxisAxis name of the master axis.
apFollowerAxisAxis name of the follower axis.

Member Function Documentation

◆ Disable()

void CINOSFollowAxis::Disable ( )

Disable following. Technically, this function actually disables the hook and therefore the follower axis stops following. It's the idea that this function shall be called when both axes are not moving any more. But in case that they're still moving, the master axis will complete it's move while the follower axis will be stopped with a proper stop ramp.

Note
Internally, this function let's the caller wait on a sync object until the 'axis follower hook' has actually been stopped. This ensures that, once this function returned, the caller can safely use the slave axis for other purposes.

◆ Enable()

uint32 CINOSFollowAxis::Enable ( real64  arFactor = REAL64(1.0))

Enable following. Technically, this function actually enables the hook and therefore the follower axis starts following.

Note
Internally, this function let's the caller wait on a sync object until the 'axis follower hook' has been called at least once.
Parameters
arFactorThe factor by which the follower shall follow. I.e. 1.0 means that the follower axis will perform the same move (assuming both axes use the same unit, e.g. [m]).

◆ GetError()

uint32 CINOSFollowAxis::GetError ( )
inline
Returns
Error that may have happened during 'following'. E.g. If pushing new pull-data to the follower axis returned an error, that incident will be noted by this error.

◆ IsSetup()

bool CINOSFollowAxis::IsSetup ( ) const
Returns
true if Setup has been called and successfully completed. false otherwise.

◆ Setup()

uint32 CINOSFollowAxis::Setup ( uint32  auFlags = 0x00000000)

Call this function to setup the object. This function must be called once after creation and before calling Enable/Disable:

  • Get the pointers to the master & slave axes
  • Register a real-time hook used to actually performing the "follower" functionality. The hook is registered 'disabled', will be enabled when calling Enable() and disabled again upon a call to Disable()
    Parameters
    auFlagsFlags used to configure certain behaviors of this object

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