Metadata-Version: 2.2
Name: spirems
Version: 0.4.5
Summary: Spire message system, a lightweight message publishing and subscription software package similar to ROS.
Author: jario
Author-email: jario <renjin@bit.edu.cn>
Maintainer-email: jario <renjin@bit.edu.cn>
License: Apache-2.0
Project-URL: Homepage, https://www.wolai.com/duBWkKUCYQJCVSGPwueCrx
Project-URL: Source, https://gitee.com/jario-jin/spirems
Project-URL: Documentation, https://www.wolai.com/duBWkKUCYQJCVSGPwueCrx
Project-URL: Bug Reports, https://gitee.com/jario-jin/spirems/issues
Project-URL: Changelog, https://gitee.com/jario-jin/spirems/releases
Keywords: message-system,lightweight,computer-vision,SpireMS
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: opencv-python
Requires-Dist: psutil
Requires-Dist: jsonschema
Requires-Dist: colorama
Provides-Extra: extra
Requires-Dist: pynvjpeg; extra == "extra"
Dynamic: author
Dynamic: requires-python

<img src="https://pic.imgdb.cn/item/66aa326bd9c307b7e9462498.png" alt="SpireMS logo" align="right" height="100" />

# SpireMS

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

具体内容请参考：[SpireMS使用手册](https://www.wolai.com/duBWkKUCYQJCVSGPwueCrx)

## 安装教程

### Python安装

1. 安装（命令行执行）

```Bash
pip install spirems
```

2. 引入（Python代码）

```Python
from spirems import Subscriber, Publisher, def_msg
```

### C++安装（Ubuntu系统）

1. 依赖项安装，如果已经安装cmake、opencv则可以忽略以下2行

```Bash
sudo apt update
sudo apt -y install cmake libopencv-dev
```

2. 源码安装

```Bash
git clone https://gitee.com/jario-jin/spirems.git
cd spirems/spirems_cpp
mkdir build && cd build
cmake ..
sudo make install
```

3. 在自己项目的CMakeLists.txt中引入SpireMS

```
find_package(SpireMS REQUIRED)
include_directories(${SpireMS_INCLUDE_DIRS})
target_link_libraries(YourAppName ${SpireMS_LIBS})
```

## 使用说明

### Python使用说明
1. 启动Core服务

```Bash
smscore
```

2.  发布话题
```Python
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)
```

3.  订阅话题
```Python
from spirems import Subscriber

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

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

### C++使用说明

1. 启动Core服务（命令行方式，也可以用Python中的启动方式，启动一次即可）

```Bash
smscore
```

2. 发布话题
```C++
#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);
    }
}
```

3. 订阅话题
```C++
#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. 显示所有话题

```Bash
sms list
```

2. 打印话题

```Bash
sms echo /topic/hello
```

3. 打印话题频率

```Bash
sms hz /topic/hello
```

4. 打印参数服务器所有参数

```Bash
smsparam list
```

5. 在线更新参数

```Bash
smsparam set param_key param_value
```

6. 导出所有参数

```Bash
smsparam export output.json
```

## 参与贡献

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