You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[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)
42
42
43
43
44
44
45
45
# Overview
46
46
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.
| 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. |
426
427
| value | PanTilt parameter value (after decoding SET_PARAM command). |
427
428
428
429
**Returns:** **0** - in case decoding COMMAND, **1** - in case decoding SET_PARAM command or **-1** in case errors.
@@ -614,7 +615,7 @@ public:
614
615
};
615
616
```
616
617
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.
| data | Pointer to data buffer. Buffer size must be >= 48 bytes. |
649
650
| bufferSize | Data buffer size. Buffer size must be >= 48 bytes. |
650
651
| 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. |
652
653
653
654
**Returns:** TRUE if params encoded (serialized) or FALSE if not.
[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:
712
713
713
714
```cpp
714
715
booldecode(uint8_t* data, int dataSize);
@@ -899,7 +900,7 @@ Done!
899
900
900
901
# How to make custom implementation
901
902
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:
0 commit comments