1.3.1-alpha • Published 2 years ago

abconnect-sdk-lite v1.3.1-alpha

Weekly downloads
-
License
Private
Repository
github
Last release
2 years ago

ABConnect SDK for Node.js

Example Usage

import { ROSPlugin, ABConnect } from "abconnect-sdk-lite"
// or const {ROSPlugin, ABConnect} = require("abconnect-sdk-lite")

const abc = new ABConnect(
  {
    auth: "",
    host: "ws://localhost:3000",
  },
  {
    id: "clientA",
    category: "car",
  },
  new ROSPlugin(9090, false)
)

abc
  .addDeviceById("co-device")
  .then((coDevice) => {
    coDevice.addPublisher("/chatter", "std_msgs/String", {})
    coDevice.addSubscriber("/blabber", "std_msgs/String", {}, (msg) => {
      console.log(msg)
    })
  })
  .catch((error) => {
    console.log(error)
  })

Development on Docker

  1. Build an image
docker build -t abconnect-sdk-alpha .
  1. Create a container
docker run -it --name sdk-dev -v $PWD/build:/sdk/build abconnect-sdk-alpha
# or start by running docker start -i alpha-dev
  1. To start the container in another window
docker exec -it sdk-dev bash
  1. Start the compilation of the code in a new terminal window by running
yarn dev
  1. Test the code by going to /build/cjs/src and running the compiled code from the terminal windows with the running Docker containers.