APIs, concepts, guides, and more

Memory sample application.

This sampple app demonstrates how to get/set controller memory.

This sample code presumes that the user has set the tuning paramters(PID, PIV, etc.) prior to running this program so that the motor can rotate in a stable manner.
This is a sample program to assist in the integration of the RMP motion controller with your application. It may not contain all of the logic and safety features that your application requires.
#include "rsi.h" // Import our RapidCode Library.
#include "SampleAppsHelper.h" // Import our SampleApp helper functions.
#include "SampleApps.h"
using namespace RSI::RapidCode; // Import the RapidCode namespace
int Memory::Run()
// *NOTICE* The following constants must be configured before attempting to run with hardware.
// Axis configuration parameters
const int AXIS_COUNT = 1; // Specify how many axes we will be using in this sample.
const int AXIS_NUMBER = 0; // Specify which axis/motor we will be controlling.
// To run with hardware, set the USE_HARDWARE flag to true AFTER you have configured the parameters above and taken proper safety precautions.
Axis* axis;
uint64_t addr;
// Initialize MotionController class. (PCI board)
MotionController* controller = MotionController::CreateFromSoftware();
// Setup the controller for the appropriate hardware configuration.
SampleAppsHelper::SetupControllerForPhantoms(controller, AXIS_COUNT, { AXIS_NUMBER });
// initialize Axis (0)
axis = controller->AxisGet(AXIS_NUMBER);
// get a controller host address for axis memory
addr = axis->AddressGet(RSIAxisAddressType::RSIAxisAddressTypeACTUAL_POSITION);
printf("Axis Host address is 0x%llx Firmware Address is 0x%x\n", addr, controller->FirmwareAddressGet(addr));
printf("Value is %lf\n", controller->MemoryDoubleGet(addr)); // ACTUAL_POSITION is a 64-bit double
catch (RsiError const& err)
printf("\n%s\n", err.text);
return -1;
controller->Delete(); // Delete the controller as the program exits to ensure memory is deallocated in the correct order.
return 0;
uint64_t AddressGet(RSIAxisAddressType addressType)
Get the an address for some location on the Axis.
Represents a single axis of motion control. This class provides an interface for commanding motion,...
Definition rsi.h:5513
Axis * AxisGet(int32_t axisNumber)
AxisGet returns a pointer to an Axis object and initializes its internals.
uint32_t FirmwareAddressGet(uint64_t hostAddress)
Convert a host controller address to a firmware address.
void Delete(void)
Delete the MotionController and all its objects.
double MemoryDoubleGet(uint64_t address)
Read a 64-bit double value from controller memory.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
Definition rsi.h:794
Represents the error details thrown as an exception by all RapidCode classes. This class contains an ...
Definition rsi.h:105
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 ...
static void SetupControllerForPhantoms(MotionController *controller, int axisCount, std::vector< int > axisNums)
Sets up the controller for phantom axes, including configuring specified axes as phantom.