1.2.1 • Published 3 years ago

@wpilib/wpilib-ws-robot v1.2.1

Weekly downloads
17
License
ISC
Repository
github
Last release
3 years ago

wpilib-ws-robot

Library for creating robots controllable via WPILib's WebSocket protocol

Installation

npm install wpilib-ws-robot

Overview

This package consists of two main units, an abstract class representing a robot (WPILibWSRobotBase) and an endpoint (either client or server) that links a provided WPILibWSRobotBase-derived class and the protocol implementation from node-wpilib-ws. The endpoint (WPILibWSRobotEndpoint) acts as an interface between the WPILib WebSocket protocol implementation and the robot controller.

Usage

To start, create a robot controller class that extends from WPILibWSRobotBase. This abstract base class provides methods to interact with robot "hardware" (this can be actual hardware, or even a simulated robot). See src/debug-robot.ts for a simplistic example.

With a concrete robot controller class in hand, you can then create an endpoint, passing in the robot controller as a parameter. Endpoints come in two flavors, a client or a server.

To create a server (which interacts with the halsim_ws_client extension):

const endpointServer = WPILibWSRobotEndpoint.createServer(robot, optionalServerConfig);

Similarly, to create a client (which interacts with the halsim_ws_server extension):

const endpointClient = WPILibWSRobotEndpoint.createClient(robot, optionalClientConfig);

Once your endpoint is created, start it up with the startP() method, which resolves a promise when the protocol interface and robot are ready.

endpoint.startP()
.then(() => {
    console.log("System Ready");
});

Example Implementations

This library is designed to make it easy to implement a robot controller interface. For a more feature complete example, look at the reference robot design

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.0

3 years ago

0.1.1

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago