Custom Stylus

From H3D.org

Jump to: navigation, search

The stylus is supposed to be a representation of the manipulator being used by the user. By default this is either a sphere or cylindrical device. It is possible to change this by creating an X3D file. There is one trick to creating a new stylus: you must assign a DEF point for the proxy position.

For 3 DoF haptic devices such as the Novint Falcon you must be careful of the stylus you create. There is no rotation of the Falcon so the object will always be facing the same direction.

I will document the process of creating a basic stylus similar to that of the basic device and then I will show the process using a 3D model exported from another program for a more realistic manipulator.

Basic Device


The following device uses a cylinder with a rectangular prism at the end to simulate a primitive scalpel. Some things to note are the translation and size of the models. For my setup the size should be on a magnitude between 10^-2 to 10^-3. The proxy point should be even smaller.

Every model must include a proxy position. This is the point that touches the surface of objects and is used in the evaluation of forces. This is referenced by setting the shape definition as "PROXY" as seen below. When creating an H3D project the position of this shape is used for the haptic rendering.

 
    <Group>
        <Shape>
            <Appearance>
                <Material/>
            </Appearance>
        <Sphere DEF="PROXY" radius = "0.000025"/>
        </Shape>
 

A transform should move the position of the rest of the objects relative to the proxy point. At this point the rest of the file continues like a traditional X3D file.

 
        <Transform translation="0 0.040 0">
            <Shape>
                <Cylinder radius=".003" height=".07"/>
                <Appearance>
                    <Material diffuseColor="0.7 0.7 0.7"/>
                </Appearance>
            </Shape>
        </Transform>
        <Transform translation="0 0.003 0">
                <Shape>
                    <Box size="0.003 0.006 0.003"/>
                <Appearance>
                    <Material diffuseColor="0.3 0.3 0.3"/>
                </Appearance>
                </Shape>
        </Transform>
    </Group>
 

In order for the stylus to be used it must be put in the folder \H3D\H3DAPI\settings\common\stylus. To use this model the H3D config file must be changed. This can be done using the H3DLoad interface or by editing h3dload.ini directly.

H3DLoad
Enlarge
H3DLoad

The resulting stylus is pictured in the scene here:

 Basic 3D Stylus
Enlarge
Basic 3D Stylus


Realistic Stylus

The following file was created using Autodesk 3DS Max. It was exported as a VRML file and converted to X3D using VRMLMerge.

It is in VRML formatting so the following code must be added for the proxy object:

 
    DEF PROXY Transform{
    children[ Shape{
    geometry Sphere{radius 0.000001}
    }]}
 

In case the model is too big the object must be scaled. This can be done by wrapping an additional Transform around the 3D scene.

 
    DEF gen Transform{
    translation 0.0 0.0 0.0
    scale 0.025 0.025 0.025
    children [
 
    ...rest of scene...
 
 
    ]
    }
 


This is the result:


 Syringe Stylus
Enlarge
Syringe Stylus
Personal tools
go to