Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ajakhotia/nioc

Repository files navigation

infra-congruency-check docker-image

nioc β€” Nerve IO Core Library

Core C++ utilities for building high-performance robotics and AI applications on edge devices.

πŸš€ Capabilities

Core Utilities (nioc::common)

  • Thread-Safe Wrappers: Locked<T> template for protecting non-atomic types from access contention with automatic mutex management
  • Cache Management: CacheManager<T> for managing cache implementations with automatic validity checking and reset
  • Type Traits: Advanced C++20 type manipulation utilities and compile-time type checking

Geometry Processing (nioc::geometry)

  • Reference Frames: Type-safe compile-time frame management with StaticFrame<FrameId>
  • 3D Transformations: Rigid body transforms, poses, and rotations with Eigen3 integration
  • Geometric Primitives: Frame references, frame concepts, and geometric constants
  • Type Safety: Template-based compile-time type validation with static assertions

High-Performance Logging (nioc::logger)

  • Memory-Mapped I/O: Efficient file-based logging using Boost.Iostreams
  • Structured Data: Cap'n Proto serialization for high-performance binary logging
  • Concurrent Access: Separate reader/writer interfaces for concurrent log processing
  • Configurable Storage: Customizable file sizes and storage locations
  • Log Replay: Built-in log reader for data analysis and replay

Message Passing (nioc::messages)

  • Serialization Framework: Cap'n Proto-based message serialization
  • Memory-Mapped Messages: MMappedMessageReader for efficient message deserialization
  • Base Message Types: Foundation classes for building custom message protocols
  • Schema Support: IDL-based message schema definitions

Development Features

  • Modern C++20: Full C++20 standard support with std::span, std::ranges, and std::format
  • Cross-Platform: Tested on Ubuntu 22.04+ with GNU and Clang compiler support
  • CMake Integration: Advanced CMake utilities for library and executable exports
  • Code Quality: Integrated clang-format and clang-tidy support
  • Testing Framework: GoogleTest integration with CTest runner

πŸ› οΈ Setup

The following instructions have been tested on Ubuntu 22.04 and Ubuntu 24.04. Read the docker/ubuntu.dockerfile for details.

πŸ“‚ Clone

Before getting started, define three paths and ensure you have read and write permission for each. These paths are referenced throughout the rest of this document using the following tokens. Substitute your actual paths wherever these tokens appear.

SOURCE_DIR

Path where you will clone the nioc project. This may be a temporary directory if you only plan to build once. Examples:

  • "${HOME}/sandbox/nioc"
  • "/tmp/nioc"

BUILD_DIR

Path where you will create the build tree. This may also be temporary if you are not iterating on builds. Examples:

  • "${SOURCE_DIR}/build"
  • "/tmp/nioc-build"
  • "${HOME}/sandbox/nioc-build"

INSTALL_DIR

Path where installation artifacts will be placed. Keep this directory long-term; it will contain executables, libraries, and supporting files. Examples:

  • "${HOME}/usr"
  • "${HOME}/opt"
  • "/opt/nioc" (requires sudo during the build step)
  • "/usr" (requires sudo during the build step)

NOTE: The build step of nioc (which is a super-build) triggers the download, configure, build, and install steps of all the child libraries. Hence, sudo is needed during the build step when installing to a location that requires superuser privileges to write to. As a general rule prefer to install to locations that do not require extra privileges.

NOTE: You may export these paths as environment variables in your current terminal context if you prefer

export SOURCE_TREE=${HOME}/sandbox/nioc
export BUILD_TREE=${HOME}/sandbox/nioc/build
export INSTALL_TREE=${HOME}/opt/nioc

Clone the nioc project using the following:

git clone [email protected]:ajakhotia/nioc.git ${SOURCE_TREE}

πŸ”§ Install tools

Install jq so that we can extract the list of system dependencies from the systemDependencies.json file.

sudo apt install -y --no-install-recommends jq

Install cmake. You may skip this if your OS-default cmake version is > 3.27

sudo bash tools/installCMake.sh

Install basic build tools:

sudo apt install -y --no-install-recommends \
  $(sh tools/apt/extractDependencies.sh Basics systemDependencies.json)

Set up apt-sources for the latest compilers / toolchains. Prefer to skip this if the default OS-provided compilers / toolchains are new enough. Note the following constraints:

  • GNU compilers >= version 12
  • LLVM compilers >= version 19
  • Cuda toolkit >= version 13

You are responsible for installing the appropriate compilers / toolchains yourself if you are skipping the commands below.

sudo bash tools/apt/addGNUSources.sh -y
sudo bash tools/apt/addLLVMSources.sh -y
sudo bash tools/apt/addNvidiaSources.sh -y
sudo apt update && sudo apt install -y --no-install-recommends $(sh tools/apt/extractDependencies.sh Compilers systemDependencies.json)

External Dependencies

nioc depends on the following external libraries:

  • Boost (headers + iostreams)
  • Cap'n Proto
  • Eigen3
  • GoogleTest
  • Nlohmann JSON
  • Spdlog

It's recommended to use robotFarm to build these. Here is how it can be done using the quick start instructions:

export ROBOT_FARM_INSTALL_TREE=/opt/robotFarm
curl -fsSL                                                                                          \
  https://raw.githubusercontent.com/ajakhotia/robotFarm/refs/heads/main/tools/quickBuild.sh |       \
  sudo bash -s --                                                                                   \
    --version v1.1.0                                                                                \
    --prefix ${ROBOT_FARM_INSTALL_TREE}                                                             \
    --build-list "BoostExternalProject;CapnprotoExternalProject;Eigen3ExternalProject;GoogleTestExternalProject;NlohmannJsonExternalProject;SpdLogExternalProject"

For more details, see the robotFarm README.


πŸ› οΈ Build Instructions

Clone

git clone [email protected]:ajakhotia/nioc.git <SOURCE_TREE>

Configure

Use CMake (with Ninja recommended):

cmake                                                       \
    -G Ninja                                                \
    -S ${SOURCE_TREE}                                       \
    -B ${BUILD_TREE}                                        \
    -DCMAKE_BUILD_TYPE:STRING="Release"                     \
    -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_TREE}             \
    -DBUILD_SHARED_LIBS:BOOL=ON                             \
    -DCMAKE_PREFIX_PATH:PATH=${ROBOT_FARM_INSTALL_TREE}

Notes:

  • Set CMAKE_BUILD_TYPE to "Debug" for debug builds.
  • Set BUILD_SHARED_LIBS=OFF for static builds (requires static versions of dependencies).

Build

cmake --build <BUILD_TREE>

Install

cmake --install <BUILD_TREE>

🀝 Contributing

We welcome contributions! Please follow the project conventions when submitting PRs.

Naming Conventions

  • Member variables: mCamelCase
  • Compile-time constants: kCamelCase
  • Types: PascalCase
  • Everything else (including filenames): camelCase

🧰 Tooling

Clang Format

CMake automatically detects clang-format-14 and creates the target niocClangFormat. Run it to format all C/C++ code in the repository.

Clang Tidy

Generate .clang-tidy with:

clang-tidy-12 -checks=android-*,bugprone-*,cert-*,cppcoreguidelines-*,hicpp-*,misc-*,modernize-*,openmp-*,performance-*,portability-*,readability-* --dump-config >> .clang-tidy

Enable clang-tidy in CMake with:

-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON
-DCMAKE_CXX_CLANG_TIDY:PATH=/path/to/clang-tidy-exe

πŸ“œ License

MIT Β© 2025 Anurag Jakhotia with restrictions on commercial use.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 3

  •  
  •  
  •