1.     Simulink Real-Time Set up

1.1. Development PC Program Setup

a.     MATLAB 설치(R2016a이상 설치, R2019b 강력 추천!)

-       https://kr.mathworks.com/downloads/web_downloads/select_release?mode=gwylf

b.     MATLAB, Simulink Real-Time 설치

c.     Visual Studio 설치(2017 or 2019, 2017이 지원하는 범위가 더 넓기 때문에 2017추천)

-       https://visualstudio.microsoft.com/ko/

-       워크로드 -> C++를 사용한 Desktop 개발 체크

d.     MATLAB Support for MinGW-w64 C/C++ Compiler 설치

-       https://mathworks.com/matlabcentral/fileexchange/52848-matlab-support-for-mingw-w64-c-c-compiler

e.     MATLAB실행 후 mex -setup

f.      Microsoft Visual C++ 201X (C) 클릭

1.2. Target PC Setting

a.     Activate PXE Boot option at Bios setting. (Only for Lan Boot)

b.     Activate USB Boot option at Bios setting. (Only for USB Boot)

1.3. Development Computer Setting (Only for Lan Boot)

a.     Developement Computer의 해당 LAN 포트의 ip주소와 서브넷 마스크를 설정하고 기억하라. (여기선 192.168.7.4 & 255.255.255.0) 게이트웨이는 비워도 된다.

b    Development Computer에서 MATLAB을 실행하고 slrtexplr 를 명령창에 입력하면 Simulink Real-Time Rxplorer 창이 나타난다.

c.     Add Target을 눌러 Target을 만들고 해당 Target Properties에 들어가라.

d.     Host-to-Target communication 에서 Target Computer ip를 설정해주자. 임의로 설정하되 Developement Computer ip 주소와 8 LSB 비트만 달라야한다. (, 192.168.7.xxx 의 형식으로 설정) 서브넷 마스크는 Developement Computer와 일치하도록 설정하며, 게이트웨이의 경우Developement Computer의 게이트웨이가 따로 설정되지 않았다면 255.255.255.255로 설정하여라.

e.     Target Driveauto, Bus type PCI 로 설정하여라.

f.     Target Setting 에서는 USB Support, Multicore CPU, Graphics mode 를 체크하여라. (USB Support를 할 경우 안될 때가 있는데 그럴때는 체크해제 하도록, 원인은 모르겠음.) Memory settings 에서는 RAM size auto 로 체크.

g.      Boot Configuration 에서는 Boot mode Network로 설정.

h.     Target Computer를 실행하여라. 성공적으로 실행됐다면 Developement Computer에 어떤 창이 뜰 것이고, 해당 Target을 선택하고 OK를 눌러라. MAC address가 자동으로 입력되고 기다리면 Simulink Real time Target Computer에서 실행된다.

i.     Simulink Real-Time Explorer에서 해당 Target Connect

j.      slrttest를 입력하여 connect가 잘 되었는지 test한다. 다음은 connection이 있을 때 참고할 수 있는 link이다.

-       https://mathworks.com/help/xpc/troubleshooting-in-xpc-target.html

 

1.     Connect Elmo Motor Controller with Simulink Real-Time

1.1. EtherCAT Network Information file (ENI file) Generation

-       Set up Visual Studio (Visual studio 2017 is rcommended)

https://visualstudio.microsoft.com/

-       Set up Twincat3

https://www.beckhoff.com/twincat3/

download -> software -> twincat 3 -> TExxxx | Engineering

TwinCAT 3.1 – eXtended Automation Engineering (XAE) -> download & set up

-       Elmo Slave Information (ESI) Download

www.elmomc.com

Support -> Resources Center -> Gold Drive Links -> Version ---.zip download

ECAT********.xml is ESI file of Elmo Gold drive

Put ESI file at C:\TwinCAT\3.1\Config\Io\EtherCAT

-       Run TwinCAT 3

C:\ProgramData\Microsoft\Windows\Startmenu\Programs\Beckhoff\TwinCAT3

Run TwinCAT XAE (TcXaeShell)

-       Make ENI file with TwinCAT 3

New TwinCAT project

(Next to Debug) TwinCAT -> show realtime ehternet compatible devices

Click LAN port -> install

(menu bar) TWINCAT -> Scan or (See the picture below) Solution Elplorer -> TwinCAT Project -> I/O -> Devices -> Scan

-       If there is ‘All devices may not automatically be found’ message -> click OK

-       New I/O devices have been found -> Check check-box and click OK

-       If there is ‘Scan for boxes’ message -> Click Yes -> EtherCAT devices appears at Solution Explorer

-       If there is ‘Free run mode’ message -> Click NO

-       Solution Explorer reflects EtherCAT Network connection (following picture)

-       Solution Explorer -> SYSTEM -> right click Tasks -> Add New Item…

-       Insert Task -> Select TwinCAT Task With Image -> set name of task -> OK

 

-       Double click generated task(following picture Manual_Task)

-       Match the Cycle Ticks on the Task tab to sampling time of Simulink Real-time(SYSTEM -> REALTIME tap -> system clock) See the Simulink Block example for setting the Sampling Time.     

-       Solution Explorer -> Devices -> Device(EtherCAT) -> Drive 1 or Drive 2 or Drive 3 -> Check the Inputs or Outputs(following picture). This information is the Process Data Object (PDO). PDO means the information exchanged between EtherCAT slave and EtherCAT master. To change the PDO, see the PDO setting.

-       Solution Explorer > Tasks > Task > Inputs 를 오른쪽 클릭하고 Add New Item... 을 클릭하면 Insert Variable 창이 뜨는 것을 볼 수 있다. Data Type을 설정해주어야 한다. 일단 Insert Variable 창은 다시 꺼라.

-       Solution Explorer > Devices > Device (EhterCAT) > Drive 1 or Drive 2 or Drive 3 > Inputs 의 하위 요소 중 하나(여기선 Position actual value)를 한 번 클릭해라. 다음과 같이 오른쪽에 설정창이 뜨고, 그 중 Type 에 입력된 값을 기억해라(여기선 DINT).

-       이 값을 Solution Explorer > Tasks > Task > Inputs 를 오른쪽 클릭하고 Add New Item... 을 클릭했을 때 뜨는 Insert Variable 창에서 Search Type 에 쓰고 해당하는 Data Type 을 선택하고 OK 를 눌러라. (Multiple을 활용하면 여러개 만들 수 있다.)

-       이전에 확인했던 Solution Explorer > Devices > Device (EhterCAT) > Drive 1 or Drive 2 or Drive 3 > Inputs 의 하위 요소 중 하나(여기선 Position actual value) 를 다시 한 번 클릭하고, 오른쪽에 나타나는 설정 창에서 Linked to... 를 클릭해라

-       만들었던 Input에 해당하는 값(여기선 SYSTEM > Tasks > Manual_Task > Var 5)을 클릭하고 OK 를 누른다.

-       모든 Drive에 속해있는 Inputs Outputs 에 속한 요쇼 중 최소한 하나씩은 이짓을 하여서 다음과 같이 Task를 만들어야 한다.

-       Solution Explorer > I/O > Devices > Device (EtherCAT) 을 클릭하고 나타나는 창의 EtherCAT 탭에서 Export Configuration File 을 클릭하여, .xml 파일 저장. (요놈이 ENI 파일이다.)

 

 

 

 

 

지금껏 나는 Robot을 구동 시키기 위해 KAIST Hubolab에서 자체 개발한 PODO[1]–[3]라는 Robot operating system을 사용하였다. PODODARPA Robotics Challenge에 출전하며 팀원과의 원활한 협업을 목적으로 탄생한 C++기반 프로그램이다. 구조적으로 ROS와 비슷한 점들이 많으며 real-time system으로 구축 가능하다.

이번에 만들고 있는 새로운 Robot CYBOPODO가 아니라 MATLAB Simulink Real-Time을 사용해보기로 하였다. 익숙했던 기존 로봇의 시스템을 뒤엎는 다는 큰 결심을 하고 Simulink Real-Time License를 구입하였다. 앞으로 어떤 난관이 있을지부디 장벽을 잘 돌파하고 성공적으로 시스템 구축할 수 있기를 바란다.

 

1.     Simulink Real-Time

A.     Before Start

Simulink Real-Time Robot operating programdevelopmentdevelopment PC(MATLAB이 설치가능한 일반적인 Desktop이나 Laptop으로 구축 가능)Simulink Real-time OS로 부팅하여 real-time 으로 Robot을 구동할 Target PC가 필요하다.

B.      Cheap, Powerful, Lightweight Target PC Selection

MathworksSpeedGoat hardware를 이용하여 Target PC를 구축하길 강력하게 추천하고 있지만! 가격이 비싸고 무게가 무겁다(for legged robot)는 문제가 있다.

다음은 Mathworks에서 official하게 제공하는 Target PC requirement이다.

Target PC requirement

https://mathworks.com/help/releases/R2017b/xpc/gs/target-computer-hardware.html#bu2qpln-1

Target PC Bios Setting

https://mathworks.com/help/releases/R2017b/xpc/gs/bios-settings.html

하지만 조건을 만족하는 embedded PC(smaller than mini-iTX formfactor)Target PC로 만드는 것을 시도하였다. 여러 시도 끝에 PC 1(i5 4th generation) 성공, 2(i7 6th generation)는 실패하였다. 결국 computing power와 유지 보수가 쉬운 mini-iTX formfactortarget PC Setting하였다.

Specification of Development PC(My Laptop Lenovo E480)

-       Intel i7 8550U

Specification of Target PC

-       CPU: Intel i7 9700k

-       Motherboard: ASUS PRIME H310I-PLUS

-       Additional Ethernet Card: Intel i210

-       Display Port: HDMI/DVI/D-SUB

-       RAM: Samsung DDR4 16GB(8GBX2)

-       Power Supply: SELTECH LR1010

-       Storage: Samsung 970 EVO M.2 SSD 250GB

 

 

 

2.     Simulink Real-Time 설치

2.1. Development PC Program Setup

a.     MATLAB 설치(R2016a이상 설치, R2019b 추천)

-       https://kr.mathworks.com/downloads/web_downloads/select_release?mode=gwylf

b.     MATLAB, Simulink Real-Time 설치

c.     Visual Studio 설치(2017 or 2019, 2017이 지원하는 범위가 더 넓기 때문에 2017 추천)

-       https://visualstudio.microsoft.com/ko/

-       워크로드 -> C++를 사용한 Desktop 개발 체크

d.     MATLAB Support for MinGW-w64 C/C++ Compiler 설치

-       https://mathworks.com/matlabcentral/fileexchange/52848-matlab-support-for-mingw-w64-c-c-compiler

e.     MATLAB실행 후 mex -setup

f.      Microsoft Visual C++ 201X (C) 클릭

2.2. Target PC Setting

a.     Activate PXE Boot option at Bios setting. (Only for Lan Boot)

b.     Activate USB Boot option at Bios setting. (Only for USB Boot)

2.3. Development Computer Setting (Only for Lan Boot)

a.     Developement Computer의 해당 LAN 포트의 ip주소와 서브넷 마스크를 설정하고 기억하라. (여기선 192.168.7.4 & 255.255.255.0) 게이트웨이는 비워도 된다.

 

b.     Development Computer에서 MATLAB을 실행하고 slrtexplr 를 명령창에 입력하면 Simulink Real-Time Rxplorer 창이 나타난다.

c.     Add Target을 눌러 Target을 만들고 해당 Target Properties에 들어가라.

d.     Host-to-Target communication 에서 Target Computer ip를 설정해주자. 임의로 설정하되 Developement Computer ip 주소와 8 LSB 비트만 달라야한다. (, 192.168.7.xxx 의 형식으로 설정) 서브넷 마스크는 Developement Computer와 일치하도록 설정하며, 게이트웨이의 경우Developement Computer의 게이트웨이가 따로 설정되지 않았다면 255.255.255.255로 설정하여라.

e.     Target Driveauto, Bus type PCI 로 설정하여라.

f.     Target Setting 에서는 USB Support, Multicore CPU, Graphics mode 를 체크하여라. (USB Support를 할 경우 안될 때가 있는데 그럴때는 체크해제 하도록, 원인은 모르겠음.) Memory settings 에서는 RAM size auto 로 체크.

g.      Boot Configuration 에서는 Boot mode Network로 설정.

h.     Target Computer를 실행하여라. 성공적으로 실행됐다면 Developement Computer에 어떤 창이 뜰 것이고, 해당 Target을 선택하고 OK를 눌러라. MAC address가 자동으로 입력되고 기다리면 Simulink Real time Target Computer에서 실행된다.

i.     Simulink Real-Time Explorer에서 해당 Target Connect

j.      slrttest를 입력하여 connect가 잘 되었는지 test한다. 다음은 connection이 있을 때 참고할 수 있는 link이다.

https://mathworks.com/help/xpc/troubleshooting-in-xpc-target.html

Cybo에 사용될 GTWID Solo를 모두 조립하였다!

 

이제 GTWID Solo를 Computer와 연결하기 위해 Cable을 만들어야 한다. 타이밍 좋게 하루 차이를 두고 Aliexpress에서 주문한 Siliconwire와 connector, battery 등이 도착하였다. connector wiring 작업은 혼자 하면 고독하기 때문에 사람을 한 명 구해 수다를 떨면서 할 예정이다! ㅋㅋㅋ

 

ElmoMolex Pico-Clasp, AKsIM-2Molex Pico-Blade를 이용하기 때문에 두 종류의 connector가 섞여서 구성된다. Connector에 대해 공부한 것이 처음이라 실수가 있지 않을까 조금 불안하다. 잘 됐으면 좋겠다사용을 해봐야 느낌을 알 수 있을 것 같다. 간단한 전원분배 hub를 만들고 싶은데 PCB설계를 할 줄 모르기 때문에 PCB Artwork을 배우고 싶은 욕구가 솟구친다. 홧김에 Altium Designer 30일 평가판을 등록하였으나 당장 사용하지 않아 일주일정도 늦게 할 껄 살짝 후회가 된다. 하지만 시작이 반 아니겠는가!

 

1.    Electrical Connection

1.1. General information

Elmo Gold Double Twitter SoloConnector는 아래와 같이 구성되어 있다.

 

구매한 GTWID Solocontrol board의 공급전원인 VLinternal connect 되어있다(detailed option).

1.2. Pin-map

사용할 예정인 Pin-map은 아래와 같다. EncoderAKsIM-2를 사용할 예정이다. Wire color와 Mating Connector는 추후 update 예정이다. 좋은 color와 connector가 있으면 열린 마음으로 추천받는다!

 

 

1.3. Cables

GTWID Solo에 사용되는 Cable 목록은 다음과 같다.

1.4. Connector Box Setup

추후 SensorPC, LCD, Switch를 연결하기 위해 connector 작업이 필요하기 때문에 이참에 connector box를 만들기로 하였다. 구매목록은 다음과 같다. 많은 current가 흐르는 connectorXT30, XT60, MR30, MR60을 사용하기로 한다. 아래와 같이 커넥터 작업 박스를 구성하였다. 가격에 대한 감이 없기 때문에 견적을 받고 수량을 조절해볼 예정이다.

+ Recent posts