One Condition Position User Limit sample application.
This sample code shows how to configure the RMP controller's User Limits to compare an encoder position to a specific encoder position value.
If the (1 condition) pattern matches, then the specified output bit is activated (turns high) and the axis will cause an ABORT at the specified position.
In this example we configure a user limit to trigger when our axis reaches a specific position. Once the specific position has been reached then our user limit will set the OUTPUT to high(1) as well as command an ABORT on the current motion.
The ENCODER VALUE is specified in UserLimitConditionSet()
The ABORT is specified in UserLimitConfigSet()
The OUTPUT is specified in UserLimitOutputSet()
In this example Beckhoff IO Terminals (Model EL1088 for Inputs and Model EL2008 for outputs) were used to control the Digital IO signals.
Make sure to check the correct digital IO signal indexes of your system in: RapidSetup -. Tools -. NetworkIO
- Precondition
- This sample code presumes that the user has set the tuning paramters(PID, PIV, etc.) prior to running this program so that the motor can rotate in a stable manner.
- Warning
- This is a sample program to assist in the integration of your motion controller with your application. It may not contain all of the logic and safety features that your application requires.
- Copyright
- Copyright © 1998-2019 by Robotic Systems Integration, Inc. All rights reserved. This software contains proprietary and confidential information of Robotic Systems Integration, Inc. (RSI) and its suppliers. Except as may be set forth in the license agreement under which this software is supplied, disclosure, reproduction, or use with controls other than those provided by RSI or suppliers for RSI is strictly prohibited without the prior express written consent of Robotic Systems Integration.
using RSI.RapidCode.dotNET;
using RSI.RapidCode.dotNET.Enums;
using System;
{
class UserLimitPositionOneCondition
{
static void Main(string[] args)
{
const int AXIS_NUMBER = 0;
const int POSITION = 5;
const int USER_UNITS = 1048576;
const int VELOCITY = 1;
const int ACCELERATION = 10;
const int DECELERATION = 10;
const int POSITION_INDEX = 0;
const int OUTPUT_INDEX = 0;
const int NODE_INDEX = 0;
try
{
int userLimit = 1;
int condition = 0;
double limitValue = 10 * USER_UNITS;
condition,
limitValue);
int duration = 0;
triggerType,
action,
AXIS_NUMBER,
duration);
uint andMask = (uint)output0.
MaskGet();
uint orMask = (uint)output0.
MaskGet(); ;
bool enableOutput = true;
andMask,
orMask,
outputAddress,
enableOutput);
Console.WriteLine("Waiting for axis to reach specified position\n");
{
}
Console.WriteLine("\nPress Any Key To Continue");
Console.ReadKey();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
Console.WriteLine("\nPress Any Key To Exit");
Console.ReadKey();
}
}
}