this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Continue rapport

+74 -15
+74 -15
rapport/sdk2-study.typ
··· 1 + #show figure: set block(spacing: 3em) 2 + 1 3 Unitree met à disposition du public un _SDK_#footnote[Kit de développement logiciel (Software Development Kit)] permettant de contrôler ses robots (dont le H1v2). 2 4 3 5 == Une base de code partiellement open-source 4 6 5 - Le code source du SDK d'unitree est disponible sur _Github_ à https://github.com/unitreerobotics/unitree_sdk2. Cependant, le code source comprend des fichiers binaires déjà compilés: 7 + Le code source du SDK d'unitree est disponible sur Github @sdk2_source_today. Cependant, le dépôt git comprend des fichiers binaires déjà compilés: 6 8 7 9 #figure( 8 - caption: [Résultat de `tree lib thirdparty` dans le dépot git @sdk2_source_today], 10 + caption: [Résultat de `tree lib thirdparty` dans le dépot git], 9 11 ``` 10 12 lib 11 13 ├── aarch64 ··· 32 34 33 35 Compiler le SDK nécéssite l'existance de ces fichiers binaires: 34 36 35 - #import "@preview/zebraw:0.5.5": zebraw 37 + #import "@preview/zebraw:0.5.5" 38 + #let zebraw = (..args) => zebraw.zebraw(lang: false, background-color: luma(255), ..args) 36 39 37 40 #figure( 38 41 caption: [Extrait de `cmake/unitree_sdk2Targets.cmake`], 39 42 zebraw( 40 43 numbering-offset: 63 - 1, 41 44 highlight-lines: (4,), 42 - lang: false, 43 - background-color: luma(255), 44 - ```cmake 45 - # Create imported target unitree_sdk2 46 - add_library(unitree_sdk2 STATIC IMPORTED GLOBAL) 47 - set_target_properties(unitree_sdk2 PROPERTIES 48 - IMPORTED_LOCATION ${_IMPORT_PREFIX}/lib/libunitree_sdk2.a 49 - INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include" 50 - INTERFACE_LINK_LIBRARIES "ddsc;ddscxx;Threads::Threads" 51 - LINKER_LANGUAGE CXX 52 - ``` 45 + ```cmake 46 + # Create imported target unitree_sdk2 47 + add_library(unitree_sdk2 STATIC IMPORTED GLOBAL) 48 + set_target_properties(unitree_sdk2 PROPERTIES 49 + IMPORTED_LOCATION ${_IMPORT_PREFIX}/lib/libunitree_sdk2.a 50 + INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include" 51 + INTERFACE_LINK_LIBRARIES "ddsc;ddscxx;Threads::Threads" 52 + LINKER_LANGUAGE CXX 53 + ``` 53 54 )) 54 55 55 56 Ici est défini, via `set_target_properties(... IMPORTED_LOCATION)`, le chemin d'une bibliothèque à lier avec la bibliothèque finale @cmake-imported-location. 56 57 57 - == Canaux DDS bas niveau 58 + On confirme ceci en lançant `mkdir build && cd build && cmake ..` après avoir supprimé le répertoire `lib/` : 59 + 60 + #{ 61 + show regex(".*CMake Error.*"): set text(fill: red) 62 + show regex(".*not found.*"): set text(fill: red) 63 + 64 + zebraw( 65 + highlight-lines: (18, 19), 66 + numbering: false, 67 + ``` 68 + -- The C compiler identification is GNU 13.3.0 69 + -- The CXX compiler identification is GNU 13.3.0 70 + -- Detecting C compiler ABI info 71 + -- Detecting C compiler ABI info - done 72 + -- Check for working C compiler: /usr/bin/cc - skipped 73 + -- Detecting C compile features 74 + -- Detecting C compile features - done 75 + -- Detecting CXX compiler ABI info 76 + -- Detecting CXX compiler ABI info - done 77 + -- Check for working CXX compiler: /usr/bin/c++ - skipped 78 + -- Detecting CXX compile features 79 + -- Detecting CXX compile features - done 80 + -- Setting build type to 'Release' as none was specified. 81 + -- Current system architecture: x86_64 82 + -- Performing Test CMAKE_HAVE_LIBC_PTHREAD 83 + -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success 84 + -- Found Threads: TRUE 85 + -- Importing: /home/glebihan/playground/unitree_sdk2/thirdparty/lib/x86_64/libddsc.so 86 + -- Importing: /home/glebihan/playground/unitree_sdk2/thirdparty/lib/x86_64/libddscxx.so 87 + 88 + CMake Error at CMakeLists.txt:42 (message): 89 + Unitree SDK library for the architecture is not found 90 + 91 + 92 + -- Configuring incomplete, errors occurred! 93 + ``` 94 + ) 95 + } 96 + 97 + Les logs montrent aussi que les recettes de compilation dépendent de versions précompilées de LibDDSC et LibDDSCXX, dont le code source semble cependant être fourni dans le code source: 98 + 99 + ```sh-session 100 + thirdparty/include/dds 101 + ├── config.h 102 + ├── ddsc 103 + │   ├── dds_basic_types.h 104 + │   ├── dds_data_allocator.h 105 + │   ├── dds_internal_api.h 106 + │   ├── dds_loan_api.h 107 + │   ├── dds_opcodes.h 108 + │   ├── dds_public_alloc.h 109 + ... 110 + ``` 111 + 112 + Ces particularités laissent planner quelques doutes sur la nature open-source du code: ces binaires requis sont-ils seulement présent pour améliorer l'expérience développeur en accélererant la compilation, ou "cachent"-ils du code non public? 58 113 59 114 == Rétroingénierie des binaires 115 + 116 + Ces constats ont motivé une première tentative de décompilation de ces `libunitree_sdk2.a` pour comprendre le fonctionnement du SDK2. 117 + 118 + == Canaux DDS bas niveau 60 119 61 120 == Un autre bridge existant: `unitree_mujoco` 62 121