Python example: se2-poses-example.py

SE(2) pose composition and inverse composition with mrpt.poses.CPose2D.

Modules: mrpt.poses

 1#!/usr/bin/env python3
 2"""
 3SE(2) pose composition and inverse composition with mrpt.poses.CPose2D.
 4"""
 5
 6from math import radians
 7from mrpt.poses import CPose2D
 8
 9p1 = CPose2D(1.0, 2.0, radians(90.0))
10p2 = CPose2D(3.0, 0.0, radians(0.0))
11
12p3 = p1 + p2
13p4 = p3 - p1
14
15print('p1             : ' + str(p1))
16print('p2             : ' + str(p2))
17print('p1(+)p2        : ' + str(p3))
18print('(p1(+)p2)(-)p1 : ' + str(p4))

Output:

p1             : [1.000000 2.000000 90.000000deg]
p2             : [3.000000 0.000000 0.000000deg]
p1(+)p2        : [1.000000 5.000000 90.000000deg]
(p1(+)p2)(-)p1 : [3.000000 -0.000000 0.000000deg]