如何求解空间中openmv的位置?
-
通过Apriltags可以进行测距,如何使用AprilTags提供的坐标转换为空间中openmv的位置。例如我将AprilTag摆放在
{'x':500,'y':500,'z':0}
的位置得到tx,ty,tz,rx,ry,rz的值,并通过移动距离/tx(ty)
的方式得出的xk、ykcosPitch = math.cos(Ry) cosYaw = math.cos(Rz) cosRoll = math.cos(Rx) sinPitch = math.sin(Ry) sinYaw = math.sin(Rz) sinRoll = math.sin(Rx) if tag.id() in range(len(tags)): # tags是存放规定tag坐标的列表 X = cosPitch * cosYaw * Tx * xk + cosPitch * sinYaw * Ty * yk - sinPitch * Tz * zk Y = (-cosRoll * sinYaw + sinRoll * sinPitch * cosYaw) * Tx * xk + (cosRoll * cosYaw + sinRoll * sinPitch * sinYaw) * Ty * yk + sinRoll * cosPitch * Tz * zk Z = (sinRoll * sinYaw + cosRoll * sinPitch * cosYaw) * Tx * xk + (-sinRoll * cosYaw + cosRoll * sinPitch * sinYaw) * Ty * yk + cosRoll * cosPitch * Tz * zk changed = (X, Y, Z) currentX = str(round((tags[currentID].get('x') - X) / 10, 2)) + 'cm' currentY = str(round((tags[currentID].get('y') - Y) / 10, 2)) + 'cm' currentZ = str(round((tags[currentID].get('z') - Z) / 10, 2)) + 'cm'``
是否能通过这种方式正确的得出openmv自身的位置?另外xk、yk的值是否和求z方向的k值的方式一致?