Skip to content

Commit 69fabfe

Browse files
Update documentation for website
1 parent 757ec6d commit 69fabfe

File tree

2 files changed

+46
-45
lines changed

2 files changed

+46
-45
lines changed
185 KB
Binary file not shown.

README.md

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,47 @@
44

55
# **PanTilt C++ library**
66

7-
**v1.0.0**
7+
**v1.0.1**
88

99

1010

1111
# Table of contents
1212

13-
- [Overview](#Overview)
14-
- [Versions](#Versions)
15-
- [Library files](#Library-files)
16-
- [PanTilt interface class description](#PanTilt-interface-class-description)
17-
- [Class declaration](#Class-declaration)
18-
- [getVersion method](#getVersion-method)
19-
- [openPanTilt method](#openPanTilt-method)
20-
- [initPanTilt method](#initPanTilt-method)
21-
- [closePanTilt method](#closePanTilt-method)
22-
- [isPanTiltInitialized method](#isPanTiltInitialized-method)
23-
- [isPanTiltConnected method](#isPanTiltConnected-method)
24-
- [setParam method](#setParam-method)
25-
- [getParam method](#getParam-method)
26-
- [getParams method](#getParams-method)
27-
- [executeCommand method](#executeCommand-method)
28-
- [encodeSetParamCommand method](#encodeSetParamCommand-method)
29-
- [encodeCommand method](#encodeCommand-method)
30-
- [decodeCommand method](#decodeCommand-method)
31-
- [decodeAndExecuteCommand method](#decodeAndExecuteCommand-method)
32-
- [Data structures](#Data-structures)
33-
- [PanTiltCommand enum](#PanTiltCommand-enum)
34-
- [PanTiltParam enum](#PanTiltParam-enum)
35-
- [PanTiltParams class description](#PanTiltParams-class-description)
36-
- [Class declaration](#Class-declaration)
37-
- [Serialize PanTilt params](#Serialize-PanTilt-params)
38-
- [Deserialize PanTilt params](#Deserialize-PanTilt-params)
39-
- [Read params from JSON file and write to JSON file](#Read-params-from-JSON-file-and-write-to-JSON-file)
40-
- [Build and connect to your project](#Build-and-connect-to-your-project)
41-
- [How to make custom implementation](#How-to-make-custom-implementation)
13+
- [Overview](#overview)
14+
- [Versions](#versions)
15+
- [Library files](#library-files)
16+
- [PanTilt interface class description](#pantilt-interface-class-description)
17+
- [Class declaration](#class-declaration)
18+
- [getVersion method](#geversion-method)
19+
- [openPanTilt method](#openpantilt-method)
20+
- [initPanTilt method](#initpantilt-method)
21+
- [closePanTilt method](#closepantilt-method)
22+
- [isPanTiltInitialized method](#ispantiltinitialized-method)
23+
- [isPanTiltConnected method](#ispantiltconnected-method)
24+
- [setParam method](#setparam-method)
25+
- [getParam method](#getparam-method)
26+
- [getParams method](#getparams-method)
27+
- [executeCommand method](#executecommand-method)
28+
- [encodeSetParamCommand method](#encodesetparamcommand-method)
29+
- [encodeCommand method](#encodecommand-method)
30+
- [decodeCommand method](#decodecommand-method)
31+
- [decodeAndExecuteCommand method](#decodeandexecutecommand-method)
32+
- [Data structures](#data-structures)
33+
- [PanTiltCommand enum](#pantiltcommand-enum)
34+
- [PanTiltParam enum](#pantiltparam-enum)
35+
- [PanTiltParams class description](#pantiltparams-class-description)
36+
- [Class declaration](#class-declaration)
37+
- [Serialize PanTilt params](#serialize-pantilt-params)
38+
- [Deserialize PanTilt params](#deserialize-pantilt-params)
39+
- [Read params from JSON file and write to JSON file](#read-params-from-json-file-and-write-to-json-file)
40+
- [Build and connect to your project](#build-and-connect-to-your-project)
41+
- [How to make custom implementation](#how-to-make-custom-implementation)
4242

4343

4444

4545
# Overview
4646

47-
**PanTilt** is a C++ library designed to serve as a standard interface for various pan-tilt devices. The library defines interface and data structures for pan-tilt software controllers. The library provides methods to encode/decode commands and encode/decode parameters. **PanTilt.h** file contains list of data structures ([PanTiltCommand enum](#PanTiltCommand-enum), [PanTiltParam enum](#PanTiltParam-enum) and **PanTiltParams** class) and **PanTilt** class declaration. **PanTilt** interface depends on **[ConfigReader](https://github.com/ConstantRobotics-Ltd/ConfigReader)** library to provide methods to read/write JSON config files.
47+
**PanTilt** is a C++ library designed to serve as a standard interface for various pan-tilt devices. The library defines interface and data structures for pan-tilt software controllers. The library provides methods to encode/decode commands and encode/decode parameters. **PanTilt.h** file contains list of data structures ([PanTiltCommand enum](#pantiltcommand-enum), [PanTiltParam enum](#pantiltparam-enum) and **PanTiltParams** class) and **PanTilt** class declaration. **PanTilt** interface depends on **[ConfigReader](https://github.com/ConstantRobotics-Ltd/ConfigReader)** library to provide methods to read/write JSON config files.
4848

4949

5050

@@ -55,6 +55,7 @@
5555
| Version | Release date | What's new |
5656
| ------- | ------------ | --------------------------------------------- |
5757
| 1.0.0 | 06.02.2024 | - First version of PanTilt interface library. |
58+
| 1.0.1 | 23.04.2024 | - Documentation updated for website. |
5859

5960

6061

@@ -173,7 +174,7 @@ std::cout << "PanTilt version: " << cr::pantilt::PanTilt::getVersion();
173174
Console output:
174175

175176
```bash
176-
PanTilt class version: 1.0.0
177+
PanTilt class version: 1.0.1
177178
```
178179

179180

@@ -242,7 +243,7 @@ virtual bool isPanTiltConnected() = 0;
242243

243244
| Parameter | Description |
244245
| --------- | ------------------------------------------------------------ |
245-
| id | Parameter ID according to [PanTiltParam](#PanTiltParam-enum) enum. |
246+
| id | Parameter ID according to [PanTiltParam](#pantiltparam-enum) enum. |
246247
| value | Parameter value. Value depends on parameter ID. |
247248

248249
**Returns:** TRUE if the pan-tilt controller has data exchange with camera equipment or FALSE if not.
@@ -259,7 +260,7 @@ virtual bool setParam(PanTiltParam id, float value) = 0;
259260
260261
| Parameter | Description |
261262
| --------- | ------------------------------------------------------------ |
262-
| id | Parameter ID according to [PanTiltParam](#PanTiltParam-enum) enum. |
263+
| id | Parameter ID according to [PanTiltParam](#pantiltparam-enum) enum. |
263264
| value | Parameter value. Value depends on parameter ID. |
264265
265266
**Returns:** TRUE if the parameter was set or FALSE if not.
@@ -276,7 +277,7 @@ virtual float getParam(PanTiltParam id) = 0;
276277

277278
| Parameter | Description |
278279
| --------- | ------------------------------------------------------------ |
279-
| id | Parameter ID according to [PanTiltParam](#PanTiltParam-enum) enum. |
280+
| id | Parameter ID according to [PanTiltParam](#pantiltparam-enum) enum. |
280281

281282
**Returns:** parameter value or **-1** if the parameters doesn't exist.
282283

@@ -292,7 +293,7 @@ virtual void getParams(PanTiltParams& params) = 0;
292293
293294
| Parameter | Description |
294295
| --------- | ------------------------------------------------------------ |
295-
| params | Reference to [PanTiltParams](#PanTiltParams-class-description) object to store params. |
296+
| params | Reference to [PanTiltParams](#pantiltparams-class-description) object to store params. |
296297
297298
298299
@@ -306,7 +307,7 @@ virtual bool executeCommand(PanTiltCommand id, float arg1 = 0.0f, float arg2 = 0
306307

307308
| Parameter | Description |
308309
| --------- | ------------------------------------------------------------ |
309-
| id | Command ID according to [PanTiltCommand](#PanTiltCommand-enum) enum. |
310+
| id | Command ID according to [PanTiltCommand](#pantiltcommand-enum) enum. |
310311

311312
**Returns:** TRUE if the command executed or FALSE if not.
312313

@@ -324,7 +325,7 @@ static void encodeSetParamCommand(uint8_t* data, int& size, PanTiltParam id, flo
324325
| --------- | ------------------------------------------------------------ |
325326
| data | Pointer to data buffer for encoded command. Must have size >= 11. |
326327
| size | Size of encoded data. Will be 11 bytes. |
327-
| id | Parameter ID according to [**PanTilt enum**](#PanTilt-enum). |
328+
| id | Parameter ID according to [**PanTilt enum**](#pantilt-enum). |
328329
| value | Parameter value. |
329330
330331
**SET_PARAM** command format:
@@ -371,7 +372,7 @@ static void cr::pantilt::PanTilt::encodeCommand(uint8_t* data, int& size,
371372
| --------- | ------------------------------------------------------------ |
372373
| data | Pointer to data buffer for encoded command. Must have size >= 15. |
373374
| size | Size of encoded data. Will be 15 bytes. |
374-
| id | Command ID according to [**PanTiltCommand enum**](#PanTiltCommand-enum). |
375+
| id | Command ID according to [**PanTiltCommand enum**](#pantiltcommand-enum). |
375376
| arg1 | Command argument 1 value (value depends on command ID). |
376377
| arg2 | Command argument 2 value (value depends on command ID). |
377378
@@ -421,8 +422,8 @@ static int decodeCommand(uint8_t* data, int size, PanTiltParam& paramId, PanTilt
421422
| --------- | ------------------------------------------------------------ |
422423
| data | Pointer to input command. |
423424
| size | Size of command. Must be 11 bytes for SET_PARAM and 7 bytes for COMMAND. |
424-
| paramId | PanTilt parameter ID according to [**PanTiltParam enum**](#PanTiltParam-enum). After decoding SET_PARAM command the method will return parameter ID. |
425-
| commandId | PanTilt command ID according to [**PanTiltCommand enum**](#PanTiltCommand-enum). After decoding COMMAND the method will return command ID. |
425+
| paramId | PanTilt parameter ID according to [**PanTiltParam enum**](#pantiltparam-enum). After decoding SET_PARAM command the method will return parameter ID. |
426+
| commandId | PanTilt command ID according to [**PanTiltCommand enum**](#pantiltcommand-enum). After decoding COMMAND the method will return command ID. |
426427
| value | PanTilt parameter value (after decoding SET_PARAM command). |
427428
428429
**Returns:** **0** - in case decoding COMMAND, **1** - in case decoding SET_PARAM command or **-1** in case errors.
@@ -614,7 +615,7 @@ public:
614615
};
615616
```
616617
617-
**Table 4** - **PanTiltParams** class fields description is related to [PanTiltParam enum](#PanTiltParam-enum) description.
618+
**Table 4** - **PanTiltParams** class fields description is related to [PanTiltParam enum](#pantiltparam-enum) description.
618619
619620
| Field | type | Description |
620621
| -------------------- | ----- | ------------------------------------------------------ |
@@ -648,7 +649,7 @@ bool encode(uint8_t* data, int bufferSize, int& size, PanTiltParamsMask* mask =
648649
| data | Pointer to data buffer. Buffer size must be >= 48 bytes. |
649650
| bufferSize | Data buffer size. Buffer size must be >= 48 bytes. |
650651
| size | Size of encoded data. |
651-
| mask | Parameters mask - pointer to **PanTiltParamsMask** structure. **PanTiltParamsMask** (declared in PanTilt.h file) determines flags for each field (parameter) declared in [PanTiltParams class](#PanTiltParams-class-description). If the user wants to exclude any parameters from serialization, he can put a pointer to the mask. If the user wants to exclude a particular parameter from serialization, he should set the corresponding flag in the **PanTiltParamsMask** structure. |
652+
| mask | Parameters mask - pointer to **PanTiltParamsMask** structure. **PanTiltParamsMask** (declared in PanTilt.h file) determines flags for each field (parameter) declared in [PanTiltParams class](#pantiltparams-class-description). If the user wants to exclude any parameters from serialization, he can put a pointer to the mask. If the user wants to exclude a particular parameter from serialization, he should set the corresponding flag in the **PanTiltParamsMask** structure. |
652653

653654
**Returns:** TRUE if params encoded (serialized) or FALSE if not.
654655

@@ -708,7 +709,7 @@ params1.encode(buffer, bufferSize, size, &mask);
708709

709710
## Deserialize PanTilt params
710711

711-
[PanTiltParams](#PanTiltParams-class-description) class provides method **decode(...)** to deserialize params. Deserialization of PanTilt params is necessary in case when it is needed to receive params via communication channels. Method automatically recognizes which parameters were serialized by **encode(...)** method. Method declaration:
712+
[PanTiltParams](#pantiltparams-class-description) class provides method **decode(...)** to deserialize params. Deserialization of PanTilt params is necessary in case when it is needed to receive params via communication channels. Method automatically recognizes which parameters were serialized by **encode(...)** method. Method declaration:
712713

713714
```cpp
714715
bool decode(uint8_t* data, int dataSize);
@@ -899,7 +900,7 @@ Done!
899900

900901
# How to make custom implementation
901902

902-
The **PanTilt** class provides only an interface, data structures, and methods for encoding and decoding commands and params. To create your own implementation of the pan-tilt controller, PanTilt repository has to be included in your project (see [**Build and connect to your project**](#Build-and-connect-to-your-project) section). The catalogue **example** (see [**Library files**](#Library-files) section) includes an example of the design of the custom pan-tilt controller. All the methods of the PanTilt interface class have to be included. Custom PanTilt class declaration:
903+
The **PanTilt** class provides only an interface, data structures, and methods for encoding and decoding commands and params. To create your own implementation of the pan-tilt controller, PanTilt repository has to be included in your project (see [**Build and connect to your project**](#build-and-connect-to-your-project) section). The catalogue **example** (see [**Library files**](#library-files) section) includes an example of the design of the custom pan-tilt controller. All the methods of the PanTilt interface class have to be included. Custom PanTilt class declaration:
903904

904905
```c++
905906
class CustomPanTilt : public PanTilt

0 commit comments

Comments
 (0)