Motion Hold Move Released By Software Address sample application.
Create a motion hold on an axis that is released by setting a bit located at a software address in the user buffer.
#include <thread>
#include "rsi.h"
#include "SampleAppsHelper.h"
#include "SampleApps.h"
int MotionHoldReleasedBySoftwareAddress::Run()
{
const int AXIS_COUNT = 1;
const int AXIS_NUMBER = 0;
const double USER_UNITS = 1048576;
const int USER_BUFFER_INDEX = 0;
const double MOTION_DISTANCE = 0.25;
const std::chrono::duration HOLD_TIME = std::chrono::milliseconds(2000);
USE_HARDWARE = false;
const char rmpPath[] = "C:\\RSI\\X.X.X\\";
if (USE_HARDWARE)
{
}
else
{
}
try
{
uint64_t userBufferAddress = controller->
AddressGet(RSIControllerAddressType::RSIControllerAddressTypeUSER_BUFFER, USER_BUFFER_INDEX);
if (controller->
MemoryGet(userBufferAddress) != 0x0)
{
controller->
MemorySet(userBufferAddress, 0x0);
}
printf("\nCommanding Motion...\n");
printf("\nSetting Motion Hold...\n");
printf("Commanding Motion...\n");
std::this_thread::sleep_for(HOLD_TIME);
printf("Releasing Motion Hold...\n");
controller->
MemorySet(userBufferAddress, 0x1);
controller->
MemorySet(userBufferAddress, 0x0);
printf("\nClearing Motion Hold...\n");
printf("Commanding Motion...\n");
}
{
printf("%s\n", err.text);
return -1;
}
return 0;
}
void UserUnitsSet(double countsPerUserUnit)
Sets the number of counts per User Unit.
void ErrorLimitTriggerValueSet(double triggerValue)
Set the Position Error Limit trigger value.
void PositionSet(double position)
Set the Command and Actual positions.
void MoveRelative(double relativePosition, double vel, double accel, double decel, double jerkPct)
Command a relative point-to-point S-Curve motion.
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.
void MemorySet(uint64_t address, int32_t data)
Write a value to controller memory.
uint64_t AddressGet(RSIControllerAddressType type)
Get the an address for some location on the MotionController.
int32_t MemoryGet(uint64_t address)
Read controller memory.
void Delete(void)
Delete the MotionController and all its objects.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
void ClearFaults()
Clear all faults for an Axis or MultiAxis.
void AmpEnableSet(bool enable)
Enable all amplifiers.
void Abort()
Abort an axis.
int32_t MotionDoneWait()
Waits for a move to complete.
void MotionHoldUserMaskSet(int32_t holdMask)
Sets the Motion Hold User bit mask.
void MotionHoldUserPatternSet(int32_t pattern)
Sets the Motion Hold User pattern bit mask.
void MotionAttributeMaskOffSet(RSIMotionAttrMask maskOff)
Turn off a particular motion attribute mask.
void MotionHoldTypeSet(RSIMotionHoldType type)
Set the motion hold type.
void MotionHoldUserAddressSet(uint64_t address)
Sets the Motion Hold User Address.
void MotionAttributeMaskOnSet(RSIMotionAttrMask maskOn)
Turn on a particular motion attribute mask.
Represents the error details thrown as an exception by all RapidCode classes. This class contains an ...
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.