Skip to content

Commit

Permalink
fix: 完善文档,添加dotnet的文档。 (#31)
Browse files Browse the repository at this point in the history
* fix: 完善文档,添加dotnet的文档。

* fix: 修正linux_python_build.yml重复编译的问题,以及没有指定PYTHONPATH的问题。
  • Loading branch information
liufang-robot authored Feb 1, 2023
1 parent 75ca49b commit 90372ba
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 23 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/linux_python_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,13 @@ jobs:
- run: for PYBIN in /opt/python/*/bin;do "${PYBIN}/pip" install -r requirements.txt; done;
- run: /opt/python/cp310-cp310/bin/pip install twine==2.0.0

- name: configure
run: cmake -S. -Bbuild -DBUILD_PYTHON=ON

- name: build
run: cmake --build build

- name: create-whl-dir
run: mkdir -p whl

- name: build with python
run: for PY in /opt/python/*;do
rm -rf build;
cmake -S. -Bbuild -DBUILD_PYTHON=ON;
cmake -S. -Bbuild -DBUILD_PYTHON=ON -DPYTHONPATH=${PY};
cmake --build build;
cp build/python/dist/*.whl whl/;
done;
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

option(CMAKE_EXPORT_COMPILE_COMMANDS "Export compile command" TRUE)

project(lebai VERSION 1.0.15 LANGUAGES CXX)
project(lebai VERSION 1.0.16 LANGUAGES CXX)
set(PROJECT_NAMESPACE lebai)
message(STATUS "${PROJECT_NAME} version: ${PROJECT_VERSION}")
# message(STATUS "major: ${PROJECT_VERSION_MAJOR}")
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "lebai sdk"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 1.0.15
PROJECT_NUMBER = 1.0.16

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@ lebai-sdk的源代码仓库,可以用于控制乐白机械臂.
| Linux | [![Status][cpp_linux_svg]][cpp_linux_link] | [![Status][python_linux_svg]][python_linux_link] | [![Status][dotnet_linux_svg]][dotnet_linux_link] | TODO |
| Windows | TODO | TODO | TODO | TODO |

**上图中显示TODO的地方表示该平台该语言的实现还存在问题,没有完全测试通过,后续会陆续完成。**

[cpp_linux_svg]: https://github.com/lebai-robotics/lebai-sdk/actions/workflows/linux_cpp_release.yml/badge.svg
[cpp_linux_link]: https://github.com/lebai-robotics/lebai-sdk/actions/workflows/linux_cpp_release.yml
[python_linux_svg]: https://github.com/lebai-robotics/lebai-sdk/actions/workflows/linux_python_release.yml/badge.svg
[python_linux_link]: https://github.com/lebai-robotics/lebai-sdk/actions/workflows/linux_python_release.yml
[dotnet_linux_svg]: https://github.com/lebai-robotics/lebai-sdk/actions/workflows/linux_dotnet_release.yml/badge.svg
[dotnet_linux_link]: https://github.com/lebai-robotics/lebai-sdk/actions/workflows/linux_dotnet_release.yml


[SDK在线文档](http://help.lebai.ltd/sdk/)
[SDK在线文档](http://help.lebai.ltd/sdk/)中包含了lua语言的接口(本项目参考了lua语言进行接口设置,但是本项目和lua语言的接口无直接关系)

# 包管理直接安装

## python
python开发可以直接从[PyPI](https://pypi.org/project/pylebai/)安装.

**目前python仅支持linux平台,windows平台还存在问题.**

```
pip install pylebai
```
Expand All @@ -28,6 +33,22 @@ pip install pylebai
- `3.9`
- `3.10`


python开发可以直接从[PyPI](https://pypi.org/project/pylebai/)安装.


## .net
.net平台开发可以直接从[Nuget](https://www.nuget.org/packages/lebai/)安装,使用C#进行开发.

**目前.net仅支持linux平台,windows平台还存在问题.**

```
dotnet add package lebai
```
目前支持的.net版本有
- `6.0`


# 从源代码构建安装

## Ubuntu&&Debian平台
Expand Down Expand Up @@ -103,6 +124,9 @@ pip3 install pylebai-xxx.whl
pip3 uninstall pylebai
```




# 第三方库
lebai-sdk使用如下第三方软件:

Expand Down
68 changes: 68 additions & 0 deletions doc/dotnet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# .net平台应用文档

**目前.net仅支持linux平台,windows平台还存在问题.**

[Nuget包地址](https://www.nuget.org/packages/lebai/)

## 通过nuget安装'

```bash
dotnet add package lebai
```

## 示例工程运行

您可以自行创建.net工程,并且在CSharp中使用lebai包进行开发。

一个简单的示例步骤如下:

1. 创建工程


```bash
# 创建
mkdir lebai-sdk-dotnet-example
cd lebai-sdk-dotnet-example
dotnet new console
```

2. 添加lebai packages

```bash
dotnet add package lebai
```

3. 编写代码


在程序中添加如下代码

```c#
using lebai.l_master;


# in Main
Robot robot = new Robot("xxx.xxx.xxx.xxx", true);
robot.stop_sys();
Console.WriteLine($"stop...");
robot.start_sys();
Console.WriteLine($"start...");
DoubleVector jp1 = new DoubleVector();
jp1.Add(0.0);
jp1.Add(-60.0 / 180.0 * 3.14);
jp1.Add(80.0 / 180.0 * 3.14);
jp1.Add(-10.0 / 180.0 * 3.14);
jp1.Add(-60.0 / 180.0 * 3.14);
jp1.Add(0.0);
robot.movej(jp1, 1.0, 1.0, 0.0, 0.0);
```

4. 编译运行

```
dotnet build
# run your console application.
```



14 changes: 8 additions & 6 deletions doc/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

## 通过pypi安装

TODO
```
pip3 install pylebai
```

## 通过源码构建安装

Expand All @@ -22,28 +24,28 @@ cmake --build build --target python_package
构建完成后,在`build/python/dist/`目录下会生成python的whl包,可以直接使用pip进行安装。

```bash
sudo pip3 install build/python/dist/lebai-xxx.whl
pip3 install build/python/dist/pylebai-xxx.whl
```

您可以通过如下命令来查看安装的包的信息。

```bash
pip3 show lebai
pip3 show pylebai
```

您可以通过如下命令来卸载。

```bash
sudo pip3 uninstall lebai
sudo pip3 uninstall pylebai
```

### 运行

安装完成后可以直接使用lebai包。

```python
from lebai import robot
robot = robot.Robot("172.17.0.5",True)
from lebai import l_master
robot = l_master.Robot("172.17.0.5",True)
robot.movej({"j1": 1.0,"j2": -1.0471975511965976,"j3": 1.3962634015954636,"j4": -0.17453292519943295,"j5": -1.0471975511965976,"j6": 0.0},1.0,1.0,0.0,0.0)
```

Expand Down
2 changes: 1 addition & 1 deletion dotnet/lebai.csproj.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Version>@PROJECT_VERSION@</Version>

<!-- Nuget Properties -->
<Description>.NET wrapper for the CMakeSwig project</Description>
<Description>.NET wrapper for the lebai-sdk project</Description>

<!-- Pack Option -->
<Title>@DOTNET_PROJECT@ v@PROJECT_VERSION@</Title>
Expand Down
5 changes: 4 additions & 1 deletion sdk/include/lebai/lebai.hh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
* 查阅 \ref doc/changelog.md.
*
* # Python
* 查看 \ref doc/python.md 来获取使用python相关的内容.
* 查看 \ref doc/python.md 来获取使用python开发相关的内容.
*
* # .net
* 查看 \ref doc/dotnet.md 来获取在.net中使用C#开发相关的内容.
*
* # Develop
* 如果需要开发sdk,添加新的功能,可以参考 \ref doc/develop.md.
Expand Down
12 changes: 8 additions & 4 deletions sdk/include/lebai/robot.hh
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,16 @@ namespace lebai
* \brief 机器人计算相关的接口.
*/

/** \defgroup FILE 文件系统
* \brief 文件系统相关的接口
/** \defgroup FILE 文件系统.
* \brief 文件系统相关的接口.
*/

/** \defgroup MODBUS modbus
* \brief modbus相关的接口
/** \defgroup MODBUS modbus.
* \brief modbus相关的接口.
*/

/** \defgroup SCENE 场景.
* \brief 场景相关的接口.
*/

/** \addtogroup STARTSTOP
Expand Down

0 comments on commit 90372ba

Please sign in to comment.