Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
H3D.org Feeds
H3D.org Forum Index
   Programming Issues
     Problem with cylinder
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
Anisha
Posted on: 2009/6/10 22:43
Just popping in
Joined: 2009/6/10
From:
Posts: 5
Problem with cylinder
Hi. I am new to using H3D, so thanks in advance for being patient with me. I was attempting to use H3D interfaced with a Falcon device to interact with a scene I created using Python. I created a hollow cylinder and was attempting to move my stylus inside the cylinder, but H3D has inserted haptic triangles into the cylinder so that my stylus's range of motion inside the cylinder is limited to compartments of the cylinder sectioned off by the triangles. I have figured out how to make the triangles visible by selecting the "draw haptic triangles" box under the "Debug" tab under Settings, but I do not know how to make the triangles disappear. How do I eliminate these triangles so that I can move my stylus freely inside the hollow cylinder. Thanks in advance for any replies.
Markus
Posted on: 2009/6/15 8:36
Webmaster
Joined: 2006/3/27
From: SenseGraphics
Posts: 1900
Re: Problem with cylinder
If I understand correctly there are triangles inside the cylinder in places where there should be none, i.e. where the graphics does not display any triangles.

If that is the case then I wonder, what is your graphics card? Is it an ATI card?

I tested a simple cylinder withouth bottom cap and which was not solid on my system and had no problems.
If I did not understand your example entirely correct please provide a small x3d file which gives you the problem so I can test it.
Anisha
Posted on: 2009/6/15 17:16
Just popping in
Joined: 2009/6/10
From:
Posts: 5
Re: Problem with cylinder
Thanks for your reply. Yes, I believe you have assessed my situation correctly; there are triangles inside the cylinder where they should not be. Normally, these triangles are invisible, but I have figured out how to make them show up, as I stated in my last post. As you suspected, my computer does have an ATI card. Is this causing the problem? If not, then is there something wrong with my code? I have included the code I have been using below:

<Scene>
<Group>
<Transform rotation="1 0 0 1.57" translation = "0 0 -.07">
<Shape>
<Appearance>
<Material diffuseColor = "1 .4 .3"/><SmoothSurface/>
</Appearance><Cylinder DEF="cylinder2" radius="0.08" height=".3" top="false" solid = "false"/>
</Shape>
</Transform>
</Group>
</Scene>

Thanks again for your help.
Markus
Posted on: 2009/6/22 8:42
Webmaster
Joined: 2006/3/27
From: SenseGraphics
Posts: 1900
Re: Problem with cylinder
Yes, it can be the ATI card and bad drivers for OpenGL that is causing the problem. H3DAPI uses the a feature of OpenGL which lets it collect triangles rendered on screen, for ATI card this sometimes gives problems because the ATI card creates triangles which are not there.

You could try to upgrade to the latest trunk version of H3DUtil/HAPI/H3DAPI to see if the problem goes away if you know how to check out trunk or is willing to follow wiki guide. I doubt that this would fix the problem though.

Nothing is wrong with your code, it works fine on my system, with an NVIDIA card :).
agreen24
Posted on: 2009/8/3 19:41
Quite a regular
Joined: 2008/12/18
From:
Posts: 21
Re: Problem with cylinder
Hi,

I decided to add my problem here because I see that you were discussing graphics cards. I've been using code that works completely fine on one computer that has an nVidia card, but when I transferred it to a computer with an ATI card, it throws up an error saying "global name hdev is not defined," and when it hits the 'wall' (like it's supposed to, the Falcon starts bouncing around violently - I'll put up some of the code here (the relevant part anyway):

python file (please ignore non-indentations, that happened when I pasted):
Quote:

def writeLogData( self ):
try:
f = open( self.log_file, "a" )
pos = self.tracker_position.getValue()
orn = self.tracker_orientation.getValue()
force = hdev.force.getValue()


now= datetime.datetime.now()
f.write( "%s\t%s:%s:%s-%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" % (self.next_target_index,
now.hour, now.minute, now.second, now.microsecond, time.getValue()-self.experiment_start_time, pos.x, pos.y, pos.z, orn.x, orn.y, orn.z, orn.angle, force.x, force.y, force.z) )
f.close()
except:
print "Unable to write log data to file: ", self.log_file


# The main function of the experiment. Called once per scene-graph loop.
def experimentMain( self ):
Experiment.Experiment.experimentMain( self )
current_time = time.getValue()

last_mode = self.mode

current_speed = self.tracker_velocity.getValue().length()

if( self.mode == "WAIT_TO_SHOW" ):
if( (current_time - self.target_change_time) > self.current_target.getTargetPauseTime() ):
self.current_target.showTarget()
self.target_show_time = current_time
self.max_speed = 0
self.mode = "OUTSIDE_TARGET"
self.onTargetMoveOutside()
elif( self.mode == "OUTSIDE_TARGET" ):
if( self.current_target.isInsideTarget( self.tracker_position.getValue() )):
self.mode = "INSIDE_TARGET"
self.onTargetMoveInside()
self.moveToNextTarget()
moveCursor(self.current_target.getCursorPosition().x)

if( self.mode != last_mode ):
print "Switching mode: ", self.mode

return "CONTINUE"

def moveCursor(tx):
pos = hdev.trackerPosition.getValue()
x = pos.x

fx = calculateForce(tx-x)

global forcefield

if(fx!=0):
forcefield.force.setValue( Vec3f(fx,0,-10) )
Timer(.1, moveCursor, [tx]).start()
else:
forcefield.force.setValue( Vec3f(0,0,-10) )

def applyPulse():
try:
setSerialPort(1)
Timer(.05, setSerialPort, [0]).start()
except:
print "Unable to apply pulse"

class FoodButton(AutoUpdate( SFString ) ):
def update(self, even ):
routes_in = self.getRoutesIn()
temp = routes_in[0].getValue()
return temp

foodButton = FoodButton()

class ActionButton( AutoUpdate( SFInt32 ) ):
def update( self, event ):
routes_in = self.getRoutesIn()
temp = routes_in[0].getValue()
when = datetime.datetime.now()
if temp==1:
#applyPulse()
print 'gotcha'
print when
return temp

actionbutton = ActionButton()

def setSerialPort(value):
global serialPort
serialPort.setRTS(value)

# Get the group to use from the x3d file.
main_group,forcefield = references.getValue()

# Get the haptics device currently in use.
hdev = None
di = getActiveDeviceInfo()
if( di and len( di.device.getValue() ) ):
hdev = di.device.getValue()[0]
hdev.stylus.setValue( createX3DNodeFromURL( "ast_pointer.wrl" )[0] )

if( not(hdev ) ):
print "Could not find any haptics device."
sys.exit( 0 )


Please help!

Thanks in Advance!

AG
agreen24
Posted on: 2009/8/4 17:46
Quite a regular
Joined: 2008/12/18
From:
Posts: 21
Re: Problem with cylinder
I've already un/reinstalled H3D, and the Falcon drivers, but no good. Any advice?
Markus
Posted on: 2009/8/7 8:50
Webmaster
Joined: 2006/3/27
From: SenseGraphics
Posts: 1900
Re: Problem with cylinder
Seems strange that you would get an error about HDEV for computers with different graphics cards. I guess there are more differences. Is the H3DAPI version the same on both?

Is the wall a geometry? In that case, is it an IndexedTriangleSet or some pre-defined geometry? Are there many triangles?

For very few triangles I have not noticed a difference between ATI and NVIDIA. At least not with IndexedTriangleSet.
Markus
Posted on: 2009/8/7 8:50
Webmaster
Joined: 2006/3/27
From: SenseGraphics
Posts: 1900
Re: Problem with cylinder
Seems strange that you would get an error about HDEV for computers with different graphics cards. I guess there are more differences. Is the H3DAPI version the same on both?

Is the wall a geometry? In that case, is it an IndexedTriangleSet or some pre-defined geometry? Are there many triangles?

For very few triangles I have not noticed a difference between ATI and NVIDIA. At least not with IndexedTriangleSet. I have only noticed it with Cylinder.
agreen24
Posted on: 2009/8/8 4:07
Quite a regular
Joined: 2008/12/18
From:
Posts: 21
Re: Problem with cylinder
It isn't the different graphics card (because I replaced it with an nVidia), but it is something about the single computer. I tried running the program on a third computer, and I didn't get that error, though it did bounce around a little upon hitting the wall. I just don't know where the cause of the problem is, so I don't know what to do from here. Any ideas?...please...

AG
Markus
Posted on: 2009/8/12 9:20
Webmaster
Joined: 2006/3/27
From: SenseGraphics
Posts: 1900
Re: Problem with cylinder
Do you get any other error message? Like if it tries to initialize some other device first and fails.

Did you select the falcon device through the H3DLoadSettings program or is the DeviceInfo part of the x3d-file (I am guessing the first one).

Are you using the AnyDevice in the H3DLoadSettings?

Regarding the bouncing:
Which renderer are you using, it is the same bouncing for both GodObjectRender, RuspiniRenderer and Chai3DRenderer?
(1) 2 »
Threaded | Newest First Previous Topic | Next Topic | Top

Register To Post
 



(C) 2012 SenseGraphics AB    ---    Powered by XOOPS