@lichtblick/asam-osi-types
v3.7.0
Published
ASAM Open Simulation Interface (ASAM OSI) types for Typescript
Readme
ASAM OSI Types
ASAM OSI Types provides TypeScript type definitions for the Open Simulation Interface (OSI) specification. OSI facilitates the interoperability of simulation environments in automated driving and advanced driver-assistance systems (ADAS) development.
Features
- Comprehensive TypeScript type definitions for the OSI specification.
- Simplifies development by enabling static type checking in TypeScript.
- Maintains compatibility with the official OSI schema versions.
- Designed for use in simulation and modeling projects involving OSI.
Installation
Install the package using npm or yarn:
npm install asam-osi-typesor
yarn add asam-osi-typesBuild and Scripts
Here are the available commands and scripts for working with the project:
Build
npm run buildor
yarn buildCompiles the TypeScript code into JavaScript. The compiled output is stored in the dist/ folder.
Setup
npm run setupor
yarn setupInstalls the OSI dependencies
Generate
npm run generateor
yarn generateGenerates protobuf files
Lint
npm run lintor
yarn lintLints the project using ESLint to enforce consistent code style.
Test
npm run testor
yarn testRuns the test suite to ensure the code functions as expected.
Clean
npm run cleanor
yarn cleanRemoves the build output (dist/) and cleans up the workspace.
Additional Commands
npm run formator
yarn formatFormats the codebase using Prettier to maintain consistent styling.
Usage
Here’s how to use the provided type definitions in a TypeScript project:
import { OsiMessage } from "asam-osi-types";
// Example: Define an OSI Message
const message: OsiMessage = {
header: {
timestamp: {
seconds: 1627500000,
nanos: 123456789,
},
frame_id: "example-frame",
},
content: {
exampleField: "value",
},
};
console.log(message);API Documentation
Main Types
OsiMessage: Represents the base message format in OSI.Header: Metadata for OSI messages, including timestamps and IDs.Timestamp: Specifies time information.
For detailed type definitions, explore the source files in the src folder.
Local Testing
To test the package locally, build the project and run the following command to create a symbolic link for the package
npm linkCreate a local typescript test project with an index.ts file
mkdir test-project && cd $_ && touch index.tsInitialize project
npm init -yLink test project with the package
npm link asam-osi-typesImport types into the test-project
import * as types from "asam-osi-types";Versioning
The versioning for the project is handeled automatically via the github actions CI/CD workflow, it will always reflect the current version of the OSI repository.
Local versioning can be applied to the project through the package.json file, but it will not be reflected in the npm package metadata since it is overwritten when publishing.
Contributing
Contributions are welcome! Here's how you can help:
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name. - Commit your changes:
git commit -m 'Add feature-name'. - Push to the branch:
git push origin feature-name. - Submit a pull request.
Please ensure all code adheres to the Mozilla Public License 2.0 and follows the repository's coding standards.
Related Projects
License
This project is licensed under the Mozilla Public License 2.0. For more details, see the LICENSE file.
