---
# System prepended metadata

title: EpsonRC70

---


EpsonRC70
==

## 2.ddd
```python=
chromium-browser --new-window 
                 --window-position=0,0    #開啟網頁1postion座標位置
                 --no-sandbow
                 --user-data-dir="/home/rafel/Documents/1"             
                   /home/rafel/express/demo.html --kiosk &
chromium-browser --new-window 
                 --window-position=2000,0  #開啟網頁2postion座標位置
                 --no-sandbow
                 --user-data-dir="/home/rafel/Documents/2" 
                   /home/rafel/express/demo2.html --kiosk &      
```

## 1. 基本命令
```csharp=
m_spel.ArmClr(1);//Clears (undefines) an arm for the current robot.
m_spel.ArmDef(1);//Returns whether a robot arm is defined or not.
m_spel.ArmSet(1, 1.5, 0, 0, 0, 0);//Defines an auxiliary robot arm.
m_spel.Atan(.7);//Returns the arc tangent of a numeric expression.
m_spel.Atan2(-25, 50);//Returns the angle of the imaginary line connecting 
                      //points (0,0) and (X, Y) in radians.
m_spel.ATCLR();//Clears and initializes the average torque for one or more joints.
m_spel.ATRQ(i);//Returns the average torque for the specified joint.
m_spel.AvgSpeedClear();//Clears and initializes the average of the absolute speed
                       //values for one or more joints.
m_spel.AxisLocked(1)//Returns True when specified axis release free joint state.
m_spel.BGo(100);//Executes Point to Point relative motion in the selected local
                //coordinate system
m_spel.BMove(100);//Executes linear interpolated relative motion 
                  //in the selected local coordinate system
bool state= m_spel.Brake(1);
/*
[Description]:Reads or sets brake status for specified joint.
[Parameters]:
JointNumber Integer expression from 1-9 representing the joint number.
State The keyword On is used to turn the brake on.
The keyword Off is used to turn the brake off.
[eturn Value]:
0 = Brake Off
1 = Brake On
*/
```
## 一. Multiple Threads
```csharp=
RCAPINet.Spel m_spel_1 = new RCAPINet.Spel();
RCAPINet.Spel m_spel_2 = new RCAPINet.Spel();
m_spel_1.ServerInstance = 1;
m_spel_2.ServerInstance = 1;
m_spel_1.CommandTask = 1;
m_spel_2.CommandTask = 2;
m_spel_1.Initialize();
m_spel_1.Project = @"c:\EpsonRC70\Projects\MyProject\MyProject.sprj";
m_spel_1.Connect(1);

//[Thread 1] Uses instance m_spel_1 for motion
m_spel_1.Robot = 1;
do{
    m_spel_1.Go(1);
    m_spel_1.Go(2);
}while(!m_stop);

//[Thread 2] Uses instance m_spel_2 for I/O
do{
    m_spel_2.On(1);
    m_spel_2.Delay(500);
    m_spel_2.Off(1);
    m_spel_2.Delay(500);
}while(!m_stop);
```
## 二. Executing SPEL+ Programs
| Program Number | SPEL+ Function Name |
| -------- | -------- |
| 0     | main     | 
| 1     | main1     | 
| 2     | main2     | 
| 3     | main3     | 
| ...     | ...     | 
| 63     | main63     | 

```csharp=
void btnStart_Click(object sender, EventArgs e)
{
    m_spel.Start(0);//Starts function main
    btnStart.Enabled = false;
    btnStop.Enabled = true;
}
```
## 三. AsyncMode
>AsyncMode allows you to execute Spel methods while other methods are executing. Only
the following Spel class methods are allowed to execute asynchronously:<br>
>
>|Arc | Arc3 | BGo | BMove | CVMove |
>| -------- | -------- | -------- | -------- | -------- |
>| **Go** | **Home** | **JTran** |**Jump** |**Jump3** |
>| **Jump3CP** | **MCal** | **Move** |**Pass** |**PTran** |
>| **Pulse** | **TGo** | **TMove** | | |<br>

## 四. Spel Class Properties
### 1.CommandInCycle Property
>Description: Returns whether a method is being executed.<br>
>Return value: A Boolean value that is True if a method is executing, False if not.<br>

```csharp=
if (m_spel.CommandInCycle)
    MessageBox.Show("SPEL command is executing, operation aborted");
```
### 2.CommandTask Property
>Description: Specifies the reserved API task to use in the Controller for executing <br>
>&emsp;&emsp;&emsp; &emsp; &emsp; robot commands.<br>
>Default Value: The default value is 0 (do not use a reserved API task).<br>
```csharp=
// In Robot1 thread
m_spel.CommandTask = 1;
m_spel.Robot = 1;
// In Robot2 thread
m_spel.CommandTask = 2;
m_spel.Robot = 2;
```
### 3.ErrorCode Property
>Description:　Returns the current Controller error code.<br>
>Return Value: Integer value containing the error code.<br>

```csharp=
if (m_spel.ErrorOn)
    lblErrorCode.Text = m_spel.ErrorCode.ToString();
else
    lblErrorCode.Text = "";
```
### 4.ErrorOn Property
>Description: Returns True if a critical error has occurred in the Controller.<br>
>Return Value: True if the Controller is in the error state, False if not.<br>
```csharp=
if (m_spel.ErrorOn)
    m_spel.Reset();
```
### 5.EStopOn Property
>Description: Returns the status of the Controller's emergency stop.<br>
>Return Value: True if the emergency stop is active, False if not.<br>
```csharp=
if (m_spel.EStopOn)
    lblEStop.Text = "Emergency stop is active";
else
    lblEStop.Text = "";
```
### 6.Force_Sensor Property
>Description: Sets and return the current force sensor number.<br>
>Default value: 1<br>
>Return value: An Integer value that is the current force sensor number<br>
```csharp=
// Read the Z axis force for sensor 2
m_spel.Force_Sensor = 2;
f = m_spel.Force_GetForce(3);
```
### 7.NoProjectSync Property
>Description: Sets / returns whether the current project in the PC should be synchronized<br> 
>&emsp;&emsp;&emsp; &emsp; &emsp; with the Controller project.<br>
>Default Value: False<br>
```csharp=
m_spel.Initialize();
m_spel.NoProjectSync = true;
```
### 8.OperationMode Property
>Description: Reads or sets the EPSON RC+ 7.0 mode of operation.<br>
>Return value: SpelOperationMode value
```csharp=
void btnSpelProgramMode_Click(object sender, EventArgs e)
{
    try{
        m_spel.OperationMode = RCAPINet.SpelOperationMode.Auto;
        // If you want to wait for the user to close the RC+ GUI, 
        // you can wait here
        Do{
            Application.DoEvents();
            Systme.Threading.Thread.Sleep(10);
        }while(!m_spel.OperationMode =RCAPINet.OperationMode.Auto);
    }Catch (SpelException ex){
        MessageBox.Show(ex.Message);
    }
}
```
### 9.ParentWindowHandle Property
>Description: Sets / returns the handle for the parent window used for dialogs and windows.<br>
>Return Value: Integer value containing the window handle<br>
```csharp=
m_spel.ParentWindowHandle = (int)this.Handle;
m_spel.ShowWindow(RCAPINet.SpelWindows.IOMonitor);
```

### 10.ProjectBuildComplete Property
>Description: Returns the status of the current project build.<br>
>Return Value: True if the project build is complete, False if not.<br>
```csharp=
if (m_spel.ProjectBuildComplete)
    lblBuild.Text = "Project build is Complete";
else
    lblBuild.Text = "Project build is not Complete";
```
### 11.ProjectOverwriteWarningEnabled Property
>Description: Sets / returns whether the project overwrite warning will be displayed.<br>
>Default Value: True<br>
>Return Value: True if the project overwrite warning is enabled, False if not. <br>
```csharp=
m_spel.ProjectOverwriteWarningEnabled = false;
m_spel.Project =@"c:\EpsonRC70\Projects\Project1\Project1.sprj";
```
### 12.SafetyOn Property
>Description: Returns status of the Controller's safeguard input.<br>
>Return Value: True if the safeguard is open, False if not.<br>
```csharp=
if (m_spel.SafetyOn)
    lblSafeguard.Text = "Safe guard is active";
else
    lblSafeguard.Text = "";
```
### 13.ServerInstance Property
>Description: Specifies which instance of EPSON RC+ server to use.<br>
>Default Value: The default value is the next available server instance.<br>
>Remarks: 
>>The API communicates with an RC+ server process. ServerInstance specifies which server to use. Each server instance corresponds with one controller and one project.
By default, when you create a new Spel class instance, the ServerInstance is automatically
set to 1.
Sometimes you may want multiple instances of the Spel class for the same Controller,
such as for multithreading in your application. In that case, you must set the
ServerInstance property to the same value for each Spel class instance using the same
controller.
==ServerInstance must be between 1 and 10== and it must be set before executing Initialize or
any other methods.
```csharp=
// Controller 1
RCAPINet.Spel spel1 = new RCAPINet.Spel();
spel1.ServerInstance = 1;
spel1.Initialize();
spel1.Connect(1);
// Controller 2
RCAPINet.Spel spel2 = new RCAPINet.Spel();
spel2.ServerInstance = 2;
spel2.Initialize();
spel2.Connect(2);
```
### 14.Version Property
>Description: Returns the current EPSON RC+ 7.0 software version.<br>
>Return Value: String that contains the current EPSON RC+ 7.0 software version.<br>
```csharp=
string curVer = m_spel.Version;
```
15.WarningCode Property
>Description: Returns Controller warning code.<br>
>Return Value: Integer value that contains the current controller warning code.<br>
```csharp=
if (m_spel.WarningOn)
    lblWarningCode.Text = m_spel.WarningCode.ToString();
else
    lblWarningCode.Text = "";
```
16.WarningOn Property
>Description: Returns status of the Controller warning state.<br>
>Return Value: True if the Controller is in the warning state, False if not.<br>
```csharp=
if (m_spel.WarningOn)
    lblWarningStatus.Text = "ON";
else
    lblWarningStatus.Text = "OFF";
```

## 五. Spel Class Method
### 1.Accel
>Description: Sets acceleration and deceleration for point to point motion commands<br> 
>&emsp;&emsp;&emsp;&emsp; &emsp; Go, Jump, and Pulse.<br>
>Syntax: Sub Accel (PointToPointAccel As Integer, PointToPointDecel As Integer, <br>
>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;[JumpDepartAccel As Integer], [JumpDepartDecel As Integer], <br>
>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;[JumpApproAccel As Integer], [JumpApproDecel As Integer])<br>
>Parameters:
>>| Name | Description | 
>>| -------- | -------- |
>>| PointToPointAccel | Integer expression between 1-100 representing a percentage of maximum acceleration rate.| 
>>| PointToPointDecel | Integer expression between 1-100 representing a percentage of maximum deceleration rate. | 
>>| JumpDepartAccel | Integer expression between 1-100 representing a percentage of maximum acceleration rate for Jump command Z Axis upward motion. | 
>>| JumpDepartDecel | Integer expression between 1-100 representing a percentage of maximum deceleration rate for Jump command Z Axis upward motion. | 
>>| JumpApproAccel | Integer expression between 1-100 representing a percentage of maximum acceleration rate for Jump command Z Axis downward motion.| 
>>| JumpApproDecel | Integer expression between 1-100 representing a percentage of maximum deceleration rate for Jump command Z Axis downward motion.| <br>
>
```csharp=
m_spel.Accel(50, 50);
m_spel.Go ("pick");
```
### 2.AccelR
>Description: Sets acceleration and deceleration for tool rotation motion.<br>
>Syntax: Sub AccelR (Accel As Single, [Decel As Single])<br>
>Parameters:
>>| Name | Description |
>>| -------- | -------- |
>>| Accel | Single expression from 0.1 to 5000 deg/sec2 to define tool rotation acceleration when ROT is used in motion commands. If Decel is omitted, this value is used for both the Acceleration and Deceleration rates. |
>>| Decel | Optional.<br> Single expression from 0.1 to 5000 deg/sec2 to define tool rotation deceleration when ROT is used in motion commands.|<br>
```csharp=
void MoveToPlace()
{
    m_spel.AccelR(100);
    m_spel.Move("place ROT");
}
```
### 3.AccelS
>Description: Sets acceleration and deceleration for linear interpolar (straight line) motion commands Jump3CP, Move, TMove.<br>
>Syntax: Sub AccelS ( Accel As Single, Decel As Single,<br>
>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;[JumpDepartAccel As Single], [JumpDepartDecel As Single],<br>
>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;[JumpApproAccel As Single], [JumpApproDecel As Single] )<br>
>Parameters:
>>| Name | Description |
>>| -------- | -------- |
>>| Accel |Single expression between 1-5000 represented in mm/sec2 units to define acceleration and deceleration values for Straight Line and Continuous Path motion. If Decel is omitted, this value is used for both the Acceleration and Deceleration rates.|
>>| Decel |Single expression between 1-5000 represented in mm/sec2 units to define deceleration values for Straight Line and Continuous Path motion. One parameter is used for representing both the Acceleration and Deceleration rates.|
>>| JumpDepartAccel |Single expression between 1-5000 representing a percentage of maximum acceleration rate for Jump3CP command Z Axis upward motion.|
>>| JumpDepartDecel |Single expression between 1-5000 representing a percentage of maximum deceleration rate for Jump3CP command Z Axis upward motion.|
>>| JumpApproAccel |Single expression between 1-5000 representing a percentage of maximum acceleration rate for Jump3CP command Z Axis downward motion.|
>>| JumpApproDecel |Single expression between 1-5000 representing a percentage of maximum deceleration rate for Jump3CP command Z Axis downward motion.|<br>

```csharp=
void MoveToPlace()
{
    m_spel.AccelS(500);
    m_spel.Move(pick);
    m_spel.AccelS(500, 300);
    m_spel.Move(place);
}
```
### 4.Agl
>Description: Returns the joint angle for the selected rotational axis, or position <br>
>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;for the selected linear axis.<br>
>Parameters: JointNumber Integer expression from 1-9 representing the joint number.
```csharp=
float j1Angle;
j1Angle = m_spel.Agl(1);
```
### 5.AIO_In
>Description: Reads analog value form optional analog I/O input channel.<br>
>Parameters: Channel Specify the channel number of the analog I/O.<br>
>Return Value: 
>>Return the analog input value of the analog I/O channel which specified in channel number in real number.
Return value range differs depending on the input range configuration of the analog I/O board.
```csharp=
float val;
val = m_spel.AIO_In(2);
```
### 6.AIO_InW
>Description: Reads analog value from optional analog I/O input channel.<br>
>Parameters: Channel Specify the channel number of the analog I/O.<br>
>Return Value: Returns the input states (Integer expression from 0 to 65535) <br>
>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp; of specified analog I/O channel.
```csharp=
int val;
val = m_spel.AIO_InW(2);
```
### 7.AIO_Out
>Description: Reads or set analog value from the optional analog I/O output channel.<br>
>Parameters:
>>| Name | Description |
>>| -------- | -------- |
>>| Channel  | Specify the channel number of the analog I/O. |
>>| Value    | Specify the real number which indicates output voltage [V] or current. |
>Return Value:
>>Returns specified analog I/O channel voltage and current output state in real number. Unit
of voltage output is [V] and current output is [mA].
For Function AIO_Out (Channel As Integer) As Single:
When outputting the speed information of the robot on specified channel, a return value
can be acquired by this method.<br>
```csharp=
float val;
val = m_spel.AIO_Out(1);
```
### 8.AIO_OutW
>Description: Reads or set analog value from the optional analog I/O output channel.<br>
>Parameters:
>>| Name | Description |
>>| -------- | -------- |
>>| Channel | Specify the channel number of the analog I/O. |
>>| OutputData | Specify the output data (Integer expression from 0 to 65535) in formula or value.|
>Return Value:
>>Returns the output state of specified analog I/O channel in Long integers from 0 to 65535.The following table shows output voltage (current) and return value of each output channel according to output range configuration of analog I/O board.<br>
```csharp=
int val;
val = m_spel.AIO_OutW(1);
```
### 9.Arc
>Description: Arc moves the arm to the specified point using circular interpolation <br>
>&emsp;&emsp;&emsp;&emsp; &emsp; in the XY plane.<br>
>Parameters:
>>Each syntax has two parameters that specify the mid point and end point of the arc.
>>| Name | Description |
>>| -------- | -------- |
>>| MidPoint | Specifies the mid point by using an integer, SpelPoint or string expression.  |
>>| EndPoint | Specifies the end point by using an integer, SpelPoint or string expression. When using a string expression, you can include ROT, CP,SYNC, a search expression for Till, and a parallel processing statement.|
```csharp=
// Points specified using SpelPoint
SpelPoint midPoint, endPoint;
midPoint = m_spel.GetPoint("P1");
endPoint = m_spel.GetPoint("P2");
m_spel.Arc(midPoint, endPoint);
// Points specified using expressions
m_spel.Arc("P1", "P2");
m_spel.Arc("P1", "P2 CP");
// Using parallel processing
m_spel.Arc("P1", "P2 !D50; On 1; D90; Off 1!");
```
### 10.Arc3
>Description: Arc3 moves the arm to the specified point using circular interpolation <br>
>&emsp;&emsp;&emsp;&emsp; &emsp; in 3 dimensions.<br>
>Parameters:
>>Each syntax has two parameters that specify the mid point and end point of the arc.
>>| Name | Description |
>>| -------- | -------- |
>>| MidPoint | Specifies the mid point by using an integer, SpelPoint or string expression.|
>>| EndPoint | Specifies the end point by using an integer, SpelPoint or string expression. When using a string expression, you can include ROT, ECP, CP, SYNC, a search expression for Till, and a parallel processing statement.|
```csharp=
// Points specified using SpelPoint
SpelPoint midPoint, endPoint;
midPoint = m_spel.GetPoint("P1");
endPoint = m_spel.GetPoint("P2");
m_spel.Arc3(midPoint, endPoint);
// Points specified using expressions
m_spel.Arc3("P1", "P2");
m_spel.Arc3("P1", "P2 CP");
// Using parallel processing
m_spel.Arc3("P1", "P2 !D50; On 1; D90; Off 1!");
```
### 11.Arch
>Description: Defines ARCH parameters (Z height to move before beginning horizontal <br>
>&emsp;&emsp; &emsp;&emsp; &emsp; motion) for use with the JUMP instructions.<br>
>Parameters:
>>| Name | Description |
>>| -------- | -------- |
>>| ArchNumber | The Arch number to define. Valid Arch numbers are (0-6) making a total of 7 entries into the Arch table.|
>>| DepartDist | The depart distance in millimeters moved at the beginning of the Jump instruction before starting horizontal motion.|
>>| ApproDist  | The approach distance in millimeters above the target position of the Jump instruction.| <br>
```csharp=
void SetArchs()
{
    m_spel.Arch(1, 30, 30);
    m_spel.Arch(2, 60, 60);
    m_spel.Jump("P1 C1");
    m_spel.Jump("P2 C2");
}
```
### 12.Arm
>Description: Selects the current robot arm.<br>
>Parameters:<br> 
>>ArmNumber Integer expression from 0-15. The user may select up to 16 different arms.Arm 0 is the standard (default) robot arm. Arm(s) 1-15 are auxiliary arms defined by the ArmSet instruction.
```csharp=
m_spel.Arm(1);
```






<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br>

### 1.Box
```csharp=
m_spel.Box(1,-5,5,-10,10,-20,20);
/*
[Description]:Specifies an approach check area defined within a box. 
[Parameters]:
AreaNumber Integer number from 1-15 representing which of the 15 boxes to define.
MinX The minimum X coordinate position of the approach check area.
MaxX The maximum X coordinate position of the approach check area.
MinY The minimum Y coordinate position of the approach check area.
MaxY The maximum Y coordinate position of the approach check area.
MinZ The minimum Z coordinate position of the approach check area.
MaxZ The maximum Z coordinate position of the approach check area.
*/
m_spel.BoxClr(1);//Clears the definition of a box (approach check area).
bool x = m_spel.BoxDef(1);
/*
[Description]:Returns whether Box has been defined or not.
[Parameters:]BoxNumber Integer expression representing the area number from 1 to 15.
[Return Value]:True if the specified box is defined, False if not.
*/
```
### 2.BuildProject
```csharp=
//Description:Builds the EPSON RC+ 7.0 project specified by the Project property.
m_spel.Project =@"c:\EpsonRC70\projects\myproj\myproj.sprj";
if(!m_spel.ProjectBuildComplete())
    m_spel.BuildProject();
```
### 3.Call
C# Code
> Description: Calls (executes) a SPEL+ function which can optionally return a value.<br>
> Parameters: <br>
>| Parameters | description | 
>| -------- | -------- | 
>| FuncName | The name of a function which has already been defined in the current project. | 
>| Parameters| Optional.<br>Specify a list of arguments. Use arguments separated by commas (,).|
>
> Return Value: The return value of the SPEL+ function. The data type matches the data type of
> &emsp;&emsp;&emsp;&emsp;&emsp;&emsp; the function.
```csharp=
int errCode;
errCode = m_spel.Call("GetPart", """Test"",2");
```
SPEL+ function
```cmake=
Function GetPart(Info$ As String, Timeout As Integer) As Integer
    Long errNum
    OnErr GoTo GPErr
        Print Info$
        errNum = 0
        Jump P1
        On vacuum
        Wait Sw(vacOn) = On, Timeout
        If TW = True Then
            errNum = VAC_TIMEOUT
        EndIf
        GetPart = errNum
        Exit Function
    GPErr:
        GetPart = Err
Fend
```
### 4.CalPls
> Description:
Reads or sets the position and orientation ==pulse== values for ==calibration==.
>Parameters:
J1Pulses – J9Pulses Integer number representing the pulse count of J1 to J9.
>&emsp;&emsp;&emsp;&emsp; &emsp; J5Pulses to J9Pulses can be omitted. 
><br>Return Value: When parameters are omitted, displays the current CalPls values.
```csharp=
float val;
for(int i = 1; i <= 4; i++)
    val = m_spel.CalPls(i);
```
### 5.ClearPoints
> Description: Clears the points in memory for the current robot.
```csharp=
m_spel.ClearPoints();
m_spel.SetPoint(1, 100, 200, -20, 0, 0, 0);
m_spel.Jump(1);
```
### 6.Continue
>Description: Causes all tasks in the Controller to resume if a pause has occurred.
```csharp=
void btnContinue_Click(object sender, EventArgs e)
{
    btnPause.Enabled = true;
    btnContinue.Enabled = true;
    try{
        m_spel.Continue();
    }catch(RCAPINet.SpelException ex){
        MessageBox.Show(ex.Message);
    }
}
```
### 7.Ctr
>Description: Returns the counter value of the specified input counter.<br>
>Parameters: BitNumber Number of the input bit set as a counter.<br>
>&emsp;&emsp;&emsp;&emsp; &emsp; Only 16 counters can be active at the same time.<br>
>Return Value: Returns the counter value.( integer from 0 to 65535)
```csharp=
lblCounter.Text = m_spel.Ctr(1).ToString();
```

page106 to be continue