forked from robotika/eduro
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpose.py
More file actions
26 lines (20 loc) · 682 Bytes
/
pose.py
File metadata and controls
26 lines (20 loc) · 682 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python
"""
Simple pose operations
"""
import math
def normalizeAnglePIPI( angle ):
while angle < -math.pi:
angle += 2*math.pi
while angle > math.pi:
angle -= 2*math.pi
return angle
def combinedPose( robotPose, sensorPose ):
return (
robotPose[0] + sensorPose[0] * math.cos( robotPose[2] ) - sensorPose[1] * math.sin( robotPose[2] ),
robotPose[1] + sensorPose[0] * math.sin( robotPose[2] ) + sensorPose[1] * math.cos( robotPose[2] ),
normalizeAnglePIPI( robotPose[2] + sensorPose[2] ) )
def inversePose( pose ):
"return inverse pose to (0,0,0)"
x,y,a = pose
return -x*math.cos(a)-y*math.sin(a), x*math.sin(a)-y*math.cos(a), -a