Hello!
Could you offer me some suggestions to get other sensor measures into the Matlab API control loop for real-time control? Like how to feedback EMG data to design the X-series motor controller. I know all the X-series motor control and feedback are within the same Matlab code, which is not applicable to collect other sensors data like using DAQ board.
Thanks a lot.
Communication between Matlab API and Simulink
- dave_rollinson
- HEBI Official
- Posts: 41
- Joined: Tue Dec 31, 2019 11:58 am
Re: Communication between Matlab API and Simulink
Qiang,
We have done some demos using EMG sensors before, sending the amplified signals to an I/O Board:
In the video above we used the analog voltage input on the I/O board to read the EMG sensor, a MyoWare Muscle Sensor. Based on that analog signal you can design controllers in Matlab of varying complexity. The video above was just a simple velocity control with some thresholding. You could do similar things with torque and I think get some interesting results.
Hope this helps!
-Dave
We have done some demos using EMG sensors before, sending the amplified signals to an I/O Board:
In the video above we used the analog voltage input on the I/O board to read the EMG sensor, a MyoWare Muscle Sensor. Based on that analog signal you can design controllers in Matlab of varying complexity. The video above was just a simple velocity control with some thresholding. You could do similar things with torque and I think get some interesting results.
Code: Select all
while true
fbk = emgSensorGroup.getNextFeedbackIO();
cmd.velocity = max( emgSensorGain * (fbk.a1-emgSensorOffset), 0 );
cmdGroup.send(cmd);
end
-Dave
Re: Communication between Matlab API and Simulink
Thanks a lot. This demo is really interesting and helpful.
Here is one of my another question: I am using the SpeedGoat target machine (running in Simulink) to collect EMG data and joint encoder data, and in order to control the motor in real-time, I need to transfer the live sensor data from Simulink to Matlab API, which is really painful for me. Would you please offer me some suggestions for the data transfer between Simulink and the Matlab API? Or would you please tell me do you have some Simulink API support for the motor control?
I really appreciate your help.
Here is one of my another question: I am using the SpeedGoat target machine (running in Simulink) to collect EMG data and joint encoder data, and in order to control the motor in real-time, I need to transfer the live sensor data from Simulink to Matlab API, which is really painful for me. Would you please offer me some suggestions for the data transfer between Simulink and the Matlab API? Or would you please tell me do you have some Simulink API support for the motor control?
I really appreciate your help.
- florian_enner
- HEBI Official
- Posts: 33
- Joined: Wed Mar 25, 2020 11:31 am
- Location: Austria
Re: Communication between Matlab API and Simulink
Simulink targets are unfortunately really limited, so it's not possible for us to create a real Simulink API.
If you can't use an I/O board as Dave mentioned, you would need to send the Simulink data to your MATLAB instance via a UDP block.
If you can't use an I/O board as Dave mentioned, you would need to send the Simulink data to your MATLAB instance via a UDP block.