@lichtblick/asam-osi-types
v3.7.0
Published
ASAM Open Simulation Interface (ASAM OSI) types for Typescript
Downloads
147
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-types
or
yarn add asam-osi-types
Build and Scripts
Here are the available commands and scripts for working with the project:
Build
npm run build
or
yarn build
Compiles the TypeScript code into JavaScript. The compiled output is stored in the dist/ folder.
Setup
npm run setup
or
yarn setup
Installs the OSI dependencies
Generate
npm run generate
or
yarn generate
Generates protobuf files
Lint
npm run lint
or
yarn lint
Lints the project using ESLint to enforce consistent code style.
Test
npm run test
or
yarn test
Runs the test suite to ensure the code functions as expected.
Clean
npm run clean
or
yarn clean
Removes the build output (dist/) and cleans up the workspace.
Additional Commands
npm run format
or
yarn format
Formats 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 link
Create a local typescript test project with an index.ts file
mkdir test-project && cd $_ && touch index.ts
Initialize project
npm init -y
Link test project with the package
npm link asam-osi-types
Import 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.