#include <iostream>
#include <fstream>
#include "rsi.h"
#include "SampleAppsHelper.h"
#include "SampleApps.h"
int PathMotion::Run()
{
const int AXIS_COUNT = (2);
const int AXIS_X = 0;
const int AXIS_Y = 1;
const double USER_UNITS = 1048576;
const char* const PATH_MOTION_FILEPATH = "PathMotion.csv";
USE_HARDWARE = false;
double running_x = 0;
double running_y = 0;
double line_A[2] = { running_x, running_y };
running_x += -0.5;
double line_B[2] = { running_x, running_y };
running_y += -0.5;
double line_C[2] = { running_x, running_y };
running_y += (-0.25);
double arc_center_A[2] = { running_x,running_y };
running_x += (0.25);
running_x += -0.25;
double arc_center_B[2] = { running_x,running_y };
running_y += -0.25;
running_y += 0.25;
double arc_center_C[2] = { running_x,running_y };
running_x += -0.25;
running_x += 0.25;
double arc_center_D[2] = { running_x,running_y };
running_y += 0.25;
running_x += -0.5;
running_y += 0.5;
double line_D[2] = { running_x, running_y };
if (USE_HARDWARE)
{
}
else
{
}
try
{
axisX->
HomeMethodSet(RSIHomeMethod::RSIHomeMethodCURRENT_POSITION);
axisY->
HomeMethodSet(RSIHomeMethod::RSIHomeMethodCURRENT_POSITION);
std::ofstream myfile;
myfile.open(PATH_MOTION_FILEPATH);
myfile << "samples,x,y,\n";
}
myfile.close();
printf("\n%s\n", PATH_MOTION_FILEPATH);
}
{
printf(
"\n%s\n", err.
text);
return -1;
}
return 0;
}
double CommandPositionGet()
Get the current command position.
void AmpDisableActionSet(RSIMotorDisableAction action)
Set the Amp Disable action.
void SoftwareNegLimitActionSet(RSIAction action)
Set the action that will occur when the Software Negative Limit Event triggers.
void UserUnitsSet(double countsPerUserUnit)
Sets the number of counts per User Unit.
void ErrorLimitActionSet(RSIAction action)
Set the action that will occur when the Error Limit Event triggers.
void Home()
Execute the homing routine.
void HomeMethodSet(RSIHomeMethod method)
Set the method to be used for homing.
void PositionSet(double position)
Set the Command and Actual positions.
void SoftwarePosLimitActionSet(RSIAction action)
Set the action that will occur when the Software Positive Limit Event triggers.
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 MotionCountSet(int32_t motionCount)
Set the number of processed Motion Supervisors in the controller.
void SampleWait(uint32_t samples)
Wait for controller firmware to execute samples.
void Delete(void)
Delete the MotionController and all its objects.
int32_t SampleCounterGet()
Get the current value of the controller's processor's sample counter.
MultiAxis * MultiAxisGet(int32_t motionSupervisorNumber)
MultiAxisGet returns a pointer to a MultiAxis object and initializes its internals.
int32_t AxisCountGet()
Get the number of axes processing.
int32_t MotionCountGet()
Get the number of Motion Supervisors available in the firmware.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
void PathListStart(const double *const startPosition)
Start a line and arc point list for path motion.
void PathMotionStart()
Start the path motion.
void PathArcAdd(const double *const center, double angle)
Add an arc segment to the path.
void VectorDecelerationSet(double deceleration)
Set the vector deceleration.
void PathLineAdd(const double *const position)
Add a line segment to the path.
void PathBlendSet(bool blend)
Set the blending attribute.
void VectorAccelerationSet(double acceleration)
Set the vector acceleration.
void PathListEnd()
End a line and arc point list for path motion.
void AxisAdd(Axis *axis)
Add an Axis to a MultiAxis group.
void VectorVelocitySet(double velocity)
Set the vector velocity.
Represents multiple axes of motion control, allows you to map two or more Axis objects together for e...
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.
bool MotionDoneGet()
Check to see if motion is done and settled.
Represents the error details thrown as an exception by all RapidCode classes. This class contains an ...
@ RSIMotorDisableActionNONE
No action taken when disabled.
@ RSIActionNONE
None - do not perform any action.
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.