⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ampparam.cpp

📁 美国COPLEY驱动器,程序开发工具之一.
💻 CPP
📖 第 1 页 / 共 5 页
字号:
/**
  Get the most recently captured home sensor position.

  Note that support for capturing position on a home input pin was
  added in version 4.77 firmware.  Earlier versions of firmware will
  return an error if an attempt is made to read this register.
  */
const Error *Amp::GetHomeCapture( int32 &value )
{
   return sdo.Upld32( OBJID_CAP_HOME, 0, value );
}

/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
/*
   Position profile mode (point to point moves)
   */
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/

/***************************************************************************/
/**
  Set the motion profile type.

  The motion profile type is only used when running in 'position profile' mode.
  In this mode, the drive performs point to point moves using it's internal 
  trajectory generator.

  The motion profile type defines the type of trajectory profile that the 
  drive will generate.

  @param type The profile type to use
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::SetProfileType( PROFILE_TYPE type )
{
   return sdo.Dnld16( OBJID_PROFILE_TYPE, 0, (int16)type );
}

/***************************************************************************/
/**
  Get the currently selected motion profile type.  This profile type is used
  for point to point moves in which the amplifier calculates it's own 
  trajectory.

  @param type variable that will store the returned value
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetProfileType( PROFILE_TYPE &type )
{
   int16 value;
   const Error *err = sdo.Upld16( OBJID_PROFILE_TYPE, 0, value );
   type = (PROFILE_TYPE)value;
   return err;
}

/***************************************************************************/
/**
  Set the profile target position (i.e. the position to which the motor should move).

  For relative moves, this function sets the distance to move.

  This parameter is specified in "user units".  See Amp::SetCountsPerUnit for details.

  @param value The position to move to
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::SetTargetPos( uunit value )
{
   return sdo.Dnld32( OBJID_PROFILE_POS, 0, PosUser2Load(value) );
}

/***************************************************************************/
/**
  Get the profile target position.

  This parameter is specified in "user units".  See Amp::SetCountsPerUnit for details.

  @param value variable that will store the returned value
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetTargetPos( uunit &value )
{
   int32 v;
   const Error *err = sdo.Upld32( OBJID_PROFILE_POS, 0, v ); 
   value = PosLoad2User( v );
   return err;
}

/***************************************************************************/
/**
  Set the target velocity used in profile velocity mode.  

  This parameter is only used when the amplifier is set to profile velocity 
  mode (AMPMODE_CAN_VELOCITY).  When in this mode, this parameter defines the
  target velocity for motion.  

  This parameter is specified in "user units".  See Amp::SetCountsPerUnit for details.

  @param value The new target velocity.
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::SetTargetVel( uunit value )
{
   return sdo.Dnld32( OBJID_TARGET_VEL, 0, VelUser2Load(value) );
}

/***************************************************************************/
/**
  Get the target velocity used in profile velocity mode.

  This parameter is specified in "user units".  See Amp::SetCountsPerUnit for details.

  @param value variable that will store the returned value
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetTargetVel( uunit &value )
{
   int32 v;
   const Error *err = sdo.Upld32( OBJID_TARGET_VEL, 0, v ); 
   value = VelLoad2User( v );
   return err;
}

/***************************************************************************/
/**
  Set the profile velocity value (i.e. the velocity that the motor will normally
  attain during the move).

  This parameter is specified in "user units".  See Amp::SetCountsPerUnit for details.

  @param value The value to set.
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::SetProfileVel( uunit value )
{ 
   int32 v = VelUser2Load(value);
   if( v < 0 ) return &AmpError::badMoveParam;

   return sdo.Dnld32( OBJID_PROFILE_VEL, 0, v );
}

/***************************************************************************/
/**
  Get the profile velocity value

  This parameter is specified in "user units".  See Amp::SetCountsPerUnit for details.

  @param value variable that will store the returned value
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetProfileVel( uunit &value )
{ 
   int32 v;
   const Error *err = sdo.Upld32( OBJID_PROFILE_VEL, 0, v );
   value = VelLoad2User( v );
   return err;
}

/***************************************************************************/
/**
  Set the profile acceleration value (i.e. the acceleration that the motor will normally
  attain when starting the move).

  This parameter is specified in "user units".  See Amp::SetCountsPerUnit for details.

  @param value The value to set.
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::SetProfileAcc( uunit value )
{ 
   int32 v = AccUser2Load(value);
   if( v < 0 ) return &AmpError::badMoveParam;

   return sdo.Dnld32( OBJID_PROFILE_ACC, 0, v ); 
}

/***************************************************************************/
/**
  Get the profile acceleration value

  This parameter is specified in "user units".  See Amp::SetCountsPerUnit for details.

  @param value variable that will store the returned value
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetProfileAcc( uunit &value )
{ 
   int32 v;
   const Error *err = sdo.Upld32( OBJID_PROFILE_ACC, 0, v ); 
   value = AccLoad2User( v );
   return err;
}

/***************************************************************************/
/**
  Set the profile deceleration value (i.e. the acceleration that the motor will normally
  attain when ending the move).

  Note that S-curve profiles don't use a separate deceleration value.  For S-curve moves,
  the value programmed in SetProfileAcc is also used for the deceleration segment at the
  end of the move.

  This parameter is specified in "user units".  See Amp::SetCountsPerUnit for details.

  @param value The value to set.
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::SetProfileDec( uunit value )
{ 
   int32 v = AccUser2Load(value);
   if( v < 0 ) return &AmpError::badMoveParam;

   return sdo.Dnld32( OBJID_PROFILE_DEC, 0, v ); 
}

/***************************************************************************/
/**
  Get the profile deceleration value.

  This parameter is specified in "user units".  See Amp::SetCountsPerUnit for details.

  @param value variable that will store the returned value
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetProfileDec( uunit &value )
{ 
   int32 v;
   const Error *err = sdo.Upld32( OBJID_PROFILE_DEC, 0, v ); 
   value = AccLoad2User( v );
   return err;
}

/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
/*
   Profile torque mode
   */
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/

/***************************************************************************/
/**
  Set the amplifier target torque value.  This parameter is used in profile 
  torque mode (AMPMODE_CAN_TORQUE) to specify the desired target torque value.
  The actual torque commanded by the amplifier will ramp up/down to this value
  based on the programmed torque slope (see Amp::SetTorqueSlope).  

  @param value The torque value to be set.  This is specified in thousandths
  of the motor rated torque (see Amp::GetTorqueRated).
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::SetTorqueTarget( int16 value )
{
   return sdo.Dnld16( OBJID_TORQUE_TARGET, 0, value ); 
}

/***************************************************************************/
/**
  Get the current target torque value.

  This parameter is used in profile torque mode (AMPMODE_CAN_TORQUE) to specify 
  the torque that should be applied by the motor.

  @param value The torque value is returned here.  This is specified in thousandths
  of the motor rated torque (see Amp::GetTorqueRated).
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetTorqueTarget( int16 &value )
{
   return sdo.Upld16( OBJID_TORQUE_TARGET, 0, value ); 
}

/***************************************************************************/
/**
  Get the torque demand value.  This is the torque that the amplifier is attempting
  to apply at the moment.

  @param value The torque value is returned here.  This is specified in thousandths
  of the motor rated torque (see Amp::GetTorqueRated).
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetTorqueDemand( int16 &value )
{
   return sdo.Upld16( OBJID_TORQUE_DEMAND, 0, value ); 
}

/***************************************************************************/
/**
  Get the actual torque being applied by the motor at the moment.

  @param value The torque value is returned here.  This is specified in thousandths
  of the motor rated torque (see Amp::GetTorqueRated).
  @return A pointer to an error object, or NULL on success
  */
/***************************************************************************/
const Error *Amp::GetTorqueActual( int16 &value )
{
   return sdo.Upld16( OBJID_TORQUE_ACTUAL, 0, value ); 
}

/***************************************************************************/
/**
  Set the rate of change of torque for use in profile torque mode (AMPMODE_CAN_TORQUE).
  Setting this parameter to zero will cause the rate of change to be unlimited.

  @param value The rate of change specified in thousandths of the total rated torque
  per second.  For example, setting to 1000 would specify a slope of the full
  rated to

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -