realtime_control_environment_setup
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
realtime_control_environment_setup [24.07.2019 17:35] – [Realtime control environment setup] Guoping Zhao | realtime_control_environment_setup [27.11.2022 22:58] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== Realtime control environment setup ====== | ====== Realtime control environment setup ====== | ||
+ | |||
+ | **Author**: Guoping Zhao, Lauflabor (www.lauflabor.de), | ||
+ | |||
+ | **Date**: July, 2019 | ||
+ | |||
+ | ---- | ||
There are lots of different ways to set up a realtime control environment for a robotic system. Here, we choose **Matlab simulink realtime toolbox** (xPC) as the software framework because: | There are lots of different ways to set up a realtime control environment for a robotic system. Here, we choose **Matlab simulink realtime toolbox** (xPC) as the software framework because: | ||
Zeile 54: | Zeile 60: | ||
You need two computers. One as xPC target computer. Another one as host computer. | You need two computers. One as xPC target computer. Another one as host computer. | ||
- | If you want the host and target computer communicate via TCP/IP ethernet, the target computer needs at least *two available ethernet interfaces (PCIe)* (because EtherCAT also needs one). Thus, normally the target computer has to be a desktop computer. | + | If you want the host and target computer communicate via TCP/IP ethernet, the target computer needs at least **two available ethernet interfaces (PCIe)** (because EtherCAT also needs one). Thus, normally the target computer has to be a desktop computer. |
=== Network card=== | === Network card=== | ||
Zeile 70: | Zeile 76: | ||
=== EtherCAT slave === | === EtherCAT slave === | ||
- | Beckhoff' | + | Beckhoff' |
- | # USB flash drive | + | |
- | A USB flash drive is needed if you want to boot the target from a bootable USB drive. I think it's the most convenient way for testing. It' | + | |
- | # Motor and motor driver | + | |
- | Depends on you. Select Beckhoff terminals according to the interface of your motor driver. | + | |
- | h2. System configuration | + | == USB flash drive == |
+ | |||
+ | A USB flash drive is needed if you want to boot the target from a bootable USB drive. I think it's the most convenient way for testing. | ||
+ | |||
+ | == Motor and motor driver == | ||
+ | |||
+ | Depends on you. Select Beckhoff terminals according to the interface of your motor driver. | ||
- | http:// | + | ===== System |
- | This section describes | + | This section describes |
Here's the current hardware system specifications: | Here's the current hardware system specifications: | ||
- | | *Name* | *Description* | | + | | **Name** | **Description** | |
- | | "EK1100": | + | | EK1100 | Beckhoff E-bus copuler | |
- | | "EL1124": | + | | EL1124 | 4-channel digital input (5V) | |
- | | "EL2124": | + | | EL2124 | 4-channel digital output (5V) | |
- | | "EL3004": | + | | EL3004 | 4-channel analog input terminal (-10~10V, 12bit, 16bit presentation incl. sign) | |
- | | "EL4034": | + | | EL4034 | 4-channel analog output terminalr (-10~10V, 12bit, 16bit presentation incl. sign) | |
- | | "EL9011": | + | | EL9011 | bus end cap | |
- | | "motor": | + | | motor | Maxon, brushless, 24V, 120W; gearhead ratio 1:111 | |
- | | "motor driver": | + | | motor driver | Maxon, ESCON 50/5 | |
| EXPI9301CTBLK PRO1000 | Network card, bought from " | | EXPI9301CTBLK PRO1000 | Network card, bought from " | ||
| 24V DC power | 240W | | | 24V DC power | 240W | | ||
- | Here's the software I'm using: | + | Here're the softwares: |
- | * Windows 10 OS | + | * Windows 10 OS |
- | * ET9000 | + | * ET9000 |
- | * Matlab 2015b | + | * Matlab 2015b |
- | * Microsoft Visual C++ 2012 as the compiler | + | * Microsoft Visual C++ 2012 as the compiler |
- | * ESCON Studio for motor driver configuration | + | * ESCON Studio for motor driver configuration |
- | Here's the system overview | ||
- | h3. Host-target ethernet link setup | ||
- | For more details, please | + | ==== Host-target ethernet link setup ==== |
+ | |||
+ | |||
+ | First of all, make sure the network card installed in the target is supported by Matlab xPC (check " | ||
- | First of all, make sure the network card installed in the target is supported by Matlab xPC (check @Hardware Preparation@ section). | ||
Then, | Then, | ||
- | # Open Matlab in the host computer. Type the following command | + | 1. Nummerierter ListenpunktOpen |
- | < | + | |
- | slrtexplr | + | |
- | </ | + | |
- | Here's the explorer window | + | |
- | !{width: 720px}simulinkrealtimeexplorer.png! | + | |
- | # Click " | + | |
- | < | + | |
- | IP: 192.168.0.2 | + | |
- | Subnet mask: 255.255.255.0 | + | |
- | Port: 22222 | + | |
- | Gateway: 192.168.0.100 | + | |
- | </ | + | |
- | *Note:* These settings are related to the host computer network settings (step 5). | + | |
- | Change " | + | |
- | # Set " | + | |
- | # For "Boot configuration", | + | |
- | < | + | |
- | BOOTSECT.RTT | + | |
- | xpmtgb.RTA | + | |
- | </ | + | |
- | " | + | |
- | # Setup host computer Ethernet. It's related to the target network settings (step 2). Make sure @Subnet mask@ and @Gateway@ is the same as target. | + | |
- | < | + | |
- | IP: 192.168.0.1 | + | |
- | Subnet mask: 255.255.255.0 | + | |
- | Gateway: 192.168.0.100 | + | |
- | </ | + | |
- | Like this | + | |
- | !hostnetworksetting.png! | + | |
- | *_IMPORTANT NOTE_* | + | {{: |
- | In the " | + | |
- | < | + | 2. Click " |
- | setxpcenv(' | + | |
- | </ | + | |
- | h3. Boot the target and test xPC | + | IP: 192.168.0.2 |
+ | Subnet mask: 255.255.255.0 | ||
+ | Port: 22222 | ||
+ | Gateway: 192.168.0.100 | ||
+ | |||
+ | **Note:** These settings are related to the host computer network settings (step 5). | ||
+ | |||
+ | Change " | ||
+ | 3. Set " | ||
+ | |||
+ | 4. For "Boot configuration", | ||
+ | |||
+ | BOOTSECT.RTT | ||
+ | xpmtgb.RTA | ||
+ | |||
+ | " | ||
+ | |||
+ | 5. Setup host computer Ethernet. It's related to the target network settings (step 2). Make sure Subnet mask and Gateway is the same as the target. | ||
+ | |||
+ | IP: 192.168.0.1 | ||
+ | Subnet mask: 255.255.255.0 | ||
+ | Gateway: 192.168.0.100 | ||
+ | |||
+ | Like this: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | |||
+ | For more details, please check here: http:// | ||
+ | |||
+ | ==== Boot the target and test xPC ==== | ||
+ | |||
+ | |||
+ | 1. Inserted the bootable usb flash drive to the target. Boot the target from the usb stick. Then the target should run with Matlab xPC realtime kernel. If your target has a monitor, you should see something like this: | ||
+ | |||
+ | {{: | ||
- | # Inserted the bootable usb flash drive to the target. Boot the target from the usb stick. Then the target should run with Matlab xPC realtime kernel. If your target has a monitor, you should see something like this: | ||
- | !{width: 480px}xpc-startupscreen.jpg! | ||
Check your host-target communication settings in the right-bottom corner: | Check your host-target communication settings in the right-bottom corner: | ||
- | !{width: 480px}xpc-startupscreen-info.jpg! | ||
- | Make sure they are correct. | ||
- | # For testing the configuration, | ||
- | <pre> | ||
- | slrttest | ||
- | </ | ||
- | in the Matlab command window of the host. If all your setup is correct, you should get something like this: | ||
- | <pre> | ||
- | ### Simulink Real-Time Test Suite | ||
- | ### Host-Target interface is: TCP/IP (Ethernet) | ||
- | ### Test 1, Ping target computer ' | ||
- | ### Test 2, Ping target computer ' | ||
- | ### Test 3, Software reboot the target computer ' | ||
- | ### Test 4, Build and download a Simulink Real-Time application using model xpcosc to target computer ' | ||
- | ### Test 5, Check host-target command communications with ' | ||
- | ### Test 6, Download a pre-built Simulink Real-Time application to target computer ' | ||
- | ### Test 7, Execute the Simulink Real-Time application for 0.2s: ... OK | ||
- | ### Test 8, Upload logged data and compare with simulation results: ... OK | ||
- | ### Test Suite successfully finished | ||
- | </ | ||
- | h3. EtherCAT slave configuration | + | {{: |
+ | |||
+ | |||
+ | Make sure they are the same as what you configured. | ||
+ | |||
+ | 2. For testing the configuration, | ||
+ | |||
+ | slrttest | ||
+ | |||
+ | in the Matlab command window (host PC). If all your setup is correct, you should get something like this: | ||
+ | |||
+ | ### Simulink Real-Time Test Suite | ||
+ | ### Host-Target interface is: TCP/IP (Ethernet) | ||
+ | ### Test 1, Ping target computer ' | ||
+ | ### Test 2, Ping target computer ' | ||
+ | ### Test 3, Software reboot the target computer ' | ||
+ | ### Test 4, Build and download a Simulink Real-Time application using model xpcosc to target computer ' | ||
+ | ### Test 5, Check host-target command communications with ' | ||
+ | ### Test 6, Download a pre-built Simulink Real-Time application to target computer ' | ||
+ | ### Test 7, Execute the Simulink Real-Time application for 0.2s: ... OK | ||
+ | ### Test 8, Upload logged data and compare with simulation results: ... OK | ||
+ | ### Test Suite successfully finished | ||
+ | |||
+ | |||
+ | ==== EtherCAT slave configuration | ||
+ | |||
+ | This part is well documented by Mathworks. Please find the detailed info [[https:// | ||
+ | |||
+ | |||
+ | ===== Run Simulink in Realtime ===== | ||
+ | |||
+ | In order to run the simulink in realtime (on the target machine) with EtherCAT, the EtherCAT Init block is needed. The configure file, PCI bus number, and the PCI slot number has to be configured correctly according to the setup. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | In addition, the solver of the simulink model has to be configured as " | ||
- | * Connect EtherCAT slave to your host computer with ethernet cable. | + | {{: |
- | * Open ET9000 software. | + | |
- | h2. Test xPC with EtherCAT | + | And the " |
- | h3. Demo1: Digital IO | + | {{:simulinkmodelconfig1.png? |
- | !simulinkmodelconfig1.png! | ||
- | !simulinkmodelconfig2.png! | ||
- | !ethercatinitblock.png! | ||
- | h3. Demo2: Analog IO | ||
- | h3. Demo3: Motor Current Control | ||
realtime_control_environment_setup.1563982505.txt.gz · Zuletzt geändert: 27.11.2022 22:55 (Externe Bearbeitung)