Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: control GUI slider with haptic device in Simulink external mode
Replies: 4   Last Post: Mar 5, 2013 6:09 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Wetoo

Posts: 8
Registered: 12/5/10
control GUI slider with haptic device in Simulink external mode
Posted: Dec 5, 2010 3:06 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello everyone,

I have a simulink block diagram that interfaces to a force-feedback haptic device:(http://www.sensable.com/haptic-phantom-omni.htm) in Simulink external mode. I can read position commands from this device and output force-feedback to this device (a block in my diagram does this, and it works fine). I can visualize the position signals on a simulink scope. In addition to that, I want to be able to use these position signals from the device to control a slider in my matlab GUI.

I included a gain block in the path of the position signal and tried to use add_exec_event_listener to register an event listener on its output. I understand that the callback registered by add_exec_event_listener is only executed when the corresponding block (in this case the Gain block) in the simulink block diagram is executed. I got errors when I tried to build this, since the diagram is running in external mode.

I found out that since in external mode, blocks are not executed inside simulink, but on the target processor, I cannot simply use add_exec_event_listener to register listeners. So I needed to get this Gain block out from external mode execution. I learnt that by creating an "atomic subsystem" in my block diagram, I can make some blocks in my block diagram to run inside Simulink rather than in external mode. So I created an "atomic subsystem" around this Gain block (there are also a few other blocks in this atomic subsystem), and I can now use add_exec_event_listener on the Gain block output. The diagram now builds and even runs without any errors.

However, add_exec_event_listener does not really work! The handle to the listener returned by
h = add_exec_event_listener(blk, event, listener);
is empty (very sad)!

If I try to edit the handle 'h' in the Matlab workspace by entering my updateGUI() function into it while the block diagram is executing, I can hit breakpoints inside the function. But this is of no use.

If I add a pushButton on my GUI that reads the current Gain block output and updates the GUI slider position (using runtimeObject), it works. But of course, I cannot click on this button at a rate of 500 Hz for a few minutes, which is what I want the listener to do. But it does not do that currently.

Extremely sorry for the long text, I just wanted to be clear enough. Any ideas on how one could solve my problem?

thanks and best regards,
Wetoo



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.