首先标定要确定机械手和相机的安装方式选择平台属性。
一:眼在手上即标定的对象是相机
二:眼在手外即标定的对象是平台
输入原点坐标即机械手拍照点位置(X,Y,C,R)
选择X,Y,R轴方向及运动步长(写入整形)
点击【点位生成】输出数据表报。
附上界面效果展示
//加密狗访问
private void button1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("Explorer.exe", "http://localhost:1947/");
}
//退出事件
private void button2_Click(object sender, EventArgs e)
{
Process[] pc=Process.GetProcesses();
foreach (var item in pc)//
{
try
{
if (item.ProcessName =="iexplore")
{
item.Kill();
}
}
catch (System.Exception ex)
{
Console.WriteLine( ex.Message );
}
}
this.Close();
}
//生成文件
private void button3_Click(object sender, EventArgs e)
{
string path=@"D:\Luster";
string files=textBox2.Text;
if(files=="")
{
files="1.工程;2.软件;3.数据;4.图片;5.文档;6.标定;7.其他";
textBox2.Text=files;
}
textBox1.Text = Directory.Exists(path).ToString();
if (textBox1.Text=="False")
{
string[] filepaths=files.Split(';');
for (int i = 0; i < filepaths.Length; i++)
{
Directory.CreateDirectory(path + "\\" + filepaths[i]);
}
textBox2.Text = files;
MessageBox.Show("文件创建完成!!");
}
else
{
MessageBox.Show("文件已创建!!");
}
}
//点击按钮生成标定坐标
//需要 原点坐标 轴方向 步长 输出文件位置
private void button4_Click(object sender, EventArgs e)
{
if (Reasult())
{
StringBuilder sb = new StringBuilder();
int stepX=int.Parse(textBox5.Text);
int stepY=int.Parse(textBox8.Text);
int stepR=int.Parse(textBox6.Text);
int selectnum=SelcetNums();
List<List<double>> A = CalibrationPointList(stepX, stepY, stepR, selectnum);
for (int i = 0; i < A.Count; i++)
{
for (int j = 0; j < A[i].Count; j++)
{
sb.Append(A[i][j]);
sb.Append(",");
}
sb.Append("\r\n");
}
textBox7.Text=sb.ToString();
string fileName = @"C:\Users\至尊宝\Desktop\标定文件.csv";
using (FileStream fsw = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write))
{
byte[] buffer = Encoding.Default.GetBytes(textBox7.Text);
fsw.Write(buffer,0, buffer.Length);
}
}
else
{
MessageBox.Show("请填入正确的参数信息!");
}
}
//判断条件符合要求
private bool Reasult()
{
if (textBox3.Text.Count() > 4 && (comboBox4.Text == "顺时针" || comboBox4.Text == "逆时针") && (comboBox3.Text == "平台" || comboBox3.Text == "相机") && (comboBox1.Text == "向左" || comboBox1.Text == "向右") && (comboBox2.Text == "向上" || comboBox2.Text == "向下") && Regex.IsMatch(textBox5.Text, @"^\d+$") && Regex.IsMatch(textBox6.Text, @"^\d+$"))
{
return true;
}
else
{
return false;
}
}
private List<List<double>> CalibrationPointList(int X,int Y,int R,int SelcectNum)
{
double X1=0;
double Y1=0