lcm安裝c++和python版本,不同編程語言之間相互通信

 從github上下載源碼

git clone https://github.com/lcm-proj/lcm.git
cd lcm
mkdir build
cd build
cmake ..
make
sudo make install

若想安裝python版本:

cd lcm
cd lcm-python
python3 setup.py install

examples下關於types, cpp, python的文件結構如下:

├── cpp
│   ├── exlcm
│   │   ├── exampleconst_t.hpp
│   │   ├── example_list_t.hpp
│   │   ├── example_t.hpp
│   │   ├── muldim_array_t.hpp
│   │   └── node_t.hpp
│   ├── listener
│   ├── listener.cpp
│   ├── listener.o
│   ├── Makefile
│   ├── read-log
│   ├── read_log.cpp
│   ├── read_log.o
│   ├── send-message
│   ├── send_message.cpp
│   └── send_message.o
├── python
│   ├── cleanup.sh
│   ├── exlcm
│   │   ├── exampleconst_t.py
│   │   ├── example_list_t.py
│   │   ├── example_t.py
│   │   ├── __init__.py
│   │   ├── muldim_array_t.py
│   │   ├── node_t.py
│   │   └── __pycache__
│   │       ├── exampleconst_t.cpython-36.pyc
│   │       ├── example_list_t.cpython-36.pyc
│   │       ├── example_t.cpython-36.pyc
│   │       ├── __init__.cpython-36.pyc
│   │       ├── muldim_array_t.cpython-36.pyc
│   │       └── node_t.cpython-36.pyc
│   ├── gen-types.sh
│   ├── listener.py
│   ├── listener_select.py
│   ├── read-log.py
│   └── send-message.py
└── types
    ├── exampleconst_t.lcm
    ├── example_list_t.lcm
    ├── example_t.lcm
    ├── multidim_array_t.lcm
    └── node_t.lcm

在cpp目錄下運行命令

make
./listener

在python目錄下運行:

./gen-types.sh
python send-message.py

效果如下:

lcm教程與實例(C++ API)

lcm實例(Python API)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章