No project description provided
Project description
SpireMS
介绍
Spire消息系统,一个类似ROS的轻量化消息发布、订阅软件包,支持图像、雷达等传感器话题。
具体内容请参考:SpireMS使用手册
安装教程
Python安装
- 安装(命令行执行)
pip install spirems
- 引入(Python代码)
from spirems import Subscriber, Publisher, def_msg
C++安装(Ubuntu系统)
- 依赖项安装,如果已经安装cmake、opencv则可以忽略以下2行
sudo apt update
sudo apt -y install cmake libopencv-dev
- 源码安装
git clone https://gitee.com/jario-jin/spirems.git
cd spirems/spirems_cpp
mkdir build && cd build
cmake ..
sudo make install
- 在自己项目的CMakeLists.txt中引入SpireMS
find_package(SpireMS REQUIRED)
include_directories(${SpireMS_INCLUDE_DIRS})
target_link_libraries(YourAppName ${SpireMS_LIBS})
使用说明
Python使用说明
- 启动Core服务
smscore
- 发布话题
from spirems import Publisher, def_msg
import time
pub = Publisher('/topic/hello', 'std_msgs::String')
msg = def_msg('std_msgs::String')
while True:
msg['data'] = 'hello world!'
pub.publish(msg)
time.sleep(1)
- 订阅话题
from spirems import Subscriber
def callback_f(msg):
print(msg['data'])
sub = Subscriber('/topic/hello', 'std_msgs::String', callback_f)
C++使用说明
- 启动Core服务(命令行方式,也可以用Python中的启动方式,启动一次即可)
smscore
- 发布话题
#include <sms_core.h>
int main(int argc, char *argv[])
{
sms::Publisher pub("/topic/hello", "std_msgs::String");
nlohmann::json msg = sms::def_msg("std_msgs::String");
while (true)
{
msg["data"] = "hello world!";
pub.publish(msg);
sleep(1);
}
}
- 订阅话题
#include <sms_core.h>
void callback(nlohmann::json msg)
{
std::cout << msg["data"] << std::endl;
}
int main(int argc, char *argv[])
{
sms::Subscriber sub("/topic/hello", "std_msgs::String", callback);
sub.join();
return 0;
}
命令行控制
- 显示所有话题
sms list
- 打印话题
sms echo /topic/hello
- 打印话题频率
sms hz /topic/hello
- 打印参数服务器所有参数
smsparam list
- 在线更新参数
smsparam set param_key param_value
- 导出所有参数
smsparam export output.json
参与贡献
- Fork 本仓库
- 新建 Feat_xxx 分支
- 提交代码
- 新建 Pull Request
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
spirems-0.3.1-py3-none-any.whl
(695.3 kB
view details)
File details
Details for the file spirems-0.3.1-py3-none-any.whl.
File metadata
- Download URL: spirems-0.3.1-py3-none-any.whl
- Upload date:
- Size: 695.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b76944301a4eedb7ff716c80a3be267dc0d2fcccb1cc844bcd339707a05efe08
|
|
| MD5 |
fd22fe486786d6141b669e70ea7b762a
|
|
| BLAKE2b-256 |
bd1234c2ba7e93811a0766f7b402b243d8ed7a73457807efb74b34fc1c8295e2
|