台达机器人API理解

682 0

基础

引用

using RABD.Lib;
using RABD.DROE.SystemDefine;

new 一个新对象

Robot d = new Robot();

连接一个机器人

d.ConnectRobot(SIp, "192.168.1.70",11000);//Ms IP ,Computer IP , Computer Port
  • MsIP 控制器IP 一般默认为192.168.1.1
  • Computer IP/Port程 序运行电脑的IP以及端口

获取机器人属性

d.RobotType().ToString();//机器人类型
d.ServoState()//使能状态
d.HasAlarm() //报警状态
d.HasWarning() //警告状态
d.GetInputState(0) //输入DI(1) 的状态 
d.GetOutputState(0) //输入DO(1)的状态
d.IsConnected() //连接状态
d.GetPos();//获取现在的点

主要的方法

d.ServoOn(); // 开启使能
d.ServoOff(); //关闭使能
d.RunProgram(); // 运行程序
d.PauseProgram(); // 暂停程序
d.StopProgram(); //停止程序
d.SetSpeed(20);
d.SetJointDistance(1000);
d.SetCartesianDistance(1000);
d.GetGlobalPointData();
d.GetJointdexValue(PointList[i].Info.JointIndex, ref JRCMode, ref J4JRC,ref J5JRC, ref J6JRC); 
 string[] data =d.GetToolFrame(Index);
d.SetToolFrame()
string[] data = d.GetUserFrame(Index);
string[] _ProjectsExecuteMS = d.ProjectList();//程序列表
d.SelectProgram(_ProjectIndex);
d.ResetAlarm(); //重置报警
public string[,] GetAlarmCodes(eLanguage language, eCertification Certificcation);//获取报警信息
 d.Step(eDirection.J1N);
d.Jog(eDirection.J1N);
d.Step(eDirection.J1P);
d.Jog(eDirection.J1P);
d.MovStop(eAxisName.J1);

模拟输出(开/关)

bool outio=d.GetOutputState(0);
outio = !outio;
d.SetOutputState(1, outio);

ModBus 读写

  1. 定义
public bool WriteMulitModbus(ushort address, short[] data);
public short[] ReadMulitModbus(ushort address, short count);
public enum eModbusWordType
 {
  Word = 0,
  DoubleWord = 1
 }
public string WriteModbus(ushort address, eModbusWordType WordType, int iValue);
public string ReadModbus(ushort address, eModbusWordType WordType, ref int iModbusValues);

项目相关

string[] _ProjectsExecuteMS = d.ProjectList(); //获取项目列表
d.SelectProgram(_ProjectIndex); //选中项目

运行程序

d.RunProgram(); // 运行程序
d.PauseProgram(); // 暂停程序
d.StopProgram(); //停止程序
public void RunSelectProgram(short index);

报警相关

  1. 定义
public string[,] GetAlarmCodes(eLanguage language, eCertification Certificcation);  //获取报警代码
public void ResetAlarm();
  1. Demo代码
d.ResetAlarm();  //重置报警
string[,] AL = { { "" } };
if(radioButton9.Checked == true)
    AL = d.GetAlarmCodes(eLanguage.EN, eCertification.CE);
else
    AL = d.GetAlarmCodes(eLanguage.TW, eCertification.CE);

点位

  1. 定义
public void GetPos(out sPoint p);
public cPoint GetPos();
public int ExternalPUU(int ExternalID);
  1. Demo代码
cPoint pos = d.GetPos();//获取的点
    //获取点位的各个值
   textBox2.Text = pos[eAxisName.J1].ToString();
   textBox3.Text = pos[eAxisName.J2].ToString();
   textBox4.Text = pos[eAxisName.J3].ToString();
   textBox5.Text = pos[eAxisName.J4].ToString();
   textBox27.Text = pos[eAxisName.J5].ToString();
   textBox28.Text = pos[eAxisName.J6].ToString();
   textBox6.Text = (pos[eAxisName.X] / 1000).ToString("0.000");
   textBox7.Text = (pos[eAxisName.Y] / 1000).ToString("0.000");
   textBox8.Text = (pos[eAxisName.Z] / 1000).ToString("0.000");
   textBox9.Text = (pos[eAxisName.RX] / 1000).ToString("0.000");
   textBox30.Text = (pos[eAxisName.RZ] / 1000).ToString("0.000");
   textBox29.Text = (pos[eAxisName.RY] / 1000) .ToString("0.000");
   textBox26.Text = pos.Info.Hand.ToString();
   textBox31.Text = pos.Info.Hand.ToString();
   textBox32.Text = pos.Info.Shoulder.ToString();
   textBox33.Text = pos.Info.Flip.ToString();
   ExternaPuuBox.Text = d.ExternalPUU(1).ToString();

断开连接

d.DisConnectRobot();

XuJoe

发表评论