Python example: se2-poses-example.py
Example usage of SE(2) poses, for transformations in the plane (x,y,phi):
1#!/usr/bin/env python3
2
3# ---------------------------------------------------------------------
4# Install python3-pymrpt, ros-$ROS_DISTRO-mrpt2, or test with a local build with:
5# export PYTHONPATH=$HOME/code/mrpt/build-Release/:$PYTHONPATH
6# ---------------------------------------------------------------------
7
8from math import radians
9from mrpt import pymrpt
10mrpt = pymrpt.mrpt
11
12p1 = mrpt.poses.CPose2D(1.0, 2.0, radians(90.0))
13p2 = mrpt.poses.CPose2D(3.0, 0.0, radians(0.0))
14
15p3 = p1 + p2
16p4 = p3 - p1
17
18print('p1 : ' + str(p1))
19print('p2 : ' + str(p2))
20print('p1(+)p2 : ' + str(p3))
21print('(p1(+)p2)(-)p1 : ' + str(p4))