WorldViz User Forum  

Go Back   WorldViz User Forum > Plug-in development

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
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
  #2  
Old 04-24-2012, 05:13 AM
pwsnow pwsnow is offline
Member
 
Join Date: Apr 2012
Posts: 23
Many thanks for the reply, your post does clear up alot!

I do have further questions though.

I've followed that guide I posted in my first post and set up the SDK in my copy of VS2008 (thankfully I had a copy!). I've added the code to create a dle file to test if the sample code works (which it does) although I get a pop up asking me about a Executable for the debug session. My question here is how would I add the .h files for the HapticMaster? Would this be via the "Project -> Properties" way or hard coded into "MyExtension.cpp"? I'm guessing so long as the cpp file finds the HapticMaster commands it doesn't matter.

I take it that overwriting getPosition, getOrientation etc would be coded in MyExtension.cpp? The getPosition part will be easy I would use the code I used in my Ogre app, however I have a ADL Gimball attached to the HapticMaster which allows the arm to be controlled www.youtube.com/watch?v=RvXGnFky3c which uses 3 pot sensors to gather additional values. I take it that the code from the HapticMaster API to get these 3 values should be stored into getOrientation?

Connection to the HapticMaster needed to obtain these values via a network connection. I take it just like my Ogre app I define this connection along with any other variables at the top of MyExtension.cpp just like any program?

I'll have a go now and try to get it working, thanks to your post it seems alot clearer. It also means that now I know I can get the HapticMaster to work with Vizard4.0 we can put an order in.

Many thanks, and I'm sure I will be back with any questions etc
Reply With Quote
  #3  
Old 04-24-2012, 05:21 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Quote:
My question here is how would I add the .h files for the HapticMaster? Would this be via the "Project -> Properties" way or hard coded into "MyExtension.cpp"? I'm guessing so long as the cpp file finds the HapticMaster commands it doesn't matter.
The easiest way would be to simply place the .h file in the same directory as the Visual Studio project for your extension.

Quote:
I take it that overwriting getPosition, getOrientation etc would be coded in MyExtension.cpp? The getPosition part will be easy I would use the code I used in my Ogre app, however I have a ADL Gimball attached to the HapticMaster which allows the arm to be controlled www.youtube.com/watch?v=RvXGnFky3c which uses 3 pot sensors to gather additional values. I take it that the code from the HapticMaster API to get these 3 values should be stored into getOrientation?
No, getPosition/getOrientation are methods of the VizExtensionSensor class, so you would override them in the MySensor class. The orientation data should be specified as a quaternion, so you will need to perform an appropriate conversion from the values provided by the HapticMaster.

Quote:
Connection to the HapticMaster needed to obtain these values via a network connection. I take it just like my Ogre app I define this connection along with any other variables at the top of MyExtension.cpp just like any program?
I'm not familiar with the HapticMaster API, but if they have a function for connecting and disconnecting, then the most appropriate place for calling these functions would probably be within the constructor/destructor of the MyExtension class.

Is the HapticMaster API publicly available?
Reply With Quote
Reply


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
Realistic Light and Shadows Using Vizard and 3DS Max jde Vizard 4 07-13-2012 10:58 AM
Vizard 4 Beta Testing farshizzo Announcements 0 02-01-2011 10:46 AM
Vizard 4 Beta Testing farshizzo Vizard 0 02-01-2011 10:46 AM
.3DS importing in Vizard and 3D Studio jde Vizard 1 08-28-2009 03:14 PM
Vizard tech tip: Using the Python Imaging Library (PIL) Jeff Vizard 0 03-23-2009 11:13 AM


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


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