[AUTONAVx][lec3]3D Geometry and Sensors
2015-06-02 00:03
295 查看
3D Geometry
Rotation matrices and quaternions can simply be concatenated by multiplication.
Euler angles use three variables to describe three degrees of freedom and thus are minimal.
Angle-Axis can be minimal if the rotation about the angle is encoded in the length of the axis vector.
Rotation matrices can simply be transposed to invert them.Angle Axis can be inverted by negating angle or axis.
Quaternions can be inverted by flipping the sign of v or w.
Only rotation matrices are unique. The other representations allow to express the same rotation in multiple ways.
implement the position inverse and multiply operations.
import numpy as np class Pose3D: def __init__(self, rotation, translation): self.rotation = rotation self.translation = translation def inv(self): ''' Inversion of this Pose3D object :return inverse of self ''' # TODO: implement inversion inv_rotation = self.rotation.T inv_translation = -np.dot(inv_rotation, self.translation) return Pose3D(inv_rotation, inv_translation) def __mul__(self, other): ''' Multiplication of two Pose3D objects, e.g.: a = Pose3D(...) # = self b = Pose3D(...) # = other c = a * b # = return value :param other: Pose3D right hand side :return product of self and other ''' return Pose3D(np.dot(self.rotation, other.rotation), np.dot(self.rotation, other.translation) + self.translation) def __str__(self): return "rotation:\n" + str(self.rotation) + "\ntranslation:\n" + str(self.translation.transpose()) def compute_quadrotor_pose(global_marker_pose, observed_marker_pose): ''' :param global_marker_pose: Pose3D :param observed_marker_pose: Pose3D :return global quadrotor pose computed from global_marker_pose and observed_marker_pose ''' # TODO: implement global quadrotor pose computation global_quadrotor_pose = global_marker_pose * observed_marker_pose.inv() return global_quadrotor_pose
相关文章推荐
- jsp中include使用html静态文件出现乱码问题
- 我的代数充能01
- MidnightBSD 发布 1.0!
- Linux Shell脚本系列教程(一):Shell入门
- Linux Shell脚本系列教程(二):终端打印命令详解
- Linux Shell脚本系列教程(三):变量和环境变量
- Linux Shell脚本系列教程(四):使用函数添加环境变量
- Linux Shell脚本系列教程(五):数学运算
- Linux Shell脚本系列教程(六):数组和关联数组
- Linux Shell脚本系列教程(七):脚本调试
- 8个实用的Shell脚本分享
- Python中for循环控制语句用法实例
- python实现的文件同步服务器实例
- Python中字典创建、遍历、添加等实用操作技巧合集
- Python中pip安装非PyPI官网第三方库的方法
- Python中的自省(反射)详解
- python基于xmlrpc实现二进制文件传输的方法
- python使用xmlrpclib模块实现对百度google的ping功能
- 使用pdb模块调试Python程序实例
- Python多进程并发(multiprocessing)用法实例详解