Console.WriteLine("📜 Sample Apps Setup");
KillExistingController();
var creationParams = GetCreationParameters();
SetupController(controller, Constants.AXIS_COUNT, Constants.USE_HARDWARE);
Console.WriteLine($"RMP path: {creationParams.RmpPath}");
Console.WriteLine($"Use hardware: {Constants.USE_HARDWARE}");
Console.WriteLine($"Axis count: {controller.AxisCountGet()}");
for (int i = 0; i < Constants.AXIS_COUNT; i++)
{
if (currentAxis != null)
{
Console.WriteLine($" Axis {i}: Motor Type = {currentAxis.MotorTypeGet()}");
Console.WriteLine($" Axis {i}: UserUnits = {currentAxis.UserUnitsGet()}");
}
}
{
#if WINDOWS
createParams.RmpPath = Constants.RMP_WINDOWS_PATH;
createParams.NodeName = Constants.RMP_NODE_NAME;
#elif LINUX
createParams.RmpPath = Constants.RMP_LINUX_PATH;
createParams.NicPrimary = Constants.RMP_NIC_PRIMARY;
createParams.CpuAffinity = Constants.RMP_CPU_AFFINITY;
#endif
return createParams;
}
static void SetupController(
MotionController controller,
int userAxisCount,
bool useHardware)
{
if (useHardware)
{
}
{
throw new Exception(
"The Sample Apps are configured to use Phantom Axes, but the network is not in the UNINITIALIZED or SHUTDOWN state.\n" +
"If you intended to run with hardware, then set USE_HARDWARE to true in config.json\n" +
"Otherwise, shutdown the network before running the sample apps with phantom axes.");
}
if (useHardware)
{
if (axisCount < userAxisCount)
{
throw new Exception(
$"Error! Not enough axes configured. Expected {userAxisCount} axes but only found {axisCount} axes.\n" +
"Please configure the axes in your hardware setup.");
}
}
else
{
if (userAxisCount != initialAxisCount)
{
}
for (int i = 0; i < userAxisCount; i++)
{
}
}
}
static void KillExistingController()
{
try
{
}
catch
{
}
finally
{
}
}
static void ConfigurePhantomAxis(Axis phantomAxis)
Configures a phantom axis on the controller.
static void SetupControllerForHardware(MotionController controller)
Sets up the controller for hardware use by resetting it and starting the network.
static void CheckErrors(RapidCodeObject rsiObject)
Checks for errors in the given RapidCodeObject and throws an exception if any non-warning errors are ...
Helpers class provides static methods for common tasks in RMP applications.
void UserUnitsSet(double countsPerUserUnit)
Sets the number of counts per User Unit.
Represents a single axis of motion control. This class provides an interface for commanding motion,...
Axis * AxisGet(int32_t axisNumber)
AxisGet returns a pointer to an Axis object and initializes its internals.
RSINetworkState NetworkStateGet()
static MotionController * Get()
Get an already running RMP EtherCAT controller.
static MotionController * Create(CreationParameters *creationParameters)
Initialize and start the RMP EtherCAT controller.
void Delete(void)
Delete the MotionController and all its objects.
void Shutdown()
Shutdown the controller.
int32_t AxisCountGet()
Get the number of axes processing.
int32_t MotionCountGet()
Get the number of Motion Supervisors available in the firmware.
void AxisCountSet(int32_t axisCount)
Set the number of allocated and processed axes in the controller.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
RSINetworkState
State of network.
CreationParameters for MotionController::Create.