Sei sulla pagina 1di 13

Virtual Environments ELG5124/CSI5151 Fall 2011

Jochen Lang SITE, University of Ottawa Canada

Introduction to CHAI3D
Haptics SDK
computer haptics interface to different hardware, extensible (see assignment 3) haptics rendering loop haptic effects visualization graphics support based on openGL and GLUT visual rendering loop scenegraph interactive real-time simulation collision detection, timers and thread management
Jochen Lang

Overview: Haptic Control Loops


Input Loop
Force Force Haptic Rendering Position

User Control Position

Actuators

Device + Biomechanics

Output Loop

Adapted from M.C. Lin and M.A. Otaduy, Recent advances in haptic rendering and applications, Otaduy, SIGGRAPH course notes, 2005.
Jochen Lang

Haptic Rendering
Force Haptic Rendering Position

Force Computation

Object Response

Collision Detection

Jochen Lang

Generic Haptic Devices Key Methods


class cGenericHapticDevice : public cGenericDevice // Read the position of the device. Units are meters [m]. int getPosition(cVector3d& a_position) // Read the orientation frame of the device end-effector. int getRotation(cMatrix3d& a_rotation) // Read the linear velocity of the device. Units are meters per second [m/s]. int getLinearVelocity(cVector3d& a_linearVelocity) // Read the angular velocity of the device. Units are in radians per second [m/s]. int getAngularVelocity(cVector3d& a_angularVelocity) // Send a force [N] to the haptic device. int setForce(cVector3d& a_force) // Read a sensed force [N] from the haptic device. int getForce(cVector3d& a_force) // Send a torque [N*m] to the haptic device. int setTorque(cVector3d& a_torque) // Read a sensed torque [N*m] from the haptic device. int getTorque(cVector3d& a_torque) // read the status of the user switch [\b true = \b ON / \b false = \b OFF]. int getUserSwitch(int a_switchIndex, bool& a_status) // Get the specifications of the current device. cHapticDeviceInfo getSpecifications()
Jochen Lang

Generic Haptic Devices State


class cGenericHapticDevice : public cGenericDevice // Open connection to haptic device (0 indicates success). int open() // Close connection to haptic device (0 indicates success). int close() // Initialize or calibrate haptic device (0 indicates success). int initialize(const bool a_resetEncoders=false) // Get the specifications of the current device cHapticDeviceInfo getSpecifications()}

Jochen Lang

Haptic Device Handler


class cHapticDeviceHandler
// Returns the number of devices connected to your computer.

unsigned int getNumDevices() getNumDevices()


// Updates information regarding the devices that are connected to your computer.

void update();
// Returns the specifications of the ith device.

int getDeviceSpecifications( getDeviceSpecifications( cHapticDeviceInfo& a_deviceSpecifications, cHapticDeviceInfo& a_deviceSpecifications, unsigned int a_index = 0);
// Returns a handle to the ith device if available.

int getDevice(cGenericHapticDevice*& a_hapticDevice, getDevice(cGenericHapticDevice*& a_hapticDevice, unsigned int a_index = 0);


Jochen Lang

Connecting to a haptic device


// create a haptic device handler handler = new cHapticDeviceHandler(); // get access to the first available haptic device cGenericHapticDevice* hapticDevice; handler->getDevice(hapticDevice, 0); // retrieve information about the current haptic device cHapticDeviceInfo info= hapticDevice->getSpecifications();

cHapticDeviceInfo string m_manufacturerName; double m_maxForce; double m_workspaceRadius; bool m_sensedPosition; bool m_sensedRotation; bool m_actuatedPosition; bool m_actuatedRotation;
Jochen Lang

Chai3D Source File Organization

Jochen Lang

Scenegraph Nodes
cGenericObject
Parent of all scenegraph nodes

cCamera
Controls the position/orientation of the camera relative to the scene

cLight
Light source position and orientation

cMesh, cShapeSphere, etc.


Objects in the scene

cGenericTool
Haptic tools

cWorld
Root of the scene
Jochen Lang

10

Haptic Scenegraph Traversal

Jochen Lang

11

Example: 12-Polygon
Uses a triangle mesh Haptic finger proxy rendering algorithm of [Ruspini et al. 97] Collision detection with build in axis-aligned-bounding-box tree

Copyright Chai3D

Jochen Lang

12

Credits, References
Material from:
Francois Conti, Chai3D source code Kenneth Salisbury, Federico Barbagli and Franois Conti, CS 277 - Experimental Haptics, Lecture 4, Open Source Framework CHAI 3D, Stanford University

Jochen Lang

13

Potrebbero piacerti anche