RMP Motion Controller
10.6.2
APIs
, concepts, guides, and more
Community
Support
Contact
◆
SetupController()
static void SetupController
(
MotionController
*
controller
)
static
static
void
SetupController
(
MotionController
*controller)
{
// Set the axis and motion counts
controller->
AxisCountSet
(
SampleAppsConfig::AXIS_COUNT
);
controller->
MotionCountSet
(
SampleAppsConfig::MOTION_COUNT
);
controller->
MathBlockCountSet
(
SampleAppsConfig::MATH_BLOCK_COUNT
);
controller->
UserLimitCountSet
(
SampleAppsConfig::USER_LIMIT_COUNT
);
controller->
RecorderCountSet
(
SampleAppsConfig::RECORDER_COUNT
);
// Get the axis objects and check them for errors
Axis
*axisX = controller->
AxisGet
(
SampleAppsConfig::AXIS_X_INDEX
);
CheckErrors
(axisX);
Axis
*axisY = controller->
AxisGet
(
SampleAppsConfig::AXIS_Y_INDEX
);
CheckErrors
(axisY);
// Check if we are using hardware or phantom axes
if
(
SampleAppsConfig::USE_HARDWARE
)
{
SampleAppsConfig::ConfigureHardwareAxes
(controller, {axisX, axisY});
}
else
{
// Set the user units
axisX->
UserUnitsSet
(
SampleAppsConfig::AXIS_X_USER_UNITS
);
axisY->
UserUnitsSet
(
SampleAppsConfig::AXIS_Y_USER_UNITS
);
// Configure them as phantoms
ConfigurePhantomAxis
(controller,
SampleAppsConfig::AXIS_X_INDEX
);
ConfigurePhantomAxis
(controller,
SampleAppsConfig::AXIS_Y_INDEX
);
}
// Clear Faults
axisX->
ClearFaults
();
axisY->
ClearFaults
();
// Start or shutdown the network depending on the configuration
if
(
SampleAppsConfig::USE_HARDWARE
)
{
StartTheNetwork
(controller);
}
else
{
if
(controller->
NetworkStateGet
() != RSINetworkState::RSINetworkStateUNINITIALIZED &&
controller->
NetworkStateGet
() != RSINetworkState::RSINetworkStateSHUTDOWN)
{
std::cout <<
"The Sample Apps are configured to use Phantom Axes, but the network is not in the UNINITIALIZED or SHUTDOWN state.\n"
;
std::cout <<
"If you intended to run with hardware, then follow the steps in README.md and /include/SampleAppsHelper.h\n"
;
}
ShutdownTheNetwork
(controller);
}
}
Examples
AxisConfiguration.cpp
,
CalculateAccelerationFromVelocity.cpp
,
DifferenceOfPositionUserLimit.cpp
,
PhantomAxis.cpp
,
PointToPoint.cpp
, and
SampleAppsHelper.h
.
Definition at line
337
of file
SampleAppsHelper.h
.
SampleAppsHelper
Generated by
1.10.0