Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
H3D.org Feeds


Browsing this Thread:   1 Anonymous Users






Adding a custom force node to H3D
#1
Not too shy to talk
Not too shy to talk


See User information
Hello,

I'm trying to add a new node to H3D. I had issues getting H3D and Visual Studio 2017 to recognize and begin compiling the files, but was able to resolve them with much appreciated help from Markus on this forum.

Now that Visual Studio is compiling my code, I managed to fix some bugs and get HAPI to compile successfully. H3DAPI is, however, another story. I keep getting errors with the constructor in both the cpp file and the header file. At Markus' request, I'm attaching the four files (HAPI and H3DAPI, header and cpp files) here.

What I ultimately need is a custom force that behaves as a sigmoid, providing negative viscosity (F proportional to -v) up to a force cap, and transitioning smoothly to the cap. HAPI is okay with the force calculations (at least at the compiling stage), so I don't think the problem is the forces.

Thank you,
-Yaz

Attach file:


Link only for registered users

Posted on: 2/26 8:07
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: Adding a custom force node to H3D
#2
Webmaster
Webmaster


See User information
Hello.

There were mostly some issues with incorrect include file names (you probably used some old name for the included file and not the actual file name ). Then it seems like there were some variables that were named differently between different files. The constructor in the NegVisSigmoid header and source files did not match up and finally damping was declared as a float in the node but a vec3 in the force effect file.
Please use some tool like tortoisesvn diff or similar so you can see the difference between the files I now upload and your original.

Attach file:


Link only for registered users

Posted on: 3/7 10:02
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: Adding a custom force node to H3D
#3
Not too shy to talk
Not too shy to talk


See User information
Thank you very much Markus!

It compiled perfectly. Sorry it took me some time but I finally looked through the differences in the code. Besides the variable naming issues (which it seems were confusing the field names and even the H3D database), it seems the significant change was to the damping input.

I only know basics in C++ and had no idea about the Vec3(1,1,1)*damping->getValue() trick. It makes perfect sense now, but my previous understanding was that it gets the value even if it was Vec3 and I didn't need to tell it explicitly in the get command.

Next step is incorporating it into my protocol, hopefully the robot doesn't end up punching me!

Thanks again,
-Yaz

Posted on: 3/15 22:12
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: Adding a custom force node to H3D
#4
Webmaster
Webmaster


See User information
Hello,
Just to correct a potential confusion.
The Vec3(1,1,1)*damping->getValue() is there simply because the underlying HAPI force effect expects a HAPI::Vec3 while the damping field in the Node is declared as a float.
For that reason I simply made a quick solution.
Note that this solution is most likely not what you want simply because Vec3(1,1,1) is not a normalized vector.
I would recommend changing this to something that makes more sense in your case.

Posted on: 3/16 10:14
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: Adding a custom force node to H3D
#5
Not too shy to talk
Not too shy to talk


See User information
Thanks for the clarification, it does make sense.

So here's what I changed: Since the ForceNV files in HAPI calculate damping as a 3D vector, I changed damping from SFFloat to SFVec3f in H3DAPI, and changed the initFields entry from
setValue(0)
to
setValue(Vec3f(0,0,0))
then changed the
Vec3(1,1,1)*damping
back to simply
damping


I recompiled and it compiles correctly. I think this avoids having to tweak the values in Vec3(1,1,1) to suit a specific condition by getting the damping value as a Vec3 directly.

Is my logic correct here? Please let me know if there are any logical steps I'm missing here.

-Yaz

Posted on: 3/16 22:01
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: Adding a custom force node to H3D
#6
Webmaster
Webmaster


See User information
That is indeed the way to do it.

Posted on: 3/19 9:10
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top







You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create pdf.
You cannot get print page.

[Advanced Search]





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