WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-17-2008, 12:29 PM
jalvarez jalvarez is offline
Member
 
Join Date: Jun 2008
Posts: 12
Torsional Spring

I want to use a haptic device to control a rigid object through a linear spring and a torsion spring. The position works correctly. However the orientation does not work even the orientation data printed out is correct.

Any suggestions? Here is the code:

Code:
import viz
import hd

viz.go()
viz.phys.enable()
viz.phys.setGravity(0,0,0)
viz.phys.setAccuracy(4)
viz.phys.setStepSize(.001)
viz.clearcolor(1,1,1)

cyl = viz.add('cylinder.wrl',pos=[0,2,5])
cyl.collideBox()

marker = viz.add('marker.wrl',pos=[0,2,5])
marker.scale(0.1,0.1,0.1)
hd.marker(marker)
hd.translate(0,2,5)

spring =
cyl.addSpring(viz.LINK_POS|viz.LINK_ORI,linearKd=10,linearKs=1000,angularKd=
10,angularKs=1000)
#spring = cyl.addSpring(viz.LINK_ORI,angularKd=10,angularKs=1000)

spring.setPosition(marker.getPosition())
spring.setQuat(marker.getQuat())


def mytimer(num):
    spring.setPosition(marker.getPosition())
    #print marker.getQuat()
    spring.setQuat(marker.getQuat())


viz.callback(viz.TIMER_EVENT, mytimer)
viz.starttimer( 0, 0, viz.FOREVER )
Reply With Quote
 


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
Physics and Haptics jalvarez Vizard 3 07-16-2008 03:03 PM


All times are GMT -7. The time now is 03:34 PM.


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