def start(self):
     self.vr_process.start()
     self.reset_lighthouse_db()
     rate = rospy.Rate(10)  # 10hz
     steamvr_launch_ok = False
     while not steamvr_launch_ok:
         try:
             self.poser = pose_openvr_wrapper.OpenvrWrapper(
                 '../cfg/config.json')
             steamvr_launch_ok = True
         except rospy.ROSInterruptException:
             #print('steamVR_not_running')
             pass
         rate.sleep()
     self.up_and_running = True
     rospy.loginfo('poser up and running')
Ejemplo n.º 2
0
 def start(self, frequency=100):
     #self.tmr = self.create_timer(1.0/frequency, self.timer_callback)
     self.reset_lighthouse_db()
     #rate = self.create_rate(10)  # 10hz
     steamvr_launch_ok = False
     while not steamvr_launch_ok:
         print('noooooooooo')
         try:
             self.poser = pose_openvr_wrapper.OpenvrWrapper(
                 './config.json')
             steamvr_launch_ok = True
         except RuntimeError:
             #print('steamVR_not_running')
             pass
     #time.sleep(0.5) #rate.sleep()
     self.up_and_running = True
     self.get_logger().info('poser up and running')
Ejemplo n.º 3
0
#!/usr/bin/env python
import rospy

import tf
import pose_openvr_wrapper
from pose_transform import Transform
import pprint as pp

if __name__ == '__main__':
    try:
        rospy.init_node('publisher_tf_node')
        pyopenvr_wrapper = pose_openvr_wrapper.OpenvrWrapper(
            '../cfg/config.json')
        pp.pprint(pyopenvr_wrapper.devices)
        broadcaster = tf.TransformBroadcaster()
        rate = rospy.Rate(250)
        while not rospy.is_shutdown():
            matrices = pyopenvr_wrapper.get_all_transformation_matrices(
                samples_count=1)
            for device, matrix in matrices.items():
                transform = Transform(
                    pyopenvr_wrapper.get_all_transformation_matrices(
                        samples_count=1))
                quaternion = transform.quaternion()
                position = transform.position()
                broadcaster.sendTransform(
                    position,
                    (quaternion.x, quaternion.y, quaternion.z, quaternion.w),
                    rospy.Time.now(), device, "local")

            rate.sleep()