def on_init(self, controller): LOG.v("Initialized", "on_init") self.t = 0 # time var for automated testing # Initialize empty frame self.frame = None # Initialize fingers and hands self.hand = Leap.Hand() self.fingers = { FINGER_NAMES[i] : Leap.Finger() for i in range(5)} # Initialize joint names for JointState messages self.joint_names = [] # Initialize node rospy.init_node('hand_tracker', anonymous=True) # Initialize publishers self.js_pub = rospy.Publisher(JS_TOPIC, JointState, queue_size=10) self.ps_pub = rospy.Publisher(PS_TOPIC, PoseStamped, queue_size=10) self.ts_pub = rospy.Publisher(TS_TOPIC, TwistStamped, queue_size=10)
def main(argv): hand = Leap.Hand() a = translate_to_origin(hand)
__author__ = 'flier' import argparse import Leap import rospy import leap_interface from leap_motion.msg import leap from leap_motion.msg import leapros from sensor_msgs.msg import JointState FREQUENCY_ROSTOPIC_DEFAULT = 0.01 NODENAME = 'leap_pub' PARAMNAME_FREQ = 'freq' PARAMNAME_FREQ_ENTIRE = '/' + NODENAME + '/' + PARAMNAME_FREQ #controller = Leap.Controller() hand = Leap.Hand() def sender(): ''' This method publishes the data defined in leapros.msg to /leapmotion/data ''' rospy.loginfo("Parameter set on server: PARAMNAME_FREQ={}".format( rospy.get_param(PARAMNAME_FREQ_ENTIRE, FREQUENCY_ROSTOPIC_DEFAULT))) li = leap_interface.Runner() li.setDaemon(True) li.start() # pub = rospy.Publisher('leapmotion/raw',leap) #pub_ros = rospy.Publisher('leapmotion/data',leapros, queue_size=2) pub_ros = rospy.Publisher('CPRMoverJointVel', JointState, queue_size=10)