From 90372ba13b691e481d1bee9fcb72c87fcbc14a39 Mon Sep 17 00:00:00 2001 From: liufang-robot <61956285+liufang-robot@users.noreply.github.com> Date: Wed, 1 Feb 2023 13:52:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=8C=E5=96=84=E6=96=87=E6=A1=A3?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0dotnet=E7=9A=84=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E3=80=82=20(#31)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 完善文档,添加dotnet的文档。 * fix: 修正linux_python_build.yml重复编译的问题,以及没有指定PYTHONPATH的问题。 --- .github/workflows/linux_python_build.yml | 8 +-- CMakeLists.txt | 2 +- Doxyfile | 2 +- README.md | 28 +++++++++- doc/dotnet.md | 68 ++++++++++++++++++++++++ doc/python.md | 14 ++--- dotnet/lebai.csproj.in | 2 +- sdk/include/lebai/lebai.hh | 5 +- sdk/include/lebai/robot.hh | 12 +++-- 9 files changed, 118 insertions(+), 23 deletions(-) create mode 100644 doc/dotnet.md diff --git a/.github/workflows/linux_python_build.yml b/.github/workflows/linux_python_build.yml index 0a3bd39..ac0fc55 100644 --- a/.github/workflows/linux_python_build.yml +++ b/.github/workflows/linux_python_build.yml @@ -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; diff --git a/CMakeLists.txt b/CMakeLists.txt index e4320d3..ec97156 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}") diff --git a/Doxyfile b/Doxyfile index f00da1d..4502b16 100644 --- a/Doxyfile +++ b/Doxyfile @@ -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 diff --git a/README.md b/README.md index 75140d7..1fd3c8c 100755 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ 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 @@ -12,12 +14,15 @@ lebai-sdk的源代码仓库,可以用于控制乐白机械臂. [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 ``` @@ -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平台 @@ -103,6 +124,9 @@ pip3 install pylebai-xxx.whl pip3 uninstall pylebai ``` + + + # 第三方库 lebai-sdk使用如下第三方软件: diff --git a/doc/dotnet.md b/doc/dotnet.md new file mode 100644 index 0000000..39585d4 --- /dev/null +++ b/doc/dotnet.md @@ -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. +``` + + + diff --git a/doc/python.md b/doc/python.md index 69a5b60..da5f04d 100755 --- a/doc/python.md +++ b/doc/python.md @@ -3,7 +3,9 @@ ## 通过pypi安装 -TODO +``` +pip3 install pylebai +``` ## 通过源码构建安装 @@ -22,19 +24,19 @@ 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 ``` ### 运行 @@ -42,8 +44,8 @@ sudo pip3 uninstall lebai 安装完成后可以直接使用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) ``` diff --git a/dotnet/lebai.csproj.in b/dotnet/lebai.csproj.in index 8db07ce..53b14d9 100644 --- a/dotnet/lebai.csproj.in +++ b/dotnet/lebai.csproj.in @@ -9,7 +9,7 @@ @PROJECT_VERSION@ - .NET wrapper for the CMakeSwig project + .NET wrapper for the lebai-sdk project @DOTNET_PROJECT@ v@PROJECT_VERSION@ diff --git a/sdk/include/lebai/lebai.hh b/sdk/include/lebai/lebai.hh index 0eb96d1..55e9b08 100644 --- a/sdk/include/lebai/lebai.hh +++ b/sdk/include/lebai/lebai.hh @@ -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. diff --git a/sdk/include/lebai/robot.hh b/sdk/include/lebai/robot.hh index 17afd45..2e12bfb 100644 --- a/sdk/include/lebai/robot.hh +++ b/sdk/include/lebai/robot.hh @@ -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