8 imp.find_module(
"view_controller_msgs")
10 import roslib; roslib.load_manifest(
'jsk_teleop_joy')
12 from view_controller_msgs.msg
import CameraPlacement
20 self.
focus = numpy.array((0, 0, 0))
21 self.
z_up = numpy.array((0, 0, 1))
26 ceye = numpy.array((camera_placement.eye.point.x,
27 camera_placement.eye.point.y,
28 camera_placement.eye.point.z))
29 cfocus = numpy.array((camera_placement.focus.point.x,
30 camera_placement.focus.point.y,
31 camera_placement.focus.point.z))
32 instance.focus = cfocus
33 viewdir = ceye - cfocus
34 instance.distance = numpy.linalg.norm(viewdir)
36 instance.z_up[0] = camera_placement.up.vector.x
37 instance.z_up[1] = camera_placement.up.vector.y
38 instance.z_up[2] = camera_placement.up.vector.z
40 instance.pitch = math.asin(viewdir[2]/instance.distance)
41 instance.yaw = math.atan2(viewdir[1], viewdir[0])
53 f = f / tf.transformations.vector_norm(f)
54 u = numpy.array((0, 0, 1))
56 r = r / tf.transformations.vector_norm(r)
57 uy = numpy.cross(f, r)
58 uy = uy / tf.transformations.vector_norm(uy)
59 m = tf.transformations.identity_matrix()[:3, :3]
75 placement = CameraPlacement()
76 placement.interpolation_mode = CameraPlacement.LINEAR
78 placement.time_from_start = rospy.Duration(TIME)
80 placement.eye.header.stamp = rospy.Time.now()
81 placement.eye.point.x = view_point[0]
82 placement.eye.point.y = view_point[1]
83 placement.eye.point.z = view_point[2]
84 placement.focus.header.stamp = rospy.Time.now()
85 placement.focus.point.x = self.
focus[0]
86 placement.focus.point.y = self.
focus[1]
87 placement.focus.point.z = self.
focus[2]
88 placement.up.header.stamp = rospy.Time.now()
89 placement.up.vector.x = self.
z_up[0]
90 placement.up.vector.y = self.
z_up[1]
91 placement.up.vector.z = self.
z_up[2]
92 placement.mouse_interaction_mode = CameraPlacement.ORBIT