Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/publish-pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish Python wheels

on:
# Run on workflow dispatch event
workflow_dispatch:
inputs:
repo:
description: 'Repo to upload to (testpypi or pypi)'
default: 'testpypi'
required: true

jobs:
build-wheels:
uses: ./.github/workflows/wheels.yaml
with:
repo: ${{ github.event.inputs.repo }}

publish:
# Publish built wheels to PyPI or TestPyPI using pypa/gh-action-pypi-publish
needs: build-wheels
runs-on: ubuntu-latest
permissions:
id-token: write

steps:

- name: Download artifacts
uses: actions/download-artifact@v4

- name: Extract archives, relocate wheels to dist/
run: |
mkdir -p dist/
find . -name "artifact-*" -exec unzip "{}" \;
find . -name "*.whl" -exec mv "{}" dist/ \;

- name: Print off wheel names
run: ls dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true
print-hash: true
if: ${{ github.event.inputs.repo == 'pypi' }}

- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
repository-url: https://test.pypi.org/legacy/
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
verbose: true
print-hash: true
if: ${{ github.event.inputs.repo == 'testpypi' }}
49 changes: 49 additions & 0 deletions .github/workflows/wheels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build Python wheels

on:
# Run on workflow dispatch, workflow call, push to main, or pull request to main
workflow_dispatch:
workflow_call:
inputs:
repo:
description: 'Repo to upload to (testpypi or pypi)'
type: string
default: 'testpypi'
required: true
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build-wheels:
# Build wheels on all supported Python versions and platforms using pypa/cibuildwheel
strategy:
fail-fast: false
matrix:
# Support Linux only
os: [ubuntu-latest]
cibw_arch: ["native"]
# Support Python versions 3.8 ~ 3.12
cibw_build: ["cp38-* cp39-* cp310-* cp311-* cp312-*"]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS: ${{ matrix.cibw_arch }}
CIBW_BEFORE_BUILD: "pip install -r requirements-dev.txt"
CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_SKIP: "*musllinux*"

- name: Upload the distribution files
uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.os }}-${{ matrix.cibw_arch }}
path: "./**/*.whl"
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.15.0)
project(trossen_slate VERSION 1.0.0)
project(libtrossen_slate VERSION 1.0.0)

# Set the C++ standard to 17 if not already set
if(NOT CMAKE_CXX_STANDARD)
Expand Down Expand Up @@ -39,7 +39,7 @@ include_directories(include ${CMAKE_CURRENT_BINARY_DIR}/include)

# Add the library
add_library(${PROJECT_NAME} SHARED
src/${PROJECT_NAME}.cpp
src/trossen_slate.cpp
src/base_driver.cpp
)

Expand All @@ -52,7 +52,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC
# Set properties for the library
set_target_properties(${PROJECT_NAME} PROPERTIES
POSITION_INDEPENDENT_CODE ON
OUTPUT_NAME ${PROJECT_NAME}
OUTPUT_NAME trossen_slate
)

# Link the serial driver library
Expand Down
12 changes: 6 additions & 6 deletions cmake/version.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#ifndef TROSSEN_SLATE__VERSION_HPP_
#define TROSSEN_SLATE__VERSION_HPP_
#ifndef LIBTROSSEN_SLATE__VERSION_HPP_
#define LIBTROSSEN_SLATE__VERSION_HPP_

#define VERSION_MAJOR @trossen_slate_VERSION_MAJOR@
#define VERSION_MINOR @trossen_slate_VERSION_MINOR@
#define VERSION_PATCH @trossen_slate_VERSION_PATCH@
#define VERSION_MAJOR @libtrossen_slate_VERSION_MAJOR@
#define VERSION_MINOR @libtrossen_slate_VERSION_MINOR@
#define VERSION_PATCH @libtrossen_slate_VERSION_PATCH@

#endif // TROSSEN_SLATE__VERSION_HPP_
#endif // LIBTROSSEN_SLATE__VERSION_HPP_
2 changes: 1 addition & 1 deletion demo/advanced_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include <iostream>

#include "trossen_slate/trossen_slate.hpp"
#include "libtrossen_slate/trossen_slate.hpp"

using namespace trossen_slate;

Expand Down
2 changes: 1 addition & 1 deletion demo/basic_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#include <iostream>

#include "trossen_slate/trossen_slate.hpp"
#include "libtrossen_slate/trossen_slate.hpp"

using namespace trossen_slate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#ifndef TROSSEN_SLATE__BASE_DRIVER_HPP_
#define TROSSEN_SLATE__BASE_DRIVER_HPP_
#ifndef LIBTROSSEN_SLATE__BASE_DRIVER_HPP_
#define LIBTROSSEN_SLATE__BASE_DRIVER_HPP_

#include <string>

Expand Down Expand Up @@ -67,4 +67,4 @@ bool setIo(uint32_t io);

} // namespace base_driver

#endif // TROSSEN_SLATE__BASE_DRIVER_HPP_
#endif // LIBTROSSEN_SLATE__BASE_DRIVER_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#ifndef TROSSEN_SLATE__SERIAL_DRIVER_HPP_
#define TROSSEN_SLATE__SERIAL_DRIVER_HPP_
#ifndef LIBTROSSEN_SLATE__SERIAL_DRIVER_HPP_
#define LIBTROSSEN_SLATE__SERIAL_DRIVER_HPP_

#include <termio.h>

Expand Down Expand Up @@ -82,4 +82,4 @@ class SerialDriver
std::mutex lock;
};

#endif // TROSSEN_SLATE__SERIAL_DRIVER_HPP_
#endif // LIBTROSSEN_SLATE__SERIAL_DRIVER_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

#ifndef TROSSEN_SLATE__TROSSEN_SLATE_HPP_
#define TROSSEN_SLATE__TROSSEN_SLATE_HPP_
#ifndef LIBTROSSEN_SLATE__TROSSEN_SLATE_HPP_
#define LIBTROSSEN_SLATE__TROSSEN_SLATE_HPP_

#include <array>
#include <memory>
#include <string>

#include "trossen_slate/base_driver.hpp"
#include "trossen_slate/serial_driver.hpp"
#include "trossen_slate/version.hpp"
#include "libtrossen_slate/base_driver.hpp"
#include "libtrossen_slate/serial_driver.hpp"
#include "libtrossen_slate/version.hpp"

enum class LightState : uint32_t
{
Expand Down Expand Up @@ -180,4 +180,4 @@ class TrossenSlate

} // namespace trossen_slate

#endif // TROSSEN_SLATE__TROSSEN_SLATE_HPP_
#endif // LIBTROSSEN_SLATE__TROSSEN_SLATE_HPP_
4 changes: 2 additions & 2 deletions package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>trossen_slate</name>
<name>libtrossen_slate</name>
<version>1.0.0</version>
<description>The trossen_slate package</description>

Expand All @@ -10,7 +10,7 @@
<license>BSD-3-Clause</license>

<buildtool_depend>ament_cmake</buildtool_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["scikit-build-core", "pybind11"]
build-backend = "scikit_build_core.build"

[project]
name = "pytrossen_slate"
name = "trossen_slate"
version = "1.0.0"
description = "A Python wrapper for the trossen_slate C++ library"
readme = "README.md"
Expand Down
30 changes: 15 additions & 15 deletions python/pytrossen_slate.cpp → python/trossen_slate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
#include <array>
#include <string>

#include "trossen_slate/trossen_slate.hpp"
#include "trossen_slate/base_driver.hpp"
#include "libtrossen_slate/trossen_slate.hpp"
#include "libtrossen_slate/base_driver.hpp"

namespace py = pybind11;

Expand Down Expand Up @@ -91,7 +91,7 @@ PYBIND11_MODULE(trossen_slate, m)
"data"),
R"pbdoc(
@brief Read data from the SLATE base

@param data The desired data reference to update with current data
)pbdoc")
.def(
Expand All @@ -101,7 +101,7 @@ PYBIND11_MODULE(trossen_slate, m)
"data"),
R"pbdoc(
@brief Write data to the SLATE base

@param data The desired data to write
@return true if succeeded, false otherwise
)pbdoc")
Expand All @@ -117,7 +117,7 @@ PYBIND11_MODULE(trossen_slate, m)
},
R"pbdoc(
@brief Initializes the SLATE base

@param result The resulting output string
@return true if succeeded, false otherwise
)pbdoc")
Expand All @@ -129,7 +129,7 @@ PYBIND11_MODULE(trossen_slate, m)
"angular"),
R"pbdoc(
@brief Set velocity commands in meters per seconds (linear) and radians per seconds (angular)

@param linear The desired linear velocity
@param angular The desired angular velocity
@return true if succeeded, false otherwise
Expand All @@ -141,7 +141,7 @@ PYBIND11_MODULE(trossen_slate, m)
"light_state"),
R"pbdoc(
@brief Set light state

@param light_state The desired light state
@return true if succeeded, false otherwise
)pbdoc")
Expand All @@ -152,7 +152,7 @@ PYBIND11_MODULE(trossen_slate, m)
"text"),
R"pbdoc(
@brief Set text on screen

@param text The desired text
@return true if succeeded, false otherwise
)pbdoc")
Expand All @@ -168,7 +168,7 @@ PYBIND11_MODULE(trossen_slate, m)
"enable"),
R"pbdoc(
@brief Enable/disable motor torque

@param enable Whether to enable motor torque or not
@return A pair (bool, string) indicating success and the resulting output string
)pbdoc"
Expand All @@ -185,7 +185,7 @@ PYBIND11_MODULE(trossen_slate, m)
"enable"),
R"pbdoc(
@brief Enable/disable charging

@param enable Whether to enable charging or not
@return A pair (bool, string) indicating success and the resulting output string
)pbdoc"
Expand All @@ -195,39 +195,39 @@ PYBIND11_MODULE(trossen_slate, m)
&TrossenSlate::get_vel,
R"pbdoc(
@brief Get the current velocity in meters per seconds (linear) and radians per seconds (angular)

@return The current velocity [linear velocity, angular velocity]
)pbdoc")
.def(
"get_pose",
&TrossenSlate::get_pose,
R"pbdoc(
@brief Get the current pose in meters (x,y) and radians (theta)

@return The current pose [x, y, theta]
)pbdoc")
.def(
"get_charge",
&TrossenSlate::get_charge,
R"pbdoc(
@brief Get the current charge percentage

@return The current charge
)pbdoc")
.def(
"get_current",
&TrossenSlate::get_current,
R"pbdoc(
@brief Get the current motor current in amps

@return The current motor current
)pbdoc")
.def(
"get_voltage",
&TrossenSlate::get_voltage,
R"pbdoc(
@brief Get the current voltage in volts

@return The current voltage
)pbdoc");
}
Expand Down
File renamed without changes.
Loading
Loading