Simulink, MS Visual Studio and Lego NXT

조회 수: 3 (최근 30일)
grig
grig 2012년 4월 1일
I have a Simulink model for controlling Lego robot. I have c# project in MSVS which receives robot's coordinates from web camera every 100 ms. How can i get data from c# application and use it in Simulink model?

답변 (4개)

Gautam Vallabha
Gautam Vallabha 2012년 4월 1일
I assume you are referring to the Run on Target Hardware capability in R2012a. You have a couple of options:
  1. You can configure your model to use external mode. In this mode, the model would run on the LEGO robot but you can change parameters via Simulink on the host computer. To use this, you would (a) send the coordinates from C# to MATLAB workspace, and (b) use set_param to change the appropriate parameters. There are several ways of sending the coordinates; see here for details.
  2. You can use a "Receive via Bluetooth" block in your model, and figure out how to send the Bluetooth data from your C# program.
  댓글 수: 1
grig
grig 2012년 4월 14일
How should look like matlab format of message for sending to robot?

댓글을 달려면 로그인하십시오.


grig
grig 2012년 4월 15일
I send [0x06 0x00 0x00 0x09 0x00 0x02 (uint8)number 0x00] but output from Receive via Bluetooth® Connection is always: Data=0,Size=32. What is wrong?

grig
grig 2012년 4월 15일
OMG! Correct is [0x02 0x00 0x01 (uint8)number] For mailbox #1 3d byte should be 0x01, not 0x00. It is not obvious!

grig
grig 2012년 4월 15일
And there is another question: how to send single or double number to robot? Just BitConverter.GetBytes() is not enough.

카테고리

Help CenterFile Exchange에서 LEGO MINDSTORMS EV3 Hardware에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by