Is it possible to control a 3D model inside the Nx motion simulation, using an input provided by a joystick signal. I have been investigating about this and found that the co-simulation could import signals from simulink to NX using NX motion plant. This partly solves my problem. However, I also found that these are not real time signals.
It would be great if someone could point me in the right direction. Thank you
Solved! Go to Solution.
I am not sure if it is possible with NX Motion Simulation but we used NX Mechatronics Concept Designer (MCD) to achive exactly this.
NX MCD provides a real time motion simulation that can also be controlled easily by external signals, either from an Industry Controller like a PLC or from other device like a joystick or a keyboard etc. .
I have created an addon to connect to an Xbox 360 Gamepad before and I posted the package including an example & installation notes in a different thread see here:
Let me know if that helps.
Hi Viktor Braun,
Your reply was extremely helpful and the example thread that you posted was exactly what I have been looking for. Thanks a lot for pointing out that this is actually possible.
I was planning on using ThrustMaster Usb Joystick. I am excited to try that with the example which you posted. I will also post on what the response was once I try that out.
Thanks again for the help. I sincerely appretiate it.
Hi Viktor Braun,
I tried this with my Thrust Master joystick and obviously it did not work :-). After digging in a little, I understood that the signal adapter needs to be reconfigured for my joystick. Since the controller and the template provided are for XB360 i should have thought about this before even trying with my joystick.
However, I am now more excited about making this work. It would be of great help if you could point me to some tutorials or documents where I could learn more about controller integration and behaviour configurations.
Thanks & Regards,
you are right: it wont work directly with your Thrustmaster since my addon uses an C# Code to connect to specificly the xbox 360 gamepads.
We call this in MCD a Runtime Behavior it can use a simple .cs script or a compiled DLL.
The Signal Adapter is only the connection from the gamepad to the MCD Physics Elements like "Joints" and "Position Controls" (these are similar to NX Motion Drivers).
But the Signals values in the Signal Adapter are beeing controlled by the Runtime Behavior.
If you are a little bit into coding or want to learn it, this could be a very nice task. Here is a place to start:
Thank you for your reply.
After doing some research, I understood that this is going to be really tough for me considering my inexperinece in C# coding. From what I understood, I need to create a .cs script to connect my joystick to MCD as a source file for run time behaviour. I have a few questions regarding this.
1. Is it possible to get an already compiled .dll file for my joystick and use it with nx?
2. Is there a more simpler way to understand how to do this scripting from a beginners perspective?
3. What is your viewpoint on giving keyboard inputs instead? Does this have to go through the same process of adding a C# script file?
Thank you for your time.
After some study of the c#, I was able to sum up a .cs script file for my thrust master joystick and i could see that it is working in visual stidio. However, When i try to insert the .cs file into NX. I am receiving some errors. It would be great if you could have a look at the attached image and advise.
It would also be nice if you could let me know on where I could find more tutorials on c# scripts in NX..
Thanks in Advance.
I have been trying to integrate my joystick using a .cs script and I am finding it extremely difficult due to unavailability of tutorials available online. It seems like you are the only expert who has previously worked and solved this problem correctly and posted it online.
The .CS script for the Xbox360 controller is not accesible from your example. It would be of great help if you could share that script file so that I could try and compare it with mine while modifying it to match my joystick.
I am working on a thesis where motion simulation and mechatronics concept designer is used to a great extend. It would help me a lot if I could include real time simulations to my concept design.
you can also email me at email@example.com
sorry I was quite busy lately and I wanted to prepare a nice example but just couldnt find the time in doing so.
As to your questions: It is great that you have it working in your c# application, but you will need to use the "MCD Runtime Behavior Class" in the next step. The predefined methods (Start, Stop, Step,Refresh and Repaint have to be in the class.
I have put an Example as an Attachment where we used a Keyboard to control Signal values in MCD and these can be then linked to the MCD Physical Elements like Position Controls in a Signal Adapter.
In the Example you can use the arrow keys on your keyboard to move the sliders.
One tip: you have to put the external libraries (dlls like "directX") into "\<YourNX11Path>\NXBIN\managed\".
Please keep us updated on your progress!
That was very kind of you to share the keyboard input method. I was able to modify them to control different sensors and actuators using different keyboard inputs. I would never have found a way to do this without your help. Thanks a ton for that.
This could in fact help me to move forward with my thesis. However, my curiosity is still pushing me to introduce the thrust master Joystick controller. I sincerely hope that you could spend some time in helping me with my script.
As I mentioned in the previous reply, I was able to find a program for my thrust master joystick. I have attached the joystick.cs file for your reference. I tried doing the following steps and still it did not work.
1. From your reply I understood that the Microsoft.DirectX.Input dll, which I am using in the script should be placed inside, (NXBIN/Managed.). I tried doing that and the code is not fetching properly.
2. I also remember that you mentioned MCD runtime behaviour class has predefined methods (Start, Stop, Step,Refresh and Repaint). I tried editing the script file and placing them into these classes. It dint work for me either. (Most probably I am doing it wrong)
3. I also tried using NX Open C# wizard in visual studio to rewrite the script, so that the predefined steps can be followed. That too end up in a failure because, I am confused on which one should be under which class.
Would you be kind enough to have a look at the attached script and advise me on how to make this work with NX?
Thanks & Regards,