lcm安装c++和python版本,不同编程语言之间相互通信

资源:

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

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

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值