📄 ampunits.cpp
字号:
this function has no effect.
If user units are enabled, then this function converts from user units
(defined using Amp::SetCountsPerUnit) to these internal amplifier units.
For dual encoder systems the unit conversion used by this function is based on
the load encoder resolution.
@param jrk The jerk in user units
@return The jerk in 100 encoder counts / second ^ 3 units
*/
/***************************************************************************/
int32 Amp::JrkUser2Load( uunit jrk )
{
#ifdef CML_ENABLE_USER_UNITS
jrk *= u2lJrk;
return (int32)Round(jrk);
#else
return jrk;
#endif
}
/***************************************************************************/
/**
Convert a position from internal amplifier units to user units
Internal to the amplifier, all positions are stored in units of encoder counts.
If user units are not enabled in CML_Settings.h, then user units are also in
encoder counts and this function has no effect.
If user units are enabled, then this function converts from amplifier units
to user units (defined using Amp::SetCountsPerUnit).
For dual encoder systems the unit conversion used by this function is based on
the load encoder resolution. To convert motor encoder positions, use Amp::PosMtr2User.
On single encoder systems either of these functions can be used.
@param pos The position in encoder counts
@return The position in user units
*/
/***************************************************************************/
uunit Amp::PosLoad2User( int32 pos )
{
#ifdef CML_ENABLE_USER_UNITS
return pos * l2uPos;
#else
return pos;
#endif
}
/***************************************************************************/
/**
Convert a velocity from internal amplifier units to user units
Internal to the amplifier, all velocities are stored in units of
0.1 encoder counts / second. If user units are not enabled in
CML_Settings.h, then user units are the same as amplifier units,
and this function has no effect.
If user units are enabled, then this function converts from amplifier units
to user units (defined using Amp::SetCountsPerUnit).
For dual encoder systems the unit conversion used by this function is based on
the load encoder resolution. To convert motor encoder velocities, use Amp::VelMtr2User.
On single encoder systems either of these functions can be used.
@param vel The velocity in 0.1 encoder counts / second
@return The velocity in user units
*/
/***************************************************************************/
uunit Amp::VelLoad2User( int32 vel )
{
#ifdef CML_ENABLE_USER_UNITS
return vel * l2uVel;
#else
return vel;
#endif
}
/***************************************************************************/
/**
Convert an acceleration from internal amplifier units to user units
Internal to the amplifier, all accelerations are stored in units of
10 encoder counts / second^2. If user units are not enabled in
CML_Settings.h, then user units are the same as amplifier units,
and this function has no effect.
If user units are enabled, then this function converts from amplifier units
to user units (defined using Amp::SetCountsPerUnit).
For dual encoder systems the unit conversion used by this function is based on
the load encoder resolution. To convert motor encoder accelerations, use Amp::AccMtr2User.
On single encoder systems either of these functions can be used.
@param acc The acceleration in units of 10 encoder counts / second^2
@return The acceleration in user units
*/
/***************************************************************************/
uunit Amp::AccLoad2User( int32 acc )
{
#ifdef CML_ENABLE_USER_UNITS
return acc * l2uAcc;
#else
return acc;
#endif
}
/***************************************************************************/
/**
Convert a jerk value from internal amplifier units to user units
Internal to the amplifier, all jerk values are stored in units of
100 encoder counts / second^3. If user units are not enabled in
CML_Settings.h, then user units are the same as amplifier units,
and this function has no effect.
If user units are enabled, then this function converts from amplifier units
to user units (defined using Amp::SetCountsPerUnit).
For dual encoder systems the unit conversion used by this function is based on
the load encoder resolution.
@param jrk The jerk value in units of 100 encoder counts / second^3
@return The jerk in user units
*/
/***************************************************************************/
uunit Amp::JrkLoad2User( int32 jrk )
{
#ifdef CML_ENABLE_USER_UNITS
return jrk * l2uJrk;
#else
return jrk;
#endif
}
/***************************************************************************/
/**
Convert a position from user position units to internal amplifier units.
This function converts using motor encoder units on a dual encoder system.
Load encoder positions can be converted using Amp::PosUser2Load.
@param pos The position in user units
@return The position in encoder counts
*/
/***************************************************************************/
int32 Amp::PosUser2Mtr( uunit pos )
{
#ifdef CML_ENABLE_USER_UNITS
pos *= u2mPos;
return (int32)Round(pos);
#else
return pos;
#endif
}
/***************************************************************************/
/**
Convert a velocity from user units to internal amplifier units.
This function converts using motor encoder units on a dual encoder system.
Load encoder velocities can be converted using Amp::VelUser2Load.
@param vel The velocity in user units
@return The velocity in 0.1 encoder counts / second
*/
/***************************************************************************/
int32 Amp::VelUser2Mtr( uunit vel )
{
#ifdef CML_ENABLE_USER_UNITS
vel *= u2mVel;
return (int32)Round(vel);
#else
return vel;
#endif
}
/***************************************************************************/
/**
Convert an acceleration from user units to internal amplifier units.
This function converts using motor encoder units on a dual encoder system.
Load encoder accelerations can be converted using Amp::AccUser2Load.
@param acc The acceleration in user units
@return The acceleration in 10 encoder counts / second ^ 2 units
*/
/***************************************************************************/
int32 Amp::AccUser2Mtr( uunit acc )
{
#ifdef CML_ENABLE_USER_UNITS
acc *= u2mAcc;
return (int32)Round(acc);
#else
return acc;
#endif
}
/***************************************************************************/
/**
Convert a position from internal amplifier units to user units
This function converts using motor encoder units on a dual encoder system.
Load encoder positions can be converted using Amp::PosLoad2User.
@param pos The position in encoder counts
@return The position in user units
*/
/***************************************************************************/
uunit Amp::PosMtr2User( int32 pos )
{
#ifdef CML_ENABLE_USER_UNITS
return pos * m2uPos;
#else
return pos;
#endif
}
/***************************************************************************/
/**
Convert a velocity from internal amplifier units to user units
This function converts using motor encoder units on a dual encoder system.
Load encoder velcities can be converted using Amp::VelLoad2User.
@param vel The velocity in 0.1 encoder counts / second
@return The velocity in user units
*/
/***************************************************************************/
uunit Amp::VelMtr2User( int32 vel )
{
#ifdef CML_ENABLE_USER_UNITS
return vel * m2uVel;
#else
return vel;
#endif
}
/***************************************************************************/
/**
Convert an acceleration from internal amplifier units to user units
This function converts using motor encoder units on a dual encoder system.
Load encoder accelerations can be converted using Amp::AccLoad2User.
@param acc The acceleration in units of 10 encoder counts / second^2
@return The acceleration in user units
*/
/***************************************************************************/
uunit Amp::AccMtr2User( int32 acc )
{
#ifdef CML_ENABLE_USER_UNITS
return acc * m2uAcc;
#else
return acc;
#endif
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -