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.
- 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.
Install the package using npm or yarn:
npm install asam-osi-types
or
yarn add asam-osi-types
Here are the available commands and scripts for working with the project:
npm run build
or
yarn build
Compiles the TypeScript code into JavaScript. The compiled output is stored in the dist/ folder.
npm run setup
or
yarn setup
Installs the OSI dependencies
npm run generate
or
yarn generate
Generates protobuf files
npm run lint
or
yarn lint
Lints the project using ESLint to enforce consistent code style.
npm run test
or
yarn test
Runs the test suite to ensure the code functions as expected.
npm run clean
or
yarn clean
Removes the build output (dist/) and cleans up the workspace.
npm run format
or
yarn format
Formats the codebase using Prettier to maintain consistent styling.
Here’s how to use the provided type definitions in a TypeScript project:
import { OsiMessage } from "@lichtblick/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);
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.
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";
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.
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.
This project is licensed under the Mozilla Public License 2.0. For more details, see the LICENSE file.