Manav Kataria's Blog

Tutorial – Using Novint Falcon with Matlab

Important: Hello Everyone, unfortunately I neither have the time nor the Haptic devices to support / respond to “help” comments on this page any longer. But I am glad to see people helping each other out; so feel free to continue doing that via this page / forum / comments and make Haptics a better technology! All the best!
-Manav

This tutorial will take you through the following:
  1. Installing Falcon Drivers and Haptik Library
  2. Configuring Haptik Library to use Falcon
  3. Running Example programs with Haptik Library
Tutorial Change Log:
  • September 2012: Newer versions of Haptik Library released (1.2RC). DLLs from previous versions (1.1RC) now deprecated. See this comment.
  • October 2010: Incompatibility with Version 4.x driver.
  • November 2009: First Release.

NOTE: This tutorial has been tested with Haptik Library 1.1RC in 2009. More recent version of the library (1.2, released Feb 2012) are available now. This tutorial should be used as a guideline and is neither tested nor guaranteed to work with the latest version.

Installing Falcon Drivers and Haptik Library

Haptik library allows you to use the Falcon with Matlab.
  1. Download the Haptik Library 1.1RC and Falcon Plugin from the Haptik Library website:
    http://sirslab.dii.unisi.it/haptiklibrary/download.htm
  2. Haptik Library is compatible with 3.1.4 version and above (Update: It doesn’t seem to work with Version 4.x) of Novint Falcon Driver. Download & Install it.
    Novint’s website:
    http://home.novint.com/support/download.php
    http://home.iitb.ac.in/~kataria/media/setup.Falcon.v3.1.4.a_090407.exe
Haptik Library Homepage:

Configuring Haptik Library to use Falcon

  • Once done with the installation of the above, try runing sample programs provided with Haptik Libary on Matlab.
    C:\Program Files\Siena Robotics and Systems Lab\Haptik Library\Matlab
  • You will Haptik Library throwing an error: Haptik.Config.txt unavailable.
To fix this you will need to install ‘Haptik.Falcon.dll’ plugin and update the ‘Haptik.config.txt’ for falcon to work with Haptik:
  1. Copy Haptik.Falcon.dll to
    C:\Program Files\Siena Robotics and Systems Lab\Haptik Library\RSLib\Bin
  2. Update the config file:
    C:\Program Files\Siena Robotics and Systems Lab\Haptik Library\Matlab\Haptik.Config.txtChange the line:
    HaptikLibrary.plugin4_0 = Haptik.Spectre.dll    to
    HaptikLibrary.plugin4_0 = Haptik.Falcon.dll
  3. Relocate(or copy) the config file the application working directory.
    Application working directory is given by:
    >> pwd
    ans =
    C:\MATLAB7\work

Running Example programs with Haptik Library

Lets try Matlab examples again,
  1. Viewing Available Haptik Devices:
    >> haptikdevice_list
    ans =
    [0]    ‘Falcon [0]’    ‘Falcon’    ‘Novint’
    >>Success! Matlab and Falcon can now talk!
  2. Run the horizontal_plane.m and play with it. You should be able to “feel” a horizontal plane.

Concluding Remarks

This completes the tutorial! You might want to explore horizontal_plane.m for better understanding of things. If you intend to use Matlab / Haptik for programming, I recommend make a vertical_plane.m to get started.

Hope this helps you get started!

Manav

55 responses

  1. Manuel Bonilla

    Hola yo seguí la guia que posteaste pero al momento correr los programas horizontal_plane.m o hapticdevice_list me da el siguiente error

    Error in ==> haptikdevice_list at 2
    list = haptik_matlab(0);

    sabes a que se deba?

    March 23, 2010 at 7:56 pm

  2. Manuel Bonilla

    Hi i follow this tutorial but when I want to run the example programs i got the next error:

    Error in ==> haptikdevice_list at 2
    list = haptik_matlab(0);

    Do you know hoe to fix it?

    March 23, 2010 at 8:06 pm

    • manavkataria

      You need to do some diagnosis on the error:

      * Check if your falcon is connected properly and the Falcon Test executable provided by Novint works fine (find it in Novint’s Program Files folder)
      * Without making any changes in the configuration file, check if the command haptikdevice_list works:
      (do NOT make this change)

      2. Update the config file:
      C:\Program Files\Siena Robotics and Systems Lab\Haptik Library\Matlab\Haptik.Config.txtChange the line:
      HaptikLibrary.plugin4_0 = Haptik.Spectre.dll to
      HaptikLibrary.plugin4_0 = Haptik.Falcon.dll

      If both the above work, that means you had a faulty configuration file.

      March 24, 2010 at 6:28 pm

      • Abhishek Yohan

        Hi Manav,
        I am trying to connect and interact with Novint Falcon using MATLAB and Simulink. I have followed all the steps you have mentioned. The only difference I had was with the drivers, as novint website is no longer available I have downloaded force dimension falcon drivers. When I am trying to run the examples in MATLAB I am being encountered with errors – undefined function or variable ‘haptik_matlab’. Could you please help me out with this ?

        January 30, 2018 at 12:13 am

  3. Manuel Bonilla

    ok, I did it but the problem continues, my computer has a 64 bit operative system i
    checked in other computer with 32 bit operative system and it works.
    Thanks.
    Do you know how to use the falcon in matlab in a 64 bits machine?
    Do you know how to operate the facon with simulink

    March 25, 2010 at 10:24 pm

    • manavkataria

      Do you know how to operate the facon with simulink

      I have not tried it myself. But Falcon is supported on Simulink as well.

      March 26, 2010 at 12:01 pm

  4. Manuel Bonilla

    I install the 32 bits matlab, and i can run the examples. Do you know if i can use multiple falcons in matlab. When i run the program haptikdevice_list, the output is always the same

    [0] ‘Falcon [0]’ ‘Falcon’ ‘Novint’

    even when i have 2 falcons connected to the PC

    March 25, 2010 at 11:54 pm

  5. Manuel Bonilla

    yes. now i have the falcon working on simulink, the only question that i have to solve is if we can use multiple falcons in matlab, i can not do it yet. have you done it?

    March 26, 2010 at 4:36 pm

  6. Nilesh

    Hi,i am interested in haptics,but i cant figure out how to start.Can you recommend some study material for it?I am a pre-final year electronics engineering student.
    waiting eagerly for your reply.

    Regards,

    May 20, 2010 at 7:53 pm

  7. Tibtib

    Hi,

    Is your method still available now? Because I tried it but some of the files are not the same (for example I do not have the Haptick.Falcon.dll file but a haptik_matlab.dll file), and if I try to do exactly all what you wrote, I obtain, with the horizontal_plane program only something that works with the mouse.
    About the falcon, it has been previously installed in a 4.x version, but I re-installed it with the link you gave. Would the problem be this one?

    Thanks for a help!

    March 15, 2011 at 11:28 am

  8. Tibtib

    Ok now it works…! Thank you very much!

    March 15, 2011 at 3:02 pm

  9. Tibtib

    Hello,

    I have got a few things that I would like to do, using the falcon with matlab and your program, maybe you could help me or tell me where I can found a way to resolve my problems.

    For example, with your program, the falcon stop working when a certain amount of time has passed. I would like it to stop when I push a button, how can I do that? If I use “input(‘prompt’)” it waits for an answer for each loop…
    Do you know if it is possible to draw the motion of the ball on the screen in real-time, using matlab?

    Thanks!

    April 4, 2011 at 12:31 pm

  10. Hi! Tibtib,

    Its easy to terminate the program at the click of a button. If I remember correctly only the center button is supported by the library. Use the read_button() API.

    The horizontal_plane.m script is designed to stop executing after a few seconds; SIMULATION_TIME.

    I couldn’t understand what you meant by “drawing the motion of ball in real-time”? If you’re talking about falcon-cursor, the answer is yes.

    Hope this helps!
    Manav

    April 5, 2011 at 9:29 am

  11. jose

    Hello

    I have a question, when I use the The horizontal_plane.m more than once don´t work, i have to close matlab first. And when i use program made by me (more than once),it shows the next message

    ??? Haptik.Matlab: no such device

    Error in ==> haptikdevice.haptikdevice at 29
    h.id = haptik_matlab(1,id);

    Error in ==> prueba_novint_grafica_boton at 14
    f=haptikdevice;

    How I fix this?. I really need help with this problem.

    April 12, 2011 at 10:31 pm

    • This is typical if Matlab doesn’t get a chance to close the haptik device – this can happen during a forced termination of the program or when the programmer forgets to call the close API.

      You can manually call the close api to fix the issue for Matlab to release the handle or restart Matlab which flushes all memory and releases the handle.

      You can think of the handle as a software lock for accessing the device.

      Hope this helps! Manav

      April 19, 2011 at 3:55 am

  12. Tibtib

    Hi again!

    I have one more question about the utilisation of the falcon with matlab. Is it possible to ask for the falcon to have the ball in a specific place, giving x, y and z?
    For example, if I want it to be at x=y=z=5, is there another solution than using a “horizontal_plane”-like program? (that is to say, just allowing a place to be)

    Thanks for your advices!

    May 6, 2011 at 2:42 pm

    • (somehow this didn’t get posted on the web, hence reposting)

      Yes. You should be able to create and play with basic shapes with the Falcon on Matlab. Horizontal Plane is only a starting point.

      May 30, 2011 at 10:04 pm

  13. Tibtib

    Hi!

    I have got a big problem, and I hope you can give me solution. I use the falcon thanks to your programs and advices since a few months, and it functionned perfectly until a few days…

    In fact, the position detection still function, but the motors do not function anymore, and instead of a blue light when I try my programs (or horizontal plane), there is a green light. As matlab does not tell me there is a problem, I suppose the problem is from the joystick itself.

    Could help me?

    Thanks!

    May 30, 2011 at 9:31 am

    • Whenever you have Falcon issues, try and test your falcon with C:\Program Files\Novint\Falcon\TestUtilities\FalconTest\FalconTest.exe before you play with MATLAB.

      May 30, 2011 at 10:06 pm

  14. Dalal

    i have tried the steps with windows xp and matlab 7.12
    when i tried haptikdevice_list >>
    gives me
    ans =

    Empty cell array: 0-by-4

    and, if i try horizontal_plane it gives me eroor
    ??? Error using ==> haptik_matlab
    Haptik.Matlab: no such device

    July 6, 2011 at 6:04 am

    • young

      Hi Dalal,

      Have you solved the problem? I have the seem problem.In case you figure out somethings please let me know if you will have time.

      Young

      June 10, 2015 at 8:35 am

  15. Dalal

    another question??
    have u tried the updated haptik library??

    July 6, 2011 at 6:06 am

  16. It seems your falcon isn’t connected. Read the comment on FalconTest.exe.
    No, I have not tested with the updated Haptik Library 1.2

    July 7, 2011 at 3:16 am

  17. how could I add the button states to simulink? the haptik dll, just send the x,y,z values but if i need use the button, Is there a chance?

    September 1, 2011 at 4:49 am

    • I haven’t tried Haptik Library with Simulink. But I think there would be support for buttons in Simulink given Matlab has it. You could check the newer version of the library as well.

      September 1, 2011 at 5:32 am

  18. Arun Dayal Udai

    Hi I am at IIT Delhi working in Roboitcs.
    I need your suggestion to use it with C#. Is there and DLL which can be referenced to C# project.

    September 6, 2011 at 12:03 pm

    • I am not aware of a C# port. You might be better off asking this question at Haptik Library Forums.

      September 6, 2011 at 7:19 pm

    • Arun Dayal Udai

      I could handle Novint Falcon with existing LabView connection and using TCP to connect to it through any other Programming end.
      🙂

      November 18, 2012 at 9:44 am

      • Fantastic! And thanks for following up here. If your work is open source you might want to pass a link to it.

        November 22, 2012 at 6:46 am

  19. fabio

    Salve a tutti ho installato il vostro software su una macchina a 64bit con matlab a 64bit ma come altri utenti ho scoperto che la libreria non riesce a girare su tali architetture, mentre funziona perfettamente su matlab a 32bit.
    Siccome ho l’esigenza di lavorare su matlab a 64bit mi sapreste indicare come risolvere il problema visto che sul sito della libreria non ho trovato nulla al riguardo?

    November 17, 2011 at 2:18 am

  20. Andrea

    Hi!
    I tried to do all the steps using the last version of the library (the one with the plugin inside). The only thing I changed was the
    HaptikLibrary.plugin4_0 = Haptik.Spectre.dll to
    HaptikLibrary.plugin4_0 = Haptik.Falcon.dll
    otherwise it recognized just the mouse.
    When I try orizontal_plane it gives me back one position for each axes. If I try again with the orizontal_plane Matlab says “Unknown Windows exception of type=c0000008 was not caught.” and that it needs to close because of an internal problem.
    I’m using a 32 bit version… So I really don’t know what can be the problem.
    I checked if the falcon is connected properly and the Falcon Test works fine.

    Could you please help me with that?

    Thank you
    Andrea

    April 10, 2012 at 4:40 am

    • Hi! Andrea, tell me if I understand your problem correctly: horizontal_plane.m works well the first time Matlab starts and then the following runs fail leading to Matlab crash?

      If so, this might be a problem of improper program exit. Make sure your device objects are shutdown / closed properly by horizontal_plane.m before you rerun it. See if this helps.

      PS: I don’t have the code or Falcon with me anymore so I can only help you with my understanding of your description.

      April 11, 2012 at 5:21 am

  21. nikita

    i have done all the configurations specified above but still getting error Error in ==> horizontal_plane at 2
    h = haptikdevice;

    June 8, 2012 at 6:04 am

  22. walid

    Hello,

    first of all thanks a lot about your programs

    I followed exactly the same steps given above, but when I tried to run one of the Matlab examples provided, I got the following error message :

    ??? Invalid MEX-file ‘C:\Program Files (x86)\Siena Robotics and Systems Lab\Haptik Library\Matlab\haptik_matlab.dll’: The specified module could not be found.

    Error in ==> haptikdevice_list at 2
    list = haptik_matlab(0);

    I found in a forum that :

    (( .dll extension for MEX-files has long been deprecated, and support for these files will be discontinued in a future version of MATLAB. If you have access to the source code, please re-compile it in a newer version of MATLAB. If the DLL was provided to you by someone else, please consider contacting them for a new version.) )

    So, I’ll be grateful if you could help me with this problem, knowing that I’m using “Matlab 7.9.0” version.

    best regards,
    walid.

    September 4, 2012 at 4:43 pm

    • Walid, thanks for that update. I’ll make relevant changes on the blog.

      The statement means you’re using an older version of the library when more recent version is available. This tutorial was tested with Haptik Library 1.1RC in 2009 and is not guaranteed to work with the latest version.

      You need to use the latest (Feb 2012) version of Haptik Library from here:
      http://sirslab.dii.unisi.it/haptiklibrary/download.htm

      It would be good to hear if you can make it work.

      September 4, 2012 at 9:10 pm

    • Rolf

      Hi Walid, I run 7.14.0.739. It gives the warning about the support-stop in future version of MATLAB but it does work.

      Copy Haptik.Falcon.dll to
      C:\Program Files\Siena Robotics and Systems Lab\Haptik Library\Matlab

      Run the Falcon Test. If it works set your Matlab workspace to:
      C:\Program Files\Siena Robotics and Systems Lab\Haptik Library\Matlab

      now run the test file (horizontalplane). It should work.

      Good luck

      October 2, 2012 at 5:29 am

  23. Rolf

    == SIMULINK UPDATE ==
    For everyone who wants to use the Falcon in Simulink:

    First follow the above tutorial to make sure your device works with Matlab. If it works in Matlab:

    Copy Haptik.Falcon.dll to
    C:\Program Files\Siena Robotics and Systems Lab\Haptik Library\Simulink
    Update the config file:
    C:\Program Files\Siena Robotics and Systems Lab\Haptik library\Simulink\Haptik.Config.txt
    Change the line:
    HaptikLibrary.plugin4_0 = Haptik.Spectre.dll to
    HaptikLibrary.plugin4_0 = Haptik.Falcon.dll

    Run
    C:\Program Files\Siena Robotics and Systems Lab\Haptik Library\Simulink\HelloHaptik.mdl
    you should feel a virtual wall on the YZ plane.

    == NOW A QUESTION ==
    Please let me now if anyone was able to connect two Falcon’s to one computer (and how you did it).

    If I run haptikdevice_list, it lists both the Falcon devices, but up to now I was unable to control both devices (neither with Matlab nor with Simulink).

    October 2, 2012 at 5:24 am

    • Thanks for the update Rolf. Happy to see people helping each other out!

      October 2, 2012 at 10:54 am

  24. Samir

    hi, i done all the setup requierd to comunicate falcon with matlab, but i could’nt manage to use falcon to control a robot model that built in simulink?

    May 29, 2013 at 1:40 pm

  25. cse

    Hi,

    I have successfully connected falcon to MATLAB but cannot find a way to set a start position when initializing programs. Could anyone kindly help?

    thanks

    October 31, 2013 at 9:11 pm

  26. kritika raj sharma

    Hi,

    I want to start my mtech research in haptics ,(ece backgroung ) using matlab as my tool but exactly how should i start

    December 16, 2013 at 12:14 pm

  27. Szabi

    Hello guys,

    has any of you manged to get the Falcon up and running in Matlab using a 64 bit operating system?? Thank you.

    December 20, 2013 at 10:57 pm

  28. Endri

    Dear Mr. Kataria,
    cc: Dear all

    I am a research student, and my research field is Robotics, and I mainly use Matlab Language.
    I have started to study haptic devices such as PhantomOmni but I have some difficulties connecting the device with matlab.
    I found this web page and I hope You can help me about this issue, as described below:

    I tried to connect with different version of Matlab (R2009b, R2011b,R2013) , and both 32 and 64 bit PCs. Firstly I test the phantom device with phantom_test soft and it works properly (also tested with HelloHaptic example). But when I tried to connect with matlab, when I enter the command haptikdevice_list, the haptic device does not appear. I downloaded and install the haptic library several times too, but it was the same result.
    I read all the haptic dockuments, and I search in internet too, but still no solution.
    I really appreciate your response and your help!
    Thanks in advance!

    June 24, 2014 at 4:58 pm

    • Hello Everyone, unfortunately I neither have the time nor the haptic devices to support this page any longer. But feel free to help each other out using this forum (page).

      Thanks,
      Manav

      June 25, 2014 at 2:39 am

    • Szabi

      Hello Endri,

      I believe I have the same problem as you and I have tried almost everything but still didn’t managed to interface it with Matlab. In case you figure out somethings please let me know if you will have time.
      Thanks.

      July 22, 2014 at 1:01 pm

      • Hamid

        Hi,
        Did you find the answer?

        September 15, 2018 at 2:14 am

  29. asuero

    Hello
    How can I to read the buttons in simulink.
    Thanks.

    September 5, 2014 at 3:44 am

  30. thank you

    December 17, 2014 at 4:43 pm

  31. Pingback: MATLAB for Kinect V1&Novint Falcon | eces690hapticsproject

  32. Henry NG

    Abhishek Yohan,
    I have the same problem with you

    February 23, 2018 at 8:08 am

  33. Salsabil Lakhdari

    exmple with phantom omni pleas

    February 22, 2020 at 7:03 pm

  34. Angel

    I am using MATLAB 64 bit. I am using Novint Falcon device and while running hptikdevice.m file I am encountering the following error.” Haptik.Matlab: no such device”. Please suggest a solution for it.

    March 15, 2020 at 6:54 pm

Leave a reply to Endri Cancel reply