Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
iMSTK
iMSTK
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 46
    • Issues 46
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 12
    • Merge Requests 12
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • iMSTK
  • iMSTKiMSTK
  • Issues
  • #262

Closed
Open
Created Nov 06, 2020 by huiqiTian222@huiqiTian222

how can get Haptic device Buttons event.

i want to get to use the haptic device's button.

now i can control a object with Haptic device , here is the core code. referenced the example “ObjectController”

`auto server = std::make_shared();

auto client = server->makeDeviceClient(phantomOmni1Name);

auto controller = std::make_shared(object, client);

scene->addController(controller);

viewer->addChildThread(server);`

but when i want to get button's event. i read some source code about imstk like "imstkHapticDeviceManager.cpp" "imstkHapticeDeviceClient.cpp"

besides, i also read example code about HDAPI Graphics Examples, HDAPI Console Examples.

in my openion, i need to write HDcallback function to get the button event. like this

` HDCallbackCode HDCALLBACK CallbackFunction(void* pData){*******}

`

in main function

` hdStartScheduler();

hdScheduleAsynchronous(releaseHotFieldCallback, 0, HD_MAX_SCHEDULER_PRIORITY); `

here is the thing, if i want to run with out error, i need to initialize the haptic device whit this line code

HHD hHD = hdInitDevice(HD_DEFAULT_DEVICE);

but it's conflict with client code , Cannot exist together auto client = server->makeDeviceClient(phantomOmni1Name);

also i noticed that in "imstkHapticDeviceManager.cpp" there has function "initialize()" to initialize the client which called

"imstkHapticDeviceClient.cpp" m_handle = hdInitDevice(this->getDeviceName().c_str());

but when i add this line "server->initialize()" to my code, the application will crashed.

what should i do to solve this problem, thank for any adcice.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None