Skip to content

Feature/add simulink library block#3

Merged
ennerf merged 3 commits intoHebiRobotics:masterfrom
jwithelm:feature/add_simulink_library_block
Jan 20, 2023
Merged

Feature/add simulink library block#3
ennerf merged 3 commits intoHebiRobotics:masterfrom
jwithelm:feature/add_simulink_library_block

Conversation

@jwithelm
Copy link
Copy Markdown
Contributor

Added a Simulink library called 'MatlabInput' which contains the block 'HebiJoystick Input'.
'HebiJoystick Input' can be used as a replacement for the 'Joystick Input' block from the
'Simulink 3D Animation' toolbox.

The Simulink block is implemented as a Level-2 MATLAB S-Function using 'HebiJoystick'.

Added a Simulink library which contains the block "HebiJoystick Input".
"HebiJoystick Input" can be used as a replacement for the "Joystick Input" block
from the "Simulink 3D Animation" toolbox.
- Splitting the release files into matlab and simulink folders.
- Include README and LICENSE.
@ennerf
Copy link
Copy Markdown
Contributor

ennerf commented Jan 19, 2023

Thanks for the PR 👍

I'm not particularly familiar with Simulink and don't have access for testing at the moment. Can you provide a screenshot of what the model (in the slx?) looks like? Does it match the interface in the official toolbox?

What versions have you tested it on?

@jwithelm
Copy link
Copy Markdown
Contributor Author

jwithelm commented Jan 19, 2023

Thank you for HebiJoystick! 😄

I created the library (matlabinput_lib.slx) with Matlab/Simulink R2018b, but I also tested it with Matlab/Simulink R2022b (a test license in which I can use the original Joystick Input block from the Simulink 3D Animation toolbox). The implementation is based on a Level-2 MATLAB S-Function (hebijoyinput.m) which uses HebiJoystick.

If you directly open the library file (matlabinput_lib.slx) it looks like this:
matlabinput_lib

As you can see here, the outputs and configuration masks of both blocks are identical:
side-by-side-comparison
I did not implement the "Adjust I/O ports according to joystick capabilities" checkbox (therefore it is permanently checked and greyed out in the configuration mask). The HebiJoystick Input block adjusts the size of its outputs to the capabilities of the joystick being used. But if a future user needs this functionality it should be straight forward to implement some logic in hebijoyinput.m.

The force-feedback function is implemented and working (at least for an XBox controller) but interestingly force-feedback does not seem to work with the original Joystick Input block as you can see here:
side-by-side-comparison_with-force-feedback

Also here are two side-by-side comparisons of the Axes and Buttons Outputs of both blocks:
Axes-comparison
Buttons-comparison

I configured HebiJoystick Input to use a discrete sample rate of 50 Hz to prevent Simulink from calling the instance of HebiJoystick to often. I think this is also a different behavior from the original Joystick Input block (but also very easy to change in hebijoyinput.m).

As a last point, I changed the target structure of the project to achieve a better separation between the Matlab and Simulink files (If you'd like, you can view it here: https://github.com/jwithelm/MatlabInput/releases)

@ennerf
Copy link
Copy Markdown
Contributor

ennerf commented Jan 19, 2023

At first glance everything looks good. I'll take a better look tomorrow and merge it in.

For what it's worth, we have internally replaced all of our joystick uses with the Mobile I/O app. It acts as a cross-platform and cross-language wireless joystick with additional support for various sensors like IMU/GPS and AR tracking. Maybe that's useful for you as well.

Here is an older example using the MATLAB API: Mobile I/O - ARKit & Magnetometer Demo. It supports up to 1KHz async sampling, async logging, and comes with visual debugging toos like Scope.

@ennerf ennerf merged commit 4bff9f5 into HebiRobotics:master Jan 20, 2023
@ennerf
Copy link
Copy Markdown
Contributor

ennerf commented Jan 20, 2023

merged and released it. thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants