INOS
|
#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 |
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.
apMasterAxis | Axis name of the master axis. |
apFollowerAxis | Axis name of the follower axis. |
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.
uint32 CINOSFollowAxis::Enable | ( | real64 | arFactor = REAL64(1.0) | ) |
Enable following. Technically, this function actually enables the hook and therefore the follower axis starts following.
arFactor | The 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]). |
|
inline |
bool CINOSFollowAxis::IsSetup | ( | ) | const |
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:
auFlags | Flags used to configure certain behaviors of this object |