SFMdata.py
Go to the documentation of this file.
1 """
2 A structure-from-motion example with landmarks
3  - The landmarks form a 10 meter cube
4  - The robot rotates around the landmarks, always facing towards the cube
5 """
6 # pylint: disable=invalid-name, E1101
7 
8 import numpy as np
9 
10 import gtsam
11 
12 
14  # Create the set of ground-truth landmarks
15  points = [gtsam.Point3(10.0, 10.0, 10.0),
16  gtsam.Point3(-10.0, 10.0, 10.0),
17  gtsam.Point3(-10.0, -10.0, 10.0),
18  gtsam.Point3(10.0, -10.0, 10.0),
19  gtsam.Point3(10.0, 10.0, -10.0),
20  gtsam.Point3(-10.0, 10.0, -10.0),
21  gtsam.Point3(-10.0, -10.0, -10.0),
22  gtsam.Point3(10.0, -10.0, -10.0)]
23  return points
24 
25 
26 def createPoses(K):
27  # Create the set of ground-truth poses
28  radius = 40.0
29  height = 10.0
30  angles = np.linspace(0, 2*np.pi, 8, endpoint=False)
31  up = gtsam.Point3(0, 0, 1)
32  target = gtsam.Point3(0, 0, 0)
33  poses = []
34  for theta in angles:
35  position = gtsam.Point3(radius*np.cos(theta),
36  radius*np.sin(theta),
37  height)
38  camera = gtsam.PinholeCameraCal3_S2.Lookat(position, target, up, K)
39  poses.append(camera.pose())
40  return poses
Vector3 Point3
Definition: Point3.h:35


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:44:01