22#if !defined(__INTIME__)
29const int AXIS_COUNT = 2;
30const int DESIRED_POINTS = 50;
31const int SYNC_PERIOD = 10;
33int32_t lastSample = 0;
35#pragma region Fixed Size Implementation
41const int POINT_BLOCK_COUNT = 10;
42int32_t extraPointsSentToEvenOutBlock = 0;
45int32_t AdjustPointsNeededToBlockCount(int32_t initialCount)
47 int32_t calculatedCount = 0;
48 int32_t adjustedInitialCount = initialCount - extraPointsSentToEvenOutBlock;
50 while ((adjustedInitialCount > 0) && (adjustedInitialCount > calculatedCount))
52 calculatedCount += POINT_BLOCK_COUNT;
56 extraPointsSentToEvenOutBlock += calculatedCount - initialCount;
58 return calculatedCount;
62volatile int _continueMonitoring =
true;
66void monitoringThread(
void* tmp)
72 controller->SyncInterruptEnableSet(
true);
74 while (_continueMonitoring)
78 int32_t sampleRecieved = controller->SyncInterruptWait();
79 int32_t pointsNeeded = sampleRecieved - lastSample;
82 pointsNeeded = AdjustPointsNeededToBlockCount(pointsNeeded);
89 lastSample = sampleRecieved;
102 printf(
"Error Found: %s\n", object->
ErrorLogGet()->text);
107void streamingMotionBufferManagementMain()
112 checkErrors(controller);
119 controller->NetworkStart();
120 checkErrors(controller);
123 _beginthread(monitoringThread, 0, controller);
126 bool exitCondition =
false;
127 while (!exitCondition)
134 printf(
"\n%s\n", err.text);
136 controller->Delete();
139 _continueMonitoring =
false;
void SyncInterruptPeriodSet(uint32_t samples)
Configure the period for the Sync Interrupt on the controller.
static MotionController * CreateFromSoftware()
Initialize and start the RMP EtherCAT controller.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
const RsiError *const ErrorLogGet()
Get the next RsiError in the log.
int32_t ErrorLogCountGet()
Get the number of software errors in the error log.
The RapidCode base class. All non-error objects are derived from this class.
Represents the error details thrown as an exception by all RapidCode classes. This class contains an ...