Skip to content

Jiu-xiao/libxr

Repository files navigation

LibXR

Want to be the best embedded framework

License Documentation GitHub Issues C/C++ CI Generate and Deploy Doxygen Docs CI/CD - Python Package FOSSA Status

English | 中文

Who is this library for

  • People who do not require desktop and web applications.
  • Realtime and high performance.
  • Finish the entire project quickly and reliably.
  • Don't want to care about the differences in APIs.

Hardware Support

Platform Peripheral Support List

System Layer

  1. The application will never exit unless it reboot or enter into low-power mode.
  2. All memory is only allocated during initializtion and will never be released.
  3. The minimum Non-blocking delay is 1us, minimum blocking delay is 1ms.
  4. All unused functions will not be linked.
System Thread Timer Semaphore Mutex Queue ASync
None
FreeRTOS
ThreadX
Linux
Webots(Linux)
WebAssembly(SingleThread)

Data structure

Structure List Stack RBTree LockFreeQueue LockFreeList

Middleware

Middleware Event Message Ramfs Terminal Database Log

Utils

Some useful tools for debugging, robotics, and communication.

Kinematics Forward-Kinematics Inverse-Kinematics Coordinate Pose and Position
Dynamics Inertia Torque G-Compensation
Control PID LQR MPC
Signal LP Filter Kalman Filter FFT FunctionGen
Math CycleValue CRC8/16/32 Triangle

Usage

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# LibXR
set(LIBXR_SYSTEM FreeRTOS) # None/Linux/FreeRTOS...
set(LIBXR_DRIVER st)       # st/Linux/...
add_subdirectory(path_to_libxr)

target_link_libraries(${CMAKE_PROJECT_NAME}
    xr
)

target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE
    PUBLIC $<TARGET_PROPERTY:xr,INTERFACE_INCLUDE_DIRECTORIES>
)

General CMake Configuration

System and Driver Platform Selection

By default, the host system (Linux, Windows) is automatically detected, and LIBXR_SYSTEM and LIBXR_DRIVER are set accordingly. You can also manually specify them via the CMake command line or in an external CMakeLists.txt, corresponding to the different folders under system and driver.

# Manually specify system and driver
set(LIBXR_SYSTEM Linux)
set(LIBXR_DRIVER Linux)

Build as Shared/Static Library

By default, the library is built as an object target. You can explicitly set the build type in the CMake command line or your own CMakeLists.txt:

# Build as a shared library
set(LIBXR_SHARED_BUILD True)

# Build as a static library
set(LIBXR_STATIC_BUILD True)

Disable Eigen

This option disables building the Eigen library and will also disable any code depending on Eigen. This is useful for platforms with incomplete C++ standard library support.

set(LIBXR_NO_EIGEN True)

Default Scalar Type

The default scalar type is double. This option only affects the default value for constructors.

set(LIBXR_DEFAULT_SCALAR float)

Internal Printf Buffer Size

Defaults to 128 for bare-metal/RTOS platforms, and 1024 for Linux. This option sets the buffer size for the LibXR::STDIO::Printf function. Setting this to 0 will disable all log printing.

set(LIBXR_PRINTF_BUFFER_SIZE 256)

Maximum Log Message Length

Defaults to 64 for bare-metal/RTOS, and 256 for Linux.

set(XR_LOG_MESSAGE_MAX_LEN 256)

Log Level

Levels 4-0 correspond to DEBUG, INFO, PASS, WARNING, and ERROR, with the default set to 4. This option determines the maximum log level allowed to be published to topics.

set(LIBXR_LOG_LEVEL 4)

Log Print Level

Levels 4-0 correspond to DEBUG, INFO, PASS, WARNING, and ERROR, with the default set to 4. This option determines the maximum log level allowed to be printed to STDIO::write_.

Unit Testing

Enable this option to build unit tests on the Linux platform.

set(LIBXR_TEST_BUILD True)

Others

STM32 C++ Code Generator

libxr-python-package

Video Tutorial

Bilibili

License

FOSSA Status

About

Standardized compatibility layer for operating systems and peripheral devices written in C++.

Resources

License

Stars

Watchers

Forks

Packages

No packages published