View Single Post
  #2  
Old 04-23-2012, 05:25 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
It sounds like you will need to create a class that extends the "VizExtensionSensor" interface. Sensors are objects that provide position, orientation, button, and analog data. Your sensor class would just override the "getPosition" and "getOrientation" methods. You would then override the "createSensor" method of your VizExtension class to provide access to your sensor class.

Once this is implemented, the Python code for retrieving the position of the haptic device would look something like this:
Code:
# Load HapticMaster extension
HapticMaster = viz.add('HapticMaster.dle')

# Create end effector sensor
endEffector = HapticMaster.addSensor()

# Get end effector position
pos = endEffector.getPosition()

# (Optional) Link a model to the end effector sensor
import vizshape
sphere = vizshape.addSphere(0.1)
viz.link(endEffector,sphere)
Let me know if anything is unclear.
Reply With Quote