WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-11-2010, 06:38 PM
hahaho hahaho is offline
Member
 
Join Date: Mar 2010
Posts: 6
using sensor.

Hi worldviz
i want to use sensor of three.
so, i make a code following.

vrpn = viz.add('vrpn7.dle')
tracker1 = vrpn.addTracker('PPT0@166.104.29.228',0)
tracker2 = vrpn.addTracker('PPT0@166.104.29.228',1)
tracker3 = vrpn.addTracker('PPT0@166.104.29.228',2)

def update():
position1 = tracker1.getPosition()
position2 = tracker2.getPosition()
position3 = tracker3.getPosition()

a = position1[0]
a1 = position1[1]
a2 = position1[2]
#print a1
b = position2[0]
b1 = position2[1]
b2 = position2[2]
print b1
c = position3[0]
c1 = position3[1]
c2 = position3[2]
#print c1
vizact.ontimer(0,update)

but !! the location of sensor is frequently change.
How can i ??
Reply With Quote
  #2  
Old 03-12-2010, 11:03 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,458
Sorry, I don't understand the question.

Please use code tags when posting code to preserve indentation
Reply With Quote
  #3  
Old 03-12-2010, 09:23 PM
hahaho hahaho is offline
Member
 
Join Date: Mar 2010
Posts: 6
Arrow

ok.
I want to use the sensor of the three.
these sensors want to fixed number[A,B,C], (no value[x,y,z])

for example)

sensorA(fixed number) = (10,10,10) <-x,y,z (receive(change) value)
sensorB(fixed number) = (20,20,20) <-x,y,z (receive(change) value)
sensorC(fixed number) = (30,30,30) <-x,y,z (receive(change) value)


so, i am used this code.


Code:
vrpn = viz.add('vrpn7.dle')
sensorA = vrpn.addTracker('PPT0@166.104.29.228',0)
sensorB = vrpn.addTracker('PPT0@166.104.29.228',1)
sensorC = vrpn.addTracker('PPT0@166.104.29.228',2)

def update(): 
      position1 = sensorA.getPosition()
      position2 = sensorB.getPosition()
      position3 = sensorC.getPosition()
     
      a =  position1[0]
      a1 = position1[1]
      a2 = position1[2]
     
      b = position2[0]
      b1 = position2[1]
      b2 = position2[2]  

      c = position3[0] 
      c1 = position3[1]
      c2 = position3[2]
      
      A = [a,0,a2]
      B = [b,0,b2]
      C = [c,0,c2]
      
      # vector
      v1 = vizmat.VectorToPoint(A,B)
      v2 = vizmat.VectorToPoint(A,C)
      v = vizmat.AngleBetweenVector(v1,v2)
      Forearm.setEuler([0,0,-v])
      UpperArm.setEuler([0, -30, -80]) 

      print v
 
vizact.ontimer(0,update)
but , the sensor's number is frequently change.

for example)

sensorB = (10,10,10)
sensorA = (20,20,20)
sensorC = (30,30,30)
.
.
.
sensorC = (10,10,10)
sensorA = (20,20,20)
sensorB = (30,30,30)
.
.

How do i receive the fixed sensor's number?
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a Vizard Sensor Plugin farshizzo Plug-in development 25 08-01-2019 01:24 AM
Sensor gets confused durf Precision Position Tracker (PPT) 1 04-23-2009 01:41 PM
wiimote and sensor bar masaki Vizard 1 03-06-2008 04:07 PM
Multiple Copies of same sensor plugin RedSpikeyThing Plug-in development 2 02-12-2008 03:10 PM
using sensor data in Physics1.py Eunice Vizard 4 01-03-2006 06:18 AM


All times are GMT -7. The time now is 07:30 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC