📄 cml_linkage.h
字号:
/************************************************************/
/* */
/* Copley Motion Libraries */
/* */
/* Author: Stephen Glow */
/* */
/* Copyright (c) 2002-2005 Copley Controls Corp. */
/* http://www.copleycontrols.com */
/* */
/************************************************************/
/** \file
This file defines the Linkage object.
A linkage is a group of two or more amplifiers which
work together.
*/
#ifndef _DEF_INC_LINKAGE
#define _DEF_INC_LINKAGE
#include "CML_Settings.h"
#include "CML_Amp.h"
#include "CML_EventMap.h"
#include "CML_Geometry.h"
#include "CML_TrjScurve.h"
CML_NAMESPACE_START()
/***************************************************************************/
/**
Linkage events. This enumeration provides a list of events that can be
used to wait on linkage conditions.
In general, linkage events parallel the amplifier events of all of the
amplifiers attached to the linkage. For example, if any of the amplifiers
is reporting an error event, then the linkage will be reporting an error
event.
*/
/***************************************************************************/
enum LINK_EVENT
{
/// Set when all amplifiers attached to this linkage have finished their moves and
/// have settled in to position at the end of the move. Cleared when a new move is
/// started on any amplifier.
LINKEVENT_MOVEDONE = 0x00000001,
/// Set when all amplifiers attached to the linkage have finished their moves, but
/// have not yet settled into position at the end of the move. Cleared when a new
/// move is on any amplifier started.
LINKEVENT_TRJDONE = 0x00000002,
/// A node guarding (or heartbeat) error has occurred. This indicates that
/// one of the amplifiers failed to respond within the expected amount of
/// time for either a heartbeat or node guarding message.
LINKEVENT_NODEGUARD = 0x00000004,
/// A latching fault has occurred on one of the amplifiers attached to this linkage.
LINKEVENT_FAULT = 0x00000010,
/// A non-latching error has occurred on one of the amplifiers.
LINKEVENT_ERROR = 0x00000020,
/// One of the the amplifiers is reporting a position warning event.
LINKEVENT_POSWARN = 0x00000040,
/// One of the amplifiers is reporting a position window event.
LINKEVENT_POSWIN = 0x00000080,
/// One of the amplifiers is reporting a velocity window event.
LINKEVENT_VELWIN = 0x00000100,
/// One of the amplifiers is currently disabled.
LINKEVENT_DISABLED = 0x00000200,
/// The positive limit switch of one or more amplifier is currently active
LINKEVENT_POSLIM = 0x00000400,
/// The negative limit switch of one or more amplifier is currently active
LINKEVENT_NEGLIM = 0x00000800,
/// The positive software limit of one or more amplifier is currently active
LINKEVENT_SOFTLIM_POS = 0x00001000,
/// The negative software limit of one or more amplifier is currently active
LINKEVENT_SOFTLIM_NEG = 0x00002000,
/// One of the linkage amplifiers is presently performing a quick stop sequence
/// or is holding in quick stop mode. The amplifier must be disabled to clear this.
LINKEVENT_QUICKSTOP = 0x00004000,
/// One or more amplifier aborted the last profile without finishing.
LINKEVENT_ABORT = 0x00008000
};
/***************************************************************************/
/**
This class represents error conditions that can occur in the Linkage class.
*/
/***************************************************************************/
class LinkError: public Error
{
public:
/// The amplifier objects used to init the linkage are
/// not all attached to the same CanOpen network.
static const LinkError NetworkMismatch;
/// An illegal number of amplifiers was passed
/// to Linkage::Init
static const LinkError BadAmpCount;
/// Init was called on a Linkage that is already initialized.
static const LinkError AlreadyInit;
/// The passed amplifier object is already assigned to a linkage
static const LinkError AmpAlreadyLinked;
/// The point dimension doesn't match the number of linkage axes
static const LinkError AxisCount;
/// Amplifier trajectory structure overflow
static const LinkError AmpTrjOverflow;
/// Amplifier trajectory already in use
static const LinkError AmpTrjInUse;
/// Amplifier trajectory not presently in use
static const LinkError AmpTrjNotRunning;
/// No linkage trajectory is active
static const LinkError NoActiveTrj;
/// A zero or negative move limit was detected
static const LinkError BadMoveLimit;
/// Unknown amplifier error
static const LinkError UnknownAmpErr;
/// Timeout waiting on amplifier to respond to start move command
static const LinkError StartMoveTO;
/// Returned if Linkage::MoveTo is called on a system where floating
/// point math was not enabled at compile time.
static const LinkError NotSupported;
protected:
/// Standard protected constructor
LinkError( uint16 id, const char *desc ): Error( id, desc ){}
};
/***************************************************************************/
/**
Receive PDO used to update the control word of all amplifiers in the linkage.
This object is intended for internal use only.
*/
/***************************************************************************/
class RPDO_LinkCtrl: public RPDO
{
/// Points to the Linkage that owns this PDO
class Linkage &link;
Pmap16 ctrl;
public:
/// Default constructor for this PDO
RPDO_LinkCtrl( class Linkage &l ): link(l) {}
const Error *Init( void );
const Error *Transmit( uint16 c );
};
/***************************************************************************/
/**
Linkage object settings. An object of this type may be passed to the
Linkage::Configure function to define the settings used by that linkage.
*/
/***************************************************************************/
class LinkSettings
{
public:
LinkSettings();
/// This setting gives the amount of time (milliseconds)
/// to wait for all amplifiers to acknowedge the start
/// of a new move before reporting an error.
///
/// When a new move is started on the linkage, each
/// amplifier will respond with an acknowledgment.
/// If all of these responses are not received in
/// this amount of time then an error will be
/// reported.
///
/// Default: 200 ms
int32 moveAckTimeout;
/// If this setting is set to true, then the linkage object
/// will automatically issue a halt to all axes if any of
/// them reports a position warning window condition during
/// a move.
///
/// Default: false
bool haltOnPosWarn;
/// If this setting is set to true, then the linkage object
/// will automatically issue a halt to all axes if any of
/// them reports a velocity tracking window condition during
/// a move.
///
/// Default: false
bool haltOnVelWin;
};
/***************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -