机械手定位(带角度)的思路及3点计算旋转中心

本文介绍了机械手带角度定位的方法,通过旋转中心RectCenter_Row和RectCenter_Column,结合基准模板图像和拍摄到的Mark点坐标,利用旋转矩阵进行坐标变换。在实际操作中,通过旋转角度和位移指导机械手动作。此外,还提供了纯C#方法来计算旋转中心以及点绕旋转中心旋转后的新坐标。
Python3.8

Python3.8

Conda
Python

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

机械手定位(带角度)的思路及3点计算旋转中心

1、旋转中心为:RectCenter_Row, RectCenter_Column

2、基准模板图像中Mark的中心点: ModelRow, ModelCol

3、拍摄得到的Mark新的中心点:Row,Column 角度:Angle
hom_mat2d_identity(HomMat2DIdentity3)
hom_mat2d_rotate(HomMat2DIdentity3,Angle,RectCenter_Row, RectCenter_Column,HomMat2DRotate3)
因为绕着实际的中心轴做了旋转,mark点的位置发生了变化,可以通过旋转变换得到新的位置
affine_trans_point_2d(HomMat2DRotate3,ModelRow, ModelCol, Qx, Qy)
实际操作中,告诉手臂旋转角度Angle,以及位移(Row - Qx, Column - Qy)

3点计算旋转中心、旋转中心的应用纯C#方法

1、已知圆上三点坐标为(X1,Y1),(X2,Y2),(X3,Y3),求圆心坐标x,y

public void GetCenterPos(double x1, double y1, double x2, double y2, double x3, double y3, ref double X, ref double Y, ref double R) 
{
	double a = 0;
	double b = 0;
	double c = 0;
	double g = 0;
	double e = 0;
	double f = 0;
	e = 2 * (x2 - x1);
	f = 2 * (y2 - y1);
	g = x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1;
	a = 2 * (x3 - x2);
	b = 2 * (y3 - y2);
	c = x3 * x3 - x2 * x2 + y3 * y3 - y2 * y2;
	X = (g * b - c * f) / (e * b - a * f);
	Y = (a * g - c * e) / (a * f - b * e);
	R = Sqrt((X - x1) * (X - x1) + (Y - y1) * (Y - y1));
}

2、已知某点坐标和旋转中心,求该点绕旋转中心运动某一角度后的新坐标

public string GetRoratedCoordinator(double XRotation, double YRotation, double ARotate, double XBefore, double YBefore, ref double XAfter, ref double YAfter)
{
	try {
		double Rad = 0;
		Rad = ARotate * Acos(-1) / 180;
		 
		XAfter = (XBefore - XRotation) * Cos(Rad) - (YBefore - YRotation) * Sin(Rad) + XRotation;
		YAfter = (YBefore - YRotation) * Cos(Rad) + (XBefore - XRotation) * Sin(Rad) + YRotation;
		 
		return "OK";
	} catch (Exception ex) {
		return ex.Message;
	}
}
 

您可能感兴趣的与本文相关的镜像

Python3.8

Python3.8

Conda
Python

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值