|
APIs, concepts, guides, and more
|
Learn RapidCode C++ with these sample applications.
Welcome to the RapidCode Sample Applications project! This collection of sample applications is designed to demonstrate the capabilities of the RapidCode API and RMP motion controller. Each sample app provides an example of how to integrate and utilize the RapidCode API within your C++ projects to control and interact with the RMP motion controller effectively.
The purpose of these sample applications is to:
Before you can build and run these sample applications, you must have the following installed:
Ensure that your development environment is set up according to the specifications of the RMP motion controller as defined in the setup page of our knowledge base.
Some C++ sample apps (such as HelloRTTasks and InternalAnalogFollow) make use of the accompanying RTTaskFunctions project, which is also located in the examples folder. This project builds the deterministic C++ task library that is loaded at runtime by the RTTaskManager. The sample application itself remains a standard host program (C++ in this guide, but it could just as easily be C# or Python) that uses RapidCode to connect to the manager and submit tasks from the shared library.
Review Real-Time Tasks if you need a refresher on how these pieces interact.
First, you need to ensure that RMP is able to read your YubiKey for license verification. Complete the following steps:
Add your user to the plugdev group
Create a Udev rule for the YubiKey
append the following:
Reload Udev rules
Verify that the new rule was applied
Then you will want to copy the examples to somewhere in your home directory.
Then you must specify which CPU core the sample apps will run on in src/SampleAppsHelper.h. In the SampleAppsConfig struct, set the CPU affinity to an isolated core. If you are unsure if you have an isolated core, then run the following command to list your isolated cpu's (if you have any):
If you don't have an isolated core, then use
and append the following:
replacing <cpu number> with the core you want to isolate. You may need to reboot for the change to apply.
Warning! Running sample applications may overwrite your axes configuration. If you've set up your axes in RapidSetup or RapidSetupX and want to retain that setup, use rsiconfig to save it before running any sample applications. You can find instructions to use rsiconfig in our support site under software tools.
The first step is to set your motion controller creation parameters in src/SampleAppsHelper.h. For most situations, the default values will be acceptable to get started, but it is recommended to read through the comments and understand what each parameter does regardless.
Then choose one of the following methods:
Install the C/C++ Extension Pack by Microsoft. Then use the CMake Tools extension to build, debug, and run the samples.
If your system is headless, then you can connect to it remotely using the Remote - SSH extension.
Use one of our helper scripts located in the VisualStudioGeneratorScripts directory. Run generate_build_files_<Visual Studio Version>.bat to use CMake to generate a solution file for your version of Visual Studio. Then navigate to the build/<Visual Studio Version> and open the .sln file located there.
Use the CMake CLI to generate build files and build the samples. Then navigate to /bin/<Configuration> and run the executables located there.
Warning! The samples are intended to assist in the integration of the RMP motion controller with your application. They may not contain all of the logic and safety features that your application requires. We recommend that you wire an external hardware emergency stop (e-stop) button for safety when using our code sample apps. Doing so will help ensure the safety of you and those around you and will prevent potential injury or damage.
By default the sample apps will run using "Phantom Axes" without the EtherCAT network running. If you wish to run the samples using hardware then complete the following: