@viamrobotics/sdk 0.0.42 → 0.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Viam TypeScript SDK
2
2
 
3
+ [![license](https://img.shields.io/badge/license-Apache_2.0-blue)](https://github.com/viamrobotics/viam-typescript-sdk/blob/main/LICENSE)
4
+ [![npm](https://img.shields.io/npm/v/@viamrobotics/sdk?color=33cd56&logo=npm)](https://www.npmjs.com/package/@viamrobotics/sdk)
5
+ [![documentation](https://img.shields.io/static/v1?label=docs&message=ts.viam.dev&color=lightgray)](https://ts.viam.dev)
6
+
3
7
  ## (In)stability Notice
4
8
 
5
9
  > **Warning**
@@ -15,9 +19,9 @@ npm install --save @viamrobotics/sdk
15
19
 
16
20
  ### Examples
17
21
 
18
- [The examples directory](examples) contains small apps that demonstrate how to use this SDK to operate a robot running Viam.
22
+ [The examples directory](https://github.com/viamrobotics/viam-typescript-sdk/tree/main/examples) contains small apps that demonstrate how to use this SDK to operate a robot running Viam.
19
23
 
20
24
  ## License
21
- Copyright 2022 Viam Inc.
25
+ Copyright 2022-2023 Viam Inc.
22
26
 
23
- Apache 2.0 - See [LICENSE](LICENSE) file
27
+ Apache 2.0 - See [LICENSE](https://github.com/viamrobotics/viam-typescript-sdk/blob/main/LICENSE) file
@@ -0,0 +1,19 @@
1
+ import type { RobotClient } from '../../robot';
2
+ import type { Encoder } from './Encoder';
3
+ import { type Options, PositionType } from '../../types';
4
+ import encoderApi from '../../gen/component/encoder/v1/encoder_pb';
5
+ /**
6
+ * A gRPC-web client for the Encoder component.
7
+ *
8
+ * @group Clients
9
+ */
10
+ export declare class EncoderClient implements Encoder {
11
+ private client;
12
+ private readonly name;
13
+ private readonly options;
14
+ constructor(client: RobotClient, name: string, options?: Options);
15
+ private get encoderService();
16
+ resetPosition(extra?: {}): Promise<void>;
17
+ getProperties(extra?: {}): Promise<encoderApi.GetPropertiesResponse.AsObject>;
18
+ getPosition(positionType?: PositionType, extra?: {}): Promise<readonly [number, 0 | 2 | 1]>;
19
+ }
@@ -0,0 +1,18 @@
1
+ import type { Extra, PositionType } from '../../types';
2
+ import pb from '../../gen/component/encoder/v1/encoder_pb';
3
+ export type EncoderProperties = pb.GetPropertiesResponse.AsObject;
4
+ /** Represents a physical encoder. */
5
+ export interface Encoder {
6
+ /** Set the current position of the encoder as the new zero position. */
7
+ resetPosition(extra?: Extra): Promise<void>;
8
+ /** Return the encoder's properties. */
9
+ getProperties(extra?: Extra): Promise<EncoderProperties>;
10
+ /**
11
+ * Return the current position either in relative units (ticks away from a
12
+ * zero position) or absolute units (degrees along a circle).
13
+ *
14
+ * @param positionType - The type of position the encoder returns (ticks or
15
+ * degrees)
16
+ */
17
+ getPosition(positionType?: PositionType, extra?: Extra): Promise<readonly [number, PositionType]>;
18
+ }
@@ -0,0 +1,2 @@
1
+ export type { Encoder, EncoderProperties } from './encoder/Encoder';
2
+ export { EncoderClient } from './encoder/Client';
package/dist/main.d.ts CHANGED
@@ -9,7 +9,7 @@ export declare const version: string;
9
9
  * @group Raw Protobufs
10
10
  */
11
11
  export { default as robotApi } from './gen/robot/v1/robot_pb';
12
- export { type Robot, type DialDirectConf, type DialWebRTCConf, RobotClient, createRobotClient, } from './robot';
12
+ export { type Robot, type DialConf, type DialDirectConf, type DialWebRTCConf, RobotClient, createRobotClient, } from './robot';
13
13
  /**
14
14
  * @deprecated Use {@link RobotClient} instead.
15
15
  * @group Clients
@@ -59,6 +59,17 @@ export { type Board, BoardClient } from './components/board';
59
59
  */
60
60
  export { default as cameraApi } from './gen/component/camera/v1/camera_pb';
61
61
  export { type Camera, CameraClient } from './components/camera';
62
+ /**
63
+ * Raw Protobuf interfaces for an Encoder component.
64
+ *
65
+ * Generated with https://github.com/improbable-eng/grpc-web
66
+ *
67
+ * @deprecated Use {@link EncoderClient} instead.
68
+ * @alpha
69
+ * @group Raw Protobufs
70
+ */
71
+ export { default as encoderApi } from './gen/component/encoder/v1/encoder_pb';
72
+ export { type Encoder, type EncoderProperties, EncoderClient, } from './components/encoder';
62
73
  /**
63
74
  * Raw Protobuf interfaces for a Motor component.
64
75
  *