Skip to main content

Spire message system, a lightweight message publishing and subscription software package similar to ROS.

Project description

SpireMS logo

SpireMS

介绍

Spire消息系统,一个类似ROS的轻量化消息发布、订阅软件包,支持图像、雷达等传感器话题。

  1. 完美适配 Windows 和 Linux 系统,以及 C++、Python、Anaconda 的各类版本

  2. 一键部署安装,轻量化

  3. 可预先定义基础数据类型,也可以灵活适应新的类型

  4. 有中心模式,内置防崩溃机制,通信稳定可靠,没有订阅者不占用带宽

  5. Linux 系统下默认开启内存共享,图像传输超低延迟

    数据分发性能测试

具体内容请参考:SpireMS使用手册

安装教程

Python安装

  1. 安装(命令行执行)
pip install spirems
  1. 引入(Python代码)
from spirems import Subscriber, Publisher, def_msg

C++安装(Ubuntu系统)

  1. 依赖项安装,如果已经安装cmake、opencv则可以忽略以下2行
sudo apt update
sudo apt -y install cmake libopencv-dev
  1. 源码安装
git clone https://gitee.com/jario-jin/spirems.git
cd spirems/spirems_cpp
mkdir build && cd build
cmake ..
sudo make install
  1. 在自己项目的CMakeLists.txt中引入SpireMS
find_package(SpireMS REQUIRED)
include_directories(${SpireMS_INCLUDE_DIRS})
target_link_libraries(YourAppName ${SpireMS_LIBS})

使用说明

Python使用说明

  1. 启动Core服务
smscore
  1. 发布话题
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)
  1. 订阅话题
from spirems import Subscriber

def callback_f(msg):
    print(msg['data'])

sub = Subscriber('/topic/hello', 'std_msgs::String', callback_f)

C++使用说明

  1. 启动Core服务(命令行方式,也可以用Python中的启动方式,启动一次即可)
smscore
  1. 发布话题
#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);
    }
}
  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;
}

命令行控制

  1. 显示所有话题
sms list
  1. 打印话题
sms echo /topic/hello
  1. 打印话题频率
sms hz /topic/hello
  1. 打印参数服务器所有参数
smsparam list
  1. 在线更新参数
smsparam set param_key param_value
  1. 导出所有参数
smsparam export output.json

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request

Project details


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

If you're not sure about the file name format, learn more about wheel file names.

spirems-0.8.1-py3-none-any.whl (1.5 MB view details)

Uploaded Python 3

File details

Details for the file spirems-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: spirems-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.10

File hashes

Hashes for spirems-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 26a334355c3284dc56b794df10190592540f15f1ce8ccf5b10b86912aa84fad2
MD5 49dc7b7973fd1dfd1cbcf8a9c82a461b
BLAKE2b-256 0ff9e8c7207aa6665b8ddf52719ba0d68bb2c42378aeb76ec7ff2d60a01744e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page