#if !defined(__INTIME__)
#include "rsi.h"
#include <process.h>
const int AXIS_COUNT = 2;
const int DESIRED_POINTS = 50;
const int SYNC_PERIOD = 10;
int32_t lastSample = 0;
#pragma region Fixed Size Implementation
const int POINT_BLOCK_COUNT = 10;
int32_t extraPointsSentToEvenOutBlock = 0;
int32_t AdjustPointsNeededToBlockCount(int32_t initialCount)
{
int32_t calculatedCount = 0;
int32_t adjustedInitialCount = initialCount - extraPointsSentToEvenOutBlock;
while ((adjustedInitialCount > 0) && (adjustedInitialCount > calculatedCount))
{
calculatedCount += POINT_BLOCK_COUNT;
}
extraPointsSentToEvenOutBlock += calculatedCount - initialCount;
return calculatedCount;
}
#pragma endregion
volatile int _continueMonitoring = true;
void monitoringThread(void* tmp)
{
controller->SyncInterruptEnableSet(true);
while (_continueMonitoring)
{
int32_t sampleRecieved = controller->SyncInterruptWait();
int32_t pointsNeeded = sampleRecieved - lastSample;
pointsNeeded = AdjustPointsNeededToBlockCount(pointsNeeded);
lastSample = sampleRecieved;
}
}
{
{
printf(
"Error Found: %s\n", object->
ErrorLogGet()->
text);
}
}
void streamingMotionBufferManagementMain()
{
checkErrors(controller);
try
{
controller->NetworkStart();
checkErrors(controller);
_beginthread(monitoringThread, 0, controller);
bool exitCondition = false;
while (!exitCondition)
{
}
}
{
printf("\n%s\n", err.text);
}
controller->Delete();
_continueMonitoring = false;
}
#endif
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 ...