资源:

https://hub.docker.com/r/ripl/lcm

1.环境准备:

ubuntu

# 安装依赖
# 必选
sudo apt install build-essential libglib2.0-dev cmake
# 可选,可根据使用的语言选择安装
sudo apt install default-jdk python-all-dev liblua5.1-dev golang doxygen

2.从github上下载源码

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

3.若想安装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

4.在cpp目录下运行命令

lcm-gen -x example_t.lcm
make
./listener

5.在python目录下运行:

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

效果如下:
在这里插入图片描述

Logo

GitCode 天启AI是一款由 GitCode 团队打造的智能助手,基于先进的LLM(大语言模型)与多智能体 Agent 技术构建,致力于为用户提供高效、智能、多模态的创作与开发支持。它不仅支持自然语言对话,还具备处理文件、生成 PPT、撰写分析报告、开发 Web 应用等多项能力,真正做到“一句话,让 Al帮你完成复杂任务”。

更多推荐